F - the actual type of factory.public class SimpleAmetysObject<F extends SimpleAmetysObjectFactory> extends AbstractAmetysObject implements JCRAmetysObject
AmetysObject, backed by a JCR node.SimpleAmetysObjectFactory counterpart.| Modifier and Type | Field and Description |
|---|---|
private F |
_factory
The corresponding
SimpleAmetysObjectFactory |
private String |
_name |
private Node |
_node |
private String |
_parentPath |
| Constructor and Description |
|---|
SimpleAmetysObject(Node node,
String parentPath,
F factory)
Creates an
SimpleAmetysObject. |
| Modifier and Type | Method and Description |
|---|---|
protected F |
_getFactory()
Retrieves the factory.
|
protected void |
_invalidateName()
Recompute the name from the Node.
To be used when the node name changesd internally. |
protected void |
_invalidateParentPath()
Invalidates cached parent path.
|
String |
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> |
ModifiableCompositeMetadata |
getMetadataHolder()
Deprecated.
use getRepositoryData instead
|
String |
getName()
Retrieves the name of the current object.
|
Node |
getNode()
Gives access to the underlying JCR node.
|
<A extends AmetysObject> |
getParent()
Returns the parent object in the Ametys hierarchy.
|
String |
getParentPath()
Returns the path of the parent object in the Ametys hierarchy.
|
String |
getPath()
Retrieves the path of the current object.
|
boolean |
needsSave()
Returns true if there is pending changes.
|
void |
remove()
Removes this
AmetysObject from the Ametys tree. |
void |
rename(String newName)
Rename the
AmetysObject |
void |
revertChanges()
Discard pending changes and revert to the currently persisted version.
|
void |
saveChanges()
Persists pending changes.
If the underlying Node is new, the Session is globally saved. |
equals, hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitequals, hashCodeprivate F extends SimpleAmetysObjectFactory _factory
SimpleAmetysObjectFactoryprivate String _parentPath
public SimpleAmetysObject(Node node, String parentPath, F factory)
SimpleAmetysObject.node - the node backing this AmetysObjectparentPath - the parentPath in the Ametys hierarchyfactory - the DefaultTraversableAmetysObjectFactory which created the AmetysObjectprotected F _getFactory()
public String getName() throws AmetysRepositoryException
AmetysObjectgetName in interface AmetysObjectAmetysRepositoryException - if an error occurs.@Deprecated public ModifiableCompositeMetadata getMetadataHolder()
CompositeMetadata of this AmetysObject.getMetadataHolder in interface MetadataAwareAmetysObjectgetMetadataHolder in interface ModifiableMetadataAwareAmetysObjectCompositeMetadata of this AmetysObjectpublic String getParentPath() throws AmetysRepositoryException
AmetysObjectgetParentPath in interface AmetysObjectAmetysRepositoryException - if an error occurs.protected void _invalidateParentPath()
protected void _invalidateName()
public String getPath() throws AmetysRepositoryException
AmetysObjectgetPath in interface AmetysObjectAmetysRepositoryException - if an error occurs.public Node getNode()
JCRAmetysObjectgetNode in interface JCRAmetysObjectpublic String getId()
AmetysObject<protocol>://<protocol-specific-part>getId in interface AmetysObjectpublic void rename(String newName) throws AmetysRepositoryException
ModifiableAmetysObjectAmetysObjectrename in interface ModifiableAmetysObjectnewName - the new name of the ametys objectAmetysRepositoryException - if an error occurs.public void remove() throws AmetysRepositoryException, RepositoryIntegrityViolationException
RemovableAmetysObjectAmetysObject from the Ametys tree.remove in interface RemovableAmetysObjectAmetysRepositoryException - if an error occurs.RepositoryIntegrityViolationException - if this AmetysObject is referenced by another objects.public <A extends AmetysObject> A getParent() throws AmetysRepositoryException
AmetysObjectgetParent in interface AmetysObjectA - the type of the parent AmetysObject.null if current object
is the root.AmetysRepositoryException - if an error occurs.public boolean needsSave() throws AmetysRepositoryException
ModifiableAmetysObjectneedsSave in interface ModifiableAmetysObjectAmetysRepositoryException - if an error occurs.public void saveChanges() throws AmetysRepositoryException
ModifiableAmetysObjectsaveChanges in interface ModifiableAmetysObjectAmetysRepositoryException - if an error occurs.public void revertChanges() throws AmetysRepositoryException
ModifiableAmetysObjectrevertChanges in interface ModifiableAmetysObjectAmetysRepositoryException - if an error occurs.