org.nakedobjects.metamodel.runtimecontext.spec.feature
Class NakedObjectActionSet

java.lang.Object
  extended by org.nakedobjects.metamodel.runtimecontext.spec.feature.NakedObjectActionSet
All Implemented Interfaces:
FacetHolder, NakedObjectAction, NakedObjectFeature, NakedObjectMember, Identified, NamedAndDescribed, Specification, TypedSpecification

public class NakedObjectActionSet
extends java.lang.Object
implements NakedObjectAction


Constructor Summary
NakedObjectActionSet(java.lang.String id, java.lang.String name, java.util.List<NakedObjectAction> actions, RuntimeContext runtimeContext)
           
NakedObjectActionSet(java.lang.String id, java.lang.String name, NakedObjectAction[] actions, RuntimeContext runtimeContext)
           
 
Method Summary
 void addFacet(Facet facet)
          Does nothing
 void addFacet(MultiTypedFacet facet)
          Does nothing
 boolean containsFacet(java.lang.Class<? extends Facet> facetType)
          Does nothing
 ActionInvocationContext createActionInvocationInteractionContext(AuthenticationSession session, InteractionInvocationMethod invocationMethod, NakedObject object, NakedObject[] candidateArguments)
          Creates an interaction context representing an attempt to invoke this action.
 UsabilityContext<?> createUsableInteractionContext(AuthenticationSession session, InteractionInvocationMethod invocationMethod, NakedObject target)
          Create an InteractionContext to represent an attempt to use this member (that is, to check if it is usable or not).
 VisibilityContext<?> createVisibleInteractionContext(AuthenticationSession session, InteractionInvocationMethod invocationMethod, NakedObject targetNakedObject)
          Does nothing, but shouldn't be called.
 java.lang.String debugData()
           
 NakedObject execute(NakedObject target, NakedObject[] parameters)
          Invokes the action's method on the target object given the specified set of parameters.
 NakedObjectAction[] getActions()
          Lists the sub-actions that are available under this name.
 NakedObject[][] getChoices(NakedObject target)
          Returns a list of possible references/values for each parameter, which the user can choose from.
 NakedObject[] getDefaults(NakedObject target)
          Returns the defaults references/values to be used for the action.
 java.lang.String getDescription()
          Returns a description of how the member is used - this complements the help text.
<T extends Facet>
T
getFacet(java.lang.Class<T> cls)
          Does nothing
 Facet[] getFacets(Filter<Facet> filter)
          Does nothing
 java.lang.Class<? extends Facet>[] getFacetTypes()
          Does nothing
 java.lang.String getHelp()
          Return the help text for this member - the field or action - to complement the description.
 java.lang.String getId()
          Returns the identifier of the member, which must not change.
 Identifier getIdentifier()
          Identifier of this feature.
 Instance getInstance(NakedObject nakedObject)
          Return an Instance of this Specification with respect to the provided NakedObject.
 java.lang.String getName()
          Return the name for this member - the field or action.
 NakedObjectSpecification getOnType()
          Returns the specification for the type of object that this action can be invoked upon.
 int getParameterCount()
          Returns the number of parameters used by this method.
 NakedObjectActionParameter[] getParameters()
          Returns set of parameter information.
 NakedObjectActionParameter[] getParameters(Filter<NakedObjectActionParameter> filter)
          Returns set of parameter information matching the supplied filter.
 NakedObjectSpecification[] getParameterTypes()
          Returns the type of each of the parameters.
 NakedObjectSpecification getReturnType()
          Returns the specifications for the return type.
 RuntimeContext getRuntimeContext()
           
 NakedObjectSpecification getSpecification()
          Always returns null.
 Target getTarget()
          Returns where the action should be executed: explicitly locally on the client; explicitly remotely on the server; or where it normally should be executed.
 NakedObjectActionType getType()
          Returns the type of action: user, exploration or debug, or that it is a set of actions.
 boolean hasReturn()
          Returns true if the represented action returns something, else returns false.
 boolean isAction()
          Whether this member represents a NakedObjectAction.
 boolean isAssociation()
          Whether this member represents a NakedObjectAssociation.
 boolean isContributed()
          Return true if the action is run on a service object using the target object as a parameter.
 boolean isOneToManyAssociation()
          Whether this member represents a OneToManyAssociation.
 boolean isOneToOneAssociation()
          Whether this member represents a OneToOneAssociation.
 Consent isProposedArgumentSetValid(NakedObject object, NakedObject[] parameters)
          Whether the provided argument set is valid, represented as a Consent.
 Consent isUsable(AuthenticationSession session, NakedObject target)
          Determines whether this member is usable, represented as a Consent.
 Consent isVisible(AuthenticationSession session, NakedObject target)
          Determines if this member is visible, represented as a Consent.
 boolean promptForParameters(NakedObject target)
           
 NakedObject realTarget(NakedObject target)
          Determine the real target for this action.
 void removeFacet(java.lang.Class<? extends Facet> facetType)
          Does nothing
 void removeFacet(Facet facet)
          Does nothing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NakedObjectActionSet

