Dekoh platform API

dekoh.portal.fwk.persistence
Class DioCollection

java.lang.Object
  extended by dekoh.portal.fwk.persistence.DigitalObject
      extended by dekoh.portal.fwk.persistence.DioCollection
Direct Known Subclasses:
TaggedDioCollection

public class DioCollection
extends DigitalObject

DioCollection represents the collection of DigitalObjects organised in a LinkedHashSet. The Policy of organising the DigitaObjects in a collection is left to the Content Application.

Since:
Oct 4, 2006

Field Summary
protected  Set digitalObjects
           
 
Fields inherited from class dekoh.portal.fwk.persistence.DigitalObject
addTime, contentCreationTime, description, id, isProtected, lastUpdated, name, owner, type
 
Constructor Summary
protected DioCollection()
           
  DioCollection(String collectionName, Properties dioProperties, String applicationId)
           
  DioCollection(String collectionName, String applicationId)
           
  DioCollection(String collectionName, String applicationId, int previewDioId, DIOEntityManager em)
          Creates the collection by given name, and sets preview digital object of this collection.
  DioCollection(String collectionName, String applicationId, LocalUser owner)
           
  DioCollection(String collectionName, String applicationId, String aPoprertyName, String propertyValue)
           
  DioCollection(String collectionName, String applicationId, String aPoprertyName, String propertyValue, LocalUser owner)
           
 
Method Summary
 void addDigitalObject(DigitalObject digitalObject)
          Adds a given DigitalObject to this collection.
 int getAllChildrenCount(DIOEntityManager em)
          Gets the number of DigitalObjects in this collection.
 List getChildCollectionIds(DIOEntityManager em)
          Gets dio ids of all collections that are part of this collection.
 int getChildrenCountOfType(Class dioEntityClass, DIOEntityManager em)
          Gets the number of DigitalObjects of type Dio that are part of this collection.
 List getChildrenOfAType(Class dioEntityClass, DIOEntityManager em)
          Gets DigitalObjects of type Dio that are part of this collection.
 List getCollectionChildren(DIOEntityManager em)
          Gets the DioCollections that are part of this collection.
 List getCollectionChildren(DIOEntityManager em, Class clazz)
          Deprecated. extending DioCollection is not needed, as each "type" can be qualified by applicationId
 int getCollectionChildrenCount(DIOEntityManager em)
          Gets the count of DioCollections that are part of this collection.
 DigitalObject getDigitalObject(Class entityClass, int id)
           
 DigitalObject getDigitalObject(int dioId)
           
 Page getDigitalObjectPage(DIOEntityManager em, Class cls, int pageNumber, int pageSize)
          Gets the Page Page Object for the current collection.
 Page getDigitalObjectPage(DIOEntityManager em, Class cls, int pageNumber, int pageSize, Query childDioPaginatedQuery)
           
 Set getDigitalObjects()
          Deprecated. use DioCollection.getDigitalObjectPage(DIOEntityManager,Class,int,int)
 DioCollection getFirstChildCollection(DIOEntityManager em)
           
 int getFirstChildDigitalObjectId(DIOEntityManager em)
           
 int getFirstChildDigitalObjectId(DIOEntityManager em, Query findChildren)
           
 List getNonCollectionChildren(DIOEntityManager em)
          Gets the list of non-collection children whose DType is not DioCollection
 List getNonCollectionChildren(DIOEntityManager em, Query query)
           
 int getNonCollectionChildrenCount(DIOEntityManager em)
          Gets the count of DigitalObjects that are not of type DioCollection.
 List getNonCollectionChildrenIds(DIOEntityManager em)
          Gets dio ids of all digital objects(except sub collections) that are part of this collection.
 List getNonCollectionChildrenIds(DIOEntityManager em, Query findNonCollectionChildrenIds)
           
 Query getNonCollectionChildrenQuery(DIOEntityManager em)
           
 DigitalObject getPreviewDigitalObject(DIOEntityManager em, Class cls)
           
 DioCollectionQueryInterface.DioWithAccessPath getPreviewDigitalObjectAcessPath(AccessPath collectionAccessPath, DIOEntityManager em, Class cls)
           
 String getSortPref()
           
 Properties getTemplateProperties()
          Gets the diocollection properties
 Iterator iterator()
           
 boolean removeDigitalObject(DigitalObject digitalObject)
           
 void replacePreviewDioInCollectionHierarchy(DigitalObject oldPreviewDio, DIOEntityManager em)
           
 void replacePreviewDioInCollectionHierarchy(DigitalObject oldPreviewDio, Query newPreviewDioQuery, DIOEntityManager em)
          Changes the preview of a DioCollection and of all the collection this collection is a part of.
 void setDigitalObjects(Set digitalObjects)
           
 void setOrAddTemplateProperties(Properties templateProperties)
          Set or changes the template properties to the current collection
 void setPreviewDioInCollectionHierarchy(int childDioRepresntingPreview, DIOEntityManager em)
           
 
