net.sourceforge.sconman
Class Content

java.lang.Object
  extended by net.sourceforge.sconman.Content

public class Content
extends java.lang.Object

A content is a typed, categorized, and described document. A content can range from multimedia data, as images, videos, or music files, to text files as HTML or PDF files.

Every content belongs to a project (Project), has a valid type ( ContentType, see getType()) within that project, and is categorized (Category, see getCategory()).

For visibility management, contents have a visibility time range (see getFromDate() and getToDate()), within which the content is "visible". Search operations can look for visible contents, or visible and not visible contents, as desired.

A content is, before all, a described document, so specific information fields can be set for this content (see set(java.lang.String, java.lang.String)).

Finally, where is the content's document file? Look for it at getUri(), relative to the contents repository.

Author:
mikeshadow

Field Summary
protected  java.util.Properties attributes
          Specific content fields for content type
static java.lang.String AUTHOR_ID
          AUTHOR_ID field id
static java.lang.String CATEGORY
          CATEGORY field id
static java.lang.String CONTENTS
          CONTENTS field id
static java.lang.String CREATION_DATE
          CREATION_DATE field id
static java.lang.String FROM_DATE
          FROM_DATE field id
static java.lang.String INDEX_DATE
          INDEX_DATE field id
static java.lang.String MODIFICATION_DATE
          MODIFICATION_DATE field id
static java.text.SimpleDateFormat sdf
          Date formatter
static java.text.SimpleDateFormat sdf_old
          Date formatter
static java.lang.String TO_DATE
          TO_DATE field id
static java.lang.String TYPE
          CTYPE field id
static java.lang.String URI
          URI field id
 
Constructor Summary
Content(ContentType ctype)
          Creates a new Content object.
Content(Project prj, java.io.File file)
          Reads a content from a file
Content(Project prj, java.io.InputStream is)
          Reads a content from an input stream
 
Method Summary
 void addRelatedContent(Content relatedContent)
          Adds a related content
 void addVisibilityDays(int days)
          Add days to the current "toDate"
 boolean canModify(User user)
          Check modify permissions for this content
 boolean canRemove(User user)
          Check remove permissions for this content
 boolean canView(User user)
          Check view permissions for this content
 java.lang.Object clone()
          Clones this content, but doesn't add it to the project.
 Content cloneInCategory(User actor)
          Clones a content in the same category.
 boolean equals(java.lang.Object obj)
          Two contents are equal if both have the same URI
(package private)  java.util.Properties getAttributes()
          Returns the internal attribute map
 java.lang.String getAttributesFilePath()
          Returns content's attribute file path, relative to the repository
static java.lang.String getAttributesFilePath(java.lang.String path)
           
 User getAuthor()
          Retrieves content's author
 java.lang.String getAuthorId()
           
 java.lang.Boolean getBoolean(java.lang.String fieldName)
          Returns a field's value as a Boolean object.
 Category getCategory()
          Returns the category where the content was stored
 java.util.List getContentsRelatedToContent(User user, boolean visible)
          Returns all the contents who are related to this content
 java.util.Date getCreationDate()
          Returns the creation date of the content.
 java.util.Date getDate(java.lang.String fieldName)
          Returns a field's value as a Date object.
 java.lang.String getDefaultFieldValue()
          Returns the default field's value
 java.lang.String getDefaultFieldValue(java.lang.String locale)
          Returns the default field's value
 java.lang.String getDirPath()
          Returns the content's dir path, relative to the filestore
 java.lang.String getEncodedString(java.lang.String fieldName, java.lang.String encoding)
          Returns a field's value as a String encoded with encoding parameter.
 java.lang.String getEncodedString(java.lang.String locale, java.lang.String fieldName, java.lang.String encoding)
          Returns a localized field's value as a String encoded with encoding parameter.
 java.lang.String getFieldsAsString()
          Returns all the non special fields as a long string
 java.lang.String getFileExtension()
          Returns the content file extension.
 java.lang.String getFileName()
          Returns the file id
 java.lang.String getFilePath()
          Return the content's file path, relative to the filestore
 java.lang.Float getFloat(java.lang.String fieldName)
          Returns a field's value as a Float object.
 java.lang.String getFormattedDate(java.lang.String fieldName, java.lang.String formatPattern)
          Returns a field's Date value as a String object formatted.
 java.util.Date getFromDate()
          Returns the visibility start date.
 java.lang.String getFromDate(java.lang.String formatPattern)
          Returns the visibility start date formatted with formatPattern.
 java.util.Date getIndexDate()
          Returns when the content was indexed, or null if the content doesn't comes from the index
