@DeclareRoles(value={"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RolesAllowed(value={"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @Deprecated public class EntityService extends Object implements EntityServiceRemote
The Bean holds an instance of an EntityPersistenceManager for the persistence unit 'org.imixs.workflow.jee.ejb' to manage the following Entity EJBs:
The save() method persists any instance of an ItemCollection. If a ItemCollection is saved the first time the EntityServiceBean generates the attribute $uniqueid which will be included in the ItemCollection returned by this method. If a ItemCollection was saved before the method updates the corresponding Entity Object.
The load() and findAllEntities() methods are used to read ItemCollections from the database. The remove() Method deletes a saved ItemCollection from the database.
All methods expect and return Instances of the object org.imixs.workflow.ItemCollection which is no entity EJB. So these objects are not managed by any instance of an EntityPersistenceManager.
A collection of ItemCollections can be read using the findAllEntites() method using EQL syntax.
This EntityServiceBean has methods to brand out different Attributes of a ItemCollection into external properties (TextIndex, IntegerIndex, DoubleIndex, CalendarIndex) With these functionality a client can query a set of ItemCollections later with EJB Query Language (EQL).
To define which attributes should be expended into external properties the Session EJB supports the method addIndex(). This method creates an index entry and ensures that every Entity saved before will be updated and future calls of the save() method will care about the new index to separate attributes into the Index Properties.
So each call of the save method automatically disassemble a ItemCollection into predefined Index properties and stores attributes which have an Index into a corresponding IndexData Object (TextIndex, IntegerIndex, DoubleIndex, CalendarIndex). On the other hand the load() method reassembles the ItemCollection including all attributes form the data property an any external index property. The EntiyService did not allow to access a managed Entity EJB directly. This simplifies the usage as a client works only with ItemCollections and so there is no need to handle managed and detached entity EJB instances.
Additional to the basic functionality to save and load instances of the object org.imixs.workflow.ItemCollection the method also manages the read- and writeAccess for each instance of an ItemCollection. Therefore the save() method scans an ItemCollection for the attributes '$ReadAccess' and '$WriteAccess' and saves these informations into the Entity EJBs ReadAccessEntity and WriteAccessEntity controlled by each instance of the EJB Entity. The EntityServiceBean implementation verifies in each call of the save() load(), remove() and findAllEntities() methods if the current callerPrincipal is granted to the affected entities. If an ItemCollection was saved with read- or writeAccess the access to an Instance of a saved ItemCollection will be protected for a callerPrincipal with missing read- or writeAccess. The default Read- and WriteAccess attributes '$ReadAccess' and '$WriteAccess' can be overwritten by the environment settings 'READ_ACCESS_FIELDS' and 'WRITE_ACCESS_FIELDS'
Some useful links about the oneToMany Relationship http://www.avaje.org/manydatatypes.html http://thomas-schuett.de/2008/11/14/ordered-lists-in-jpa-do-it-yourself/ http: //javaehrsson.blogspot.com/2005/10/ejb3-onetomany-and-orderby-set-versus.html http://forums.java.net/jive/thread.jspa?threadID=30869&start=0&tstart=0
org.imixs.workflow.jee.ejb.EntityPersistenceManager
Modifier and Type | Field and Description |
---|---|
static String |
ACCESSLEVEL_AUTHORACCESS
Deprecated.
|
static String |
ACCESSLEVEL_EDITORACCESS
Deprecated.
|
static String |
ACCESSLEVEL_MANAGERACCESS
Deprecated.
|
static String |
ACCESSLEVEL_NOACCESS
Deprecated.
|
static String |
ACCESSLEVEL_READERACCESS
Deprecated.
|
static String |
INVALID_UNIQUEID
Deprecated.
|
static String |
ISAUTHOR
Deprecated.
|
static String |
OPERATION_NOTALLOWED
Deprecated.
|
static String |
READACCESS
Deprecated.
|
static int |
TYP_CALENDAR
Deprecated.
|
static int |
TYP_DOUBLE
Deprecated.
|
static int |
TYP_INT
Deprecated.
|
static int |
TYP_TEXT
Deprecated.
|
static String |
UNIQUEID
Deprecated.
|
static String |
UNIQUEIDREF
Deprecated.
|
static String |
USER_GROUP_LIST
Deprecated.
|
static String |
WRITEACCESS
Deprecated.
|
Constructor and Description |
---|
EntityService()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
List<ItemCollection> |
_findAllEntities(String query,
int startpos,
int maxcount)
Deprecated.
|
List<String> |
_getUserNameList()
Deprecated.
|
ItemCollection |
_load(String id)
Deprecated.
|
void |
_remove(ItemCollection itemcol)
Deprecated.
|
ItemCollection |
_save(ItemCollection itemcol)
Deprecated.
|
ItemCollection |
_saveByNewTransaction(ItemCollection itemcol)
Deprecated.
|
void |
addIndex(String stitel,
int ityp)
Deprecated.
Adds an Imixs-Entity-Index for a property provided by ItemCollection
objects.
|
void |
backup(String query,
String filePath)
Deprecated.
This method creates a backup of the result set form a JQPL query.
|
int |
countAllEntities(String query)
Deprecated.
The method returns only the count of entities for an an valid jPQL
statement.
|
List<ItemCollection> |
findChildEntities(ItemCollection child,
int start,
int count)
Deprecated.
The method returns a collection of child ItemCollections.
|
ItemCollection |
findParentEntity(ItemCollection child)
Deprecated.
The method returns the parent ItemCollection to a given child
ItemCollection.
|
String |
getAccessRoles()
Deprecated.
Returns additional AccessRoles defined for the EJB instance
|
Boolean |
getDisableOptimisticLocking()
Deprecated.
|
Map<String,Integer> |
getIndices()
Deprecated.
The method returns a Map containing all EntityIndex Key/Type pairs
|
String |
getReadAccessFields()
Deprecated.
Returns additional ReadAccessFields defined for the EJB instance.
|
String |
getWriteAccessFields()
Deprecated.
Returns additional WriteAccessFields defined for the EJB instance.
|
void |
removeIndex(String stitel)
Deprecated.
This method removes an existing Imixs-Entity-Index from the current
indexlist.
|
void |
restore(String filePath)
Deprecated.
This method restores a backup from the file system and imports the
entities into the database.
|
void |
setAccessRoles(String accessRoles)
Deprecated.
|
void |
setDisableOptimisticLocking(Boolean disableOptimisticLocking)
Deprecated.
returns the disable optimistic locking status
|
void |
setReadAccessFields(String readAccessFields)
Deprecated.
|
void |
setWriteAccessFields(String writeAccessFields)
Deprecated.
|
public static final int TYP_TEXT
public static final int TYP_INT
public static final int TYP_DOUBLE
public static final int TYP_CALENDAR
public static final String ACCESSLEVEL_NOACCESS
public static final String ACCESSLEVEL_READERACCESS
public static final String ACCESSLEVEL_AUTHORACCESS
public static final String ACCESSLEVEL_EDITORACCESS
public static final String ACCESSLEVEL_MANAGERACCESS
public static final String UNIQUEID
public static final String UNIQUEIDREF
public static final String READACCESS
public static final String WRITEACCESS
public static final String ISAUTHOR
public static final String USER_GROUP_LIST
public static final String OPERATION_NOTALLOWED
public static final String INVALID_UNIQUEID
public String getAccessRoles()
getAccessRoles
in interface EntityServiceRemote
public void setAccessRoles(String accessRoles)
setAccessRoles
in interface EntityServiceRemote
public String getReadAccessFields()
getReadAccessFields
in interface EntityServiceRemote
public void setReadAccessFields(String readAccessFields)
setReadAccessFields
in interface EntityServiceRemote
public String getWriteAccessFields()
getWriteAccessFields
in interface EntityServiceRemote
public void setWriteAccessFields(String writeAccessFields)
setWriteAccessFields
in interface EntityServiceRemote
public void setDisableOptimisticLocking(Boolean disableOptimisticLocking)
setDisableOptimisticLocking
in interface EntityServiceRemote
public Boolean getDisableOptimisticLocking()
getDisableOptimisticLocking
in interface EntityServiceRemote
@Deprecated public List<String> _getUserNameList()
@Deprecated public ItemCollection _save(ItemCollection itemcol) throws AccessDeniedException
The method throws an AccessDeniedException if the CallerPrincipal is not allowed to save or update the ItemCollection in the database. The CallerPrincipial should have at least the access Role org.imixs.ACCESSLEVEL.AUTHORACCESS
The method returns a the detached itemCollection with the current VersionNumber from the persisted entity. (see issue #145)
_save
in interface EntityServiceRemote
ItemCollection
- to be savedAccessDeniedException
@Deprecated public ItemCollection _saveByNewTransaction(ItemCollection itemcol) throws AccessDeniedException
workitem= sessionContext.getBusinessObject(EntityService.class)
.saveNewTransaction(workitem);
itemcol
- AccessDeniedException
@Deprecated public ItemCollection _load(String id)
The method checks if the CallerPrincipal has read access to ItemCollection stored in the database. If not the method returns null. The method dose not throw an AccessDeniedException if the user is not allowed to read the entity to prevent a aggressor with informations about the existence of that specific ItemCollection.
CallerPrincipial should have at least the access Role org.imixs.ACCESSLEVEL.READACCESS
_load
in interface EntityServiceRemote
id
- - the $unqiueid of the ItemCollection to be loaded@Deprecated public void _remove(ItemCollection itemcol) throws AccessDeniedException
The CallerPrincipial should have at least the access Role org.imixs.ACCESSLEVEL.AUTHORACCESS
Also the method removes all existing relation ships of the entity. This is necessary becaus of the FetchType.LAZY used for most relations.
_remove
in interface EntityServiceRemote
ItemCollection
- to be removedAccessDeniedException
public void addIndex(String stitel, int ityp) throws AccessDeniedException
addIndex
in interface EntityServiceRemote
name
- of a property (not case sensetive)ityp
- - Type of EntityIndexAccessDeniedException
public void removeIndex(String stitel) throws AccessDeniedException
removeIndex
in interface EntityServiceRemote
stitel
- - will be automatical lowercased!AccessDeniedException
public Map<String,Integer> getIndices()
getIndices
in interface EntityServiceRemote
@Deprecated public List<ItemCollection> _findAllEntities(String query, int startpos, int maxcount) throws InvalidAccessException
_findAllEntities
in interface EntityServiceRemote
query
- - JQPL statementstartpos
- - optional start positionmaxcount
- - maximum count of elements to be returnedInvalidAccessException
org.imixs.workfow.jee.jpa.Entity
public int countAllEntities(String query) throws InvalidAccessException
query
- - JQPL statementstartpos
- - optional start positionmaxcount
- - maximum count of elements to be returnedInvalidAccessException
org.imixs.workfow.jee.jpa.Entity
public ItemCollection findParentEntity(ItemCollection child) throws InvalidAccessException
findParentEntity
in interface EntityServiceRemote
childentity
- InvalidAccessException
public List<ItemCollection> findChildEntities(ItemCollection child, int start, int count) throws InvalidAccessException
findChildEntities
in interface EntityServiceRemote
parententity
- startpos
- count
- InvalidAccessException
findParentEntity
public void backup(String query, String filePath) throws IOException
entities
- IOException
public void restore(String filePath) throws IOException
filepath
- IOException
Copyright © 2006–2019 Imixs Software Solutions GmbH. All rights reserved.