org.gvsig.tools.persistence.spi
Interface PersistentContextServices

All Superinterfaces:
PersistentContext
All Known Implementing Classes:
DefaultPersistentContext

public interface PersistentContextServices
extends PersistentContext


Nested Class Summary
static interface PersistentContextServices.ObjectReference
           
 
Method Summary
 PersistentContextServices.ObjectReference add(PersistentIdentifier id)
          Add a new reference associated to the identifier passed as parameter.
 PersistentContextServices.ObjectReference add(PersistentState state, Object obj)
          Add a reference to the object associated to the state.
 void clear()
          Clear the instances of references previously recreated
 PersistentContextServices.ObjectReference get(Object obj)
          Return the object reference associated to the object passed as parameter.
 PersistentContextServices.ObjectReference get(PersistentIdentifier id)
          Return the object reference associated to the id indicated as parameter.
 PersistentContextServices.ObjectReference get(PersistentState state)
          Return the object reference associated to the state passed as parameter.
 boolean getCollectErrors()
          Get information about if collect errors or launch it when produce.
 PersistentIdentifier getId(Object obj)
          Deprecated.  
 PersistentIdentifier getIdentifier(String id)
          Create a new identifier based on the string passed as parameter and return this.
 PersistentIdentifier getNewIdentifier()
          Get a valid new persistent identifier.
 Object getObject(Integer id)
          Deprecated.  
 PersistentContextServices.ObjectReference getRoot()
           
 PersistentState getState(Integer id)
          Deprecated.  
 PersistentState getState(Object obj)
          Deprecated.  
 void setCollectErrors(boolean collectErrors)
          Set flag to collect errors.
 void setRootId(PersistentIdentifier id)
           
 void update(PersistentContextServices.ObjectReference ref)
          Update the object referenced by ref, recreating it with this state,
 void validate(int mode)
          Validate al statetes en the context.
 
Methods inherited from interface org.gvsig.tools.persistence.PersistentContext
addError, getErrors, iterator
 

Method Detail

setRootId

void setRootId(PersistentIdentifier id)

getRoot

PersistentContextServices.ObjectReference getRoot()
                                                  throws PersistenceException
Throws:
PersistenceException

get

PersistentContextServices.ObjectReference get(PersistentIdentifier id)
Return the object reference associated to the id indicated as parameter. Can't create a new object reference for the passed object if it not exists. If not has object reference associated to the id passed return null.

Parameters:
id -
Returns:
the object reference or null.

get

PersistentContextServices.ObjectReference get(Object obj)
Return the object reference associated to the object passed as parameter. Can't create a new object reference for the passed object if it not exists. If not has object reference associated to the id passed return null.

Parameters:
obj -
Returns:
the object reference or null.

get

PersistentContextServices.ObjectReference get(PersistentState state)
                                              throws PersistenceException
Return the object reference associated to the state passed as parameter. If not exists an object reference associated to the state, then a new object reference is created, registered and returned. Don't modify or update the object in the reference, it can be null.

Parameters:
state -
Returns:
Throws:
PersistenceException

update

void update(PersistentContextServices.ObjectReference ref)
            throws PersistenceException
Update the object referenced by ref, recreating it with this state,

Parameters:
ref -
Throws:
PersistenceException

add

PersistentContextServices.ObjectReference add(PersistentState state,
                                              Object obj)
                                              throws PersistenceException
Add a reference to the object associated to the state. If reference already exits and obj not is null, it is updated with obj. If obj is null, the add the object reference with the state and the object to null. Return the created or updated object reference.

Parameters:
state -
obj -
Returns:
the object reference.
Throws:
PersistenceException

add

PersistentContextServices.ObjectReference add(PersistentIdentifier id)
                                              throws PersistenceException
Add a new reference associated to the identifier passed as parameter. If already exists an object reference for this id, return this.

Parameters:
id -
Returns:
Throws:
PersistenceException

clear

void clear()
Clear the instances of references previously recreated


getState

PersistentState getState(Integer id)
                         throws PersistenceException
Deprecated. 

Throws:
PersistenceException

getState

PersistentState getState(Object obj)
                         throws PersistenceException
Deprecated. 

Throws:
PersistenceException

getId

PersistentIdentifier getId(Object obj)
                           throws PersistenceException
Deprecated. 

Return the id associated to the object passed as parameter. If object is not loaded, all objects in context are loaded.

Parameters:
obj -
Returns:
id of the object.
Throws:
PersistenceException

getObject

Object getObject(Integer id)
                 throws PersistenceException
Deprecated. 

Throws:
PersistenceException

getNewIdentifier

PersistentIdentifier getNewIdentifier()
Get a valid new persistent identifier.

Returns:
the identifier

getIdentifier

PersistentIdentifier getIdentifier(String id)
                                   throws PersistenceException
Create a new identifier based on the string passed as parameter and return this. Throws a exception if the identifier passed as parameter has conflict with another identifier.

Parameters:
id -
Returns:
Throws:
PersistenceException

setCollectErrors

void setCollectErrors(boolean collectErrors)
Set flag to collect errors. If this flags is true, all errors in sets in state, or in saveToState are collected for throw later.

Parameters:
collectErrors -

getCollectErrors

boolean getCollectErrors()
Get information about if collect errors or launch it when produce.

Returns:

validate

void validate(int mode)
              throws PersistenceValidateExceptions
Validate al statetes en the context.

Throws:
PersistenceValidateExceptions


Copyright © 2004-2011 gvSIG. All Rights Reserved.