(package private)  void getInfo(boolean overrideAttrib, boolean createThumbnail)
           
 java.io.InputStream getInputStream()
          Returns the content's data as an input stream
 java.lang.Integer getInteger(java.lang.String fieldName)
          Returns a field's value as a Integer object.
 Item getItem(java.lang.String fieldName)
          Returns a field's value as a Item object.
 java.lang.String getItemValue(java.lang.String locale, java.lang.String fieldName)
          Returns the internationalized value of a Item object
 java.util.Date getModificationDate()
           
 java.lang.String getModificationDate(java.lang.String formatPattern)
          Returns the last modification date formatted with formatPattern.
 java.io.OutputStream getOutputStream()
          Returns an output channel to write content's data
 Project getProject()
          Returns project
 Content getReferencedContent(User user, java.lang.String fieldName)
          Returns the content referenced by the specified field.
 java.util.List getReferencingContents(User user, java.lang.String ctype, java.lang.String fieldName, boolean visible)
          Returns the contents of a given type that reference this content in the specified field.
 java.util.List getRelatedContents(User user, boolean visible)
          Returns all the contents related for this content
 IRepository getRepository()
          Returns the repository where this content is stored
 java.lang.String getString(java.lang.String fieldName)
          Returns a field's value as a String.
 java.lang.String getString(java.lang.String locale, java.lang.String fieldName)
          Returns a localized field's value as a String.
 java.lang.String getThumbnailFilePath()
          Returns the thumbnail file path
 java.io.InputStream getThumbnailInputStream()
          Returns the content's thumbnail as an input stream
 java.io.OutputStream getThumbnailOutputStream()
          Returns an output channel to write thumbnail
 java.util.Date getToDate()
          Returns the visibility end date.
 java.lang.String getToDate(java.lang.String formatPattern)
          Returns the visibility end date formatted with formatPattern.
 ContentType getType()
          Returns the content's type
 java.lang.String getUri()
          Returns the content's file URI, relative to the contents repository.
(package private)  boolean hasAttributeFile()
          Returns true if the content's attribute file exists
(package private)  boolean hasFile()
          Returns true if the content's file exists
(package private)  boolean hasNewerAttributeFile(java.util.Date date)
          Returns true if the attribute file is newer than the specified date
(package private)  boolean hasNewerFile(java.util.Date date)
          Returns true if the attribute file is newer than the specified date
(package private)  boolean hasThumbnailFile()
          Returns true if the content's thumbnail file exists
 boolean isAuthor(User user)
          Check if user is the author of the Content
(package private)  boolean isIndexed()
          Return true if the content is indexed
 long length()
          Gets the size of the content.
 Content moveTo(User actor, Category cat)
          Moves this content to another category
(package private)  void readAttributes()
          Reads content attributes from associated attribute file
(package private)  void readAttributes(Project prj, java.io.InputStream stream)
          Read attributes from an input stream
(package private)  void readAttributes(java.lang.String filePath)
          Reads content attributes from associated attribute file
(package private)  void remove()
          Removes a content from the repository.
 void remove(User actor)
          Removes a content from the repository.
 void removeRelatedContent(Content relatedContent)
          Removes a related content
(package private)  void save()
          Stores changes in the repository, checking user permissions.
