public abstract class ObjectSpecificationAbstract extends FacetHolderImpl implements ObjectSpecification
| Modifier and Type | Class and Description |
|---|---|
static class |
ObjectSpecificationAbstract.IntrospectionState |
| Modifier and Type | Field and Description |
|---|---|
protected Properties |
metadataProperties
Only populated once
introspectTypeHierarchyAndMembers() is called. |
protected ObjectMemberContext |
objectMemberContext |
COMPARATOR_FULLY_QUALIFIED_CLASS_NAME, COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE, EMPTY_LIST, FUNCTION_FULLY_QUALIFIED_CLASS_NAME| Constructor and Description |
|---|
ObjectSpecificationAbstract(Class<?> introspectedClass,
String shortName,
SpecificationContext specificationContext,
ObjectMemberContext objectMemberContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearDirty(ObjectAdapter object)
Clear the dirty flag so that a call to isDirty(), and before
markDirty() is called, will return false;
|
protected List<ObjectAction> |
createContributeeActions()
All contributee actions (each wrapping a service's contributed action) for this spec.
|
Object |
createObject() |
ObjectTitleContext |
createTitleInteractionContext(AuthenticationSession session,
InteractionInvocationMethod interactionMethod,
ObjectAdapter targetObjectAdapter)
Create an
InteractionContext representing an attempt to read the
object's title. |
ObjectValidityContext |
createValidityInteractionContext(DeploymentCategory deploymentCategory,
AuthenticationSession session,
InteractionInvocationMethod interactionMethod,
ObjectAdapter targetObjectAdapter)
Create an
InteractionContext representing an attempt to save the
object. |
ObjectAssociation |
getAssociation(String id)
The association with the given
id. |
List<ObjectAssociation> |
getAssociations(Contributed contributed)
Return all the fields that exist in an object of this specification,
although they need not all be accessible or visible.
|
List<ObjectAssociation> |
getAssociations(Contributed contributed,
org.apache.isis.applib.filter.Filter<ObjectAssociation> filter)
Return all
ObjectAssociations matching the supplied filter. |
List<ObjectAssociation> |
getAssociations(org.apache.isis.applib.filter.Filter<ObjectAssociation> filter)
Deprecated.
|
protected AuthenticationSession |
getAuthenticationSession()
convenience method to return the current
AuthenticationSession
from the injected
AuthenticationSessionProvider. |
protected AuthenticationSessionProvider |
getAuthenticationSessionProvider() |
List<OneToManyAssociation> |
getCollections(Contributed contributed)
All
associations that represents
collections. |
Class<?> |
getCorrespondingClass()
As provided explicitly within the
ObjectSpecificationAbstract(Class, String, org.apache.isis.core.metamodel.spec.SpecificationContext, org.apache.isis.core.metamodel.spec.feature.ObjectMemberContext)
constructor}. |
String |
getCssClass()
Returns a css class name of the specification.
|
Object |
getDefaultValue()
Default value to be provided for properties or parameters that are not
declared as @Optional but where the UI has not (yet) provided a
value.
|
protected DeploymentCategory |
getDeploymentCategory() |
String |
getDescription()
The description according to any available
PluralFacet,
else empty string (""). |
<Q extends Facet> |
getFacet(Class<Q> facetType)
Get the facet of the specified type (as per the type it reports from
Facet.facetType()). |
FeatureType |
getFeatureType() |
String |
getFullIdentifier()
The
(full) name of the
class. |
String |
getHelp()
Returns a help string or lookup reference, if any, of the specification.
|
String |
getIconName(ObjectAdapter reference)
Returns the name of an icon to use for the specified object.
|
org.apache.isis.applib.Identifier |
getIdentifier()
Identifier of this feature.
|
Instance |
getInstance(ObjectAdapter adapter)
|
ObjectSpecificationAbstract.IntrospectionState |
getIntrospectionState()
Only if
setIntrospectionState(org.apache.isis.core.metamodel.specloader.specimpl.ObjectSpecificationAbstract.IntrospectionState)
has been called (should be called within updateFromFacetValues(). |
List<ObjectAction> |
getObjectActions(ActionType type,
Contributed contributed,
org.apache.isis.applib.filter.Filter<ObjectAction> filter)
Returns an array of actions of the specified type, including or excluding
contributed actions as required.
|
List<ObjectAction> |
getObjectActions(Contributed contributed) |
List<ObjectAction> |
getObjectActions(List<ActionType> types,
Contributed contributed,
org.apache.isis.applib.filter.Filter<ObjectAction> filter) |
ObjectInstantiator |
getObjectInstantiator() |
String |
getPluralName()
The pluralized name according to any available
PluralFacet,
else null. |
List<OneToOneAssociation> |
getProperties(Contributed contributed)
All
associations that represent
properties. |
List<ObjectAction> |
getServiceActionsReturning(List<ActionType> types) |
ServicesProvider |
getServicesProvider() |
String |
getShortIdentifier()
Returns an (immutable) "short" identifier for this specification.
|
String |
getSingularName()
The name according to any available
NamedFacet,
but falling back to getFullIdentifier() otherwise. |
ObjectSpecId |
getSpecId()
Returns the (unique) spec Id, as per the
ObjectSpecIdFacet. |
SpecificationLoader |
getSpecificationLookup() |
String |
getTitle(ObjectAdapter targetAdapter,
org.apache.isis.applib.profiles.Localization localization)
Returns the title string for the specified object.
|
String |
getTitle(ObjectAdapter contextAdapterIfAny,
ObjectAdapter targetAdapter,
org.apache.isis.applib.profiles.Localization localization)
Returns the title to display of target adapter, rendered within the context
of some other adapter (if any).
|
boolean |
hasSubclasses()
Returns true if the subclasses() method will return an array of
one or more elements (ie, not an empty array).
|
ObjectAdapter |
initialize(ObjectAdapter objectAdapter)
REVIEW: should this behaviour move, eg onto ObjectAdapter?
|
List<ObjectSpecification> |
interfaces()
Get the list of specifications for all the interfaces that the class
represented by this specification implements.
|
abstract void |
introspectTypeHierarchyAndMembers() |
boolean |
isAbstract() |
boolean |
isDirty(ObjectAdapter object)
Checks if the specified object has been changed, and hence needs
persisting.
|
boolean |
isEncodeable()
Determines if objects of this type can be converted to a data-stream.
|
boolean |
isHidden()
Whether has the
HiddenFacet |
boolean |
isImmutable()
Whether has the
ImmutableFacet. |
boolean |
isNotCollection()
Determines if the object represents an value or object.
|
protected boolean |
isNotIntrospected() |
boolean |
isOfType(ObjectSpecification specification)
Determines if this class represents the same class, or a subclass, of the
specified class.
|
boolean |
isParented()
Determines if objects of this type are parented (a parented collection, or an aggregated entity).
|
boolean |
isParentedOrFreeCollection()
Determines if objects of this type are a parented (internal) or free-standing (external) collection.
|
boolean |
isParseable()
Determines if objects of this type can be set up from a text entry
string.
|
Consent |
isValid(ObjectAdapter inObject)
Determines whether the specified object is in a valid state (for example,
so can be persisted); represented as a
Consent. |
InteractionResult |
isValidResult(ObjectAdapter targetObjectAdapter)
TODO: currently this method is hard-coded to assume all interactions are
initiated
by user. |
boolean |
isValue()
Determines if objects of this type are values.
|
boolean |
isValueOrIsParented()
Determines if objects of this type are either values or aggregated.
|
void |
markDirty(ObjectAdapter object)
Mark the specified object as having been changed, and hence needing
persisting.
|
Persistability |
persistability()
Determines if objects of this specification can be persisted or not.
|
protected void |
setClearDirtyObjectFacet(ClearDirtyObjectFacet clearDirtyObjectFacet)
Intended to be called (if at all) within
updateFromFacetValues()
. |
void |
setIntrospectionState(ObjectSpecificationAbstract.IntrospectionState introspectationState) |
protected static List<ObjectAction> |
sortActions(List<ObjectAction> actions) |
protected void |
sortAndUpdateAssociations(List<ObjectAssociation> associations) |
protected List<ObjectAssociation> |
sortAssociations(List<ObjectAssociation> associations) |
protected void |
sortCacheAndUpdateActions(List<ObjectAction> objectActions) |
List<ObjectSpecification> |
subclasses()
Get the list of specifications for the subclasses of the class
represented by this specification
|
ObjectSpecification |
superclass()
Get the specification for this specification's class's superclass.
|
String |
toString() |
protected void |
updateAsSubclassTo(List<ObjectSpecification> supertypeSpecs)
Intended to be called within
introspectTypeHierarchyAndMembers()
. |
protected void |
updateAsSubclassTo(ObjectSpecification supertypeSpec)
Intended to be called within
introspectTypeHierarchyAndMembers()
. |
void |
updateFromFacetValues() |
protected void |
updateInterfaces(List<ObjectSpecification> interfaces)
Intended to be called within
introspectTypeHierarchyAndMembers()
. |
protected void |
updateSuperclass(Class<?> superclass)
Intended to be called within
introspectTypeHierarchyAndMembers()
. |
addFacet, addFacet, containsDoOpFacet, containsFacet, getFacets, getFacetTypes, removeFacet, removeFacetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisService, markAsServiceaddFacet, addFacet, containsDoOpFacet, containsFacet, getFacets, getFacetTypes, removeFacet, removeFacetgetObjectAction, getObjectAction, getObjectActionprotected Properties metadataProperties
introspectTypeHierarchyAndMembers() is called.protected final ObjectMemberContext objectMemberContext
public ObjectSpecificationAbstract(Class<?> introspectedClass, String shortName, SpecificationContext specificationContext, ObjectMemberContext objectMemberContext)
protected DeploymentCategory getDeploymentCategory()
public FeatureType getFeatureType()
getFeatureType in interface Specificationpublic ObjectSpecId getSpecId()
ObjectSpecificationObjectSpecIdFacet.
This will typically be the value of the ObjectType annotation (or equivalent);
if non has been specified then will default to the fully qualified class name (with
class name substituted if necessary to allow for runtime bytecode enhancement.
The ObjectSpecification can be retrieved using SpecificationLoader.lookupBySpecId(ObjectSpecId).
getSpecId in interface ObjectSpecificationpublic Class<?> getCorrespondingClass()
ObjectSpecificationAbstract(Class, String, org.apache.isis.core.metamodel.spec.SpecificationContext, org.apache.isis.core.metamodel.spec.feature.ObjectMemberContext)
constructor}.
Not API, but public so that FacetedMethodsBuilder can
call it.
getCorrespondingClass in interface ObjectSpecificationpublic String getShortIdentifier()
ObjectSpecificationThis will be the class name without the package; any text up to and including the last period is removed.
getShortIdentifier in interface ObjectSpecificationpublic String getFullIdentifier()
(full) name of the
class.getFullIdentifier in interface ObjectSpecificationpublic ObjectSpecificationAbstract.IntrospectionState getIntrospectionState()
setIntrospectionState(org.apache.isis.core.metamodel.specloader.specimpl.ObjectSpecificationAbstract.IntrospectionState)
has been called (should be called within updateFromFacetValues().public void setIntrospectionState(ObjectSpecificationAbstract.IntrospectionState introspectationState)
protected boolean isNotIntrospected()
public abstract void introspectTypeHierarchyAndMembers()
protected void updateSuperclass(Class<?> superclass)
introspectTypeHierarchyAndMembers()
.protected void updateInterfaces(List<ObjectSpecification> interfaces)
introspectTypeHierarchyAndMembers()
.protected void updateAsSubclassTo(ObjectSpecification supertypeSpec)
introspectTypeHierarchyAndMembers()
.protected void updateAsSubclassTo(List<ObjectSpecification> supertypeSpecs)
introspectTypeHierarchyAndMembers()
.protected void sortAndUpdateAssociations(List<ObjectAssociation> associations)
protected void sortCacheAndUpdateActions(List<ObjectAction> objectActions)
public void updateFromFacetValues()
protected void setClearDirtyObjectFacet(ClearDirtyObjectFacet clearDirtyObjectFacet)
updateFromFacetValues()
.public String getTitle(ObjectAdapter targetAdapter, org.apache.isis.applib.profiles.Localization localization)
ObjectSpecification
Corresponds to the TitleFacet#value()) value of
TitleFacet; is not necessarily immutable.
getTitle in interface ObjectSpecificationpublic String getTitle(ObjectAdapter contextAdapterIfAny, ObjectAdapter targetAdapter, org.apache.isis.applib.profiles.Localization localization)
ObjectSpecificationgetTitle in interface ObjectSpecificationTitleFacet.title(ObjectAdapter, ObjectAdapter, org.apache.isis.applib.profiles.Localization)public String getIconName(ObjectAdapter reference)
ObjectSpecification
Corresponds to the IconFacet#iconName(ObjectAdapter)) icon name
returned by the IconFacet; is not necessarily immutable.
getIconName in interface ObjectSpecificationpublic Instance getInstance(ObjectAdapter adapter)
SpecificationInstance of this Specification with respect to
the provided ObjectAdapter.
For example, if the Specification is a
OneToOneAssociation, then is an Instance implementation
representing the { ObjectAdapter/ OneToOneAssociation
tuple.
Implementations are expected to use a double-dispatch back to the
provided ObjectAdapter (passing themselves as a parameter), using
ObjectAdapter.getInstance(Specification).
Note: this method may throw an UnsupportedOperationException; see
ObjectAdapter.getInstance(Specification) for details.
getInstance in interface Specificationpublic boolean isOfType(ObjectSpecification specification)
cf Class.isAssignableFrom(Class), though target and parameter are
the opposite way around, ie:
cls1.isAssignableFrom(cls2);
is equivalent to:
spec2.isOfType(spec1);
Callable after introspectTypeHierarchyAndMembers() has been
called.
isOfType in interface Hierarchicalpublic String getSingularName()
NamedFacet,
but falling back to getFullIdentifier() otherwise.getSingularName in interface ObjectSpecificationpublic String getPluralName()
PluralFacet,
else null.getPluralName in interface ObjectSpecificationpublic String getDescription()
PluralFacet,
else empty string ("").getDescription in interface ObjectSpecificationgetDescription in interface Specification#getHelp()public String getHelp()
ObjectSpecification
Corresponds to the HelpFacet#value()) value of HelpFacet;
is not necessarily immutable.
getHelp in interface ObjectSpecificationpublic String getCssClass()
ObjectSpecification
Corresponds to the CssClass#value()) value of CssClassFacet;
getCssClass in interface ObjectSpecificationpublic Persistability persistability()
ObjectSpecificationPersistability.TRANSIENT ObjectAdapter.isPersistent() will
indicated whether the object is persistent or not. If they cannot be
persisted then ObjectAdapter. ObjectSpecification.persistability() should be
ignored.persistability in interface ObjectSpecificationpublic boolean isDirty(ObjectAdapter object)
DirtiableisDirty in interface DirtiableDirtiable.markDirty(ObjectAdapter),
Dirtiable.clearDirty(ObjectAdapter)public void clearDirty(ObjectAdapter object)
DirtiableclearDirty in interface DirtiableDirtiable.isDirty(ObjectAdapter),
Dirtiable.markDirty(ObjectAdapter)public void markDirty(ObjectAdapter object)
DirtiablemarkDirty in interface DirtiableDirtiable.isDirty(ObjectAdapter),
Dirtiable.clearDirty(ObjectAdapter)public <Q extends Facet> Q getFacet(Class<Q> facetType)
FacetHolderFacet.facetType()).getFacet in interface FacetHoldergetFacet in class FacetHolderImplpublic Object getDefaultValue()
DefaultProvidergetDefaultValue in interface DefaultProviderpublic org.apache.isis.applib.Identifier getIdentifier()
IdentifiedHoldergetIdentifier in interface IdentifiedHolderpublic ObjectTitleContext createTitleInteractionContext(AuthenticationSession session, InteractionInvocationMethod interactionMethod, ObjectAdapter targetObjectAdapter)
ObjectSpecificationInteractionContext representing an attempt to read the
object's title.createTitleInteractionContext in interface ObjectSpecificationpublic ObjectSpecification superclass()
Hierarchicalsuperclass in interface Hierarchicalpublic List<ObjectSpecification> interfaces()
Hierarchicalinterfaces in interface Hierarchicalpublic List<ObjectSpecification> subclasses()
Hierarchicalsubclasses in interface Hierarchicalpublic boolean hasSubclasses()
HierarchicalhasSubclasses in interface Hierarchicalpublic final boolean isAbstract()
isAbstract in interface ObjectSpecificationpublic List<ObjectAssociation> getAssociations(Contributed contributed)
ObjectAssociationContainergetAssociations in interface ObjectAssociationContainerpublic ObjectAssociation getAssociation(String id)
id.
This is overridable because ObjectSpecificationForFreeStandingList
simply returns null.
TODO put fields into hash.
TODO: could this be made final? (ie does the framework ever call this
method for an ObjectSpecificationForFreeStandingList)
getAssociation in interface ObjectAssociationContainer@Deprecated public List<ObjectAssociation> getAssociations(org.apache.isis.applib.filter.Filter<ObjectAssociation> filter)
ObjectAssociationContainerObjectAssociation (including contributed actions)
that match the supplied filter.getAssociations in interface ObjectAssociationContainerpublic List<ObjectAssociation> getAssociations(Contributed contributed, org.apache.isis.applib.filter.Filter<ObjectAssociation> filter)
ObjectAssociationContainerObjectAssociations matching the supplied filter.
To get the statically visible fields (where any invisible and
unauthorised fields have been removed) use
ObjectAssociationFilters#staticallyVisible(...)getAssociations in interface ObjectAssociationContainerFilterspublic List<OneToOneAssociation> getProperties(Contributed contributed)
ObjectAssociationContainerassociations that represent
properties.getProperties in interface ObjectAssociationContainerpublic List<OneToManyAssociation> getCollections(Contributed contributed)
ObjectAssociationContainerassociations that represents
collections.getCollections in interface ObjectAssociationContainerpublic List<ObjectAction> getObjectActions(List<ActionType> types, Contributed contributed, org.apache.isis.applib.filter.Filter<ObjectAction> filter)
getObjectActions in interface ObjectActionContainerpublic List<ObjectAction> getObjectActions(Contributed contributed)
getObjectActions in interface ObjectActionContainerpublic List<ObjectAction> getObjectActions(ActionType type, Contributed contributed, org.apache.isis.applib.filter.Filter<ObjectAction> filter)
ObjectActionContainergetObjectActions in interface ObjectActionContainerprotected List<ObjectAssociation> sortAssociations(List<ObjectAssociation> associations)
protected static List<ObjectAction> sortActions(List<ObjectAction> actions)
public List<ObjectAction> getServiceActionsReturning(List<ActionType> types)
getServiceActionsReturning in interface ObjectActionContainerprotected List<ObjectAction> createContributeeActions()
If this specification is actually for a service,
then returns an empty list.
public Consent isValid(ObjectAdapter inObject)
ObjectSpecificationConsent.isValid in interface ObjectSpecificationpublic InteractionResult isValidResult(ObjectAdapter targetObjectAdapter)
by user.isValidResult in interface ObjectSpecificationpublic ObjectValidityContext createValidityInteractionContext(DeploymentCategory deploymentCategory, AuthenticationSession session, InteractionInvocationMethod interactionMethod, ObjectAdapter targetObjectAdapter)
InteractionContext representing an attempt to save the
object.createValidityInteractionContext in interface ObjectSpecificationdeploymentCategory - TODOpublic boolean isImmutable()
ObjectSpecificationImmutableFacet.isImmutable in interface ObjectSpecificationpublic boolean isHidden()
ObjectSpecificationHiddenFacetisHidden in interface ObjectSpecificationpublic boolean isParseable()
ObjectSpecification
In effect, means has got a ParseableFacet.
isParseable in interface ObjectSpecificationpublic boolean isEncodeable()
ObjectSpecification
In effect, means has got EncodableFacet.
isEncodeable in interface ObjectSpecificationpublic boolean isValue()
ObjectSpecification
In effect, means has got ValueFacet.
isValue in interface ObjectSpecificationpublic boolean isParented()
ObjectSpecification
In effect, means has got ParentedFacet.
isParented in interface ObjectSpecificationpublic boolean isParentedOrFreeCollection()
ObjectSpecification
In effect, means has got CollectionFacet, and therefore will
return NOT ObjectSpecification.isNotCollection().
isParentedOrFreeCollection in interface ObjectSpecificationObjectSpecification.isNotCollection()public boolean isNotCollection()
ObjectSpecification
In effect, means that it doesn't have the CollectionFacet, and
therefore will return NOT ObjectSpecification.isParentedOrFreeCollection()
isNotCollection in interface ObjectSpecification#isCollection().public boolean isValueOrIsParented()
ObjectSpecificationisValueOrIsParented in interface ObjectSpecificationObjectSpecification.isValue(),
ObjectSpecification.isParented()public Object createObject()
createObject in interface ObjectSpecificationpublic ObjectAdapter initialize(ObjectAdapter objectAdapter)
ObjectSpecificationinitialize in interface ObjectSpecificationprotected final AuthenticationSession getAuthenticationSession()
AuthenticationSession
from the injected
AuthenticationSessionProvider.protected AuthenticationSessionProvider getAuthenticationSessionProvider()
public ServicesProvider getServicesProvider()
public ObjectInstantiator getObjectInstantiator()
public SpecificationLoader getSpecificationLookup()
Copyright © 2010–2014 The Apache Software Foundation. All rights reserved.