OBEROn SDK

com.oberon.ooql.sdk
Class Selector

java.lang.Object
  extended by com.oberon.ooql.sdk.Selector

public class Selector
extends java.lang.Object

Class used to perform ObjectObj, Link and administrative object property selection

Version:
5.0

Nested Class Summary
 class Selector.HistorySelector
          Define a Selector to filter history table items
 
Field Summary
 boolean removeLineBreak
           
 boolean rootElement
           
 boolean XMLm
          XML minus option: reduce xml information
 boolean XMLp
          XML plus option: increase xml information
 
Constructor Summary
Selector()
           
Selector(java.lang.Class<?> objType)
          Define new selector
Selector(java.lang.Class<?> objType, java.lang.String composedName)
          Define new selector
Selector(java.lang.Class<?> objType, java.lang.String composedName, java.lang.String userName)
          Define new selector for User objects
Selector(java.lang.String type, java.lang.String ooql)
          Define new selector from OOQL string
 
Method Summary
 Selector addBasic(java.lang.String property)
          Add basic property.
 Selector addBasic(java.lang.String property, java.lang.String alias)
          Add basic property with alias Used to extract simple object properties
 Selector addHistoryBasic(int event, java.lang.String userName, FieldRange dateRange)
          Add history item filter.
 Selector addSelector(Selector selector)
          Add complex property selector.
 Selector addSeparatorToken(java.lang.String token)
          Add a separator token.
 java.util.Vector<java.lang.String> getAdminProperties(java.util.Vector<?> objectNames, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Apply this selector to extract properties for multiple objects
 java.lang.String getEncoding()
          Get the charset encoding for XML output format
 java.util.Vector<java.lang.Object> getFilterArgs()
          Get property computation Program arguments
 java.lang.String getOOQLTokens()
          Show the selector tokens as OOQL syntax
 java.lang.String getOutputString(org.jdom.Element xml)
          Convert the XML data to String Apply JSON transformation if required
 Selector getParentSelector()
          Get the parent selector [INTERNAL USAGE]
 java.util.Vector<java.lang.String> getSeparatorTokens()
          Get the separator tokens
 OBBase getTargetInstance()
          Get the target object instance
 java.lang.Class<?> getTargetType()
          Get the target type
 boolean isJSON()
          Check if the property selection result is in JSON format
 boolean isXML()
          Check if the property selection result is in XML format
 int length()
          Return the number of elements at first selector level
 java.lang.String prepareFields(java.lang.Object object, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters, int level)
          Apply this selector to extract object properties
 java.lang.String prepareFields(java.util.Vector<?> objectNames, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters, int level)
          Apply this selector to extract properties for multiple objects
 org.jdom.Element prepareXMLFields(org.jdom.Element eBase, java.lang.Object object, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Apply this selector to extract object properties in XML format
 org.jdom.Element prepareXMLFields(java.lang.String listName, java.util.Vector<?> objectNames, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Apply this selector to extract properties for multiple objects in XML format
 Selector setEncoding(java.lang.String encoding)
          Set the charset encoding for XML output format
 Selector setFilterArgs(java.util.Vector<java.lang.Object> args)
          Set Program arguments used to extract properties obtained by Program execution
 Selector setJSON(boolean json)
          Set the JSON output format
 Selector setParentSelector(Selector selector)
          Set the parent selector [INTERNAL USAGE]
 Selector setSeparatorTokens(java.lang.String[] tokens)
          Set the separator tokens
 Selector setTargetInstance(OBBase objInstance)
          Set the target object instance
 Selector setTargetType(java.lang.Class<?> objType)
          Set the target type
 Selector setView(java.lang.String viewName, Framework framework)
          Set the view for object/link property extraction
 Selector setXML(boolean xml)
          Set the XML output format
 java.lang.String toOOQL()
          Show the selector properties as OOQL syntax
 java.lang.String toString()
          Show the selector properties as String
 boolean useView()
          Check if the selector applies a view to the result
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XMLm

public boolean XMLm
XML minus option: reduce xml information


XMLp

public boolean XMLp
XML plus option: increase xml information


removeLineBreak

public boolean removeLineBreak

rootElement

public boolean rootElement
Constructor Detail

Selector

public Selector()

Selector

public Selector(java.lang.String type,
                java.lang.String ooql)
         throws java.lang.Exception
Define new selector from OOQL string

Parameters:
type - the OOQL object type ( objectspace,linktype,class,object,mail,link,..... )
ooql - the OOQL selector format
Throws:
java.lang.Exception
Since:
4.0

Selector

public Selector(java.lang.Class<?> objType)
Define new selector

Parameters:
objType - the target type ( Field.class, Class.class, Link.class, ObjectObj.class ..)

Selector

public Selector(java.lang.Class<?> objType,
                java.lang.String composedName)
Define new selector

Parameters:
objType - the target type ( Field.class, Class.class, Link.class, ObjectObj.class ..)
composedName - OOQL property identifier/name (should be empty for the root selector)

Selector

public Selector(java.lang.Class<?> objType,
                java.lang.String composedName,
                java.lang.String userName)
Define new selector for User objects

Parameters:
objType - the target type ( View.class, ObjectGroup.class, Query.class ..)
composedName - OOQL property identifier/name (should be empty for the root selector)
userName - the User name
Method Detail

length

public int length()
Return the number of elements at first selector level

Since:
4.0

setTargetType

public Selector setTargetType(java.lang.Class<?> objType)
Set the target type

Parameters:
objType - object class instance

getTargetType

public java.lang.Class<?> getTargetType()
Get the target type


setTargetInstance

public Selector setTargetInstance(OBBase objInstance)
Set the target object instance

Parameters:
objInstance - target object instance

getTargetInstance

public OBBase getTargetInstance()
Get the target object instance


addBasic

public Selector addBasic(java.lang.String property)
Add basic property. Used to extract simple object properties


addBasic

public Selector addBasic(java.lang.String property,
                         java.lang.String alias)
Add basic property with alias Used to extract simple object properties

Parameters:
property - the property expression
alias - the alias for this property

addSelector

public Selector addSelector(Selector selector)
Add complex property selector. Used to extract sub-object properties


setView

public Selector setView(java.lang.String viewName,
                        Framework framework)
                 throws OberonException
Set the view for object/link property extraction

Throws:
OberonException
Since:
2.5

useView

public boolean useView()
Check if the selector applies a view to the result

Since:
2.5

addHistoryBasic

public Selector addHistoryBasic(int event,
                                java.lang.String userName,
                                FieldRange dateRange)
Add history item filter. Used to extract items from history table

Parameters:
event - the history event flag
userName - filter items by event responsible User
dateRange - filter items by date range

setParentSelector

public Selector setParentSelector(Selector selector)
Set the parent selector [INTERNAL USAGE]


getParentSelector

public Selector getParentSelector()
Get the parent selector [INTERNAL USAGE]


addSeparatorToken

public Selector addSeparatorToken(java.lang.String token)
Add a separator token.

Used to keep separated the selected properties.
More separator tokens are used for several properties level.

Example:
extract description,fields and superclass for a Class instance
description and superclass are basic properties while fields is a complex property; the result (without set the separator tokens) should be something like:

<description> <field_1> <field_2> <field_3> <superclass>

using two separator tokens '|' (for level 0) and ';' (for level 1) will be:

<description>|<field_1>;<field_2>;<field_3>|<superclass>


setSeparatorTokens

public Selector setSeparatorTokens(java.lang.String[] tokens)
Set the separator tokens

Since:
4.0
See Also:
addSeparatorToken(String)

getSeparatorTokens

public java.util.Vector<java.lang.String> getSeparatorTokens()
Get the separator tokens

See Also:
addSeparatorToken(String)

setFilterArgs

public Selector setFilterArgs(java.util.Vector<java.lang.Object> args)
Set Program arguments used to extract properties obtained by Program execution


getFilterArgs

public java.util.Vector<java.lang.Object> getFilterArgs()
Get property computation Program arguments


setXML

public Selector setXML(boolean xml)
Set the XML output format

Parameters:
xml - if true the property selection result will be in XML format

isXML

public boolean isXML()
Check if the property selection result is in XML format


setJSON

public Selector setJSON(boolean json)
Set the JSON output format

Parameters:
json - if true the property selection result will be in JSON format
Since:
4.2.3

isJSON

public boolean isJSON()
Check if the property selection result is in JSON format

Since:
4.2.3

setEncoding

public Selector setEncoding(java.lang.String encoding)
Set the charset encoding for XML output format

Parameters:
encoding - set the encoding charset ( default UTF-8 , ISO-8859-1 , ...)

getEncoding

public java.lang.String getEncoding()
Get the charset encoding for XML output format


toString

public java.lang.String toString()
Show the selector properties as String

Overrides:
toString in class java.lang.Object

toOOQL

public java.lang.String toOOQL()
Show the selector properties as OOQL syntax

Since:
4.0

getOOQLTokens

public java.lang.String getOOQLTokens()
Show the selector tokens as OOQL syntax

Since:
4.0

prepareFields

public java.lang.String prepareFields(java.util.Vector<?> objectNames,
                                      Framework framework,
                                      java.util.Hashtable<java.lang.String,java.lang.Integer> counters,
                                      int level)
                               throws OberonException
Apply this selector to extract properties for multiple objects

Parameters:
objectNames - a Vector of object names or ObjectObj/Link IDs
framework - the current framework
counters - administrative object synch counters (if null read them from database)
level - the token separator initial level
Returns:
a String with property values separated by token separators
Throws:
OberonException
See Also:
addSeparatorToken(String)

prepareFields

public java.lang.String prepareFields(java.lang.Object object,
                                      Framework framework,
                                      java.util.Hashtable<java.lang.String,java.lang.Integer> counters,
                                      int level)
                               throws OberonException
Apply this selector to extract object properties

Parameters:
object - the object name or ObjectObj/Link ID or the object instance
framework - the current framework
counters - administrative object synch counters (if null read them from database)
level - the token separator initial level
Returns:
a String with property values separated by token separators
Throws:
OberonException
See Also:
addSeparatorToken(String)

getAdminProperties

public java.util.Vector<java.lang.String> getAdminProperties(java.util.Vector<?> objectNames,
                                                             Framework framework,
                                                             java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                                                      throws OberonException
Apply this selector to extract properties for multiple objects

Parameters:
objectNames - a Vector of object names or ObjectObj/Link IDs
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Returns:
a Vector of Strings representing property values separated by token separators
The return vector is the input vector where object names (or IDs) are replaced with relative properties
Throws:
OberonException
See Also:
addSeparatorToken(String)

prepareXMLFields

public org.jdom.Element prepareXMLFields(java.lang.String listName,
                                         java.util.Vector<?> objectNames,
                                         Framework framework,
                                         java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                                  throws OberonException
Apply this selector to extract properties for multiple objects in XML format

Parameters:
listName - the root xml-tag name
objectNames - a Vector of object names or ObjectObj/Link IDs
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Returns:
a XML structure representing the property values for all objects
Throws:
OberonException

prepareXMLFields

public org.jdom.Element prepareXMLFields(org.jdom.Element eBase,
                                         java.lang.Object object,
                                         Framework framework,
                                         java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                                  throws OberonException
Apply this selector to extract object properties in XML format

Parameters:
object - the object name or ObjectObj/Link ID or the object instance
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Returns:
a XML structure representing the property values
Throws:
OberonException

getOutputString

public java.lang.String getOutputString(org.jdom.Element xml)
                                 throws OberonException
Convert the XML data to String Apply JSON transformation if required

Throws:
OberonException
Since:
4.2.3

OBEROn SDK

Copyright © 2008-2014 Mirko Solazzi. All Rights Reserved.