public NakedObjectActionSet(java.lang.String id,
                            java.lang.String name,
                            NakedObjectAction[] actions,
                            RuntimeContext runtimeContext)

NakedObjectActionSet

public NakedObjectActionSet(java.lang.String id,
                            java.lang.String name,
                            java.util.List<NakedObjectAction> actions,
                            RuntimeContext runtimeContext)
Method Detail

getActions

public NakedObjectAction[] getActions()
Description copied from interface: NakedObjectAction
Lists the sub-actions that are available under this name.

If any actions are returned then this action is only a set and not an action itself.

Specified by:
getActions in interface NakedObjectAction

getDescription

public java.lang.String getDescription()
Description copied from interface: NamedAndDescribed
Returns a description of how the member is used - this complements the help text.

Specified by:
getDescription in interface NamedAndDescribed
See Also:
#getHelp()

getIdentifier

public Identifier getIdentifier()
Description copied from interface: Identified
Identifier of this feature.

Specified by:
getIdentifier in interface Identified

getHelp

public java.lang.String getHelp()
Description copied from interface: NakedObjectMember
Return the help text for this member - the field or action - to complement the description.

Specified by:
getHelp in interface NakedObjectMember
See Also:
NamedAndDescribed.getDescription()

getId

public java.lang.String getId()
Description copied from interface: NakedObjectMember
Returns the identifier of the member, which must not change. This should be all camel-case with no spaces: so if the member is called 'Return Date' then the a suitable id would be 'ReturnDate'.

Specified by:
getId in interface NakedObjectMember

getName

public java.lang.String getName()
Description copied from interface: NamedAndDescribed
Return the name for this member - the field or action. This is based on the name of this member.

Specified by:
getName in interface NamedAndDescribed
See Also:
#getIdentifier()

getOnType

public NakedObjectSpecification getOnType()
Description copied from interface: NakedObjectAction
Returns the specification for the type of object that this action can be invoked upon.

Specified by:
getOnType in interface NakedObjectAction

getReturnType

public NakedObjectSpecification getReturnType()
Description copied from interface: NakedObjectAction
Returns the specifications for the return type.

Specified by:
getReturnType in interface NakedObjectAction

getTarget

public Target getTarget()
Description copied from interface: NakedObjectAction
Returns where the action should be executed: explicitly locally on the client; explicitly remotely on the server; or where it normally should be executed. By default instance methods should execute on the server, static methods should execute on the client.

Specified by:
getTarget in interface NakedObjectAction
See Also:
NakedObjectActionConstants.LOCAL, NakedObjectActionConstants.REMOTE, NakedObjectActionConstants.DEFAULT

getType

public NakedObjectActionType getType()
Description copied from interface: NakedObjectAction
Returns the type of action: user, exploration or debug, or that it is a set of actions.

Specified by:
getType in interface NakedObjectAction
See Also:
NakedObjectActionConstants.USER, NakedObjectActionConstants.EXPLORATION, NakedObjectActionConstants.DEBUG, NakedObjectActionConstants.SET

hasReturn

