Class Collection

All Implemented Interfaces:
Serializable, IBaseEntity, ICoreEntity, IEntity, IHrcManaged<Collection>, IRightManaged, ISortableEntity

@Entity public class Collection extends HrcEntity implements IRightManaged, IHrcManaged<Collection>
Collection are used as hierarchical structured containers for any kind of entity that implement ICollectionManaged. There are 2 ways to structure entities in collections: ComplexEntities that have a type will be grouped in a collection tree per type, other entities have a collection tree for the whole class.

Collections are ComplexEntities and are always IRightManaged (implementing interface IRightManaged). Collections are not type managed, getType() returns null.

See Also:
  • Constructor Details

    • Collection

      public Collection()
      default constructor
    • Collection

      public Collection(Collection source)
      copy constructor
    • Collection

      public Collection(Collection parentCollection, String uri)
    • Collection

      public Collection(Collection parentCollection, String uri, String internalDescription)
  • Method Details

    • getItemClass

      public String getItemClass()
    • setItemClass

      public void setItemClass(String itemClass)
    • getItemType

      public ComplexTypeEntity getItemType()
      For ComplexEntities that have a collection tree per type: store the type in collection
      Returns:
      ComplexTypeEntity
    • setItemType

      public void setItemType(ComplexTypeEntity itemType)
    • getItems

      public List<ComplexEntity> getItems()
      Returns:
      list of ComplexEntity objects "in" this collection. mapped by property EntityBase.collection.
    • setItems

      public void setItems(List<ComplexEntity> items)
    • getLinkedItems

      public List<CollectionToEntity> getLinkedItems()
      used by copy and delete collection
    • getType

      public ComplexTypeEntity getType()
      Description copied from class: ComplexEntity
      override in derived classes, return null if ComplexEntity-subclass is not type managed.
      Specified by:
      getType in class ComplexEntity
    • getUri

      public String getUri()
      The URI of collection, must be unique within the parent collection. Internally it is mapped to externalKey
      Returns:
      String
    • setUri

      public void setUri(String uri)
      set partial URI (last part of collection path) for this collection internally stored in external key. Must be unique within the parent collection
    • setParentCollection

      public void setParentCollection(Collection parent)
      Propagate itemClass and itemType to child collection
    • setParent

      public void setParent(HrcEntity parent)
      Overrides:
      setParent in class HrcEntity
    • setCollection

      public void setCollection(Collection collection)
      override to disable. never set collection on a collection - will result in corrupted data. use setParentCollection(Collection)
      Overrides:
      setCollection in class EntityBase
    • getDisplayPath

      public String getDisplayPath()
      Returns the complete path of uris for this collection. NOTE: Transient, not stored in database, must be set externally
      Returns:
      String
    • setDisplayPath

      public void setDisplayPath(String displayPath)
    • getAllowedRightTypes

      public RightType[] getAllowedRightTypes()
      Description copied from interface: IRightManaged
      give the maximum list of RightTypes that apply for this class.
      Specified by:
      getAllowedRightTypes in interface IRightManaged
      Returns:
      array of enum RightType
      See Also:
    • getHasObjectRights

      public boolean getHasObjectRights()
      Description copied from class: ComplexEntity
      type of ComplexEntity must be attached if exists
      Specified by:
      getHasObjectRights in interface IRightManaged
      Overrides:
      getHasObjectRights in class ComplexEntity
      Returns:
      true if object rights are configured for this ComplexEntity
    • getHrc

      public ComplexEntity getHrc()
      has no special hierarchy object
      Specified by:
      getHrc in class HrcEntity
    • hrcChildren

      public List<Collection> hrcChildren()
      Description copied from interface: IHrcManaged
      typesafe retrieval of HrcEntity children. never return proxies
      Specified by:
      hrcChildren in interface IHrcManaged<Collection>
      Returns:
      typesafe list of children entities or empty list. never null
    • hrcVisibleChildren

      public List<Collection> hrcVisibleChildren()
      Description copied from interface: IHrcManaged
      typesafe retrieval of HrcEntity visible children (filtered on life cycle flag visible)
      never return proxies
      Specified by:
      hrcVisibleChildren in interface IHrcManaged<Collection>
      Returns:
      typesafe list of children entities or empty list. never null
    • hrcParent

      public Collection hrcParent()
      Description copied from interface: IHrcManaged
      typesafe retrieval of HrcEntity parent. never return proxy. use this preferable over getParent() if you want access type special properties or use entity class, instead of safeCast to target type yourself. still use getParent() if you only need the id, cause no need to initialize (load) proxy then
      Specified by:
      hrcParent in interface IHrcManaged<Collection>
      Returns:
      parent entity or null
    • hrcParents

      public List<Collection> hrcParents()
      Description copied from interface: IHrcManaged
      typesafe retrieval of HrcEntity parents. never return proxies. use this if you want access type special properties or use entity class, instead of safeCast to target type yourself
      Specified by:
      hrcParents in interface IHrcManaged<Collection>
      Overrides:
      hrcParents in class HrcEntity
      Returns:
      Parents starting from root up to (but not including) this HrcEntity.
    • hrcPath

      public List<Collection> hrcPath()
      Description copied from interface: IHrcManaged
      typesafe retrieval of HrcEntity parents plus entity itself. never return proxies. use this if you want access type special properties or use entity class, instead of safeCast to target type yourself
      Specified by:
      hrcPath in interface IHrcManaged<Collection>
      Overrides:
      hrcPath in class HrcEntity
      Returns:
      List of ancestors starting with root ancestor and including ourself at the end
      See Also:
    • uriPath

      public List<String> uriPath()