public abstract class WikittyQueryMakerAbstract<M extends WikittyQueryMakerAbstract> extends Object
Condition c = new WikittyQueryMaker().and().eq("ext.field", "toto").eq("ext.field2", 10).getCondition();
On peut aussi vouloir continuer avec un WikittyQuery pour cela on peut faire.
WikittyQuery q = new WikittyQueryMaker().and().[other condition].end();
Si un WikittyQuery est passé en parametre du constructeur et que la
method end() est appeler alors la condition creee est envoyee dans
le WikittyQuery et le constructeur est fermer (on ne peut plus ajouter de
condition)
Le WikittyQuery lie avec cet objet lorsqu'on le recupere via la method
getQuery() a en interne comme condition la valuer courante de la
condition en cours d'ecriture
Cette classe est abstraite pour facilite l'heritage pour une utilisation dans
des applications qui auraient besoin d'ajouter des methodes de construction
(par exemple des methodes qui ajouteraient un ensemble de contraintes).
Pour cela il faut heriter de cette classe et implanter la methode asM()
Par exemple:
class MonMaker extends WikittyQueryMakerAbstract<MonMaker> {
// ... constructeurs et methodes supplementaires ...| Modifier and Type | Field and Description |
|---|---|
protected Condition |
condition
query condition
|
protected Deque<Condition> |
openStack
stack des conditions non terminales ouvertes
|
protected Deque<WikittyQueryFunction> |
openStackFunction
stack des function ouvertes
|
protected WikittyQuery |
query
query where to send condition when end() method called
|
| Constructor and Description |
|---|
WikittyQueryMakerAbstract() |
WikittyQueryMakerAbstract(WikittyQuery query) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCondition(Condition c)
Ajout une condition
|
protected void |
addCondition(Condition c,
boolean terminal)
Ajout une condition.
|
M |
addFunction(WikittyQueryFunction f) |
M |
and()
And (sub query).
|
protected abstract M |
asM() |
M |
avg() |
M |
avg(Element field) |
M |
avg(Element field,
String alias) |
M |
avg(String field) |
M |
avg(String field,
String alias) |
M |
bw(Element element) |
M |
bw(Element element,
Object lowerValue,
Object upperValue) |
M |
bw(String fqfield,
Object lowerValue,
Object upperValue)
Between.
|
M |
close()
Close last non terminal condition (or, and, not, in).
|
protected void |
closeIfNecessary() |
M |
condition(Condition c)
|
M |
containsAll(Element element) |
<E> M |
containsAll(Element element,
Collection<E> values)
Force l'ajout du containsAll en terminal (il n'y a pas besoin de faire
de
close() |
M |
containsAll(String element) |
<E> M |
containsAll(String fqfield,
Collection<E> values)
Contains.
|
<E> M |
containsAll(String fqfield,
E value1,
E... values)
Search on lists (multivalued fields) that a field contains all the values
given in parameter.
|
M |
containsOne(Element element) |
<E> M |
containsOne(Element element,
Collection<E> values)
Force l'ajout du containsOne en terminal (il n'y a pas besoin de faire
de
close() |
M |
containsOne(String element) |
<E> M |
containsOne(String fqfield,
Collection<E> values)
Search if a field is contained in the list of values in parameter
Ex : The field with value titi is in [titi,tutu] but not in
[tutu,tata]
Force l'ajout du containsOne en terminal (il n'y a pas besoin de faire
de
close() |
<E> M |
containsOne(String fqfield,
E value1,
E... values)
Search if a field is contained in the list of values in parameter
Ex : The field with value titi is in [titi,tutu] but not in
[tutu,tata]
Ps : Use wildcards in the values if you search for substrings.
|
protected static ConditionValue |
convertToConditionValue(Object o) |
M |
count() |
M |
count(Element field) |
M |
count(Element field,
String alias) |
M |
count(String field) |
M |
count(String field,
String alias) |
M |
distinct()
You need to close this distinct
|
M |
distinct(Element one,
Element... fields)
this distinct is auto closed if argument is not null
|
M |
distinct(String... fields)
|
WikittyQuery |
end()
Ferme la construction de la condition et la met en place dans la
WikittyQuery qui sera retournee
|
M |
eq(Element element) |
M |
eq(Element element,
Object value) |
M |
eq(String fqfield,
Object value)
Equals.
|
M |
eqIgnoreCaseAndAccent(Element element) |
M |
eqIgnoreCaseAndAccent(Element element,
Object value) |
M |
eqIgnoreCaseAndAccent(String fqfield,
Object value)
Equals.
|
M |
ew(Element element,
Object value) |
M |
ew(String fqfield,
Object value)
Ends with.
|
M |
extContainsAll(Collection<String> extensionNames)
Extension equals.
|
M |
extContainsAll(String ext1,
String... exts) |
M |
extContainsOne(Collection<String> extensionNames)
Extension equals.
|
M |
extContainsOne(String ext1,
String... exts) |
M |
exteq(String extensionName)
Extension equals.
|
M |
extne(String extensionName)
Extension not equals.
|
M |
fieldValue(Element fieldName) |
M |
fieldValue(Element fieldName,
String alias) |
M |
fieldValue(String fieldName) |
M |
fieldValue(String fieldName,
String alias) |
M |
function(String method,
Object... args)
ajoute une methode definit par l'utilisateur, la syntaxe de methode est
package.class#method.
|
M |
function(String method,
String alias,
Object... args)
ajoute une methode definit par l'utilisateur, la syntaxe de methode est
[package.class]#method.
|
M |
ge(Element element) |
M |
ge(Element element,
Object value) |
M |
ge(String fqfield,
Object value)
Greater than or equals.
|
Condition |
getCondition() |
protected Deque<Condition> |
getOpenStack()
Retourne le stack courant des conditions, si le stack est null cela
veut dire que le maker ne permet plus de modification
|
protected Deque<WikittyQueryFunction> |
getOpenStackFunction() |
WikittyQuery |
getQuery()
La query passee dans le constructeur ou une nouvelle query si aucune
query n'avait ete passee dans le constructeur
|
M |
gt(Element element) |
M |
gt(Element element,
Object value) |
M |
gt(String fqfield,
Object value)
Greater than.
|
M |
ideq(Object idOrWikitty)
Id equals.
|
M |
idne(Object idOrWikitty)
Id not equals.
|
M |
isNotNull(Element element) |
M |
isNotNull(String fqfield)
Is not null.
|
M |
isNull(Element element) |
M |
isNull(String fqfield)
Is null.
|
M |
keyword()
Keyword.
|
M |
keyword(Object value)
Keyword.
|
M |
le(Element element) |
M |
le(Element element,
Object value) |
M |
le(String fqfield,
Object value)
Less than or equals.
|
M |
like(Element element) |
M |
like(Element element,
Object value) |
M |
like(String fqfield,
Object value)
Like.
|
M |
lt(Element element) |
M |
lt(Element element,
Object value) |
M |
lt(String fqfield,
Object value)
Less than.
|
M |
max() |
M |
max(Element field) |
M |
max(Element field,
String alias) |
M |
max(String field) |
M |
max(String field,
String alias) |
M |
min() |
M |
min(Element field) |
M |
min(Element field,
String alias) |
M |
min(String field) |
M |
min(String field,
String alias) |
M |
ne(Element element) |
M |
ne(Element element,
Object value) |
M |
ne(String fqfield,
Object value)
Not equals.
|
M |
neIgnoreCaseAndAccent(Element element) |
M |
neIgnoreCaseAndAccent(Element element,
Object value) |
M |
neIgnoreCaseAndAccent(String fqfield,
Object value)
Not equals.
|
M |
not()
Not (sub query).
|
M |
notew(Element element,
Object value) |
M |
notew(String fqfield,
Object value)
Not ends with.
|
M |
notsw(Element element,
String value) |
M |
notsw(String fqfield,
String value)
Not starts with.
|
M |
or()
Or (sub query).
|
M |
parse(String query)
Parse et ajoute un bout de requete.
|
M |
parse(String query,
boolean includeExtra)
Parse et ajoute un bout de requete.
|
M |
rFalse()
False.
|
M |
rTrue()
True.
|
M |
select()
Add
Select, this condition must be first or |
M |
select(Element e) |
M |
select(String e) |
M |
select(WikittyQueryFunction f) |
M |
sum() |
M |
sum(Element field) |
M |
sum(Element field,
String alias) |
M |
sum(String field) |
M |
sum(String field,
String alias) |
M |
sw(Element element,
String value) |
M |
sw(String fqfield,
String value)
Starts with.
|
M |
unlike(Element element) |
M |
unlike(Element element,
Object value) |
M |
unlike(String fqfield,
Object value)
Unlike.
|
M |
value(Object value)
Ajout d'une valeur soit pour une condition soit pour une function de la clause select
|
M |
where()
Assigne les functions au Select et prepare l'ecriture de la condition
|
M |
wikitty(BusinessEntityImpl e)
Ajoute une contrainte qui cree les conditions en prenant comme exemple
l'objet passer en parametre.
|
M |
wikitty(Wikitty w)
Ajoute une contrainte qui cree les conditions en prenant comme exemple
l'objet passer en parametre.
|
protected WikittyQuery query
protected Condition condition
protected Deque<WikittyQueryFunction> openStackFunction
public WikittyQueryMakerAbstract()
public WikittyQueryMakerAbstract(WikittyQuery query)
protected abstract M asM()
public Condition getCondition()
public WikittyQuery getQuery()
protected Deque<Condition> getOpenStack()
protected void addCondition(Condition c)
protected void addCondition(Condition c, boolean terminal)
protected void closeIfNecessary()
protected Deque<WikittyQueryFunction> getOpenStackFunction()
public M addFunction(WikittyQueryFunction f)
public M where()
public M avg()
public M count()
public M max()
public M min()
public M sum()
public M distinct()
public M distinct(String... fields)
close()
or where() methodpublic M distinct(Element one, Element... fields)
one - use to differenciate this method with Element argument with same with String argumentfields - other elementpublic M function(String method, Object... args)
public M function(String method, String alias, Object... args)
method - la methode utilisee comme fonction, si l'argument commence
par #, le nom de la classe courante lui est ajoute. Cela permet de creer
une sous classe a WikittyQueryMakerAbstract pour son projet et d'y mettre
l'ensemble des fonctions que l'on utilise dans son projet.alias - l'alias assigne au resultatargs - les parametre de la fonction, si vide, il faut alors explicitement
appeler close() pour fermer la definition de cette fonction.protected static ConditionValue convertToConditionValue(Object o)
public M value(Object value)
value - public M condition(Condition c)
and(), or(), not(), #containsOne()c - la condition a ajouterthis with the c restriction added.public M parse(String query, boolean includeExtra)
and(), or(), not(), #containsOne()query - la requete a ajouter (peut-etre vide ou nul, dans ce cas, la
condition utiliser est "true")includeExtra - copy offset, limit, depth found in query if truethis with the c restriction added.public M parse(String query)
and(), or(), not(), #containsOne()query - la requete a ajouter (peut-etre vide ou nul, dans ce cas, la
condition utiliser est "true")this with the c restriction added.public M wikitty(Wikitty w)
w - le wikitty a prendre comme exemplethis with the w restriction added.public M wikitty(BusinessEntityImpl e)
e - l'objet a prendre comme exemplethis with the e restriction added.public <E> M containsAll(String fqfield, Collection<E> values)
close()element - the element on which the restriction is putvalues - the values to search in the elementthis with the contains restriction added.ContainsAll}public <E> M containsAll(Element element, Collection<E> values)
close()ContainsAll}public <E> M containsAll(String fqfield, E value1, E... values)
close()element - the element on which the restriction is putvalue1 - first value to search in the fieldvalues - list of values to search in the fieldthis with the contains restriction added.ContainsAll}public <E> M containsOne(String fqfield, Collection<E> values)
close()element - the element on which the restriction is putvalues - list of values the field must be inthis with the in restriction added.ContainsOne}public <E> M containsOne(Element element, Collection<E> values)
close()ContainsOne}public <E> M containsOne(String fqfield, E value1, E... values)
close()element - the element on which the restriction is putvalue1 - first value the field must be invalues - list of values the field must be inthis with the in restriction added.ContainsOne}public M eq(String fqfield, Object value)
element - the field on which the search is madevalue - the value the element must be equals tothisEquals}public M eqIgnoreCaseAndAccent(String fqfield, Object value)
element - the field on which the search is madevalue - the value the element must be equals tothisEquals}public M eqIgnoreCaseAndAccent(Element element, Object value)
Equals}public M exteq(String extensionName)
s - the extension to restrict the results tothis with the exteq restriction added.Equals}public M ideq(Object idOrWikitty)
value - the id or wikitty to restrict the results tothis with the ideq restriction added.Equals}public M extContainsAll(Collection<String> extensionNames)
extensionNames - list of the extension to restrict the results tothis with the exteq restriction added.ContainsAll}public M extContainsOne(Collection<String> extensionNames)
extensionNames - list of the extension to restrict the results tothis with the exteq restriction added.ContainsAll}public M ne(String fqfield, Object value)
fqfield - the element on which the restriction is putvalue - the value the element must not be equals to.this with the neq restriction added.NotEquals}public M neIgnoreCaseAndAccent(String fqfield, Object value)
fqfield - the element on which the restriction is putvalue - the value the element must not be equals to.this with the neq restriction added.NotEquals}public M neIgnoreCaseAndAccent(Element element, Object value)
NotEquals}public M extne(String extensionName)
extensionName - the extension that the wikitties must not have.this with the extneq restriction added.NotEquals}public M idne(Object idOrWikitty)
idOrWikitty - the id the wikitties must not have.this with the idne restriction added.NotEquals}public M gt(String fqfield, Object value)
fqfield - the element on which the restriction is putvalue - the value to be compared tothis with the gt restriction added.Greater}public M ge(String fqfield, Object value)
fqfield - the field on which the search is madevalue - the value to be compared tothis with the ge restriction added.GreaterOrEquals}public M lt(String fqfield, Object value)
fqfield - the element on which the restriction is putvalue - the value to be compared tothis with the lt restriction added.Less}public M le(String fqfield, Object value)
fqfield - the element on which the restriction is put.value - the value to be compared to.this with the le restriction added.LessOrEquals}public M bw(String fqfield, Object lowerValue, Object upperValue)
fqfield - the element on which the restriction is put.lowerValue - the lower bound.upperValue - the upper bound.this with the le restriction added.Between}public M sw(String fqfield, String value)
fqfield - the element on which the restriction is put.value - the value the element must start with.this with the sw restriction added.Equals}public M notsw(String fqfield, String value)
fqfield - the element on which the restriction is put.value - the value the element must not start with.this with the nsw restriction added.NotEquals}public M ew(String fqfield, Object value)
fqfield - the element on which the restriction is putvalue - the value the element must ends with.this with the ew restriction added.Equals}public M notew(String fqfield, Object value)
fqfield - the element on which the restriction is putvalue - the value the element must not ends with.this with the notew restriction added.NotEquals}public M keyword()
value - the value to find.this with the keyword restriction added.Keyword}public M keyword(Object value)
value - the value to find.this with the keyword restriction added.Keyword}public M isNull(String fqfield)
fqfield - the field that must be null.this with the isNull restriction added.Null}public M isNotNull(String fqfield)
fqfield - the field that must not be null.this with the isNotNull restriction added.NotNull}public M rFalse()
this with the rFalse restriction added.False}public M rTrue()
this with the rTrue restriction added.True}public M like(String fqfield, Object value)
fqfield - the element on which the restriction is putvalue - thisLike}public M unlike(String fqfield, Object value)
fqfield - the element on which the restriction is putvalue - searchAs - thisUnlike}public M not()
close()
Not}public M or()
close()
Or}public M and()
close()
And}public M select()
Select, this condition must be first orelement - le champs dont il faut extraire les donneesthisSelect}public M select(WikittyQueryFunction f)
public M close()
public WikittyQuery end()
Copyright © 2009–2015 CodeLutin. All rights reserved.