public boolean hasReturn()
Description copied from interface: NakedObjectAction
Returns true if the represented action returns something, else returns false.

Specified by:
hasReturn in interface NakedObjectAction

isContributed

public boolean isContributed()
Description copied from interface: NakedObjectAction
Return true if the action is run on a service object using the target object as a parameter.

Specified by:
isContributed in interface NakedObjectAction

getSpecification

public NakedObjectSpecification getSpecification()
Always returns null.

Specified by:
getSpecification in interface TypedSpecification

realTarget

public NakedObject realTarget(NakedObject target)
Description copied from interface: NakedObjectAction
Determine the real target for this action. If this action represents an object action than the target is returned. If this action is on a service then that service will be returned.

Specified by:
realTarget in interface NakedObjectAction

execute

public NakedObject execute(NakedObject target,
                           NakedObject[] parameters)
Description copied from interface: NakedObjectAction
Invokes the action's method on the target object given the specified set of parameters.

Specified by:
execute in interface NakedObjectAction

getFacet

public <T extends Facet> T getFacet(java.lang.Class<T> cls)
Does nothing

Specified by:
getFacet in interface FacetHolder

getFacetTypes

public java.lang.Class<? extends Facet>[] getFacetTypes()
Does nothing

Specified by:
getFacetTypes in interface FacetHolder

getFacets

public Facet[] getFacets(Filter<Facet> filter)
Does nothing

Specified by:
getFacets in interface FacetHolder
Returns:

addFacet

public void addFacet(Facet facet)
Does nothing

Specified by:
addFacet in interface FacetHolder

addFacet

public void addFacet(MultiTypedFacet facet)
Does nothing

Specified by:
addFacet in interface FacetHolder

removeFacet

public void removeFacet(Facet facet)
Does nothing

Specified by:
removeFacet in interface FacetHolder

containsFacet

public boolean containsFacet(java.lang.Class<? extends Facet> facetType)
Does nothing

Specified by:
containsFacet in interface FacetHolder

removeFacet

public void removeFacet(java.lang.Class<? extends Facet> facetType)
Does nothing

Specified by:
removeFacet in interface FacetHolder

getParameterCount

public int getParameterCount()
Description copied from interface: NakedObjectAction
Returns the number of parameters used by this method.

Specified by:
getParameterCount in interface NakedObjectAction

getParameters

public NakedObjectActionParameter[] getParameters()
Description copied from interface: NakedObjectAction
Returns set of parameter information.

Implementations may build this array lazily or eagerly as required.

Specified by:
getParameters in interface NakedObjectAction
Returns:

getParameterTypes

public NakedObjectSpecification[] getParameterTypes()
Description copied from interface: NakedObjectAction
Returns the type of each of the parameters.

Specified by:
getParameterTypes in interface NakedObjectAction

getParameters

public NakedObjectActionParameter[] getParameters(Filter<NakedObjectActionParameter> filter)
Description copied from interface: NakedObjectAction
Returns set of parameter information matching the supplied filter.

Specified by:
getParameters in interface NakedObjectAction
Returns:

promptForParameters

public boolean promptForParameters(NakedObject target)
Specified by:
promptForParameters in interface NakedObjectAction

createVisibleInteractionContext

public VisibilityContext<?> createVisibleInteractionContext(AuthenticationSession session,
                                                            InteractionInvocationMethod invocationMethod,
                                                            NakedObject targetNakedObject)
Does nothing, but shouldn't be called.

Specified by:
createVisibleInteractionContext in interface NakedObjectMember
Returns:

isVisible

public Consent isVisible(AuthenticationSession session,
                         NakedObject target)
Description copied from interface: NakedObjectMember
Determines if this member is visible, represented as a Consent.

Specified by:
isVisible in interface NakedObjectMember
target - may be null if just checking for authorization.
See Also:
#isVisibleResult(AuthenticationSession, NakedObject)

createUsableInteractionContext

public UsabilityContext<?> createUsableInteractionContext(AuthenticationSession session,
                                                          InteractionInvocationMethod invocationMethod,
                                                          NakedObject target)
