Dekoh platform API

dekoh.portal.fwk.persistence
Class DigitalObject

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

public class DigitalObject
extends Object

DigitalObject holds the metadata of the content being managed by Dekoh application. Content applications are expected to extend this Class to define the Digital object they intend deal with.

For example a content application that manages music on client's desktop will define Song class by extending this class.

Instead of extending DigitalObject one may add String name-value pairs to every instance.

Instances of DigitalObjects are made manageable entities by calling DIOEntityManager.persist(Object). DIOEntityManager can also be used to query for stored DigitalObjects.

Since:
Sep 19, 2006
See Also:
DIOEntityManager

Field Summary
protected  Timestamp addTime
           
protected  Timestamp contentCreationTime
           
protected  String description
           
protected  int id
           
protected  int isProtected
           
protected  Timestamp lastUpdated
           
protected  String name
           
protected  LocalUser owner
           
protected  String type
           
 
Constructor Summary
protected DigitalObject()
           
  DigitalObject(String applicationId)
           
  DigitalObject(String name, String applicationId)
           
  DigitalObject(String name, String applicationId, LocalUser owner)
           
 
Method Summary
 DIOProperty _getDioProperty(String name)
          Gets a property given a its names.
 Tag addTag(String tag, DIOEntityManager em)
           
 Tag addTag(String tag, DIOEntityManager em, String applicationId)
           
 void addTags(String[] strings, DIOEntityManager em)
           
 void addTags(Tag[] tags)
           
 boolean equals(Object o)
           
 Timestamp getAddTime()
           
 int getCollectionCount(DIOEntityManager em)
          Gets number of collections in which this Digital Object is a member.
 List getCollectionIds(DIOEntityManager em)
          Gets list of collection ids in which this Digital Object is a member.
 Timestamp getContentCreationTime()
           
 String getDescription()
           
 Set getDioCollections()
           
 Set getDioProperties()
          Deprecated. intended to be called by JPA implementations only. Use method DigitalObject._getDioProperty(String) to get a property by its name. Use method DigitalObject.setOrAddDioProperty(java.lang.String, java.lang.String) to create a new Property on this DigitalObject.
 String getDioProperty(String name)
           
 DioCollection getFirstCollection(DIOEntityManager em)
          Gets the first collection in which this Digital Object is a member.
 int getId()
           
 DioCollection getLastCollection(DIOEntityManager em)
          Gets the last collection in which this Digital Object is a member.
 Timestamp getLastUpdated()
           
 String getName()
           
 LocalUser getOwner()
          Owner of this digitalObject.
 Rating getRating()
           
 String[] getTagNames()
           
 Set getTags()
           
 String getType()
           
 int hashCode()
           
 int isProtected()
          A DigitalObject marked protected cannot be accessed by users other than the owner, even if its part of a Share
 void remove(DIOEntityManager dioEntityManager)
           
 void remove(DIOEntityManager dioEntityManager, boolean modifyParentsPreview)
           
 void removeTag(String tagToRemove, DIOEntityManager em, String applicationId)
           
 void removeTag(Tag tagToRemove)
           
 void removeTags(String tagsToRemove)
           
 void setAddTime(Timestamp addTime)
           
 void setContentCreationTime(Timestamp contentCreationTime)
           
 void setDescription(String desc)
           
 void setDioProperties(Set dioProperties)
          Deprecated. intended to be called by JPA implementations only. Use method DigitalObject.setOrAddDioProperty(java.lang.String, java.lang.String) to create a new Property on this DigitalObject.
 void setLastUpdated(Timestamp lastUpdated)
           
 void setName(String name)
           
 DigitalObject setOrAddDioProperty(String name, String value)
          Utility method to set or create a DIOProperty on this DigitalObject.
 void setOwner(LocalUser owner)
           
 void setProtected(int isProtected)
           
 void setRating(Rating rating)
           
 void setTags(Set tags)
           
 void setType(String type)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id

type

protected String type

name

protected String name

description

protected String description

owner

protected LocalUser owner

addTime

protected Timestamp addTime

lastUpdated

protected Timestamp lastUpdated

contentCreationTime

protected Timestamp contentCreationTime

isProtected

protected int isProtected
Constructor Detail

DigitalObject

protected DigitalObject()

DigitalObject

public DigitalObject(String applicationId)

DigitalObject