Methods inherited from class dekoh.portal.fwk.persistence.DigitalObject
_getDioProperty, addTag, addTag, addTags, addTags, equals, getAddTime, getCollectionCount, getCollectionIds, getContentCreationTime, getDescription, getDioCollections, getDioProperties, getDioProperty, getFirstCollection, getId, getLastCollection, getLastUpdated, getName, getOwner, getRating, getTagNames, getTags, getType, hashCode, isProtected, remove, remove, removeTag, removeTag, removeTags, setAddTime, setContentCreationTime, setDescription, setDioProperties, setLastUpdated, setName, setOrAddDioProperty, setOwner, setProtected, setRating, setTags, setType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

digitalObjects

protected Set digitalObjects
Constructor Detail

DioCollection

protected DioCollection()

DioCollection

public DioCollection(String collectionName,
                     String applicationId,
                     LocalUser owner)

DioCollection

public DioCollection(String collectionName,
                     String applicationId,
                     String aPoprertyName,
                     String propertyValue)

DioCollection

public DioCollection(String collectionName,
                     String applicationId,
                     String aPoprertyName,
                     String propertyValue,
                     LocalUser owner)

DioCollection

public DioCollection(String collectionName,
                     String applicationId)

DioCollection

public DioCollection(String collectionName,
                     Properties dioProperties,
                     String applicationId)

DioCollection

public DioCollection(String collectionName,
                     String applicationId,
                     int previewDioId,
                     DIOEntityManager em)
Creates the collection by given name, and sets preview digital object of this collection. If dioId passed is a DioCollection then the preview digital of that collection is copied.

Otherwise, the passed dioId becomes the preview.

Parameters:
collectionName - name of the collection being created
applicationId -
previewDioId -
em -
Throws:
NoSuchEntityException - if there is no DigitalObject with given dioId
Method Detail

getDigitalObject

public DigitalObject getDigitalObject(int dioId)
Parameters:
dioId - primary key of the digital object looking for
Returns:
Digital object entity if it is part of this collection
Throws:
DigitalObjectNotInCollectionException - if the digitalObject by given id does not exist in this collection

getDigitalObject

public DigitalObject getDigitalObject(Class entityClass,
                                      int id)

getDigitalObjects

public Set getDigitalObjects()
Deprecated. use DioCollection.getDigitalObjectPage(DIOEntityManager,Class,int,int)

Consider using DioCollection.addDigitalObject(DigitalObject) to add new DigitalObjects to this collection.

Returns:
current live list of digital objects.

setDigitalObjects

public void setDigitalObjects(Set digitalObjects)

removeDigitalObject

public boolean removeDigitalObject(DigitalObject digitalObject)
Parameters:
digitalObject -
Returns:
true if the collection contained the supplied digital Object

addDigitalObject

public void addDigitalObject(DigitalObject digitalObject)
Adds a given DigitalObject to this collection. this Collection Entity is also set on the given DigitalObject to maintain consistent in-memory model.

Parameters:
digitalObject -
Throws:
AccessDeniedException - if digital object is owned by a user and collection is not owned

iterator

public Iterator iterator()

getAllChildrenCount

public int getAllChildrenCount(DIOEntityManager em)
Gets the number of DigitalObjects in this collection. Since DioCollection is a DigitalObject this count includes the DioCollection that may be part of this collection. gets children count irrespective of dtype (all dtypes).

Parameters:
em -
Returns:
count

getChildrenCountOfType

public int getChildrenCountOfType(Class dioEntityClass,
                                  DIOEntityManager em)
Gets the number of DigitalObjects of type Dio that are part of this collection.

Parameters:
dioEntityClass -
em -
Returns:
count

getCollectionChildrenCount

public int getCollectionChildrenCount(DIOEntityManager em)
Gets the count of DioCollections that are part of this collection. This is equivalent to calling getChildrenCount(DioCollection.class)

Parameters:
em -
Returns:
count

