org.norther.tammi.spray.db.step
Class ElementStepAction

java.lang.Object
  extended by org.norther.tammi.spray.loader.task.Action
      extended by org.norther.tammi.spray.loader.task.Submit
          extended by org.norther.tammi.spray.template.step.FlowStepAction
              extended by org.norther.tammi.spray.template.step.NextStepAction
                  extended by org.norther.tammi.spray.template.step.FormStepAction
                      extended by org.norther.tammi.spray.db.step.RepositoryStepAction
                          extended by org.norther.tammi.spray.db.step.SelectionStepAction
                              extended by org.norther.tammi.spray.db.step.ElementStepAction
All Implemented Interfaces:
Serializable, Task
Direct Known Subclasses:
IdentityElementAction, MetaElementAction, UserGroupAction

public class ElementStepAction
extends SelectionStepAction

A flow step action for selecting and caching meta elements.

Version:
$Id: ElementStepAction.java,v 1.31 2010-08-18 05:41:38 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.norther.tammi.spray.loader.task.Task
Task.Control
 
Field Summary
static String META_IDENTITY_PARAMETER
          Deprecated. use IDENTITY_PARAMETER instead.
protected static String[] NEW_METADATA_ATTRIBUTES
          Attributes of a new metadata that should be nullified before saving.
 
Fields inherited from class org.norther.tammi.spray.loader.task.Submit
EXECUTE_METHOD, SUBMIT_PREFIX
 
Constructor Summary
ElementStepAction()
          Constructs a new flow step action.
 
