org.sharengo.wikitty.search
Class RestrictionHelper

java.lang.Object
  extended by org.sharengo.wikitty.search.RestrictionHelper

public class RestrictionHelper
extends Object

Author:
"Nicolas Chapurlat" This class allow you to simply create restriction.

Exmaples :

RestrictionHelper.and(
   RestrictionHelper.eq(
      new ElementDto(ElementName.CONTENT_DEFINITION, OperandName.ID, OperandType.ID),
      "myContentDefId"),
   RestrictionHelper.between(
      new ElementDto(ElementName.CONTENT, OperandName.CREATION_DATE, OperandType.DATE),
      RestrictionHelper.DATE_FORMAT.format (new Date(2008,1,25)),
      RestrictionHelper.DATE_FORMAT.format (new Date(2008,6,15))));
);

-- example 2 : I search all content witch content definition id is "myContentDefId" and attribute def 'ref' witch id is ATT_REF_ID is not equals to "REF1234567890"

RestrictionHelper.and(
   RestrictionHelper.eq(
      new ElementDto(ElementName.CONTENT_DEFINITION, OperandName.ID, OperandType.ID),
      "myContentDefId"),
   RestrictionHelper.neq(
      new ElementDto(ElementName.ATTRIBUTE, "ATT_REF_ID", OperandType.STRING),
      "REF1234567890"));
);

Constructor Summary
RestrictionHelper()
           
 
Method Summary
static And and(List<Restriction> restrictions)
           
static Restriction and(Restriction restriction1, Restriction restriction2, Restriction... otherRestrictions)
           
static Restriction between(Element element, String min, String max)
           
static Contains contains(Element element, List<String> values)
           
static Restriction contains(Element element, String value1, String... otherValues)
           
static Restriction end(Element element, String value)
           
static Restriction eq(Element element, String value)
           
static SimpleDateFormat getDateFormat()
           
static Restriction great(Element element, String value)
           
static Restriction greatEq(Element element, String value)
           
static Keyword keyword(String value)
           
static Restriction less(Element element, String value)
           
static Restriction lessEq(Element element, String value)
           
static Restriction like(Element element, String value, Like.SearchAs searchAs)
           
static Restriction neq(Element element, String value)
           
static Restriction not(Restriction restriction)
           
static Or or(List<Restriction> restrictions)
           
static Or or(Restriction restriction1, Restriction restriction2, Restriction... otherRestrictions)
           
static Restriction rFalse()
           
static Restriction rTrue()
           
static Restriction start(Element element, String value)
           
static Restriction unlike(Element element, String value, Like.SearchAs searchAs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestrictionHelper

public RestrictionHelper()
Method Detail

eq

public static Restriction eq(Element element,
                             String value)

like

public static Restriction like(Element element,
                               String value,
                               Like.SearchAs searchAs)

unlike

public static Restriction unlike(Element element,
                                 String value,
                                 Like.SearchAs searchAs)

neq

public static Restriction neq(Element element,
                              String value)

less

public static Restriction less(Element element,
                               String value)

lessEq

public static Restriction lessEq(Element element,
                                 String value)

great

public static Restriction great(Element element,
                                String value)

greatEq

public static Restriction greatEq(Element element,
                                  String value)

start

public static Restriction start(Element element,
                                String value)

end

public static Restriction end(Element element,
                              String value)

between

public static Restriction between(Element element,
                                  String min,
                                  String max)

contains

public static Restriction contains(Element element,
                                   String value1,
                                   String... otherValues)

contains

public static Contains contains(Element element,
                                List<String> values)

not

public static Restriction not(Restriction restriction)

and

public static Restriction and(Restriction restriction1,
                              Restriction restriction2,
                              Restriction... otherRestrictions)

and

public static And and(List<Restriction> restrictions)

or

public static Or or(Restriction restriction1,
                    Restriction restriction2,
                    Restriction... otherRestrictions)

or

public static Or or(List<Restriction> restrictions)

rTrue

public static Restriction rTrue()

rFalse

public static Restriction rFalse()

keyword

public static Keyword keyword(String value)

getDateFormat

public static SimpleDateFormat getDateFormat()


Copyright © 2009-2010 CodeLutin. All Rights Reserved.