public abstract class AbstractModelObject extends Object implements ModelObject, ResourceProvider
All model classes extending from this class are expected to have "id", "title" and "description" fields.
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Serializable> |
customProperties |
protected String |
description |
protected String |
descriptionId |
protected String |
id |
protected ModelPersisterInfo |
info |
protected Map<String,Serializable> |
modelProperties |
protected long |
modificationTime |
protected ResourceProvider |
resourceContainer |
protected String |
title |
protected String |
titleId |
PROP_DESCRIPTION, PROP_DESCRIPTION_ID, PROP_ID, PROP_TITLE, PROP_TITLE_ID| Modifier | Constructor and Description |
|---|---|
protected |
AbstractModelObject()
Constructor used by sentinel object
|
|
AbstractModelObject(String id,
ModelPersisterInfo info,
org.dom4j.Document document)
Constructs a new model object
|
| Modifier and Type | Method and Description |
|---|---|
Resource |
addResource(String name,
String resourceId)
Adds/Creates a resource with the given name and resource id
|
Resource |
addResource(String name,
String protocolId,
String endpointId,
String objectId)
Adds/Creates a resource with the given name, object id and
endpoint id
|
boolean |
getBooleanProperty(String propertyName) |
Map<String,Serializable> |
getCustomProperties() |
String |
getCustomProperty(String propertyName) |
String |
getDescription()
Returns the description property of the model object
|
String |
getDescriptionId()
Returns the description id property of the model object
|
org.dom4j.Document |
getDocument()
Return the representation of this Model Object as an XML DOM.
|
String |
getId()
Returns the id of the model object.
|
ModelPersisterInfo |
getKey()
Returns the model object key instance
|
Map<String,Serializable> |
getModelProperties() |
String |
getModelProperty(String propertyName) |
long |
getModificationTime() |
String |
getPersisterId()
Returns the ModelObjectPersister id that this object is bound to
|
Map<String,Serializable> |
getProperties() |
String |
getProperty(String propertyName) |
Resource |
getResource(String name)
Looks up a resource with the given name
|
protected ResourceProvider |
getResourceContainer() |
Resource[] |
getResources()
Returns the set of all resources
|
Map<String,Resource> |
getResourcesMap()
Returns the map of resources
|
String |
getStoragePath()
Returns the persistence storage path of this object
|
String |
getTitle()
Returns the title property of the model object.
|
String |
getTitleId()
Returns the title id property of the model object.
|
abstract String |
getTypeId()
Returns the type id of the model object.
|
protected boolean |
isCustomProperty(String propertyName)
Uses reflection to determine whether the given property name
is a custom property.
|
protected boolean |
isModelProperty(String propertyName)
Uses reflection to determine whether the given property name
is a model property.
|
boolean |
isSaved()
Indicates whether the object is currently persisted (saved)
or not.
|
void |
removeCustomProperty(String propertyName) |
void |
removeModelProperty(String propertyName) |
void |
removeProperty(String propertyName) |
void |
removeResource(String name)
Removes a resource with the given name
|
void |
setCustomProperty(String propertyName,
String propertyValue) |
void |
setDescription(String value)
Sets the description property of the model object
|
void |
setDescriptionId(String value)
Sets the description id property of the model object
|
void |
setId(String id)
Allows for reassignment of the id of the object
|
void |
setModelProperty(String propertyName,
String propertyValue) |
void |
setModificationTime(long modificationTime) |
void |
setProperty(String propertyName,
String propertyValue) |
void |
setTitle(String title)
Sets the title property of the model object
|
void |
setTitleId(String titleId)
Sets the title id property of the model object
|
String |
toString() |
void |
touch() |
String |
toXML()
Serializes the object to XML.
|
void |
updateResource(String name,
Resource resource)
Updates a resource for the given name
|
protected void |
updateXML(org.dom4j.Document document)
Method to be used by sub-classes to update the internal serialised representation
of the ModelObject from a given XML DOM.
|
protected final ModelPersisterInfo info
protected String id
protected long modificationTime
protected Map<String,Serializable> modelProperties
protected Map<String,Serializable> customProperties
protected String title
protected String titleId
protected String description
protected String descriptionId
protected ResourceProvider resourceContainer
public AbstractModelObject(String id, ModelPersisterInfo info, org.dom4j.Document document)
document - the documentprotected AbstractModelObject()
protected void updateXML(org.dom4j.Document document)
document - Document for XML serialisationpublic final ModelPersisterInfo getKey()
ModelObjectgetKey in interface ModelObjectpublic final String getId()
ModelObjectgetId in interface ModelObjectpublic final String getTitle()
ModelObjectgetTitle in interface ModelObjectpublic final String getTitleId()
ModelObjectgetTitleId in interface ModelObjectpublic final void setTitle(String title)
ModelObjectsetTitle in interface ModelObjecttitle - The new titlepublic final void setTitleId(String titleId)
ModelObjectsetTitleId in interface ModelObjecttitleId - The new title idpublic final String getDescription()
ModelObjectgetDescription in interface ModelObjectpublic final String getDescriptionId()
ModelObjectgetDescriptionId in interface ModelObjectpublic final void setDescription(String value)
ModelObjectsetDescription in interface ModelObjectvalue - The descriptionpublic final void setDescriptionId(String value)
ModelObjectsetDescriptionId in interface ModelObjectvalue - The description idpublic final boolean isSaved()
ModelObjectisSaved in interface ModelObjectpublic final org.dom4j.Document getDocument()
Note that this Document is transient and created new each time this method is called from the internal serialised representation. Therefore changes to the ModelObject must be persisted back through the various setProperty() methods or the serialised XML manually updated by an appropriate sub-class method.
getDocument in interface ModelObjectpublic final String toXML()
ModelObjecttoXML in interface ModelObjectpublic final boolean getBooleanProperty(String propertyName)
getBooleanProperty in interface ModelObjectpublic final String getProperty(String propertyName)
getProperty in interface ModelObjectpublic final void setProperty(String propertyName, String propertyValue)
setProperty in interface ModelObjectpublic final void removeProperty(String propertyName)
removeProperty in interface ModelObjectprotected final boolean isCustomProperty(String propertyName)
propertyName - the property nameprotected final boolean isModelProperty(String propertyName)
propertyName - the property namepublic final String getModelProperty(String propertyName)
getModelProperty in interface ModelObjectpublic final void setModelProperty(String propertyName, String propertyValue)
setModelProperty in interface ModelObjectpublic final void removeModelProperty(String propertyName)
removeModelProperty in interface ModelObjectpublic final String getCustomProperty(String propertyName)
getCustomProperty in interface ModelObjectpublic final void setCustomProperty(String propertyName, String propertyValue)
setCustomProperty in interface ModelObjectpublic final void removeCustomProperty(String propertyName)
removeCustomProperty in interface ModelObjectpublic Map<String,Serializable> getProperties()
getProperties in interface ModelObjectpublic final Map<String,Serializable> getModelProperties()
getModelProperties in interface ModelObjectpublic Map<String,Serializable> getCustomProperties()
getCustomProperties in interface ModelObjectpublic final long getModificationTime()
getModificationTime in interface ModelObjectpublic final void setModificationTime(long modificationTime)
public final void touch()
touch in interface ModelObjectpublic abstract String getTypeId()
ModelObjectgetTypeId in interface ModelObjectpublic final String getPersisterId()
getPersisterId in interface ModelObjectpublic final String getStoragePath()
getStoragePath in interface ModelObjectpublic Resource getResource(String name)
ResourceProvidergetResource in interface ResourceProvidername - Stringpublic Resource[] getResources()
ResourceProvidergetResources in interface ResourceProviderpublic Map<String,Resource> getResourcesMap()
ResourceProvidergetResourcesMap in interface ResourceProviderpublic Resource addResource(String name, String resourceId)
ResourceProvideraddResource in interface ResourceProvidername - StringresourceId - Stringpublic Resource addResource(String name, String protocolId, String endpointId, String objectId)
ResourceProvideraddResource in interface ResourceProvidername - StringprotocolId - StringendpointId - StringobjectId - Stringpublic void updateResource(String name, Resource resource)
ResourceProviderupdateResource in interface ResourceProvidername - Stringresource - Resourcepublic void removeResource(String name)
ResourceProviderremoveResource in interface ResourceProvidername - Stringprotected ResourceProvider getResourceContainer()
public void setId(String id)
id - StringCopyright © 2005–2016 Alfresco Software. All rights reserved.