|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.util.functions.FunctionProvider
org.mmbase.module.core.MMTable
org.mmbase.module.core.MMObjectBuilder
org.mmbase.module.core.VirtualBuilder
org.mmbase.module.core.ClusterBuilder
public class ClusterBuilder
The builder for clusternodes.
Provides these methods to retrieve clusternodes:
getClusterNodes(SearchQuery)
to retrieve clusternodes using a SearchQuery (recommended).
getMultiLevelSearchQuery(List,List,String,List,String,List,List,int)
as a convenience method to create a SearchQuery
searchMultiLevelVector(List,List,String,List,String,List,List,int)
to retrieve clusternodes using a constraint string.
Individual nodes in a 'cluster' node can be retrieved by calling the node's
getNodeValue() method, using
the builder name (or step alias) as argument.
ClusterNode| Field Summary | |
|---|---|
(package private) CoreClusterQueries |
clusterQueries
Deprecated. Use CoreClusterQueries.INSTANCE |
static int |
SEARCH_ALL
Deprecated. use RelationStep.DIRECTIONS_ALL |
static int |
SEARCH_BOTH
Deprecated. use RelationStep.DIRECTIONS_BOTH
In future versions of MMBase (1.8 and up) this will be the default value |
static int |
SEARCH_DESTINATION
Deprecated. use RelationStep.DIRECTIONS_DESTINATION |
static int |
SEARCH_EITHER
Deprecated. use RelationStep.DIRECTIONS_EITHER.
In future versions of MMBase (1.8 and up) the default value will be
RelationStep.DIRECTIONS_BOTH |
static int |
SEARCH_SOURCE
Deprecated. use RelationStep.DIRECTIONS_SOURCE |
| Fields inherited from class org.mmbase.module.core.MMObjectBuilder |
|---|
AGE_PARAMETERS, broadCastChanges, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, EVENT_TYPE_LOCAL, EVENT_TYPE_REMOTE, FIELD_NUMBER, FIELD_OBJECT_TYPE, FIELD_OWNER, fields, genericBlobCache, getFunctionsFunction, GUI_INDICATOR, GUI_PARAMETERS, guiFunction, infoFunction, internalVersion, maintainer, nodeCache, oType, pluralNames, searchAge, singularNames, SYSTEM_OWNER, TEMPNODE_DEFAULT_SIZE, temporaryNodes, TMP_FIELD_EXISTS, TMP_FIELD_NUMBER, TMP_FIELD_RESOLVED, virtual, WRAP_PARAMETERS, wrapFunction, xmlPath |
| Fields inherited from class org.mmbase.module.core.MMTable |
|---|
maxNodesFromQuery, mmb, storageConnector, tableName |
| Fields inherited from class org.mmbase.util.functions.FunctionProvider |
|---|
functions, getFunctions |
| Constructor Summary | |
|---|---|
ClusterBuilder(MMBase m)
Creates ClusterBuilder instance. |
|
| Method Summary | |
|---|---|
(package private) void |
addFields(BasicSearchQuery query,
String expression,
Map<String,BasicStep> stepsByAlias,
Map<String,BasicStepField> fieldsByAlias)
Retrieves fieldnames from an expression, and adds these to a search query. |
(package private) void |
addRelationDirections(BasicSearchQuery query,
List<Integer> searchDirs,
Map<String,Integer> roles)
Adds relation directions. |
(package private) void |
addSortOrders(BasicSearchQuery query,
List<String> fieldNames,
List<String> directions,
Map<String,BasicStepField> fieldsByAlias)
Adds sorting orders to a search query. |
(package private) Map<String,BasicStep> |
addSteps(BasicSearchQuery query,
List<String> tables,
Map<String,Integer> roles,
boolean includeAllReference,
Map<String,BasicStepField> fieldsByAlias)
Creates a full chain of steps, adds these to the specified query. |
(package private) MMObjectBuilder |
getBuilder(String tableAlias,
Map<String,Integer> roles)
Gets builder corresponding to the specified table alias. |
String |
getBuilderNameFromField(String fieldName)
Determines the builder part of a specified field. |
List<MMObjectNode> |
getClusterNodes(SearchQuery query)
Executes query, returns results as clusternodes or MMObjectNodes if the
query is a Node-query. |
List<MMObjectNode> |
getClusterNodesFromQueryHandler(SearchQuery query)
Executes query, returns results as clusternodes or MMObjectNodes if the
query is a Node-query. |
FieldDefs |
getField(String fieldName)
Return a field. |
static String |
getFieldNameFromField(String fieldname)
Determines the fieldname part of a specified field (without the builder name). |
Collection<CoreField> |
getFields()
Return a copy of the list of field definitions of this table. |
List<CoreField> |
getFields(int order)
Gets the field definitions for the editor, sorted according to the specified order, and excluding the fields that have not been assigned a valid position (valid is >= 0). |
Map<String,CoreField> |
getFields(MMObjectNode node)
Get text from a blob field from a database. |
String |
getGUIIndicator(MMObjectNode node)
What should a GUI display for this node. |
String |
getGUIIndicator(MMObjectNode node,
Parameters pars)
What should a GUI display for this node/field combo. |
BasicSearchQuery |
getMultiLevelSearchQuery(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> sortFields,
List<String> directions,
int searchDir)
Deprecated. use getMultiLevelSearchQuery(List snodes, List fields, String pdistinct, List tables, String where,
List orderVec, List directions, List searchDir) |
BasicSearchQuery |
getMultiLevelSearchQuery(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> sortFields,
List<String> directions,
List<Integer> searchDirs)
Creates search query that selects all the objects that match the searchkeys. |
MMObjectNode |
getNewNode(String owner)
Get a new node, using this builder as its parent. |
(package private) Step |
getNodesStep(List<Step> steps,
int nodeNumber)
Gets first step from list, that corresponds to the builder of a specified node - or one of its parentbuilders. |
static int |
getSearchDir(String search)
Translates a string to a search direction constant. |
static String |
getSearchDirString(int search)
Translates a search direction constant to a string. |
byte[] |
getShortedByte(String fieldname,
int number)
Get binary data of a database blob field. |
String |
getShortedText(String fieldname,
int number)
Get text from a blob field. |
Vector<MMObjectNode> |
searchMultiLevelVector(int snode,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> orderVec,
List<String> direction)
Same as searchMultiLevelVector(snodes, fields, pdistinct, tables, where, orderVec, direction, RelationStep.DIRECTIONS_EITHER),
where snodes contains just the number specified by snode. |
Vector<MMObjectNode> |
searchMultiLevelVector(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> orderVec,
List<String> direction)
Same as searchMultiLevelVector(snodes, fields, pdistinct, tables, where, orderVec, direction, RelationStep.DIRECTIONS_EITHER). |
Vector<MMObjectNode> |
searchMultiLevelVector(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> sortFields,
List<String> directions,
int searchDir)
Deprecated. use searchMultiLevelVector(List snodes, List fields, String pdistinct, List tables, String where,
List orderVec, List directions, List searchDirs) |
Vector<MMObjectNode> |
searchMultiLevelVector(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> sortFields,
List<String> directions,
List<Integer> searchDirs)
Return all the objects that match the searchkeys. |
| Methods inherited from class org.mmbase.module.core.VirtualBuilder |
|---|
create, getDBState, getShortedByte, getShortedText, init, insert |
| Methods inherited from class org.mmbase.module.core.MMTable |
|---|
count, count, created, getFullTableName, getMMBase, getNode, getNodes, getNodes, getNodes, getNodeType, getStorageConnector, getTableName, search, searchVector, setMMBase, setTableName, size |
| Methods inherited from class org.mmbase.util.functions.FunctionProvider |
|---|
addFunction, createParameters, getFunction, getFunctions, getFunctionValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int SEARCH_BOTH
RelationStep.DIRECTIONS_BOTH
In future versions of MMBase (1.8 and up) this will be the default value
public static final int SEARCH_DESTINATION
RelationStep.DIRECTIONS_DESTINATION
public static final int SEARCH_SOURCE
RelationStep.DIRECTIONS_SOURCE
public static final int SEARCH_ALL
RelationStep.DIRECTIONS_ALL
public static final int SEARCH_EITHER
RelationStep.DIRECTIONS_EITHER.
In future versions of MMBase (1.8 and up) the default value will be
RelationStep.DIRECTIONS_BOTH
final CoreClusterQueries clusterQueries
CoreClusterQueries.INSTANCE| Constructor Detail |
|---|
public ClusterBuilder(MMBase m)
ClusterBuilder instance.
Must be called from the MMBase class.
m - the MMbase cloud creating the node| Method Detail |
|---|
public static int getSearchDir(String search)
public static String getSearchDirString(int search)
public MMObjectNode getNewNode(String owner)
getNewNode in class VirtualBuilderowner - The administrator creating the new node (ignored).
VirtualNode.public String getGUIIndicator(MMObjectNode node)
getGUIIndicator in class VirtualBuildernode - The node to display
String
public String getGUIIndicator(MMObjectNode node,
Parameters pars)
getGUIIndicator in class MMObjectBuildernode - The node to displaypars - Parameters, see MMObjectBuilder.GUI_PARAMETERS
String, null if not specifiedpublic String getBuilderNameFromField(String fieldName)
fieldName - the name of the field
public static String getFieldNameFromField(String fieldname)
fieldname - the name of the field
public FieldDefs getField(String fieldName)
getField in class MMObjectBuilderfieldName - the requested field's name
public List<CoreField> getFields(int order)
MMObjectBuilder
getFields in class MMObjectBuilderorder - One of the sortorders defined in
CoreField
public Collection<CoreField> getFields()
MMObjectBuilder
getFields in class MMObjectBuilderCollection with the tables fieldspublic Map<String,CoreField> getFields(MMObjectNode node)
VirtualBuilder
getFields in class VirtualBuilder
public Vector<MMObjectNode> searchMultiLevelVector(int snode,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> orderVec,
List<String> direction)
searchMultiLevelVector(snodes, fields, pdistinct, tables, where, orderVec, direction, RelationStep.DIRECTIONS_EITHER),
where snodes contains just the number specified by snode.
searchMultiLevelVector(List, List, String, List, String, List, List, List)
public Vector<MMObjectNode> searchMultiLevelVector(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> orderVec,
List<String> direction)
searchMultiLevelVector(snodes, fields, pdistinct, tables, where, orderVec, direction, RelationStep.DIRECTIONS_EITHER).
searchMultiLevelVector(List,List,String,List,String,List,List,int)
public Vector<MMObjectNode> searchMultiLevelVector(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> sortFields,
List<String> directions,
int searchDir)
searchMultiLevelVector(List snodes, List fields, String pdistinct, List tables, String where,
List orderVec, List directions, List searchDirs)
QueryConvertor#setConstraint().
snodes - The numbers of the nodes to start the search with. These have to be present in the first table
listed in the tables parameter.fields - The fieldnames to return. This should include the name of the builder. Fieldnames without a builder prefix are ignored.
Fieldnames are accessible in the nodes returned in the same format (i.e. with manager indication) as they are specified in this parameter.
Examples: 'people.lastname'pdistinct - 'YES' indicates the records returned need to be distinct. Any other value indicates double values can be returned.tables - The builder chain. A list containing builder names.
The search is formed by following the relations between successive builders in the list. It is possible to explicitly supply
a relation builder by placing the name of the builder between two builders to search.
Example: company,people or typedef,authrel,people.where - The constraint, must be in one of the formats specified by QueryConvertor#setConstraint().
E.g. "WHERE news.title LIKE '%MMBase%' AND news.title > 100"sortFields - the fieldnames on which you want to sort.directions - A list of values containing, for each field in the order parameter, a value indicating whether the sort is
ascending (UP) or descending (DOWN). If less values are syupplied then there are fields in order,
the first value in the list is used for the remaining fields. Default value is 'UP'.searchDir - Specifies in which direction relations are to be
followed, this must be one of the values defined by this class.
Vector containing all matching nodes
public Vector<MMObjectNode> searchMultiLevelVector(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> sortFields,
List<String> directions,
List<Integer> searchDirs)
QueryConvertor#setConstraint().
snodes - The numbers of the nodes to start the search with. These have to be present in the first table
listed in the tables parameter.fields - The fieldnames to return. This should include the name of the builder. Fieldnames without a builder prefix are ignored.
Fieldnames are accessible in the nodes returned in the same format (i.e. with manager indication) as they are specified in this parameter.
Examples: 'people.lastname'pdistinct - 'YES' indicates the records returned need to be distinct. Any other value indicates double values can be returned.tables - The builder chain. A list containing builder names.
The search is formed by following the relations between successive builders in the list. It is possible to explicitly supply
a relation builder by placing the name of the builder between two builders to search.
Example: company,people or typedef,authrel,people.where - The constraint, must be in one of the formats specified by QueryConvertor#setConstraint().
E.g. "WHERE news.title LIKE '%MMBase%' AND news.title > 100"sortFields - the fieldnames on which you want to sort.directions - A list of values containing, for each field in the order parameter, a value indicating whether the sort is
ascending (UP) or descending (DOWN). If less values are syupplied then there are fields in order,
the first value in the list is used for the remaining fields. Default value is 'UP'.searchDirs - Specifies in which direction relations are to be followed. You can specify a direction for each
relation in the path. If you specify less directions than there are relations, the last specified direction is used
for the remaining relations. If you specify an empty list the default direction is BOTH.
Vector containing all matching nodespublic List<MMObjectNode> getClusterNodes(SearchQuery query)
clusternodes or MMObjectNodes if the
query is a Node-query.
This method uses the MultilevelCache for query results
query - The query.
public List<MMObjectNode> getClusterNodesFromQueryHandler(SearchQuery query)
throws SearchQueryException
clusternodes or MMObjectNodes if the
query is a Node-query.
The results are retrieved directly from storage without the MultilevelCache
getClusterNodes(SearchQuery) which uses the MultilevelCache
query - The query.
SearchQueryException - When an exception occurred while retrieving the results.org.mmbase.storage.search.SearchQueryHandler#getNodes
public String getShortedText(String fieldname,
int number)
fieldname - name of the fieldnumber - number of the object in the table
String containing the contents of a field as text
public byte[] getShortedByte(String fieldname,
int number)
fieldname - name of the fieldnumber - number of the object in the table
byte containing the contents of a field as text
public BasicSearchQuery getMultiLevelSearchQuery(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> sortFields,
List<String> directions,
int searchDir)
getMultiLevelSearchQuery(List snodes, List fields, String pdistinct, List tables, String where,
List orderVec, List directions, List searchDir)
QueryConvertor#setConstraint().
snodes - null or a list of numbers
of nodes to start the search with.
These have to be present in the first table listed in the
tables parameter.fields - List of fieldnames to return.
These should be formatted as stepalias.field,
e.g. 'people.lastname'pdistinct - 'YES' if the records returned need to be
distinct (ignoring case).
Any other value indicates double values can be returned.tables - The builder chain, a list containing builder names.
The search is formed by following the relations between
successive builders in the list.
It is possible to explicitly supply a relation builder by
placing the name of the builder between two builders to search.
Example: company,people or typedef,authrel,people.where - The constraint, must be in one of the formats specified by QueryConvertor#setConstraint().
E.g. "WHERE news.title LIKE '%MMBase%' AND news.title > 100"sortFields - null or a list of fieldnames on which you want to sort.directions - null or a list of values containing, for each field in the
sortFields parameter, a value indicating whether the sort is
ascending (UP) or descending (DOWN).
If less values are supplied then there are fields in order,
the first value in the list is used for the remaining fields.
Default value is 'UP'.searchDir - Specifies in which direction relations are to be
followed, this must be one of the values defined by this class.
public BasicSearchQuery getMultiLevelSearchQuery(List<String> snodes,
List<String> fields,
String pdistinct,
List<String> tables,
String where,
List<String> sortFields,
List<String> directions,
List<Integer> searchDirs)
QueryConvertor#setConstraint().
snodes - null or a list of numbers
of nodes to start the search with.
These have to be present in the first table listed in the
tables parameter.fields - List of fieldnames to return.
These should be formatted as stepalias.field,
e.g. 'people.lastname'pdistinct - 'YES' if the records returned need to be
distinct (ignoring case).
Any other value indicates double values can be returned.tables - The builder chain, a list containing builder names.
The search is formed by following the relations between
successive builders in the list.
It is possible to explicitly supply a relation builder by
placing the name of the builder between two builders to search.
Example: company,people or typedef,authrel,people.where - The constraint, must be in one of the formats specified by QueryConvertor#setConstraint().
E.g. "WHERE news.title LIKE '%MMBase%' AND news.title > 100"sortFields - null or a list of fieldnames on which you want to sort.directions - null or a list of values containing, for each field in the
sortFields parameter, a value indicating whether the sort is
ascending (UP) or descending (DOWN).
If less values are supplied then there are fields in order,
the first value in the list is used for the remaining fields.
Default value is 'UP'.searchDirs - Specifies in which direction relations are to be
followed, this must be one of the values defined by this class.
Map<String,BasicStep> addSteps(BasicSearchQuery query,
List<String> tables,
Map<String,Integer> roles,
boolean includeAllReference,
Map<String,BasicStepField> fieldsByAlias)
query - The searchquery.tables - The original chain of tables.roles - Map of tablenames mapped to Integer values,
representing the nodenumber of a corresponing RelDef node.
This method adds entries for table aliases that specify a role,
e.g. "related" or "related2".includeAllReference - Indicates if the "number"-fields must
included in the query for all tables in the original chain.fieldsByAlias - Map, mapping aliases (fieldname prefixed by table
alias) to the stepfields in the query. An entry is added for
each stepfield added to the query.
MMObjectBuilder getBuilder(String tableAlias,
Map<String,Integer> roles)
tableAlias - The table alias.
Must be tablename or relation role, optionally appended
with a digit, e.g. images, images3, related and related4.roles - Map of tablenames mapped to Integer values,
representing the nodenumber of a corresponing RelDef node.
This method adds entries for table aliases that specify a role,
e.g. "related" or "related2".
void addFields(BasicSearchQuery query,
String expression,
Map<String,BasicStep> stepsByAlias,
Map<String,BasicStepField> fieldsByAlias)
Fieldnames must be formatted as stepalias.field.
query - The query.expression - The expression.stepsByAlias - Map, mapping step aliases to the steps in the query.fieldsByAlias - Map, mapping field aliases (fieldname prefixed by
table alias) to the stepfields in the query.
An entry is added for each stepfield added to the query.
void addSortOrders(BasicSearchQuery query,
List<String> fieldNames,
List<String> directions,
Map<String,BasicStepField> fieldsByAlias)
query - The query.fieldNames - The fieldnames prefixed by the table aliases.directions - The corresponding sorting directions ("UP"/"DOWN").fieldsByAlias - Map, mapping field aliases (fieldname prefixed by
table alias) to the stepfields in the query.
Step getNodesStep(List<Step> steps,
int nodeNumber)
steps - The steps.nodeNumber - The number identifying the node.
null when not found.
void addRelationDirections(BasicSearchQuery query,
List<Integer> searchDirs,
Map<String,Integer> roles)
query - The search query.searchDirs - Specifies in which direction relations are to be followed. You can specify a direction for each
relation in the path. If you specify less directions than there are relations, the last specified direction is used
for the remaining relations. If you specify an empty list the default direction is BOTH.roles - Map of tablenames mapped to Integer values,
representing the nodenumber of the corresponing RelDef node.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||