getFirstChildDigitalObjectId

public int getFirstChildDigitalObjectId(DIOEntityManager em)

getFirstChildDigitalObjectId

public int getFirstChildDigitalObjectId(DIOEntityManager em,
                                        Query findChildren)

getNonCollectionChildrenQuery

public Query getNonCollectionChildrenQuery(DIOEntityManager em)

getFirstChildCollection

public DioCollection getFirstChildCollection(DIOEntityManager em)

getPreviewDigitalObjectAcessPath

public DioCollectionQueryInterface.DioWithAccessPath getPreviewDigitalObjectAcessPath(AccessPath collectionAccessPath,
                                                                                      DIOEntityManager em,
                                                                                      Class cls)

getPreviewDigitalObject

public DigitalObject getPreviewDigitalObject(DIOEntityManager em,
                                             Class cls)

setPreviewDioInCollectionHierarchy

public void setPreviewDioInCollectionHierarchy(int childDioRepresntingPreview,
                                               DIOEntityManager em)

getNonCollectionChildrenCount

public int getNonCollectionChildrenCount(DIOEntityManager em)
Gets the count of DigitalObjects that are not of type DioCollection.

Parameters:
em -
Returns:
count

getNonCollectionChildrenIds

public List getNonCollectionChildrenIds(DIOEntityManager em)
Gets dio ids of all digital objects(except sub collections) that are part of this collection.

Parameters:
em -
Returns:
list of collection ids

getNonCollectionChildrenIds

public List getNonCollectionChildrenIds(DIOEntityManager em,
                                        Query findNonCollectionChildrenIds)

getChildCollectionIds

public List getChildCollectionIds(DIOEntityManager em)
Gets dio ids of all collections that are part of this collection.

Parameters:
em -
Returns:
list of collection ids

getChildrenOfAType

public List getChildrenOfAType(Class dioEntityClass,
                               DIOEntityManager em)
Gets DigitalObjects of type Dio that are part of this collection.

Parameters:
dioEntityClass -
em -
Returns:
list of Dio

getCollectionChildren

public List getCollectionChildren(DIOEntityManager em)
Gets the DioCollections that are part of this collection.

Parameters:
em -
Returns:
list of DioCollections

getCollectionChildren

public List getCollectionChildren(DIOEntityManager em,
                                  Class clazz)
Deprecated. extending DioCollection is not needed, as each "type" can be qualified by applicationId

Parameters:
em -
clazz -
Returns:

getTemplateProperties

public Properties getTemplateProperties()
Gets the diocollection properties

Returns:
diocollection template properties

setOrAddTemplateProperties

public void setOrAddTemplateProperties(Properties templateProperties)
Set or changes the template properties to the current collection

Parameters:
templateProperties - template properties

getDigitalObjectPage

public Page getDigitalObjectPage(DIOEntityManager em,
                                 Class cls,
                                 int pageNumber,
                                 int pageSize)
Gets the Page Page Object for the current collection.

Parameters:
em - Entitymanager
cls - DigitalObject class
pageNumber - Page to access, if 0 means get all the digital objects
pageSize - page size
Returns:
Page Page with the above parameters

getDigitalObjectPage

public Page getDigitalObjectPage(DIOEntityManager em,
                                 Class cls,
                                 int pageNumber,
                                 int pageSize,
                                 Query childDioPaginatedQuery)

getNonCollectionChildren

public List getNonCollectionChildren(DIOEntityManager em)
Gets the list of non-collection children whose DType is not DioCollection

Parameters:
em - DIOEntitymanage instance.

getNonCollectionChildren

public List getNonCollectionChildren(DIOEntityManager em,
                                     Query query)

replacePreviewDioInCollectionHierarchy

public void replacePreviewDioInCollectionHierarchy(DigitalObject oldPreviewDio,
                                                   DIOEntityManager em)

replacePreviewDioInCollectionHierarchy

public void replacePreviewDioInCollectionHierarchy(DigitalObject oldPreviewDio,
                                                   Query newPreviewDioQuery,
                                                   DIOEntityManager em)
Changes the preview of a DioCollection and of all the collection this collection is a part of. The change of preview in the parent collection will take effect only if the parent collection's preview is oldPreviewDio.

Parameters:
oldPreviewDio - cannot be null.
newPreviewDioQuery - query to determine the new preview
em -

getSortPref

public String getSortPref()

Dekoh platform API

© 2009 Pramati Technologies - Dekoh - Portal for Developers