org.imixs.workflow.jee.jpa
Class Entity

java.lang.Object
  extended by org.imixs.workflow.jee.jpa.Entity
All Implemented Interfaces:
Serializable

@Entity
public class Entity
extends Object
implements Serializable

This Entity ejb is a wrapper class for the org.imixs.workflow.ItemCollection which is used in all Imixs Workflow Interfaces. The Entity is used by the EntityServiceBean to store ItemCollections into a database using the JEE Java Persistence API. Each Entity contains a universal unique ID to identify the Entity. Also the Entiy supports the additional properties

The creation time represents the point of time where the ItemCollection was first saved by the EntityService to the Database. The modify property represents the point of time where the ItemCollection was last saved by the EntityService. The type property is used to categorize entities in a database. This property is used by the save() method of the EntityServiceBean. So if an ItemCollection contains the attriubte 'type' the value will be automatically mapped to the type property. The properties read- and writeAccess containing the current access restrictions to an ItemCollection managed by the EntityService.

The data attribute is used to hold the ItemCollection data. It is mapped by a OR-Mapper to a large object (Lob). There is no way to query single attributes using the EJB Query Language. To support the powerful EJB Query language the Entity contains additional index properties to branch properties of an ItemCollection into onToMany relationships. These are the supported Index properties:

A Client should not work directly with an instance of the Entity EJB or its index Properties. Its recommended to use the EntityService which acts as a session facade to manage instances of ItemCollection in a database system.

Notice: All relationships are marked as FetchType=EAGER. This is because the load and find Methods of the EntiyServiceBean do a clear() call to the PersitenceContext because the implodeEntity() method of the EntityServiceBean will modifies the values of an entity. So the Entity needs to be detached Immediately.

Why did the Entity Table use Join tables to link to OneToMany relationships ?

The default schema-level mapping for unidirectional one-to-many relationships uses a join table, as described in JSR 220 - Section 2.1.8.5. Unidirectional one-to-many relationships may be implemented using one-to-many foreign key mappings, however, such support is not required in this release. Applications that want to use a foreign key mapping strategy for one-to-many relationships should make these relationships bidirectional to ensure portability.

To store the Text-, Integer-, Double- and Calendar- Lists we can not use HashSet because the order in which elements are returned by a HashSet's iterator is not specified. This is the reason why we use Vectors to store the values and check for duplicates manually. So we make sure that values added to the list are not recorded

Version:
1.0
Author:
rsoika
See Also:
EntityService, EntityService, Serialized Form

Constructor Summary
Entity()
          A Entity will be automatically initialized with a unique id and a creation date.
Entity(String aID)
          This constructor allows the creation of an Entity Instance with a default uniqueID
 
Method Summary
 List<CalendarItem> getCalendarItems()
          returns a list of all calendarItems joined to this Entity
 Calendar getCreated()
          returns the creation point of time.
 Map<String,Object> getData()
          returns the data object part of the Entity represented by a java.util.Map
 List<DoubleItem> getDoubleItems()
          returns a list of all doubleItems joined to this Entity
 String getId()
          returns the unique identifier for the Entity.
 List<IntegerItem> getIntegerItems()
          returns a list of all integerItems joined to this Entity
 Calendar getModified()
          returns the last modification point of time
 List<ReadAccess> getReadAccessList()
          ReadAccess list is loaded eager as this need to be check on every access
 List<TextItem> getTextItems()
          returns a list of all textItems joined to this Entity.
 String getType()
          returns the type property of the entity instance.
 Integer getVersion()
           
 List<WriteAccess> getWriteAccessList()
          WrateAccess list is loaded lazy as this a check is only on update method needed
 void setCalendarItems(List<CalendarItem> calendarItems)
           
 void setCreated(Calendar created)
           
 void setData(Map<String,Object> itemCol)
          sets a data object for this Entity.
 void setDoubleItems(List<DoubleItem> doubleItems)
           
protected  void setId(String aID)
           
 void setIntegerItems(List<IntegerItem> integerItems)
           
 void setModified(Calendar modified)
           
 void setReadAccessList(List<ReadAccess> readAccessList)
           
 void setTextItems(List<TextItem> textItems)
           
 void setType(String type)
           
 void setVersion(Integer version)
           
 void setWriteAccessList(List<WriteAccess> writeAccessList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Entity

public Entity()
A Entity will be automatically initialized with a unique id and a creation date.


Entity

public Entity(String aID)
This constructor allows the creation of an Entity Instance with a default uniqueID

Parameters:
aID -
Method Detail

getId

public String getId()
returns the unique identifier for the Entity.

Returns:
universal id

setId

protected void setId(String aID)

getVersion

public Integer getVersion()

setVersion

public void setVersion(Integer version)

getType

public String getType()
returns the type property of the entity instance. This property can be provided by an itemColleciton in the attribute 'type'. Values will be case sensitive!

Returns:
See Also:
EntityService

setType

public void setType(String type)

getCreated

public Calendar getCreated()
returns the creation point of time.

Returns:
time of creation

setCreated

public void setCreated(Calendar created)

getModified

public Calendar getModified()
returns the last modification point of time

Returns:
time of modification

setModified

public void setModified(Calendar modified)

getData

public Map<String,Object> getData()
returns the data object part of the Entity represented by a java.util.Map

Returns:
Map

setData

public void setData(Map<String,Object> itemCol)
sets a data object for this Entity.

Parameters:
data -

getReadAccessList

public List<ReadAccess> getReadAccessList()
ReadAccess list is loaded eager as this need to be check on every access

Returns:
ReadAccess list for the entity

setReadAccessList

public void setReadAccessList(List<ReadAccess> readAccessList)

getWriteAccessList

public List<WriteAccess> getWriteAccessList()
WrateAccess list is loaded lazy as this a check is only on update method needed

Returns:
WriteAccess list for the entity

setWriteAccessList

public void setWriteAccessList(List<WriteAccess> writeAccessList)

getTextItems

public List<TextItem> getTextItems()
returns a list of all textItems joined to this Entity.

Returns:
a collection of TextItem objects

setTextItems

public void setTextItems(List<TextItem> textItems)

getIntegerItems

public List<IntegerItem> getIntegerItems()
returns a list of all integerItems joined to this Entity

Returns:
a collection of IntegerItem objects

setIntegerItems

public void setIntegerItems(List<IntegerItem> integerItems)

getDoubleItems

public List<DoubleItem> getDoubleItems()
returns a list of all doubleItems joined to this Entity

Returns:
a collection of DoubleItem objects

setDoubleItems

public void setDoubleItems(List<DoubleItem> doubleItems)

getCalendarItems

public List<CalendarItem> getCalendarItems()
returns a list of all calendarItems joined to this Entity

Returns:
a collection of CalendarItem objects

setCalendarItems

public void setCalendarItems(List<CalendarItem> calendarItems)


Copyright © 2006-2012 Imixs Software Solutions GmbH. All Rights Reserved.