(package private)  void save(java.io.InputStream is)
          Stores changes in the repository
 void save(User user)
          Stores changes in the repository, checking user permissions.
 void save(User actor, java.io.InputStream is)
          Stores changes in the repository, checking user permissions.
 void set(java.lang.String fieldName, java.lang.Boolean value)
          Sets a Boolean field to a given content.
 void set(java.lang.String fieldName, Content refContent)
          Sets a reference field to a given content.
 void set(java.lang.String fieldName, java.util.Date fieldValue)
          Sets a Date value for a descriptor field, specific to this content.
 void set(java.lang.String fieldName, java.lang.Float value)
          Sets a Float field to a given content.
 void set(java.lang.String fieldName, java.lang.Integer value)
          Sets a Integer field to a given content.
 void set(java.lang.String fieldName, Item item)
          Sets a Itemvalue field to a given content.
 void set(java.lang.String fieldName, java.lang.String fieldValue)
          Sets a String value for a descriptor field, specific to this content.
 void set(java.lang.String locale, java.lang.String fieldName, java.lang.String fieldValue)
          Sets an internationalized text field
 void setAuthorId(java.lang.String authorId)
           
 void setCategory(Category cat)
          Sets the content's category
 void setCreationDate(java.util.Date creationDate)
          Sets creation date of the content.
 void setFormattedDate(java.lang.String fieldName, java.lang.String date, java.lang.String formatPattern)
          Sets a Date field as a String formatted in formatPattern pattern
 void setFromDate(java.util.Date fromDate)
          Sets the visibility start date, when content will become visible to normal search.
(package private)  void setIndexDate(java.util.Date indexDate)
          Sets the indexation time
 void setModificationDate(java.util.Date modificationDate)
           
 void setToDate(java.util.Date toDate)
          Sets the visibility end date, when the content will become invisible to normal search.
 void setType(ContentType ctype)
          Sets the content's type
 void setUri(java.lang.String uri)
          Sets the content URI.
 void sync()
          Synchronized attributes file
 java.lang.String toString()
           
(package private)  void writeAttributes()
          Stores content attributes
(package private)  void writeAttributes(java.io.OutputStream os)
          Write attributes on an output stream
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INDEX_DATE

public static final java.lang.String INDEX_DATE
INDEX_DATE field id

See Also:
Constant Field Values

URI

public static final java.lang.String URI
URI field id

See Also:
Constant Field Values

CATEGORY

public static final java.lang.String CATEGORY
CATEGORY field id

See Also:
Constant Field Values

TYPE

public static final java.lang.String TYPE
CTYPE field id

See Also:
Constant Field Values

AUTHOR_ID

public static final java.lang.String AUTHOR_ID
AUTHOR_ID field id

See Also:
Constant Field Values

CREATION_DATE

public static final java.lang.String CREATION_DATE
CREATION_DATE field id

See Also:
Constant Field Values

MODIFICATION_DATE

public static final java.lang.String MODIFICATION_DATE
MODIFICATION_DATE field id

See Also:
Constant Field Values

FROM_DATE

public static final java.lang.String FROM_DATE
FROM_DATE field id

See Also:
Constant Field Values

TO_DATE

public static final java.lang.String TO_DATE
TO_DATE field id

See Also:
Constant Field Values

CONTENTS

public static final java.lang.String CONTENTS
CONTENTS field id

See Also:
Constant Field Values

sdf

public static final java.text.SimpleDateFormat sdf
Date formatter


sdf_old

public static final java.text.SimpleDateFormat sdf_old
Date formatter


attributes

protected java.util.Properties attributes
Specific content fields for content type

Constructor Detail

Content

Content(ContentType ctype)
Creates a new Content object.

Parameters:
ctype - The content type

Content

public Content(Project prj,
               java.io.InputStream is)
        throws java.io.IOException
Reads a content from an input stream

Parameters:
prj - The project for this content
is - The input stream with the serialized content
Throws:
java.io.IOException

Content

public Content(Project prj,
               java.io.File file)
        throws java.io.IOException
Reads a content from a file

Parameters:
prj - The project for this content
file - The file with the serialized content
Throws:
java.io.IOException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Two contents are equal if both have the same URI

Overrides:
equals in class java.lang.Object

canView

public boolean canView(User user)
Check view permissions for this content

Parameters:
user -
Returns:
true if user can view this content

canModify

public boolean canModify(User user)
Check modify permissions for this content

Parameters:
user -

canRemove

public boolean canRemove(User user)
Check remove permissions for this content

Parameters:
user -

isAuthor

public boolean isAuthor(User user)
Check if user is the author of the Content

Parameters:
user -
Returns:

getAuthor

public User getAuthor()
Retrieves content's author

Returns:
The User object containing the author of the Content

getIndexDate

public java.util.Date getIndexDate()
Returns when the content was indexed, or null if the content doesn't comes from the index

Returns:

setIndexDate

void setIndexDate(java.util.Date indexDate)
Sets the indexation time

Parameters:
indexDate -

