public final class SearchClassSpecification extends Object implements Cloneable, Serializable
For each Searched class users can specify whether subclass objects should be included in the search. The default behavior is to include subclass objects and to exclude deleted objects.
Users can also specify aliases for the searched classes. This is needed on joins on the same class. If a user specifies an alias for a class, then the alias must be used in place of the class in all the Qualifiers, SortSpecifications, and ResultClass lists. Using the className in place of the alias will cause IfsException-22701 to be thrown.
The aliases must be unique within a SearchClassSpecification. Also the same class cannot be specified more than once without an alias. This will cause IfsException-22700 to be thrown.
// Usage Examples // Here we show combination of default constructor and other mutator // methods. Similar results can be achieved using constructor variants, // which take additional parameters. // Simple search class spec with a single class in it. // The single class acts as the result class also. // Generates Select DOCUMENT.* from DOCUMENT SearchClassSpecification searchClassSpec = new SearchClassSpecification(); searchClassSpec.addSearchClass(Document.CLASS_NAME); // Multiple search classes. Remember to use JoinQualification. // Search classes - DOCUMENT, CATEGORY // Result Class - DOCUMENT (picked by default) // SQL - Select DOCUMENT.* from DOCUMENT, CATEGORY SearchClassSpecification searchClassSpec = new SearchClassSpecification(); searchClassSpec.addSearchClass(Document.CLASS_NAME); searchClassSpec.addSearchClass(Category.CLASS_NAME); // Overriding the default result class searchClassSpec.addResultClass(Category.CLASS_NAME); // Using aliases for class names. Aliases very useful when having // same search class more than once in the search class specification. // Search Classes - DOCUMENT, CATEGORY // Search class aliases - DOC, CAT // Result Class - DOCUMENT (Picked by default) // SQL - Select DOC.* from DOCUMENT DOC, CATEGORY CAT SearchClassSpecification searchClassSpec = new SearchClassSpecification(); searchClassSpec.addSearchClass(Document.CLASS_NAME, "DOC"); searchClassSpec.addSearchClass(Category.CLASS_NAME, "CAT"); // Set up to remove duplicates searchClassSpec.setDistinct(true);
Modifier and Type | Field and Description |
---|---|
protected int |
m_AliasCounter
Counter used for generating internal Aliases.
|
protected Hashtable |
m_AliasMap
This maps user specified aliases to classes.
|
protected boolean |
m_DistinctSearch
This indicates if the duplicates will be removed.
|
protected Vector |
m_ResultClasses
List of Result Classes.
|
protected Vector |
m_SearchClassEntries
List of Search Class Entries
|
Constructor and Description |
---|
SearchClassSpecification()
Constructs an empty SearchClassSpecification.
|
SearchClassSpecification(String[] sClasses)
Construct SearchClassSpecification, initializing with the set of classes
supplied in the parameter.
|
SearchClassSpecification(String[] sClasses,
boolean[] delBehavior,
boolean[] recBehavior)
Construct SearchClassSpecification, initializing it with the
supplied set of classes, delete behavior, and recursive behavior.
|
SearchClassSpecification(String[] sClasses,
String[] sAliases,
boolean[] delBehavior,
boolean[] recBehavior)
Construct SearchClassSpecification, initializing it with the set of
supplied classes, aliases, delete behavior, and recursive behavior.
|
Modifier and Type | Method and Description |
---|---|
void |
addResultClass(String name)
Add name to the ResultClass list.
|
void |
addSearchClass(String sClass)
Adds the class to the list of Searched Classes.
|
void |
addSearchClass(String sClass,
boolean delBeh,
boolean recBeh)
Adds the class to the list of Searched Classes.
|
void |
addSearchClass(String sClass,
String sAlias)
Adds the class to the list of Searched Classes.
|
void |
addSearchClass(String className,
String aliasName,
boolean delBeh,
boolean recBeh)
Adds the class to the list of Searched Classes.
|
void |
addSearchClasses(String[] sClasses)
Add search classes to list of classes.
|
void |
addSearchClasses(String[] sClasses,
boolean[] delBeh,
boolean[] recBeh) |
void |
addSearchClasses(String[] sClasses,
String[] sAliases)
add search classes to list of classes.
|
void |
addSearchClasses(String[] sClasses,
String[] sAliases,
boolean[] delBeh,
boolean[] recBeh)
Add search classes to list of classes.
|
Object |
clone()
Returns a clone of this SearchClassSpecification.
|
protected String |
getAlias(String name)
Returns the Alias associated with the name.
|
String |
getClass(String name)
Given the alias/class, it returns the associated Class.
|
boolean[] |
getDeleteBehavior()
Returns delete behavior of classes
|
protected String |
getExternalName(int element)
Returns the name used by the user for the ith search class.
|
boolean[] |
getRecursiveBehavior()
Returns recursive behavior of classes
|
String[] |
getResultClassnames()
Gets list of result classes
|
String[] |
getSearchClassAliases()
Gets list of search aliases.
|
String[] |
getSearchClassnames()
Returns list of search classes
|
boolean[] |
getSqlViewUsage()
Returns SQL view usage behavior of classes
|
boolean |
isDistinct()
Get remove duplicates behavior.
|
protected void |
requireSqlView()
Indicate that all classes must use SQL view
instead of the table
|
protected void |
requireSqlView(String name)
Indicate that the specified alias/class must use SQL view
instead of the table
|
void |
setDistinct(boolean isDistinct)
Set remove duplicates behavior.
|
protected Vector m_SearchClassEntries
protected Vector m_ResultClasses
protected Hashtable m_AliasMap
protected transient int m_AliasCounter
protected boolean m_DistinctSearch
public SearchClassSpecification() throws IfsException
IfsException
- if operation fails.public SearchClassSpecification(String[] sClasses) throws IfsException
sClasses
- list of classes to search over.IfsException
- if operation fails.public SearchClassSpecification(String[] sClasses, boolean[] delBehavior, boolean[] recBehavior) throws IfsException
sClasses
- list of classes to search over.delBehavior
- array of boolean describing delete behavior for each class.recBehavior
- array of boolean describing recursive behavior for each class.IfsException
- if operation fails.public SearchClassSpecification(String[] sClasses, String[] sAliases, boolean[] delBehavior, boolean[] recBehavior) throws IfsException
sClasses
- list of classes to search over.sAliases
- Aliases for the classesdelBehavior
- array of boolean describing delete behavior for each class.recBehavior
- array of boolean describing recursive behavior for each class.IfsException
- if operation fails.public void addSearchClasses(String[] sClasses) throws IfsException
sClasses
- list of classes.IfsException
- if the operation failspublic void addSearchClasses(String[] sClasses, String[] sAliases) throws IfsException
sClasses
- list of classes.sAliases
- Aliases for the classes. For unspecified values, alias is
assumed to be null.IfsException
- if operation fails.public void addSearchClasses(String[] sClasses, boolean[] delBeh, boolean[] recBeh) throws IfsException
IfsException
public void addSearchClasses(String[] sClasses, String[] sAliases, boolean[] delBeh, boolean[] recBeh) throws IfsException
sClasses
- list of classes.sAliases
- Aliases for the classes. For unspecified values, alias is
assumed to be null.delBeh
- array of boolean describing delete behavior for each class.
For unspecified entries delete Behavior is assumed to be
false.recBeh
- array of boolean describing recursive behavior for each class.
For unspecified entries recursive Behavior is assumed to be
true.IfsException
- if operation fails.public void addSearchClass(String sClass) throws IfsException
sClass
- the iFS class being searchedIfsException
- if operation fails.public void addSearchClass(String sClass, String sAlias) throws IfsException
sClass
- the iFS class being searchedsAlias
- the Alias for the Class, if this is null an internal alias
is generated. User must use ClassName in Quals, SortSpec etc.IfsException
- (IFS-22702) if sClass is null.public void addSearchClass(String sClass, boolean delBeh, boolean recBeh) throws IfsException
sClass
- the iFS class being searcheddelBeh
- boolean describing delete behavior for class.recBeh
- boolean describing recursive behavior for class.IfsException
- if operation fails.public void addSearchClass(String className, String aliasName, boolean delBeh, boolean recBeh) throws IfsException
className
- the iFS class being searchedaliasName
- the Alias for the Class, if this is null an internal alias
is generated. User must use ClassName in Quals, SortSpec etc.delBeh
- boolean describing delete behavior for class.recBeh
- boolean describing recursive behavior for class.IfsException
- (IFS-22702) if sClass is null.public String[] getSearchClassnames()
public String[] getSearchClassAliases() throws IfsException
IfsException
- if the operation failspublic boolean[] getDeleteBehavior()
public boolean[] getRecursiveBehavior()
public boolean[] getSqlViewUsage()
public String getClass(String name) throws IfsException
name
- alias/Class name. If class has an associated alias, specify the
alias, otherwise sepcify the className.IfsException
- (IFS-22701) if name is not found in internal mappingprotected String getAlias(String name) throws IfsException
name
- alias/Class name. If class has an associated alias, specify the
alias, otherwise sepcify the className.IfsException
- (IFS-22701) if name is not found in internal mappingprotected void requireSqlView() throws IfsException
IfsException
- upon any failureprotected void requireSqlView(String name) throws IfsException
name
- alias/Class name. If class has an associated alias, specify the
alias, otherwise sepcify the className.IfsException
- (IFS-22701) if name is not found in internal mappingprotected String getExternalName(int element)
element
- class indexpublic void addResultClass(String name) throws IfsException
name
- For classes w/o aliases, this should be the className; o.w.
this should be the alias.IfsException
- (IFS-22702) if name is not validpublic String[] getResultClassnames() throws IfsException
IfsException
- if the operation failspublic void setDistinct(boolean isDistinct) throws IfsException
isDistinct
- if true, add DISTINCT to select clause.IfsException
- if the operation failspublic boolean isDistinct() throws IfsException
IfsException
- if the operation failsCopyright © 2023. All rights reserved.