public DigitalObject(String name,
                     String applicationId)

DigitalObject

public DigitalObject(String name,
                     String applicationId,
                     LocalUser owner)
Method Detail

setType

public void setType(String type)

setName

public void setName(String name)

setDescription

public void setDescription(String desc)

setOwner

public void setOwner(LocalUser owner)

setTags

public void setTags(Set tags)

getId

public int getId()

getType

public String getType()

getName

public String getName()

getDescription

public String getDescription()

getOwner

public LocalUser getOwner()
Owner of this digitalObject. Value can be NULL. NULL indicates that this DigitalObject can be accessed by all local users.

Returns:
local user if set null if not

getAddTime

public Timestamp getAddTime()

getLastUpdated

public Timestamp getLastUpdated()

getContentCreationTime

public Timestamp getContentCreationTime()

setContentCreationTime

public void setContentCreationTime(Timestamp contentCreationTime)

setAddTime

public void setAddTime(Timestamp addTime)

setLastUpdated

public void setLastUpdated(Timestamp lastUpdated)

getRating

public Rating getRating()
Returns:
gets the rating chosen by the owner of this digital object.

setRating

public void setRating(Rating rating)

isProtected

public int isProtected()
A DigitalObject marked protected cannot be accessed by users other than the owner, even if its part of a Share

Returns:
true if this DIO is marked protected.

setProtected

public void setProtected(int isProtected)

setOrAddDioProperty

public DigitalObject setOrAddDioProperty(String name,
                                         String value)
Utility method to set or create a DIOProperty on this DigitalObject. If this DigitalObject already has a property by the given name calling this method will change the value to the new value. If no proeprty by given name exists a new DioProperty is created.

Parameters:
name - name of the property
value - value of the property
Returns:
returns this DigitalObject for 'fluent' coding.

getDioProperty

public String getDioProperty(String name)
Parameters:
name -
Returns:
value of the DioProperty Associated with this name

_getDioProperty

public DIOProperty _getDioProperty(String name)
Gets a property given a its names.

Parameters:
name -
Returns:
null if no property by given name is set on this digital Object.

getDioProperties

public Set getDioProperties()
Deprecated. intended to be called by JPA implementations only. Use method DigitalObject._getDioProperty(String) to get a property by its name. Use method DigitalObject.setOrAddDioProperty(java.lang.String, java.lang.String) to create a new Property on this DigitalObject.


setDioProperties

public void setDioProperties(Set dioProperties)
Deprecated. intended to be called by JPA implementations only. Use method DigitalObject.setOrAddDioProperty(java.lang.String, java.lang.String) to create a new Property on this DigitalObject.


getDioCollections

public Set getDioCollections()

getTags

public Set getTags()

getTagNames

public String[] getTagNames()

addTags

public void addTags(Tag[] tags)

addTags

public void addTags(String[] strings,
                    DIOEntityManager em)

addTag

public Tag addTag(String tag,
                  DIOEntityManager em)
Parameters:
tag - - tagname
em - - DIOEntityManager
Returns:
- returns created Tag

addTag

public Tag addTag(String tag,
                  DIOEntityManager em,
                  String applicationId)

removeTag

public void removeTag(String tagToRemove,
                      DIOEntityManager em,
                      String applicationId)

removeTag

public void removeTag(Tag tagToRemove)

removeTags

public void removeTags(String tagsToRemove)

remove

public void remove(DIOEntityManager dioEntityManager)

remove

public void remove(DIOEntityManager dioEntityManager,
                   boolean modifyParentsPreview)

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getCollectionCount

public int getCollectionCount(DIOEntityManager em)
Gets number of collections in which this Digital Object is a member.

Parameters:
em -
Returns:
count

getCollectionIds

public List getCollectionIds(DIOEntityManager em)
Gets list of collection ids in which this Digital Object is a member.

Parameters:
em -
Returns:
list of collection ids

getFirstCollection

public DioCollection getFirstCollection(DIOEntityManager em)
Gets the first collection in which this Digital Object is a member.

Parameters:
em -
Returns:
DioCollection

getLastCollection

public DioCollection getLastCollection(DIOEntityManager em)
Gets the last collection in which this Digital Object is a member.

Parameters:
em -
Returns:
DioCollection

Dekoh platform API

© 2009 Pramati Technologies - Dekoh - Portal for Developers