getCreationDate

public java.util.Date getCreationDate()
Returns the creation date of the content.

Returns:
The creation date of the content.

getFromDate

public java.util.Date getFromDate()
Returns the visibility start date. This content will be visible since this time, and until getToDate().

Returns:
The visibility start date.

getFromDate

public java.lang.String getFromDate(java.lang.String formatPattern)
Returns the visibility start date formatted with formatPattern. This content will be visible since this time, and until getFromDate().

Parameters:
formatPattern - a SimpleDateFormat valid pattern
Returns:
The visibility start date formatted.

getToDate

public java.util.Date getToDate()
Returns the visibility end date. This content will be visible from getFromDate(), to this date.

Returns:
The visibility end date.

getToDate

public java.lang.String getToDate(java.lang.String formatPattern)
Returns the visibility end date formatted with formatPattern. This content will be visible from getFromDate(), to this date

Parameters:
formatPattern - a SimpleDateFormat valid pattern
Returns:
The visibility end date formatted.

getType

public ContentType getType()
Returns the content's type

Returns:
The content's type

getAuthorId

public java.lang.String getAuthorId()
Returns:
Returns the author user id.

setAuthorId

public void setAuthorId(java.lang.String authorId)
Parameters:
authorId - The author's user id to set.

getModificationDate

public java.util.Date getModificationDate()
Returns:
Returns the modificationDate.

getModificationDate

public java.lang.String getModificationDate(java.lang.String formatPattern)
Returns the last modification date formatted with formatPattern.

Parameters:
formatPattern - a SimpleDateFormat valid pattern
Returns:
The last modification date formatted.

setModificationDate

public void setModificationDate(java.util.Date modificationDate)
Parameters:
modificationDate - The modificationDate to set.

setCreationDate

public void setCreationDate(java.util.Date creationDate)
Sets creation date of the content.

Parameters:
creationDate - Creation date of the content

setFromDate

public void setFromDate(java.util.Date fromDate)
Sets the visibility start date, when content will become visible to normal search.

Parameters:
fromDate - Visibility start date

addVisibilityDays

public void addVisibilityDays(int days)
Add days to the current "toDate"

Parameters:
days -

setToDate

public void setToDate(java.util.Date toDate)
Sets the visibility end date, when the content will become invisible to normal search.

Parameters:
toDate - Visibility end date

setType

public void setType(ContentType ctype)
Sets the content's type

Parameters:
ctype - Content's type

getUri

public java.lang.String getUri()
Returns the content's file URI, relative to the contents repository.

Returns:
The content's file URI

setUri

public void setUri(java.lang.String uri)
Sets the content URI. Be careful with this method and use it only when you are absolutely sure of what you are doing!

Parameters:
uri -

save

void save(java.io.InputStream is)
    throws SCMStorageException
Stores changes in the repository

Throws:
SCMStorageException - Thrown if there's an error while removing the content
SCMSecurityException - Thrown when the user doesn't have the permissions to modify the content's type, or cannot modify the content category

save

void save()
    throws SCMStorageException
Stores changes in the repository, checking user permissions.

Throws:
SCMStorageException - Thrown if there's an error while removing the content
SCMSecurityException - Thrown when the user doesn't have the permissions to modify the content's type, or cannot modify the content category

save

public void save(User actor,
                 java.io.InputStream is)
          throws SCMStorageException,
                 SCMSecurityException
Stores changes in the repository, checking user permissions.

Parameters:
actor - The user that performs the action
is - The new content's data data source
Throws:
SCMStorageException - Thrown if there's an error while saving the content
SCMSecurityException - Thrown when the user doesn't have the permissions to modify the content's type, or cannot modify the content category

save

public void save(User user)
          throws SCMStorageException,
                 SCMSecurityException
Stores changes in the repository, checking user permissions.

Parameters:
actor - The user that performs the action
Throws:
SCMStorageException - Thrown if there's an error while removing the content
SCMSecurityException - Thrown when the user doesn't have the permissions to modify the content's type, or cannot modify the content category

remove

void remove()
      throws SCMStorageException
Removes a content from the repository. The argument content should come from a search operation.

Parameters:
user - The user who tries to remove content
content - The content to remove
Throws:
SCMException - Thrown if there's an error while removing the content
SCMStorageException

