|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ChromatticSession
The session manages Chromattic objects at runtime, it is obtained from a Chromattic
instance. A session is meant to be used by one thread and not shared among threads.
| Method Summary | ||
|---|---|---|
void |
addEventListener(EventListener listener)
Adds an event listener to this session. |
|
void |
close()
Close and dispose the session. |
|
|
copy(java.lang.Object parent,
O o,
java.lang.String name)
Clones a persistent object into a new persistent object. |
|
|
copy(O o,
java.lang.String name)
Clones a persistent object into a new persistent object. |
|
|
create(java.lang.Class<O> clazz)
Creates a transient instance of the specified object. |
|
|
create(java.lang.Class<O> clazz,
java.lang.String name)
Creates a transient instance of the specified object. |
|
|
createQueryBuilder(java.lang.Class<O> fromClass)
Create a query builder. |
|
|
findById(java.lang.Class<O> clazz,
java.lang.String id)
Finds an object from its identifier or return null if no such object can be found. |
|
|
findByNode(java.lang.Class<O> clazz,
javax.jcr.Node node)
Finds an object mapped to the provided node. |
|
|
findByPath(java.lang.Class<O> clazz,
java.lang.String relPath)
Finds an object with a path relative to a chromattic root object. |
|
|
findByPath(java.lang.Class<O> clazz,
java.lang.String path,
boolean absolute)
Finds an object given its specified path. |
|
|
findByPath(java.lang.Object origin,
java.lang.Class<O> clazz,
java.lang.String relPath)
Finds an object with a path relative to a specified origin object. |
|
|
getEmbedded(java.lang.Object o,
java.lang.Class<E> embeddedType)
Returns a specified embedded object. |
|
java.lang.String |
getId(java.lang.Object o)
Returns the id of a specified entity. |
|
javax.jcr.Session |
getJCRSession()
Returns the underlying JCR session or null if the session is closed. |
|
java.lang.String |
getName(java.lang.Object o)
Returns the name of a specified entity. |
|
java.lang.String |
getPath(java.lang.Object o)
Returns the path of a specified entity. |
|
Status |
getStatus(java.lang.Object o)
Returns the status of a specified object. |
|
|
insert(java.lang.Class<O> clazz,
java.lang.String name)
Creates a persistent instance of the specified object. |
|
|
insert(java.lang.Class<O> clazz,
java.lang.String prefix,
java.lang.String localName)
Creates a persistent instance of the specified object. |
|
|
insert(java.lang.Object parent,
java.lang.Class<O> clazz,
java.lang.String name)
Creates a persistent instance of the specified object. |
|
|
insert(java.lang.Object parent,
java.lang.Class<O> clazz,
java.lang.String prefix,
java.lang.String localName)
Creates a persistent instance of the specified object. |
|
boolean |
isClosed()
|
|
java.lang.String |
persist(java.lang.Object o)
Persists a transient object relative to the root node. |
|
java.lang.String |
persist(java.lang.Object parent,
java.lang.Object o)
Persists a transient object as a child of the specified parent. |
|
java.lang.String |
persist(java.lang.Object parent,
java.lang.Object o,
java.lang.String name)
Persists a transient object as a child of the specified parent with the specified name. |
|
java.lang.String |
persist(java.lang.Object parent,
java.lang.Object o,
java.lang.String prefix,
java.lang.String localName)
Persists a transient object as a child of the specified parent with the specified name. |
|
java.lang.String |
persist(java.lang.Object o,
java.lang.String name)
Persists a transient object with the specified name. |
|
java.lang.String |
persist(java.lang.Object o,
java.lang.String prefix,
java.lang.String localName)
Persists a transient object with the specified name. |
|
void |
remove(java.lang.Object o)
Removes a specified entity. |
|
void |
save()
Save the transient changes. |
|
|
setEmbedded(java.lang.Object o,
java.lang.Class<E> embeddedType,
E embedded)
Attach or detach the specified embedded object on the specified object. |
|
void |
setName(java.lang.Object o,
java.lang.String name)
Rename a chromattic object, the behavior of this method depends on the current object status: Status.TRANSIENT: the object is merely associated with the name until it is persisted.
Status.PERSISTENT: the object will be renamed with the new name.
Status.REMOVED: An illegal state exception is thrown.
|
|
| Method Detail |
|---|
<O> O create(java.lang.Class<O> clazz)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
clazz - the object class
java.lang.NullPointerException - if the specified clazz is null
java.lang.IllegalArgumentException - if the specified class is not a chromattic class
ChromatticException - any chromattic exception
<O> O create(java.lang.Class<O> clazz,
java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
O - the object class parameterclazz - the object classname - the node name
java.lang.NullPointerException - if the clazz argument is null
java.lang.IllegalArgumentException - if the name format is not valid or the class is not a chromattic class
ChromatticException - any chromattic exception
<O> O insert(java.lang.Class<O> clazz,
java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
O - the object class parameterclazz - the object classname - the name under root node
java.lang.NullPointerException - if any argument is null
java.lang.IllegalArgumentException - if the name is not valid or the class is not a chromattic class
ChromatticException - any chromattic exception
<O> O insert(java.lang.Class<O> clazz,
java.lang.String prefix,
java.lang.String localName)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
O - the object class parameterclazz - the object classprefix - the prefix under the root nodelocalName - the local name under root node
java.lang.NullPointerException - if any argument is null
java.lang.IllegalArgumentException - if the name is not valid or the class is not a chromattic class
ChromatticException - any chromattic exception
<O> O insert(java.lang.Object parent,
java.lang.Class<O> clazz,
java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
O - the object class parameterparent - the parent objectclazz - the object classname - the object name
java.lang.NullPointerException - if any argument is null
java.lang.IllegalArgumentException - if the name is not valid or the class is not a chromattic class or the parent is
not a persistent object
ChromatticException - any chromattic exception
<O> O insert(java.lang.Object parent,
java.lang.Class<O> clazz,
java.lang.String prefix,
java.lang.String localName)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
O - the object class parameterparent - the parent objectclazz - the object classprefix - the object prefixlocalName - the object local name
java.lang.NullPointerException - if any argument is null
java.lang.IllegalArgumentException - if the name is not valid or the class is not a chromattic class or the parent is
not a persistent object
ChromatticException - any chromattic exception
java.lang.String persist(java.lang.Object o,
java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
o - the object to persistname - the object relative path to the root
java.lang.NullPointerException - if any argument is null
java.lang.IllegalArgumentException - if the name is not valid or the object is not a chromattic transient object
ChromatticException - any chromattic exception
java.lang.String persist(java.lang.Object o,
java.lang.String prefix,
java.lang.String localName)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
o - the object to persistprefix - the object prefixlocalName - the object relative path to the root
java.lang.NullPointerException - if any argument is null
java.lang.IllegalArgumentException - if the name is not valid or the object is not a chromattic transient object
ChromatticException - any chromattic exception
java.lang.String persist(java.lang.Object parent,
java.lang.Object o)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
persist(Object) method. Since no name is provided, this
method implicitely expects a name associated with the object.
parent - the parent objecto - the object to persist
java.lang.NullPointerException - if the child argument is null
java.lang.IllegalArgumentException - if the parent is not a persistent object or the object is not a chromattic transient object
ChromatticException - any chromattic exception
java.lang.String persist(java.lang.Object o)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
o - the object to persist
java.lang.NullPointerException - if any argument is not valid
java.lang.IllegalArgumentException - if the object is not a chromattic transient object
ChromatticException - any chromattic exception
java.lang.String persist(java.lang.Object parent,
java.lang.Object o,
java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
persist(Object, String) method.
parent - the parent objecto - the object to persistname - the object relative name to the parent
java.lang.NullPointerException - if the object argument is null
java.lang.IllegalArgumentException - if the parent is not a persistent object or the name is not valid or the object
is not a chromattic transient object
ChromatticException - any chromattic exception
java.lang.String persist(java.lang.Object parent,
java.lang.Object o,
java.lang.String prefix,
java.lang.String localName)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
persist(Object, String) method.
parent - the parent objecto - the object to persistprefix - the object prefixlocalName - the object relative local name to the parent
java.lang.NullPointerException - if the object argument is null
java.lang.IllegalArgumentException - if the parent is not a persistent object or the name is not valid or the object
is not a chromattic transient object
ChromatticException - any chromattic exception
<O> O copy(java.lang.Object parent,
O o,
java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
O - the object typeparent - the parent objecto - the object to clonename - the object name
java.lang.NullPointerException - if the parent or object argument is null
java.lang.IllegalArgumentException - if the parent is not a persistent object or the name is not valid or the object
is not a chromattic persistent object
ChromatticException - any chromattic exception
<O> O copy(O o,
java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
O - the object typeo - the object to clonename - the object name
java.lang.NullPointerException - if the parent or object argument is null
java.lang.IllegalArgumentException - if the parent is not a persistent object or the name is not valid or the object
is not a chromattic persistent object
ChromatticException - any chromattic exception
<O> O findByPath(java.lang.Object origin,
java.lang.Class<O> clazz,
java.lang.String relPath)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException,
java.lang.ClassCastException,
ChromatticException
findById(Class, String)
method.
O - the object typeorigin - the origin objectclazz - the expected classrelPath - the path relative to the origin
java.lang.IllegalArgumentException - if the origin object is not a chromattic object
java.lang.NullPointerException - if any argument except the origin is null
java.lang.ClassCastException - if the object cannot be cast to the specified class
ChromatticException - any chromattic exception
<O> O findByPath(java.lang.Class<O> clazz,
java.lang.String relPath)
throws java.lang.NullPointerException,
java.lang.ClassCastException,
ChromatticException
O - the object typeclazz - the expected classrelPath - the path relative to the chromattic root
java.lang.NullPointerException - if any argument is null
java.lang.ClassCastException - if the object cannot be cast to the specified class
ChromatticException - any chromattic exception
<O> O findByPath(java.lang.Class<O> clazz,
java.lang.String path,
boolean absolute)
throws java.lang.NullPointerException,
java.lang.ClassCastException,
ChromatticException
absolute method parameter. When the object
is not found the method returns null.
O - the object typeclazz - the expected classpath - the path relative to the chromattic rootabsolute - true when an absolute path must be provided
java.lang.NullPointerException - if any argument is null
java.lang.ClassCastException - if the object cannot be cast to the specified class
ChromatticException - any chromattic exception
<O> O findByNode(java.lang.Class<O> clazz,
javax.jcr.Node node)
throws java.lang.NullPointerException,
java.lang.ClassCastException,
ChromatticException
O - the object typeclazz - the expected classnode - the node
java.lang.NullPointerException - if any argument is null
java.lang.ClassCastException - if the mapped object cannot be cast to the specified class
ChromatticException - any chromattic exception
<O> O findById(java.lang.Class<O> clazz,
java.lang.String id)
throws java.lang.NullPointerException,
java.lang.ClassCastException,
ChromatticException
O - the object typeclazz - the expected classid - the id
java.lang.NullPointerException - if any argument is null
java.lang.ClassCastException - if the mapped object cannot be cast to the specified class
ChromatticException - any chromattic exception
<O> QueryBuilder<O> createQueryBuilder(java.lang.Class<O> fromClass)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
O - the object type parameterfromClass - the node type of the from clause
java.lang.NullPointerException - if the argument is null
java.lang.IllegalArgumentException - if the from class cannot be mapped to a node type
ChromatticException - any chromattic exception
void remove(java.lang.Object o)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
o - the entity to remove
ChromatticException - any chromattic exception
java.lang.NullPointerException - if the specified object is null
java.lang.IllegalArgumentException - if the specified object is not a chromattic object
Status getStatus(java.lang.Object o)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
Status.TRANSIENT when the entity is created but not yet in correspondance with a nodeStatus.PERSISTENT when the entity is in correspondance with a non removed nodeStatus.REMOVED when the entity is in correspondance with a removed nodeStatus.TRANSIENT when the embedded is created but not yet in correspondance with a nodeStatus.PERSISTENT or Status.REMOVED when the embedded is attached to a node according
to this node's status
o - the object to get the status
ChromatticException - any chromattic exception
java.lang.NullPointerException - if the specified object is null
java.lang.IllegalArgumentException - if the specified object is not a chromattic object
java.lang.String getId(java.lang.Object o)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
o - the entity to get the id
ChromatticException - any chromattic exception
java.lang.NullPointerException - if the specified object is null
java.lang.IllegalArgumentException - if the specified object is not a chromattic object
java.lang.String getName(java.lang.Object o)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
o - the entity to get the name
ChromatticException - any chromattic exception
java.lang.NullPointerException - if the specified object is null
java.lang.IllegalArgumentException - if the specified object is not a chromattic object
void setName(java.lang.Object o,
java.lang.String name)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
Status.TRANSIENT: the object is merely associated with the name until it is persisted.Status.PERSISTENT: the object will be renamed with the new name.Status.REMOVED: An illegal state exception is thrown.
o - the entity to get the namename - the new entity name
ChromatticException - any chromattic exception
java.lang.NullPointerException - if the specified object is null
java.lang.IllegalArgumentException - if the specified object is not a chromattic object or has been destroyed.
java.lang.String getPath(java.lang.Object o)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
o - the entity to get the path
ChromatticException - any chromattic exception
java.lang.NullPointerException - if the specified object is null
java.lang.IllegalArgumentException - if the specified object is not a chromattic object
<E> E getEmbedded(java.lang.Object o,
java.lang.Class<E> embeddedType)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
E - the embedded typeo - the object to get the embedded fromembeddedType - the embedded type class
java.lang.NullPointerException - if any argument is null
java.lang.IllegalArgumentException - if the specified object is not a chromattic object
ChromatticException - any chromattic exception
<E> void setEmbedded(java.lang.Object o,
java.lang.Class<E> embeddedType,
E embedded)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
ChromatticException
Attach or detach the specified embedded object on the specified object. When the embedded argument is not null
and in Status.TRANSIENT state the embedded is attached to the object if the underlying type system
allows it. When the embedded argument is null, the embedded is removed from the object when the underlying
type system allows it.
E - the embedded typeo - the objectembeddedType - the embedded type classembedded - the embedded
java.lang.NullPointerException - if the object or type is null
java.lang.IllegalArgumentException - if the object or the embedded are not chromattic objects
ChromatticException - any chromattic exception
void addEventListener(EventListener listener)
throws java.lang.NullPointerException
listener - the listener to add
java.lang.NullPointerException - if the provided listener is null
void save()
throws ChromatticException
ChromatticException - any chromattic exceptionvoid close()
boolean isClosed()
javax.jcr.Session getJCRSession()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||