Method Summary
 boolean checkPermission(Variable var, Permission permission, Persister persister, ServletRequest request, ServletResponse response, FilterChain chain, StepFlowContext context)
          Check access permission for the specified variable.
 DBCriteria<? extends Variable> createPermissionCriteria(String className, Object oid, Object uid, Object[] gids, boolean others, Permission permission, Persister persister, FilterChain chain)
          Creates the specified permission criteria for a meta element query.
 DBCriteria<? extends Variable> createUserPermissionCriteria(String className, Permission permission, Persister persister, FilterChain chain)
          Creates the specified user permission criteria for a meta element query.
 Object getGroupId(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the id of the current group.
 Variable getImportedElement(int index, Identity id, Persister persister, ServletRequest request, ServletResponse response, FilterChain chain, StepFlowContext context, Object... options)
          Gets the indexed imported metaelement from an identity source referenced by either a primary or foreign key field by applying the specified persister.
 String getMetaRecordType(Variable variable, Persister persister, FilterChain chain)
          Gets the record type of the specified meta variable.
 Variable getMetaSelectionVariable(int index, Identity[] ids, DBCriteria<? extends Variable> criteria, Permission permission, String[] nameFields, Persister persister, ServletRequest request, ServletResponse response, FilterChain chain, StepFlowContext context)
          Gets the indexed meta list selection variable with the specified identities selected for the specified search criteria.
 Variable getMetaSelectionVariable(int index, Identity[] ids, String className, Object oid, Object uid, Object[] gids, boolean others, Permission permission, DBAttribute[] attributes, String[] nameFields, Persister persister, ServletRequest request, ServletResponse response, FilterChain chain, StepFlowContext context)
          Gets the indexed meta list selection variable with the specified identities selected for the specified users.
 Variable getMetaSelectionVariable(int index, Identity[] ids, Variable search, Permission permission, String[] nameFields, Persister persister, ServletRequest request, ServletResponse response, FilterChain chain, StepFlowContext context)
          Gets the indexed meta list selection variable with the specified identities selected for the specified meta search variable.
 String getSelectedFormPrefix(int index, ServletRequest request, ServletResponse response, FilterChain chain, StepFlowContext context)
          Gets the selected form prefix.
 Identity getSelectedIdentity(int index, ServletRequest request, ServletResponse response, FilterChain chain, StepFlowContext context)
          Gets the selected identity.
 boolean isGroupMember(Object group, Persister persister, FilterChain chain)
          Checks if the current user if the owner or member of the specified group.
 boolean isGroupOwner(Object group, Persister persister, FilterChain chain)
          Checks if the current user is the owner of the specified group.
 Variable prepareMetaElement(Identity id, Persister persister, ServletRequest request, ServletResponse response, FilterChain chain, StepFlowContext context, Object... options)
          Prepares the selected meta element.
<T> Map<Object,T>
queryAllMemberGroups(String className, String[] sortFields, Persister persister, FilterChain chain)
          Queries all member groups of the current user in a relation tree fulfilling the specified criteria, and may sort them by optional sort fields.
<T> Map<Object,T>
queryChildMemberGroups(String className, String[] sortFields, Persister persister, FilterChain chain)
          Queries child member groups of the current user in a relation tree fulfilling the specified criteria, and may sort them by optional sort fields.
 Variable queryMetaElement(Identity id, Permission permission, Persister persister, FilterChain chain)
          Queries a meta element with permissions.
<T> Map<Object,T>
queryParentMemberGroups(String className, String[] sortFields, Persister persister, FilterChain chain)
          Queries parent member groups of the current user in a relation tree fulfilling the specified criteria, and may sort them by optional sort fields.
 
Methods inherited from class org.norther.tammi.spray.db.step.SelectionStepAction
buildSearchVariable, clearSelectedIdentity, deleteVariables, digest, fillQueryCriteria, fillSelectionVariable, fillSelectionVariable, filterRoleEnumeration, getAccountIdentity, getImportedVariable, getImportedVariables, getMandatorySelection, getSearchVariable, getSelectedIdentities, getSelectedIdentity, getSelectedIndex, getSelectedIndices, getSelectedVariable, getSelectionEnumeration, getSelectionEnumeration, getSelectionVariable, getSelectionVariable, getSelectionVariable, getStepClassName, getStepFieldNames, getStepMetaNames, getStepPermission, getUserId, insertVariables, queryAccountVariable, queryAllVariables, queryAllVariables, queryTreeVariables, submitDeleteVariable, submitDeleteVariables, submitDeleteVariables, submitInsertVariable, submitInsertVariables, submitInsertVariables, submitQueryVariable, submitSearchVariable, submitSelectAll, submitUnselectAll, submitUpdateVariable, submitUpdateVariables, submitUpdateVariables, updateVariables
 
Methods inherited from class org.norther.tammi.spray.db.step.RepositoryStepAction
add1NForeignReferences, add1NNullReferences, add1NObjectReferences, addAttributeValues, addToRelationMap, createVariable, createVariable, deleteReferences, deleteVariable, deleteVariable, getAttributeInfo, getAttributeValues, getDesktopData, getIntrospector, getLoader, getMetaDesktop, getMetaFolder, getPersister, getReferenceValue, getRepositoryFilter, getRootFolder, getRootReferences, getVariableInfo, insertReferences, insertVariable, insertVariable, isRelatedTo, orderObjects, queryAllObjects, queryAllObjects, queryTreeObjects, setMNForeignReferences, setMNObjectReferences, sortObjects, storeVariable, storeVariable, toClass, updateReferences, updateVariable, updateVariable
 
Methods inherited from class org.norther.tammi.spray.template.step.FormStepAction
clearParameters, loadPropertyFile, loadUploadedFile, submit, submitCancelStep, submitFinishStep, submitInsertForm, submitNextStep, submitPreviousStep, submitRenewForm, submitResetForm, submitReuseForm, submitUpdateForm, update, update, update, update
 
Methods inherited from class org.norther.tammi.spray.template.step.NextStepAction
isNextStepEnabled, setNextStepEnabled, submitBackStep
 
Methods inherited from class org.norther.tammi.spray.template.step.FlowStepAction
checkPermission, checkPermission, checkPermission, construct, execute, execute, finish, forward, getPermissibleRoles, getSignature, include, initialize, initialize, prepare, submit, submitOpenHelp
 
Methods inherited from class org.norther.tammi.spray.loader.task.Submit
getAction, getAction, invoke
 
Methods inherited from class org.norther.tammi.spray.loader.task.Action
find, find, getFilter, getMBeanServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_IDENTITY_PARAMETER

public static final String META_IDENTITY_PARAMETER
Deprecated. use IDENTITY_PARAMETER instead.
The meta element identity parameter.

See Also:
Constant Field Values

NEW_METADATA_ATTRIBUTES

protected static final String[] NEW_METADATA_ATTRIBUTES
Attributes of a new metadata that should be nullified before saving.

Constructor Detail

ElementStepAction

public ElementStepAction()
Constructs a new flow step action.

Method Detail

prepareMetaElement

public Variable prepareMetaElement(Identity id,
                                   Persister persister,
                                   ServletRequest request,
                                   ServletResponse response,
                                   FilterChain chain,
                                   StepFlowContext context,
                                   Object... options)
                            throws Exception
Prepares the selected meta element.

Parameters:
id - the element identity.
persister - the persister.
request - the request.
response - the response.
chain - the filter chain.
context - the flow context.
options - optional foreign key field, resource permission, permission criteria and attribute filter.
Returns:
the prepared element.
Throws:
Exception - on errors.

getImportedElement

public Variable getImportedElement(int index,
                                   Identity id,
                                   Persister persister,
                                   ServletRequest request,
                                   ServletResponse response,
                                   FilterChain chain,
                                   StepFlowContext context,
                                   Object... options)
                            throws Exception
Gets the indexed imported metaelement from an identity source referenced by either a primary or foreign key field by applying the specified persister.

Parameters:
index - the variable index.
id - the source identity.
persister - the persister.
request - the request.
response - the response.
chain - the filter chain.
context - the flow context.
options - optional foreign key field, resource permission, permission criteria and attribute filter.
Returns:
the imported variable.
Throws:
Exception - on errors.

getGroupId

public Object getGroupId(ServletRequest request,
                         ServletResponse response,
                         FilterChain chain)
Gets the id of the current group.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
Returns:
the id or null.

isGroupOwner

public boolean isGroupOwner(Object group,
                            Persister persister,
                            FilterChain chain)
                     throws Exception
Checks if the current user is the owner of the specified group.

Parameters:
group - the member group.
persister - the persister.
chain - the filter chain.
Returns:
true if an owner, false otherwise.
Throws:
Exception - on errors.

isGroupMember

public boolean isGroupMember(Object group,
                             Persister persister,
                             FilterChain chain)
                      throws Exception
Checks if the current user if the owner or member of the specified group.

Parameters:
group - the member group.
persister - the persister.
chain - the filter chain.
Returns:
true if a member, false otherwise.
Throws:
Exception - on errors.

queryAllMemberGroups

public <T> Map<Object,T> queryAllMemberGroups(String className,
                                              String[] sortFields,
                                              Persister persister,
                                              FilterChain chain)
                                   throws Exception
Queries all member groups of the current user in a relation tree fulfilling the specified criteria, and may sort them by optional sort fields. Groups owned by the user are included.

Type Parameters:
T - the group type.
Parameters:
className - the class name.
sortFields - optionals sort field.
persister - the persister.
chain - the filter chain.
Returns:
a map of objects.
Throws:
Exception - on errors.

queryParentMemberGroups

public <T> Map<Object,T> queryParentMemberGroups(String className,
                                                 String[] sortFields,
                                                 Persister persister,
                                                 FilterChain chain)
                                      throws Exception
Queries parent member groups of the current user in a relation tree fulfilling the specified criteria, and may sort them by optional sort fields. Groups owned by the user are included.

Type Parameters:
T - the group type.
Parameters:
className - the class name.
sortFields - optionals sort field.
persister - the persister.
chain - the filter chain.
Returns:
a map of objects.
Throws:
Exception - on errors.

queryChildMemberGroups

public <T> Map<Object,T> queryChildMemberGroups(String className,
                                                String[] sortFields,
                                                Persister persister,
                                                FilterChain chain)
                                     throws Exception
Queries child member groups of the current user in a relation tree fulfilling the specified criteria, and may sort them by optional sort fields. Groups owned by the user are included.

Type Parameters:
T - the group type.
Parameters:
className - the class name.
sortFields - optionals sort field.
persister - the persister.
chain - the filter chain.
Returns:
a map of objects.
Throws:
Exception - on errors.

getMetaSelectionVariable

public Variable getMetaSelectionVariable(int index,
                                         Identity[] ids,
                                         DBCriteria<? extends Variable> criteria,
                                         Permission permission,
                                         String[] nameFields,
                                         Persister persister,
                                         ServletRequest request,
                                         ServletResponse response,
                                         FilterChain chain,
                                         StepFlowContext context)
                                  throws Exception
Gets the indexed meta list selection variable with the specified identities selected for the specified search criteria.

Parameters:
index - the selection variable index.
ids - the selected identities.
criteria - the search criteria.
nameFields - the name fields.
permission - the permission.
persister - the persister.
request - the request.
response - the response.
chain - the filter chain.
context - the flow context.
Returns:
the selection variable.
Throws:
Exception - on errors.

getMetaSelectionVariable

public Variable getMetaSelectionVariable(int index,
                                         Identity[] ids,
                                         Variable search,
                                         Permission permission,
                                         String[] nameFields,
                                         Persister persister,
                                         ServletRequest request,
                                         ServletResponse response,
                                         FilterChain chain,
                                         StepFlowContext context)
                                  throws Exception
Gets the indexed meta list selection variable with the specified identities selected for the specified meta search variable.

Parameters:
index - the selection variable index.
ids - the selected identities.
search - the search variable.
nameFields - the name fields.
permission - the permission.
persister - the persister.
request - the request.
response - the response.
chain - the filter chain.
context - the flow context.
Returns:
the selection variable.
Throws:
Exception - on errors.

getMetaSelectionVariable

public Variable getMetaSelectionVariable(int index,
                                         Identity[] ids,
                                         String className,
                                         Object oid,
                                         Object uid,
                                         Object[] gids,
                                         boolean others,
                                         Permission permission,
                                         DBAttribute[] attributes,
                                         String[] nameFields,
                                         Persister persister,
                                         ServletRequest request,
                                         ServletResponse response,
                                         FilterChain chain,
                                         StepFlowContext context)
                                  throws Exception
Gets the indexed meta list selection variable with the specified identities selected for the specified users.

Parameters:
index - the selection variable index.
ids - the selected identities.
className - the selection class name.
oid - the owner id.
uid - the user id.
gids - the group ids.
others - the others option.
permission - the permission.
attributes - optional attributes.
nameFields - the name fields.
persister - the persister.
request - the request.
response - the response.
chain - the filter chain.
context - the flow context.
Returns:
the selection variable.
Throws:
Exception - on errors.

getMetaRecordType

public String getMetaRecordType(Variable variable,
                                Persister persister,
                                FilterChain chain)
                         throws Exception
Gets the record type of the specified meta variable.

Parameters:
variable - the meta variable.
persister - the persister.
chain - the filter chain.
Returns:
the package variable.
Throws:
Exception - on errors.

createPermissionCriteria

public DBCriteria<? extends Variable> createPermissionCriteria(String className,
                                                               Object oid,
                                                               Object uid,
                                                               Object[] gids,
                                                               boolean others,
                                                               Permission permission,
                                                               Persister persister,
                                                               FilterChain chain)
Creates the specified permission criteria for a meta element query.

Parameters:
className - the variable class name.
oid - the owner id.
uid - the user id.
gids - the group ids.
others - the others option.
permission - the reuqested permission.
persister - the persister.
chain - the filter chain.
Returns:
the created criteria.

createUserPermissionCriteria

public DBCriteria<? extends Variable> createUserPermissionCriteria(String className,
                                                                   Permission permission,
                                                                   Persister persister,
                                                                   FilterChain chain)
                                                            throws Exception
Creates the specified user permission criteria for a meta element query.

Parameters:
className - the element class name.
permission - the permission.
persister - the persister.
chain - the filter chain.
Returns:
the search criteria.
Throws:
Exception - on errors.

queryMetaElement

public Variable queryMetaElement(Identity id,
                                 Permission permission,
                                 Persister persister,
                                 FilterChain chain)
                          throws Exception
Queries a meta element with permissions.

Parameters:
id - the meta element identity.
persister - the persister.
permission - the permission.
chain - the filter chain.
Returns:
the meta element or null.
Throws:
Exception - on errors.

getSelectedIdentity

public Identity getSelectedIdentity(int index,
                                    ServletRequest request,
                                    ServletResponse response,
                                    FilterChain chain,
                                    StepFlowContext context)
Gets the selected identity.

Parameters:
index - the parameter index.
request - the request.
response - the response.
chain - the filter chain.
context - the flow context.
Returns:
the identity or null.

getSelectedFormPrefix

public String getSelectedFormPrefix(int index,
                                    ServletRequest request,
                                    ServletResponse response,
                                    FilterChain chain,
                                    StepFlowContext context)
Gets the selected form prefix.

Parameters:
index - the variable index.
request - the request.
response - the response.
chain - the filter chain.
context - the flow context.
Returns:
the form prefix.

checkPermission

public boolean checkPermission(Variable var,
                               Permission permission,
                               Persister persister,
                               ServletRequest request,
                               ServletResponse response,
                               FilterChain chain,
                               StepFlowContext context)
                        throws Exception
Description copied from class: SelectionStepAction
Check access permission for the specified variable.

Overrides:
checkPermission in class SelectionStepAction
Parameters:
var - the variable.
permission - the permissions.
persister - the persister.
request - the request.
response - the response.
chain - the filter chain.
context - the flow context.
Returns:
true if accessible, false otherwise.
Throws:
Exception - on errors.


Copyright © 2004 The Norther Organization. All rights reserved.