remove

public void remove(User actor)
            throws SCMSecurityException,
                   SCMStorageException
Removes a content from the repository. The argument content should come from a search operation.

Parameters:
actor - The user who tries to remove content
content - The content to remove
Throws:
SCMException - Thrown if there's an error while removing the content
SCMSecurityException
SCMStorageException

moveTo

public Content moveTo(User actor,
                      Category cat)
               throws SCMStorageException,
                      SCMSecurityException
Moves this content to another category

Parameters:
actor - The user that performs the action
cat - The new category
Throws:
SCMStorageException - Thrown if there's a problem changing category
SCMSecurityException - Thrown if the actor hasn't enough permissions

set

public void set(java.lang.String fieldName,
                java.lang.String fieldValue)
Sets a String value for a descriptor field, specific to this content. Use getString(java.lang.String)to retrieve values set with this method.

Parameters:
fieldName - The descriptor field to set
fieldValue - The new value

set

public void set(java.lang.String locale,
                java.lang.String fieldName,
                java.lang.String fieldValue)
Sets an internationalized text field

Parameters:
locale -
fieldName -
fieldValue -

set

public void set(java.lang.String fieldName,
                java.util.Date fieldValue)
Sets a Date value for a descriptor field, specific to this content. Use getDate(java.lang.String)to retrieve values set with this method.

Parameters:
fieldName - The descriptor field to set
fieldValue - The new value

set

public void set(java.lang.String fieldName,
                Content refContent)
Sets a reference field to a given content. Use #getContentto retrieve references set with this method

Parameters:
fieldName - The field to set
refContent - The referenced content

set

public void set(java.lang.String fieldName,
                java.lang.Integer value)
Sets a Integer field to a given content. Use getInteger(java.lang.String)to retrieve values set with this method

Parameters:
fieldName - The field to set
value - The new value

set

public void set(java.lang.String fieldName,
                java.lang.Float value)
Sets a Float field to a given content. Use getFloat(java.lang.String)to retrieve values set with this method

Parameters:
fieldName - The field to set
value - The new value

set

public void set(java.lang.String fieldName,
                java.lang.Boolean value)
Sets a Boolean field to a given content. Use getBoolean(java.lang.String)to retrieve values set with this method

Parameters:
fieldName - The field to set
value - The new value

set

public void set(java.lang.String fieldName,
                Item item)
Sets a Itemvalue field to a given content. Use getItem(java.lang.String) to retrieve Itemset with this method

Parameters:
fieldName - The field to set
Item - The new Itemvalue

getDefaultFieldValue

public java.lang.String getDefaultFieldValue()
Returns the default field's value

Returns:

getDefaultFieldValue

public java.lang.String getDefaultFieldValue(java.lang.String locale)
Returns the default field's value

Returns:

getString

public java.lang.String getString(java.lang.String fieldName)
Returns a field's value as a String. This method should be used for fields stored with set(String,String)

Parameters:
fieldName - Field id
Returns:
The field's value

getString

public java.lang.String getString(java.lang.String locale,
                                  java.lang.String fieldName)
Returns a localized field's value as a String. This method should be used for fields stored with set(String,String)

Parameters:
fieldName - Field id
Returns:
The field's value

getEncodedString

public java.lang.String getEncodedString(java.lang.String fieldName,
                                         java.lang.String encoding)
Returns a field's value as a String encoded with encoding parameter. This method should be used for fields stored with set(String,String)

Parameters:
fieldName - Field id
encoding - Valid encoding type "UTF-8", "ISO-8859-1", ...
Returns:
The field's value

getEncodedString

public java.lang.String getEncodedString(java.lang.String locale,
                                         java.lang.String fieldName,
                                         java.lang.String encoding)
Returns a localized field's value as a String encoded with encoding parameter. This method should be used for fields stored with set(String,String)

Parameters:
fieldName - Field id
encoding - Valid encoding type "UTF-8", "ISO-8859-1", ...
Returns:
The field's value

getDate

public java.util.Date getDate(java.lang.String fieldName)
Returns a field's value as a Date object. An exception will be thrown if the value cannot be converted to a date object. This method works fine with field values set with set(String,Date).

Parameters:
fieldName - Field id.
Returns:
The field's value

getFormattedDate