Description copied from interface: NakedObjectMember
Create an InteractionContext to represent an attempt to use this member (that is, to check if it is usable or not).

Typically it is easier to just call NakedObjectMember.isUsable(AuthenticationSession, NakedObject) or #isUsableResult(AuthenticationSession, NakedObject); this is provided as API for symmetry with interactions (such as AccessContext accesses) have no corresponding vetoing methods.

Specified by:
createUsableInteractionContext in interface NakedObjectMember
Returns:

isUsable

public Consent isUsable(AuthenticationSession session,
                        NakedObject target)
Description copied from interface: NakedObjectMember
Determines whether this member is usable, represented as a Consent.

Specified by:
isUsable in interface NakedObjectMember
target - may be null if just checking for authorization.
See Also:
#isUsableResult(AuthenticationSession, NakedObject)

createActionInvocationInteractionContext

public ActionInvocationContext createActionInvocationInteractionContext(AuthenticationSession session,
                                                                        InteractionInvocationMethod invocationMethod,
                                                                        NakedObject object,
                                                                        NakedObject[] candidateArguments)
Description copied from interface: NakedObjectAction
Creates an interaction context representing an attempt to invoke this action.

Typically it is easier to just call #isProposedArgumentSetValid(NakedObject, NakedObject[]) {@link #isProposedArgumentSetValidResultSet(NakedObject, NakedObject[])}; this is provided as API for symmetry with interactions (such as {@link AccessContext} accesses) have no corresponding vetoing methods.

Specified by:
createActionInvocationInteractionContext in interface NakedObjectAction

isProposedArgumentSetValid

public Consent isProposedArgumentSetValid(NakedObject object,
                                          NakedObject[] parameters)
Description copied from interface: NakedObjectAction
Whether the provided argument set is valid, represented as a Consent.

Specified by:
isProposedArgumentSetValid in interface NakedObjectAction

getDefaults

public NakedObject[] getDefaults(NakedObject target)
Description copied from interface: NakedObjectAction
Returns the defaults references/values to be used for the action.

Specified by:
getDefaults in interface NakedObjectAction

getChoices

public NakedObject[][] getChoices(NakedObject target)
Description copied from interface: NakedObjectAction
Returns a list of possible references/values for each parameter, which the user can choose from.

Specified by:
getChoices in interface NakedObjectAction

isAction

public boolean isAction()
Description copied from interface: NakedObjectMember
Whether this member represents a NakedObjectAction.

If so, can be safely downcast to NakedObjectAction.

Specified by:
isAction in interface NakedObjectMember

isAssociation

public boolean isAssociation()
Description copied from interface: NakedObjectMember
Whether this member represents a NakedObjectAssociation.

If so, can be safely downcast to NakedObjectAssociation.

Specified by:
isAssociation in interface NakedObjectMember

isOneToManyAssociation

public boolean isOneToManyAssociation()
Description copied from interface: NakedObjectMember
Whether this member represents a OneToManyAssociation.

If so, can be safely downcast to OneToManyAssociation.

Specified by:
isOneToManyAssociation in interface NakedObjectMember

isOneToOneAssociation

public boolean isOneToOneAssociation()
Description copied from interface: NakedObjectMember
Whether this member represents a OneToOneAssociation.

If so, can be safely downcast to OneToOneAssociation.

Specified by:
isOneToOneAssociation in interface NakedObjectMember

debugData

public java.lang.String debugData()
Specified by:
debugData in interface NakedObjectMember

getInstance

public Instance getInstance(NakedObject nakedObject)
Description copied from interface: Specification
Return an Instance of this Specification with respect to the provided NakedObject.

For example, if the Specification is a OneToOneAssociation, then is an Instance implementation representing the { NakedObject/ OneToOneAssociation } tuple.

Implementations are expected to use a double-dispatch back to the provided NakedObject (passing themselves as a parameter), using NakedObjectMM.getInstance(Specification).

Note: this method may throw an UnsupportedOperationException; see NakedObjectMM.getInstance(Specification) for details.

Specified by:
getInstance in interface Specification

getRuntimeContext

public RuntimeContext getRuntimeContext()


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.