OBEROn SDK

com.oberon.ooql.sdk
Class Query

java.lang.Object
  extended by com.oberon.ooql.sdk.OBBase
      extended by com.oberon.ooql.sdk.AdminBase
          extended by com.oberon.ooql.sdk.Query
All Implemented Interfaces:
java.io.Serializable

public class Query
extends AdminBase
implements java.io.Serializable

Query: represents a User query for OBEROn ObjectObj instances

Version:
5.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.oberon.ooql.sdk.AdminBase
bsOptions, HIDDEN_OPTION
 
Constructor Summary
Query()
           
Query(java.lang.String name)
          Define a new Query to all users
Query(java.lang.String name, java.lang.String userName)
          Define a new Query associated to a specific User
 
Method Summary
 void addClassPattern(java.lang.String pattern)
          Add a pattern to the ObjectObj's Class name filter
 void addHolderPattern(java.lang.String pattern)
          Add a pattern to the ObjectObj's holder filter
 void addLifecyclePattern(java.lang.String pattern)
          Add a pattern to the ObjectObj's Lifecycle filter
 void addNamePattern(java.lang.String pattern)
          Add a pattern to the ObjectObj's name filter
 void addObjectSpacePattern(java.lang.String pattern)
          Add a pattern to the ObjectSpace filter
 void addRevisionPattern(java.lang.String pattern)
          Add a pattern to the ObjectObj's revision filter
 void addStagePattern(java.lang.String pattern)
          Add a pattern to the ObjectObj's Stage filter
 java.lang.String compareUpdate(Query refQuery, boolean checkImage, boolean overwrite, boolean force, Framework framework)
          Return/apply the OOQL command to update this Query object and let it become equals to another reference object.
 void count(Framework framework)
          Execute the Query and count the result instance number
 void create(boolean overwrite, boolean force, Framework framework)
          Create a new Query object on the database
 void create(Framework framework)
          Create a new Query object on the database
 void destroy(Framework framework)
          Remove the Query object from the database.
 void execute(java.io.DataOutputStream outStream, Framework framework)
          Execute the Query
 void execute(Selector selector, java.io.DataOutputStream outStream, Framework framework)
          Execute the Query and extract the result ObjectObj instance properties
 void fromXML(org.jdom.Element rootElement)
          Load the Query object from XML element tree
 java.util.Vector<java.lang.String> getClassPattern()
          Get filters for the ObjectObj Class name
 java.lang.String getClassPatternAsString()
          Get filters for the ObjectObj Class name as String (separated with ",")
 java.lang.String getCreateCommand(boolean force)
          Return the OOQL command to create this Query object with the settled properties
 java.lang.String getCreateCommand(boolean force, boolean overwrite)
          Return the OOQL command to create this Query object with the settled properties
 java.lang.String getDescriptionPattern()
          Get filter for the ObjectObj's description
 java.lang.String getExecuteCommand()
          Return the OOQL command to execute the Query ob the basis of settled filters
 java.lang.String getFilter()
          Get OOQL filter expression for this Query
 java.util.Vector<java.lang.String> getHolderPattern()
          Get filters for the ObjectObj holder
 java.lang.String getHolderPatternAsString()
          Get filters for the ObjectObj holder as String (separated with ",")
 java.util.Vector<java.lang.String> getLifecyclePattern()
          Get filters for the ObjectObj Lifecycle
 java.lang.String getLifecyclePatternAsString()
          Get filters for the ObjectObj Lifecycle as String (separated with ",")
 int getMaxItems()
          Get the maximum number of retrieved ObjectObj instances during the Query execution
 java.util.Vector<java.lang.String> getNamePattern()
          Get filters for the ObjectObj name
 java.lang.String getNamePatternAsString()
          Get filters for the ObjectObj name as String (separated with ",")
 java.util.Vector<java.lang.String> getObjectSpacePattern()
          Get filters for the ObjectSpace
 java.lang.String getObjectSpacePatternAsString()
          Get filters for the ObjectSpace as String (separated with ",")
 java.lang.String getProperty(java.lang.String propertyName, java.util.Vector<java.lang.Object> filterArgs, java.lang.String token, Framework framework)
          Get a property for this Query object by its OOQL identifier
 java.util.Vector<java.lang.String> getRevisionPattern()
          Get filters for the ObjectObj revision
 java.lang.String getRevisionPatternAsString()
          Get filters for the ObjectObj revision as String (separated with ",")
 java.lang.String getSaveCommand(boolean force)
          Return the OOQL command to update this Query object with the modified properties.
 ObjectGroup getSaveGroup()
          Get ObjectGroup where collect the Query result ObjectObj instances
 java.util.Vector<java.lang.String> getStagePattern()
          Get filters for the ObjectObj Stage
 java.lang.String getStagePatternAsString()
          Get filters for the ObjectObj Stage as String (separated with ",")
 java.util.Vector<?> getTargetNames(java.lang.String composedName, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Return a Vector of administrative object names extracted by using an OOQL selector
 java.lang.String getUser()
          Get the User associated to this Query
 int getUserId()
          Get the internal id of User associated to this Query
 java.util.Hashtable<java.lang.String,java.lang.String> getVariables()
          Get the variable values for the Query execution
 boolean isGroupOverwrite()
          Check if the ObjectGroup where collect the Query result ObjectObj instances can be updated
 void link(Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the Query object: connect the memory instance with the database instance
static Query open(java.lang.String name, Framework framework)
          Open a general Query and read its properties from the database
static Query open(java.lang.String name, java.lang.String userName, Framework framework)
          Open a Query for a given user and read its properties from the database
static Query open(java.lang.String name, java.lang.String userName, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open a Query for a given user and read its properties from the database
 void resetClassPattern()
          Remove filters for the ObjectObj Class name
 void resetHolderPattern()
          Remove filters for the ObjectObj holder
 void resetLifecyclePattern()
          Remove filters for the ObjectObj Lifecycle
 void resetNamePattern()
          Remove filters for the ObjectObj name
 void resetObjectSpacePattern()
          Remove filters for the ObjectSpace
 void resetRevisionPattern()
          Remove filters for the ObjectObj revision
 void resetStagePattern()
          Remove filters for the ObjectObj Stage
 void saveToGroup(java.lang.String objectgroup, java.lang.String userName, boolean overwrite)
          Set the Query to collect resul ObjectObj instances into a user ObjectGroup
 void setClassPattern(java.util.Vector<java.lang.String> patterns)
          Set filters for the ObjectObj Class name
 void setDescriptionPattern(java.lang.String pattern)
          Set filter for the ObjectObj's description
 void setFilter(java.lang.String expression)
          Set OOQL filter expression for this Query
 void setHolderPattern(java.util.Vector<java.lang.String> patterns)
          Set filters for the ObjectObj holder
 void setLifecyclePattern(java.util.Vector<java.lang.String> patterns)
          Set filters for the ObjectObj Lifecycle
 void setMaxItems(int maxItems)
          Set the maximum number of retrieved ObjectObj instances during the Query execution
 void setNamePattern(java.util.Vector<java.lang.String> patterns)
          Set filters for the ObjectObj name
 void setObjectSpacePattern(java.util.Vector<java.lang.String> patterns)
          Set filters for the ObjectSpace
 void setRevisionPattern(java.util.Vector<java.lang.String> patterns)
          Set filters for the ObjectObj revision
 void setSelector(Selector selector)
          Set the Query selector for ObjectObj instance properties
 void setStagePattern(java.util.Vector<java.lang.String> patterns)
          Set filters for the ObjectObj Stage
 void setUser(java.lang.String userName)
          Set the User associated to this Query
 void setUserId(int userID)
          Set the internal id of User associated to this Query
 void setVariable(java.lang.String varName, java.lang.String value)
          Set a variable values for Query execution
 java.lang.String toString()
          Return the Query object basic properties as a single String
 java.lang.String toString(Framework framework)
          Return the Query object extended properties as a single String
 org.jdom.Element toXML(boolean getImage, boolean fullDump, Framework framework)
          Return the Query object properties as XML element tree
 org.jdom.Element toXML(Framework framework)
          Return the Query object properties as XML element tree
 void unlink(Framework framework)
          Close the object: disconnect the memory instance from the database instance
 void write(boolean force, Framework framework)
          Update the Query object to the database
 void write(Framework framework)
          Update the Query object to the database
 
Methods inherited from class com.oberon.ooql.sdk.AdminBase
addFeature, changedApplication, checkChangeName, checkCounters, checkCounters, getAdminType, getApplication, getCommonProperty, getCommonTargetNames, getCounters, getCreateBasicCommand, getCreateCommand, getCrtDate, getDescription, getEditBasicCommand, getFeature, getFeatures, getFeaturesAsString, getImage, getImage, getImage, getImageData, getImageFile, getModDate, getModUser, getName, getOldName, getPlainFeatures, getSaveCommand, getSVNRevision, getXMLFeatureList, hasImage, isHidden, setApplication, setCounters, setCrtDate, setDescription, setHidden, setImage, setImageData, setImageFile, setModDate, setModUser, setName, setSVNRevision, show, show, toCommonXML, toXML
 
Methods inherited from class com.oberon.ooql.sdk.OBBase
addChange, addUniqueChange, ChangesFromXML, ChangesToXML, getChanges, getChangesAsString, getId, isLinked, removeChange, resetChanges, setId, setLinked
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Query

public Query()

Query

public Query(java.lang.String name)
      throws OberonException
Define a new Query to all users

Parameters:
name - the Query name
Throws:
OberonException - if the name contains invalid characters
Since:
2.4

Query

public Query(java.lang.String name,
             java.lang.String userName)
      throws OberonException
Define a new Query associated to a specific User

Parameters:
name - the Query name
userName - the User name
Throws:
OberonException - if the name contains invalid characters
Method Detail

open

public static Query open(java.lang.String name,
                         Framework framework)
                  throws OberonException
Open a general Query and read its properties from the database

Parameters:
name - the Query name
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions
Since:
2.4

link

public void link(Framework framework,
                 java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          throws OberonException
Open the Query object: connect the memory instance with the database instance

Specified by:
link in class AdminBase
Parameters:
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions

open

public static Query open(java.lang.String name,
                         java.lang.String userName,
                         Framework framework)
                  throws OberonException
Open a Query for a given user and read its properties from the database

Parameters:
name - the Query name
userName - the User name
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

open

public static Query open(java.lang.String name,
                         java.lang.String userName,
                         Framework framework,
                         java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                  throws OberonException
Open a Query for a given user and read its properties from the database

Parameters:
name - the Query name
userName - the User name
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions
Since:
4.0

create

public void create(Framework framework)
            throws OberonException
Create a new Query object on the database

Specified by:
create in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
2.4

create

public void create(boolean overwrite,
                   boolean force,
                   Framework framework)
            throws OberonException
Create a new Query object on the database

Parameters:
overwrite - if true overwrite the Query when it already exists
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
2.4

write

public void write(Framework framework)
           throws OberonException
Update the Query object to the database

Specified by:
write in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

write

public void write(boolean force,
                  Framework framework)
           throws OberonException
Update the Query object to the database

Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions
Since:
2.4

unlink

public void unlink(Framework framework)
            throws OberonException
Close the object: disconnect the memory instance from the database instance

Specified by:
unlink in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

destroy

public void destroy(Framework framework)
             throws OberonException
Remove the Query object from the database.

Specified by:
destroy in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

execute

public void execute(java.io.DataOutputStream outStream,
                    Framework framework)
             throws java.io.IOException,
                    OberonException
Execute the Query

Parameters:
outStream - the stream for the results (if null the result is stored into the framework)
framework - the current framework
Throws:
java.io.IOException
OberonException
See Also:
Framework.getResult()

execute

public void execute(Selector selector,
                    java.io.DataOutputStream outStream,
                    Framework framework)
             throws java.io.IOException,
                    OberonException
Execute the Query and extract the result ObjectObj instance properties

Parameters:
selector - selection parameters for result ObjectObj instances (if null return class,name,revision and id)
outStream - the stream for the results (if null the result is stored into the framework)
framework - the current framework
Throws:
java.io.IOException
OberonException
See Also:
Framework.getResult()

count

public void count(Framework framework)
           throws OberonException
Execute the Query and count the result instance number

Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
3.0

setUser

public void setUser(java.lang.String userName)
Set the User associated to this Query


getUser

public java.lang.String getUser()
Get the User associated to this Query


setUserId

public void setUserId(int userID)
Set the internal id of User associated to this Query


getUserId

public int getUserId()
Get the internal id of User associated to this Query


setMaxItems

public void setMaxItems(int maxItems)
Set the maximum number of retrieved ObjectObj instances during the Query execution


getMaxItems

public int getMaxItems()
Get the maximum number of retrieved ObjectObj instances during the Query execution


setVariable

public void setVariable(java.lang.String varName,
                        java.lang.String value)
Set a variable values for Query execution

Parameters:
varName - the variable name
value - the variable value
Since:
4.0

getVariables

public java.util.Hashtable<java.lang.String,java.lang.String> getVariables()
Get the variable values for the Query execution

Since:
4.0

addClassPattern

public void addClassPattern(java.lang.String pattern)
Add a pattern to the ObjectObj's Class name filter

Parameters:
pattern - the filter patten (can include wildcards {*?})

resetClassPattern

public void resetClassPattern()
Remove filters for the ObjectObj Class name


setClassPattern

public void setClassPattern(java.util.Vector<java.lang.String> patterns)
Set filters for the ObjectObj Class name


getClassPattern

public java.util.Vector<java.lang.String> getClassPattern()
Get filters for the ObjectObj Class name


getClassPatternAsString

public java.lang.String getClassPatternAsString()
Get filters for the ObjectObj Class name as String (separated with ",")


addNamePattern

public void addNamePattern(java.lang.String pattern)
Add a pattern to the ObjectObj's name filter

Parameters:
pattern - the filter patten (can include wildcards {*?})

resetNamePattern

public void resetNamePattern()
Remove filters for the ObjectObj name


setNamePattern

public void setNamePattern(java.util.Vector<java.lang.String> patterns)
Set filters for the ObjectObj name


getNamePattern

public java.util.Vector<java.lang.String> getNamePattern()
Get filters for the ObjectObj name


getNamePatternAsString

public java.lang.String getNamePatternAsString()
Get filters for the ObjectObj name as String (separated with ",")


addRevisionPattern

public void addRevisionPattern(java.lang.String pattern)
Add a pattern to the ObjectObj's revision filter

Parameters:
pattern - the filter patten (can include wildcards {*?})

resetRevisionPattern

public void resetRevisionPattern()
Remove filters for the ObjectObj revision


setRevisionPattern

public void setRevisionPattern(java.util.Vector<java.lang.String> patterns)
Set filters for the ObjectObj revision


getRevisionPattern

public java.util.Vector<java.lang.String> getRevisionPattern()
Get filters for the ObjectObj revision


getRevisionPatternAsString

public java.lang.String getRevisionPatternAsString()
Get filters for the ObjectObj revision as String (separated with ",")


addHolderPattern

public void addHolderPattern(java.lang.String pattern)
Add a pattern to the ObjectObj's holder filter

Parameters:
pattern - the filter patten (can include wildcards {*?})

resetHolderPattern

public void resetHolderPattern()
Remove filters for the ObjectObj holder


setHolderPattern

public void setHolderPattern(java.util.Vector<java.lang.String> patterns)
Set filters for the ObjectObj holder


getHolderPattern

public java.util.Vector<java.lang.String> getHolderPattern()
Get filters for the ObjectObj holder


getHolderPatternAsString

public java.lang.String getHolderPatternAsString()
Get filters for the ObjectObj holder as String (separated with ",")


setDescriptionPattern

public void setDescriptionPattern(java.lang.String pattern)
Set filter for the ObjectObj's description

Parameters:
pattern - the filter patten (can include wildcards {*?})

getDescriptionPattern

public java.lang.String getDescriptionPattern()
Get filter for the ObjectObj's description


addLifecyclePattern

public void addLifecyclePattern(java.lang.String pattern)
Add a pattern to the ObjectObj's Lifecycle filter

Parameters:
pattern - the filter patten (can include wildcards {*?})

resetLifecyclePattern

public void resetLifecyclePattern()
Remove filters for the ObjectObj Lifecycle


setLifecyclePattern

public void setLifecyclePattern(java.util.Vector<java.lang.String> patterns)
Set filters for the ObjectObj Lifecycle


getLifecyclePattern

public java.util.Vector<java.lang.String> getLifecyclePattern()
Get filters for the ObjectObj Lifecycle


getLifecyclePatternAsString

public java.lang.String getLifecyclePatternAsString()
Get filters for the ObjectObj Lifecycle as String (separated with ",")


addStagePattern

public void addStagePattern(java.lang.String pattern)
Add a pattern to the ObjectObj's Stage filter

Parameters:
pattern - the filter patten (can include wildcards {*?})

resetStagePattern

public void resetStagePattern()
Remove filters for the ObjectObj Stage


setStagePattern

public void setStagePattern(java.util.Vector<java.lang.String> patterns)
Set filters for the ObjectObj Stage


getStagePattern

public java.util.Vector<java.lang.String> getStagePattern()
Get filters for the ObjectObj Stage


getStagePatternAsString

public java.lang.String getStagePatternAsString()
Get filters for the ObjectObj Stage as String (separated with ",")


addObjectSpacePattern

public void addObjectSpacePattern(java.lang.String pattern)
Add a pattern to the ObjectSpace filter

Parameters:
pattern - the filter patten (can include wildcards {*?})

resetObjectSpacePattern

public void resetObjectSpacePattern()
Remove filters for the ObjectSpace


setObjectSpacePattern

public void setObjectSpacePattern(java.util.Vector<java.lang.String> patterns)
Set filters for the ObjectSpace


getObjectSpacePattern

public java.util.Vector<java.lang.String> getObjectSpacePattern()
Get filters for the ObjectSpace


getObjectSpacePatternAsString

public java.lang.String getObjectSpacePatternAsString()
Get filters for the ObjectSpace as String (separated with ",")


setFilter

public void setFilter(java.lang.String expression)
Set OOQL filter expression for this Query

Parameters:
expression - boolean expression used to filter ObjectObj instances during the query execution process

getFilter

public java.lang.String getFilter()
Get OOQL filter expression for this Query


setSelector

public void setSelector(Selector selector)
Set the Query selector for ObjectObj instance properties

Parameters:
selector - selection parameters for result ObjectObj instances (if null return class,name,revision and id)

saveToGroup

public void saveToGroup(java.lang.String objectgroup,
                        java.lang.String userName,
                        boolean overwrite)
                 throws OberonException
Set the Query to collect resul ObjectObj instances into a user ObjectGroup

Parameters:
objectgroup - the ObjectGroup name
userName - the User name
overwrite - if true update the ObjectGroup when it already exists
Throws:
OberonException

getSaveGroup

public ObjectGroup getSaveGroup()
Get ObjectGroup where collect the Query result ObjectObj instances


isGroupOverwrite

public boolean isGroupOverwrite()
Check if the ObjectGroup where collect the Query result ObjectObj instances can be updated


getProperty

public java.lang.String getProperty(java.lang.String propertyName,
                                    java.util.Vector<java.lang.Object> filterArgs,
                                    java.lang.String token,
                                    Framework framework)
Get a property for this Query object by its OOQL identifier

Specified by:
getProperty in class OBBase
Parameters:
propertyName - OOQL property identifier/name (example: objclass , objdescr ...)
filterArgs - extra arguments used to compute properties
token - separator token for complex properties
framework - the current framework
Returns:
the property value

getTargetNames

public java.util.Vector<?> getTargetNames(java.lang.String composedName,
                                          java.util.Vector<java.lang.Object> filterArgs,
                                          Framework framework)
Return a Vector of administrative object names extracted by using an OOQL selector

Specified by:
getTargetNames in class OBBase
Parameters:
composedName - OOQL property identifier/name
filterArgs - extra arguments used to compute properties
framework - the current framework
Returns:
a Vector of target names, used to extract their (sub)properties values

toString

public java.lang.String toString()
Return the Query object basic properties as a single String

Overrides:
toString in class AdminBase

toString

public java.lang.String toString(Framework framework)
Return the Query object extended properties as a single String

Overrides:
toString in class AdminBase
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(Framework framework)
Return the Query object properties as XML element tree

Specified by:
toXML in class AdminBase
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(boolean getImage,
                              boolean fullDump,
                              Framework framework)
Return the Query object properties as XML element tree

Specified by:
toXML in class AdminBase
Parameters:
fullDump - true to include detailed information
framework - the current framework
getImage - true to include "imagedata" element with the base64 encoded image data

fromXML

public void fromXML(org.jdom.Element rootElement)
Load the Query object from XML element tree

Overrides:
fromXML in class AdminBase

getExecuteCommand

public java.lang.String getExecuteCommand()
Return the OOQL command to execute the Query ob the basis of settled filters


getCreateCommand

public java.lang.String getCreateCommand(boolean force)
Return the OOQL command to create this Query object with the settled properties

Specified by:
getCreateCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

getCreateCommand

public java.lang.String getCreateCommand(boolean force,
                                         boolean overwrite)
Return the OOQL command to create this Query object with the settled properties

Parameters:
overwrite - if true add the overwrite option to the command

getSaveCommand

public java.lang.String getSaveCommand(boolean force)
Return the OOQL command to update this Query object with the modified properties.
If the object is new, it returns the create command.

Specified by:
getSaveCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

compareUpdate

public java.lang.String compareUpdate(Query refQuery,
                                      boolean checkImage,
                                      boolean overwrite,
                                      boolean force,
                                      Framework framework)
                               throws OberonException
Return/apply the OOQL command to update this Query object and let it become equals to another reference object.
This method is useful to import objects from an XML file.

Parameters:
refQuery - the reference Query object
checkImage - if true compare also the image icon
overwrite - if true update the database object instance
force - if true ignores optional properties
framework - the current framework
Throws:
OberonException
See Also:
fromXML(Element)

OBEROn SDK

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