public java.lang.String getFormattedDate(java.lang.String fieldName,
                                         java.lang.String formatPattern)
Returns a field's Date value as a String object formatted.

Parameters:
fieldName - Field id
formatPattern - a SimpleDateFormat valid pattern
Returns:
The field's Date value as String in formatPattern

setFormattedDate

public void setFormattedDate(java.lang.String fieldName,
                             java.lang.String date,
                             java.lang.String formatPattern)
Sets a Date field as a String formatted in formatPattern pattern

Parameters:
fieldName - Field id
date - String representing the Date in formatPattern pattern
formatPattern - a SimpleDateFormat valid pattern

getInteger

public java.lang.Integer getInteger(java.lang.String fieldName)
Returns a field's value as a Integer object. An exception will be thrown if the value cannot be converted to a Integer object. This method works fine with field values set with set(String,Integer).

Parameters:
fieldName - Field id.
Returns:
The field's value

getFloat

public java.lang.Float getFloat(java.lang.String fieldName)
Returns a field's value as a Float object. An exception will be thrown if the value cannot be converted to a Float object. This method works fine with field values set with set(String,Float).

Parameters:
fieldName - Field id.
Returns:
The field's value

getBoolean

public java.lang.Boolean getBoolean(java.lang.String fieldName)
Returns a field's value as a Boolean object. This method works fine with field values set with set(String,Boolean).

Parameters:
fieldName - Field id.
Returns:
The field's value

getItem

public Item getItem(java.lang.String fieldName)
Returns a field's value as a Item object. This method works fine with field values set with set(String,Item).

Parameters:
fieldName - Field id.
Returns:
The field's Item value

getItemValue

public java.lang.String getItemValue(java.lang.String locale,
                                     java.lang.String fieldName)
Returns the internationalized value of a Item object

Parameters:
locale - The current locale
fieldName - The field's name
Returns:
The internationalized field's Item value

getReferencedContent

public Content getReferencedContent(User user,
                                    java.lang.String fieldName)
                             throws SCMStorageException,
                                    SCMSecurityException
Returns the content referenced by the specified field. This method works fine with field values set with set(String,Content).

Parameters:
user - The user that requests the referenced content
fieldName - Field id.
Returns:
The referenced content
Throws:
SCMStorageException
SCMSecurityException

getReferencingContents

public java.util.List getReferencingContents(User user,
                                             java.lang.String ctype,
                                             java.lang.String fieldName,
                                             boolean visible)
                                      throws java.io.IOException,
                                             SCMException
Returns the contents of a given type that reference this content in the specified field.

Parameters:
ctype - The type of the requested contents
fieldName - The field id that references this content's type
visible - True to filter non visible contents
Returns:
The results
Throws:
java.io.IOException - If there's an IO problem
SCMException

getRelatedContents

public java.util.List getRelatedContents(User user,
                                         boolean visible)
                                  throws SCMStorageException,
                                         SCMSecurityException
Returns all the contents related for this content

Parameters:
user - The user who requests the related contents
Returns:
Throws:
SCMStorageException
SCMSecurityException

getContentsRelatedToContent

public java.util.List getContentsRelatedToContent(User user,
                                                  boolean visible)
                                           throws SCMStorageException,
                                                  SCMSecurityException
Returns all the contents who are related to this content

Parameters:
user - The user who requests the related contents
Returns:
Throws:
SCMStorageException
SCMSecurityException

addRelatedContent

public void addRelatedContent(Content relatedContent)
                       throws SCMStorageException
Adds a related content

Parameters:
relatedContent -
Throws:
SCMStorageException

removeRelatedContent

public void removeRelatedContent(Content relatedContent)
                          throws SCMStorageException
Removes a related content

Parameters:
relatedContent -
Throws:
SCMStorageException

getCategory

public Category getCategory()
Returns the category where the content was stored

Returns:
The category where the content can be found

setCategory

public void setCategory(Category cat)
Sets the content's category

Parameters:
cat - A valid category

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns the content's data as an input stream

Returns:
The content's data as an input stream
Throws:
java.io.IOException - If there's an IO problem

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Returns an output channel to write content's data

Returns:
An output stream to set the content's data
Throws:
java.io.IOException - If there's an IO problem

getThumbnailInputStream

public java.io.InputStream getThumbnailInputStream()
                                            throws java.io.IOException
