Package ch.ivyteam.ivy.cm
Interface IContentObjectValue
-
- All Superinterfaces:
org.eclipse.core.runtime.IAdaptable
,ch.ivyteam.ivy.cm.IContentManagementEntity
public interface IContentObjectValue extends ch.ivyteam.ivy.cm.IContentManagementEntity
Interface to access information about content object value- Version:
- 10.5.2006, kvg: revised and simplified for 4.0
- API:
- This is a public API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
delete(String user)
Deletes this content object valuevoid
exportContentToFile(File file, String encoding)
Exports the content to a file using the provided character encoding.Date
getChanged()
Gets timestamp for the last change.String
getChangedBy()
Gets the user that has changed this content last time.InputStream
getContentAsBinaryStream()
Gets the content as binary stream.byte[]
getContentAsByteArray()
Allows to get binary content directly as an array of bytes.Reader
getContentAsCharacterStream()
Gets the content as character stream.String
getContentAsString()
Gets the content as string (works for string and text type).IContentObject
getContentObject()
Gets the associated ContentObject (= parent)IContentObjectType
getContentObjectType()
Gets the associated ContentObjectTypeString
getDescription()
Gets the descriptionLocale
getLanguage()
Gets the languageString
getPropertyString()
Gets the property stringDate
getValidFrom()
Deprecated.the valid to/from of cov will be removed without replacement; do not use any moreDate
getValidTo()
Deprecated.the valid to/from of cov will be removed without replacement; do not use any morevoid
importContentFromFile(File file, String encoding, String user)
Import the content from a file.boolean
isDefault()
Return true if this is the default valueboolean
isValid()
Returns true if the entry is valid.void
setContent(InputStream content, int contentLength, String user)
Sets the content from a binary stream.void
setContent(Reader content, int contentLength, String user)
Sets the content from a character stream.void
setContent(String content, String user)
Sets the content from a stringvoid
setDefault(boolean isDefault, String user)
Sets if this value is the default or notvoid
setDescription(String description, String user)
Sets the description.void
setLanguage(Locale language, String user)
Sets the languagevoid
setPropertyString(String propertyString, String user)
Sets the property stringvoid
setValidFrom(Date validFrom, String user)
Deprecated.the valid to/from of cov will be removed without replacement; do not use any morevoid
setValidTo(Date validTo, String user)
Deprecated.the valid to/from of cov will be removed without replacement; do not use any more
-
-
-
Method Detail
-
getDescription
String getDescription()
Gets the description- Returns:
- description (may be empty, but never null)
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setDescription
void setDescription(String description, String user)
Sets the description. If null is given, then empty string will be set- Parameters:
description
- Descriptionuser
- of the user who changes the description (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getLanguage
Locale getLanguage()
Gets the language- Returns:
- language
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setLanguage
void setLanguage(Locale language, String user)
Sets the language- Parameters:
language
- new languageuser
- Name of the user who changes the language (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getValidFrom
@Deprecated Date getValidFrom()
Deprecated.the valid to/from of cov will be removed without replacement; do not use any moreGets the valid from timestamp. Never null.- Returns:
- valid from timestamp (never null)
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setValidFrom
@Deprecated void setValidFrom(Date validFrom, String user)
Deprecated.the valid to/from of cov will be removed without replacement; do not use any moreSets the valid from timestamp. If validFrom is null the current date will be used.- Parameters:
validFrom
- New valid from timestamp. If null is given the current date will be used.user
- Name of the user who changes the valid from (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getValidTo
@Deprecated Date getValidTo()
Deprecated.the valid to/from of cov will be removed without replacement; do not use any moreGets the valid to timestamp, null means foreever- Returns:
- valid to timestamp
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setValidTo
@Deprecated void setValidTo(Date validTo, String user)
Deprecated.the valid to/from of cov will be removed without replacement; do not use any moreSets the valid to timestamp- Parameters:
validTo
- New valid to timestamp, null means foreveruser
- Name of the user who changes the valid to (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getChanged
Date getChanged()
Gets timestamp for the last change. Changes include e.g. touch, setting validity, changing language, or value.- Returns:
- changed timestamp
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getChangedBy
String getChangedBy()
Gets the user that has changed this content last time. It can be null if not set at the recent change operation (see change operations, likesetValidTo(..)
).- Returns:
- user changed by
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getContentObject
IContentObject getContentObject()
Gets the associated ContentObject (= parent)- Returns:
- associated content object
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getContentObjectType
IContentObjectType getContentObjectType()
Gets the associated ContentObjectType- Returns:
- associated content object type
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
isDefault
boolean isDefault()
Return true if this is the default value- Returns:
- true if this is the default value, otherwise false
- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setDefault
void setDefault(boolean isDefault, String user)
Sets if this value is the default or not- Parameters:
isDefault
- Default flaguser
- Name of the user which changes the default (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getPropertyString
String getPropertyString()
Gets the property string- Returns:
- property string, never
null
, if not set ornull
was set, empty string is returned. - Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
setPropertyString
void setPropertyString(String propertyString, String user)
Sets the property string- Parameters:
propertyString
- Property string, can benull
user
- name of the user which changes the property string (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
getContentAsString
String getContentAsString()
Gets the content as string (works for string and text type). If no content exists or if content was set to empty string, thennull
will be returned.- Returns:
- content as string or
null
if no content exists - Throws:
PersistencyException
- if DB access failsUnsupportedOperationException
- if datatype is binary- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getContentAsBinaryStream
InputStream getContentAsBinaryStream()
Gets the content as binary stream. If no content exists, thennull
will be returned.If this content value is a string or text type, then the string/text is UTF-8 encoded in the stream.
- Returns:
- content as binary stream or
null
if no content exists - Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getContentAsCharacterStream
Reader getContentAsCharacterStream()
Gets the content as character stream. If no content exists, thennull
will be returned.- Returns:
- content as character stream or
null
if no content exists - Throws:
PersistencyException
- if DB access failsUnsupportedOperationException
- if datatype of value is not TEXT- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getContentAsByteArray
byte[] getContentAsByteArray()
Allows to get binary content directly as an array of bytes. If no content exists, thennull
will be returned.If this content value is a string or text type, then the string/text is UTF-8 encoded in the byte array.
- Returns:
- the content of this value as a byte array or
null
if no content exists - Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
setContent
void setContent(String content, String user)
Sets the content from a string- Parameters:
content
- The content to set, can benull
user
- Name of the user who sets the content (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access failsUnsupportedOperationException
- if the datatype of this value is not STRING- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setContent
void setContent(InputStream content, int contentLength, String user)
Sets the content from a binary stream. If contentLength is given as 0 (i.e. read all) then the stream will be closed as soon as the content is read, which means that the stream will be closed upon return. If contentLength is > 0 then the stream will still be open when the method returns.- Parameters:
content
- The content to set, can benull
contentLength
- length of the content to read and write (in bytes), 0 -> to enduser
- Name of the user who sets the content (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access failsUnsupportedOperationException
- if the datatype of this value is not BINARY- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setContent
void setContent(Reader content, int contentLength, String user)
Sets the content from a character stream. If contentLength is given as 0 (i.e. read all) then the reader will be closed as soon as the content is read, which means that the reader will be closed upon return. If contentLength is > 0 then the reader will still be open when the method returns.- Parameters:
content
- The content to set, can benull
contentLength
- length of the content to read and write (in chars), 0 -> to enduser
- Name of the user who sets the content (optional, will be used bygetChangedBy()
method )- Throws:
PersistencyException
- if DB access failsUnsupportedOperationException
- if the datatype of this value is not TEXT- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
importContentFromFile
void importContentFromFile(File file, String encoding, String user) throws IOException
Import the content from a file. If this value has a non-image (i.e. non-binary) type, then the encoding of the file will be important. It should thus be provided, if non-binary data is read. If encoding is not provided, the platform's default encoding will be used.- Parameters:
file
- the file to importencoding
- the encoding of the file to be read (may be null, in which case the platform's default encoding will be assumed). if this value's datatype is "image", the encoding will not be considered.user
- the name of the user who imports the content (optional, will be used bygetChangedBy()
method )- Throws:
IOException
- if file could not be readPersistencyException
- if DB access failsUnsupportedEncodingException
- if provided encoding is not supportedUnsupportedOperationException
- if the datatype of this value is neither TEXT nor BINARY- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
exportContentToFile
void exportContentToFile(File file, String encoding) throws IOException, PersistencyException
Exports the content to a file using the provided character encoding. If this value is not a character-based type (i.e. of type "image"), the encoding will be ignored. If no encoding is provided, the platform's default encoding will be used by exporting. If the provided file already exists it will be overwritten.- Parameters:
file
- the file to write toencoding
- the encoding of the file to be written (may be null, in which case the platform's default encoding will be assumed). If this value's datatype is "image", the encoding will be ignored.- Throws:
IOException
- if file could not be readPersistencyException
- if DB access failsUnsupportedEncodingException
- if provided encoding is not supported- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
delete
void delete(String user)
Deletes this content object value- Parameters:
user
- the user who deleted this object (optional, will be used bygetChangedBy()
method)- Throws:
PersistencyException
- if DB access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
isValid
boolean isValid()
Returns true if the entry is valid. False, if the entry is invalid and should no longer be used. E.g. the entry was deleted and this instance should no longer be used.- Returns:
- True if the entry is valid. False, if the entry is invalid.
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
-