Class SimpleAmetysObject<F extends SimpleAmetysObjectFactory>
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
- Type Parameters:
F- the actual type of factory.
- All Implemented Interfaces:
AmetysObject,JCRAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableAmetysObject,RemovableAmetysObject
- Direct Known Subclasses:
Activity,AmetysObjectCollection,Catalog,ContentBackupAmetysObject,ContentConsistencyResult,DefaultAlias,DefaultAmetysObject,DefaultDefinition,DefaultTheme,DefaultTraversableAmetysObject,DefaultZoneItem,FormEntry,FormPageRule,VersionAmetysObject
public class SimpleAmetysObject<F extends SimpleAmetysObjectFactory>
extends AbstractAmetysObject
implements JCRAmetysObject
Default implementation of an
This implementation heavily relies on its
AmetysObject, backed by a JCR node.This implementation heavily relies on its
SimpleAmetysObjectFactory counterpart.-
Constructor Summary
ConstructorsConstructorDescriptionSimpleAmetysObject(javax.jcr.Node node, String parentPath, F factory) Creates anSimpleAmetysObject. -
Method Summary
Modifier and TypeMethodDescriptionprotected FRetrieves the factory.protected voidRecompute the name from the Node.
To be used when the node name changesd internally.protected voidInvalidates cached parent path.getId()Retrieves the unique identifier of this AmetysObject.
It must be unique in the whole repository and must never be null.
It must conform to the URI syntax:
<protocol>://<protocol-specific-part>Deprecated.use getRepositoryData insteadgetName()Retrieves the name of the current object.javax.jcr.NodegetNode()Gives access to the underlying JCR node.<A extends AmetysObject>
AReturns the parent object in the Ametys hierarchy.Returns the path of the parent object in the Ametys hierarchy.getPath()Retrieves the path of the current object.booleanReturns true if there is pending changes.voidremove()Removes thisAmetysObjectfrom the Ametys tree.voidRename theAmetysObjectvoidDiscard pending changes and revert to the currently persisted version.voidPersists pending changes.
If the underlying Node is new, the Session is globally saved.Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, hashCode
-
Constructor Details
-
SimpleAmetysObject
Creates anSimpleAmetysObject.- Parameters:
node- the node backing thisAmetysObjectparentPath- the parentPath in the Ametys hierarchyfactory- the DefaultTraversableAmetysObjectFactory which created the AmetysObject
-
-
Method Details
-
_getFactory
Retrieves the factory.- Returns:
- the factory.
-
getName
Description copied from interface:AmetysObjectRetrieves the name of the current object.- Specified by:
getNamein interfaceAmetysObject- Returns:
- the name.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getMetadataHolder
Deprecated.use getRepositoryData insteadReturns the rootCompositeMetadataof thisAmetysObject.- Specified by:
getMetadataHolderin interfaceMetadataAwareAmetysObject- Specified by:
getMetadataHolderin interfaceModifiableMetadataAwareAmetysObject- Returns:
- the root
CompositeMetadataof thisAmetysObject
-
getParentPath
Description copied from interface:AmetysObjectReturns the path of the parent object in the Ametys hierarchy.- Specified by:
getParentPathin interfaceAmetysObject- Returns:
- the path of the parent object.
- Throws:
AmetysRepositoryException- if an error occurs.
-
_invalidateParentPath
Invalidates cached parent path. -
_invalidateName
Recompute the name from the Node.
To be used when the node name changesd internally. -
getPath
Description copied from interface:AmetysObjectRetrieves the path of the current object.- Specified by:
getPathin interfaceAmetysObject- Returns:
- the path.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getNode
Description copied from interface:JCRAmetysObjectGives access to the underlying JCR node.- Specified by:
getNodein interfaceJCRAmetysObject- Returns:
- the JCR node backing this AmetysObject.
-
getId
Description copied from interface:AmetysObjectRetrieves the unique identifier of this AmetysObject.
It must be unique in the whole repository and must never be null.
It must conform to the URI syntax:
<protocol>://<protocol-specific-part>- Specified by:
getIdin interfaceAmetysObject- Returns:
- the unique identifier of this AmetysObject
-
rename
Description copied from interface:ModifiableAmetysObjectRename theAmetysObject- Specified by:
renamein interfaceModifiableAmetysObject- Parameters:
newName- the new name of the ametys object- Throws:
AmetysRepositoryException- if an error occurs.
-
remove
Description copied from interface:RemovableAmetysObjectRemoves thisAmetysObjectfrom the Ametys tree.- Specified by:
removein interfaceRemovableAmetysObject- Throws:
AmetysRepositoryException- if an error occurs.RepositoryIntegrityViolationException- if thisAmetysObjectis referenced by another objects.
-
getParent
Description copied from interface:AmetysObjectReturns the parent object in the Ametys hierarchy.- Specified by:
getParentin interfaceAmetysObject- Type Parameters:
A- the type of the parentAmetysObject.- Returns:
- the parent object or
nullif current object is the root. - Throws:
AmetysRepositoryException- if an error occurs.
-
needsSave
Description copied from interface:ModifiableAmetysObjectReturns true if there is pending changes.- Specified by:
needsSavein interfaceModifiableAmetysObject- Returns:
- true if there is pending changes.
- Throws:
AmetysRepositoryException- if an error occurs.
-
saveChanges
Description copied from interface:ModifiableAmetysObjectPersists pending changes.
If the underlying Node is new, the Session is globally saved.- Specified by:
saveChangesin interfaceModifiableAmetysObject- Throws:
AmetysRepositoryException- if an error occurs.
-
revertChanges
Description copied from interface:ModifiableAmetysObjectDiscard pending changes and revert to the currently persisted version.- Specified by:
revertChangesin interfaceModifiableAmetysObject- Throws:
AmetysRepositoryException- if an error occurs.
-