Returns the content's thumbnail as an input stream

Returns:
The content's thumbnail as an input stream
Throws:
java.io.IOException - If there's an IO problem

getThumbnailOutputStream

public java.io.OutputStream getThumbnailOutputStream()
                                              throws java.io.IOException
Returns an output channel to write thumbnail

Returns:
An output stream to set the thumbnail
Throws:
java.io.IOException - If there's an IO problem

getFileExtension

public java.lang.String getFileExtension()
Returns the content file extension.

Returns:
A valid file extension for the content type.

getFileName

public java.lang.String getFileName()
Returns the file id

Returns:
The file id

getRepository

public IRepository getRepository()
Returns the repository where this content is stored

Returns:

getFilePath

public java.lang.String getFilePath()
Return the content's file path, relative to the filestore

Parameters:
content -
Returns:

getDirPath

public java.lang.String getDirPath()
Returns the content's dir path, relative to the filestore

Parameters:
content -
Returns:

writeAttributes

void writeAttributes(java.io.OutputStream os)
               throws java.io.IOException
Write attributes on an output stream

Parameters:
os -
Throws:
java.io.IOException

readAttributes

void readAttributes(Project prj,
                    java.io.InputStream stream)
              throws java.io.IOException
Read attributes from an input stream

Parameters:
stream -
Throws:
java.io.IOException

writeAttributes

void writeAttributes()
               throws SCMStorageException
Stores content attributes

Throws:
SCMStorageException - Thrown if there's an exception writting the attribute file

readAttributes

void readAttributes()
              throws SCMStorageException
Reads content attributes from associated attribute file

Throws:
SCMStorageException - Thrown if there's an exception reading the attribute file

readAttributes

void readAttributes(java.lang.String filePath)
              throws SCMStorageException
Reads content attributes from associated attribute file

Throws:
SCMStorageException - Thrown if there's an exception reading the attribute file

getThumbnailFilePath

public java.lang.String getThumbnailFilePath()
Returns the thumbnail file path

Returns:
Path to the content's thumbnail relative to the repository

getAttributesFilePath

public java.lang.String getAttributesFilePath()
Returns content's attribute file path, relative to the repository

Returns:

getAttributesFilePath

public static java.lang.String getAttributesFilePath(java.lang.String path)

isIndexed

boolean isIndexed()
            throws SCMStorageException
Return true if the content is indexed

Returns:
Throws:
SCMStorageException

hasFile

boolean hasFile()
Returns true if the content's file exists

Returns:

hasNewerFile

boolean hasNewerFile(java.util.Date date)
Returns true if the attribute file is newer than the specified date

Parameters:
date -
Returns:

hasAttributeFile

boolean hasAttributeFile()
Returns true if the content's attribute file exists

Returns:

hasNewerAttributeFile

boolean hasNewerAttributeFile(java.util.Date date)
Returns true if the attribute file is newer than the specified date

Parameters:
date -
Returns:

hasThumbnailFile

boolean hasThumbnailFile()
Returns true if the content's thumbnail file exists

Returns:

getProject

public Project getProject()
Returns project

Returns:

sync

public void sync()
          throws SCMStorageException
Synchronized attributes file

Throws:
java.io.IOException
SCMStorageException

getInfo

void getInfo(boolean overrideAttrib,
             boolean createThumbnail)

length

public long length()
Gets the size of the content. This size is the addition of the file size, thumbnail file size, and attributes file size

Returns:
The content size

getAttributes

java.util.Properties getAttributes()
Returns the internal attribute map

Returns:

clone

public java.lang.Object clone()
Clones this content, but doesn't add it to the project. If the content has a file, you should add it to the project using the input stream of the original content ( Category.addContent(User, Content, InputStream, String)).

Overrides:
clone in class java.lang.Object
Returns:
A clone of this content, ready to be added to the project

cloneInCategory

public Content cloneInCategory(User actor)
                        throws SCMStorageException,
                               SCMSecurityException
Clones a content in the same category. If the content has a file, "copy" will be added to its name.

Returns:
The cloned content
Throws:
SCMStorageException
SCMSecurityException

getFieldsAsString

public java.lang.String getFieldsAsString()
Returns all the non special fields as a long string

Returns:


Copyright null null. All Rights Reserved.