OBEROn SDK

com.oberon.ooql.sdk
Class Command

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

public class Command
extends AdminBase
implements java.io.Serializable

Command Admin Object: defines a Menu-Command item for a web user interface

Version:
5.0
See Also:
Serialized Form

Field Summary
static int EXECUTABLE_OPTION
          The Executable flag index inside the Option Set
 
Fields inherited from class com.oberon.ooql.sdk.AdminBase
bsOptions, HIDDEN_OPTION
 
Constructor Summary
Command()
           
Command(java.lang.String name)
           
 
Method Summary
 void addExecuteAccess(java.lang.String actorType, java.lang.String actorName)
          Add access right to execute this Command to an actor
 java.lang.String compareUpdate(Command refCommand, boolean checkImage, boolean overwrite, boolean force, Framework framework)
          Return/apply the OOQL command to update this Command object and let it become equals to another reference object.
static java.lang.String covertActorFormat(java.lang.String actor)
          Convert the actor string format from actortype|actorname to OOQL format
 void create(boolean force, Framework framework)
          Create a new Command object on the database
 void create(Framework framework)
          Create a new Command object on the database
 void destroy(Framework framework)
          Remove the Command object from the database
 Framework execute(Framework framework, java.util.Hashtable<java.lang.String,java.lang.String> parameters, java.util.Vector<java.lang.Object> filterArgs)
          Execute the Command
 Framework execute(Framework framework, java.util.Vector<java.lang.Object> filterArgs)
          Execute the Command
 void fromXML(org.jdom.Element rootElement)
          Load the Command object properties from XML element tree
 java.lang.String getAccessProgram()
          Get the access Program
 java.lang.String getAlt()
          Get the Command tip (html alt).
 java.lang.String getCreateCommand(boolean force)
          Return the OOQL command to create this Command object with the settled properties
 java.util.Vector<java.lang.String> getExecuteAccess()
          Return the list of execute access rights for this Command.
 java.lang.String getHRef()
          Get the web page link
 java.lang.String getLabel()
          Get the Command label.
 java.util.Vector<java.lang.String> getMenus(Framework framework)
          Return a list of Menus where this Command is used
 java.lang.String getMenusAsString(java.lang.String delim, Framework framework)
          Return a list of Menus where this Command is used, as String
 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 Command object by its OOQL identifier
 java.lang.String getSaveCommand(boolean force)
          Return the OOQL command to update this Command object with the modified properties.
 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
 boolean hasAccess(java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Check if the framework user has access to execute this Command
 boolean isExecutable()
          Check if the command is or not executable
 void link(Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the Command object: connect the memory instance with the database instance
static Command open(java.lang.String name, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open an administrative object and read properties from the database or retrieve them from memory
 void removeExecuteAccess(java.lang.String actorType, java.lang.String actorName)
          Remove the actor access right to execute this Command
 void setAccessProgram(java.lang.String programName)
          Set a method to check the user access
 void setAlt(java.lang.String altTip)
          Set the Command tip (html alt).
 void setExecutable(boolean executable)
          Set the command Executable flag;
If a command is executable, the Href value must include a program name as follow:
<ProgramName>?
 void setHRef(java.lang.String url)
          Set the web page link for this Command.
 void setLabel(java.lang.String label)
          Set the Command label.
 java.lang.String toString()
          Return the Command object basic properties as a single String
 java.lang.String toString(Framework framework)
          Return the Command object extended properties as a single String
 org.jdom.Element toXML(boolean getImage, boolean fullDump, Framework framework)
          Return the Command object properties as XML element tree
 org.jdom.Element toXML(Framework framework)
          Return the Command object properties as XML element tree
 void unlink(Framework framework)
          Close the object: disconnect the memory instance from the database instance
 void updateExecuteAccess(java.util.Vector<java.lang.String> accesses)
          Update the execute access on the basis of a given list
 void write(boolean force, Framework framework)
          Update the Command object to the database
 void write(Framework framework)
          Update the Command 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
 

Field Detail

EXECUTABLE_OPTION

public static final int EXECUTABLE_OPTION
The Executable flag index inside the Option Set

See Also:
Constant Field Values
Constructor Detail

Command

public Command()

Command

public Command(java.lang.String name)
        throws OberonException
Parameters:
name - the name of the administrative object
Throws:
OberonException - if the name contains invalid characters
Method Detail

open

public static Command open(java.lang.String name,
                           Framework framework,
                           java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                    throws OberonException
Open an administrative object and read properties from the database or retrieve them from memory

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

link

public void link(Framework framework,
                 java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          throws OberonException
Open the Command 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

create

public void create(Framework framework)
            throws OberonException
Create a new Command 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

create

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

Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
1.6

write

public void write(Framework framework)
           throws OberonException
Update the Command 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 Command object to the database

Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
1.6

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 Command 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 Framework execute(Framework framework,
                         java.util.Vector<java.lang.Object> filterArgs)
                  throws OberonException
Execute the Command

Parameters:
framework - the current framework
filterArgs - vector of input arguments used by access and execution program
Throws:
OberonException - due to execution errors or programmatically raised exceptions
Since:
2.5

execute

public Framework execute(Framework framework,
                         java.util.Hashtable<java.lang.String,java.lang.String> parameters,
                         java.util.Vector<java.lang.Object> filterArgs)
                  throws OberonException
Execute the Command

Parameters:
framework - the current framework
parameters - additional framework environment parameters
filterArgs - vector of input arguments used by access and execution program
Throws:
OberonException - due to execution errors or programmatically raised exceptions
Since:
2.5

setHRef

public void setHRef(java.lang.String url)
Set the web page link for this Command. HTTP parameters can be added as Command Features

Parameters:
url - the http url (example: /myfolder/mypage.jsp)

getHRef

public java.lang.String getHRef()
Get the web page link

Returns:
the page link

setAlt

public void setAlt(java.lang.String altTip)
Set the Command tip (html alt).

Parameters:
altTip - the alt tip

getAlt

public java.lang.String getAlt()
Get the Command tip (html alt).

Returns:
the alt tip

setLabel

public void setLabel(java.lang.String label)
Set the Command label.

Parameters:
label - the label value

getLabel

public java.lang.String getLabel()
Get the Command label.

Returns:
the label value

setExecutable

public void setExecutable(boolean executable)
Set the command Executable flag;
If a command is executable, the Href value must include a program name as follow:
<ProgramName>?param1=value1¶m2=value2&......

Parameters:
executable - the executable flag
Since:
2.5

isExecutable

public boolean isExecutable()
Check if the command is or not executable

Since:
2.5

addExecuteAccess

public void addExecuteAccess(java.lang.String actorType,
                             java.lang.String actorName)
Add access right to execute this Command to an actor

Parameters:
actorType - the actor type: can be ActorAccess.USER , ActorAccess.TEAM , ActorAccess.ASSIGNMENT
actorName - the actor name

removeExecuteAccess

public void removeExecuteAccess(java.lang.String actorType,
                                java.lang.String actorName)
Remove the actor access right to execute this Command

Parameters:
actorType - the actor type: can be ActorAccess.USER , ActorAccess.TEAM , ActorAccess.ASSIGNMENT
actorName - the actor name

updateExecuteAccess

public void updateExecuteAccess(java.util.Vector<java.lang.String> accesses)
Update the execute access on the basis of a given list

Parameters:
accesses - list of accesses formatted as actorType|actorName
Since:
4.0

getExecuteAccess

public java.util.Vector<java.lang.String> getExecuteAccess()
Return the list of execute access rights for this Command.

Returns:
Vector of access rights formatted as actorType|actorName
See Also:
addExecuteAccess(String, String)

getMenus

public java.util.Vector<java.lang.String> getMenus(Framework framework)
Return a list of Menus where this Command is used

Parameters:
framework - the current framework
Returns:
vector of Menu names

getMenusAsString

public java.lang.String getMenusAsString(java.lang.String delim,
                                         Framework framework)
Return a list of Menus where this Command is used, as String

Parameters:
delim - the separator item
framework - the current framework
Returns:
list of Menu names separated by the delim characters

setAccessProgram

public void setAccessProgram(java.lang.String programName)
Set a method to check the user access

Parameters:
programName - the Program name

getAccessProgram

public java.lang.String getAccessProgram()
Get the access Program

Returns:
the Program name

covertActorFormat

public static java.lang.String covertActorFormat(java.lang.String actor)
Convert the actor string format from actortype|actorname to OOQL format

Parameters:
actor - actor string formatted as actortype|actorname ( User|MyName )
Returns:
actor name formatted as actortype[actorname] ( user[MyName] )

hasAccess

public boolean hasAccess(java.util.Vector<java.lang.Object> filterArgs,
                         Framework framework)
Check if the framework user has access to execute this Command


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 Command object by its OOQL identifier

Specified by:
getProperty in class OBBase
Parameters:
propertyName - OOQL property identifier/name (example: href , alt ,label ...)
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 (example: menu .. )
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 Command object basic properties as a single String

Overrides:
toString in class AdminBase

toString

public java.lang.String toString(Framework framework)
Return the Command 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 Command 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 Command object properties as XML element tree

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

fromXML

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

Overrides:
fromXML in class AdminBase

getCreateCommand

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

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

getSaveCommand

public java.lang.String getSaveCommand(boolean force)
Return the OOQL command to update this Command 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(Command refCommand,
                                      boolean checkImage,
                                      boolean overwrite,
                                      boolean force,
                                      Framework framework)
                               throws OberonException
Return/apply the OOQL command to update this Command object and let it become equals to another reference object.
This method is useful to import objects from an XML file.

Parameters:
refCommand - the reference Command 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.