Package ch.ivyteam.ivy.cm
Interface IContentObject
-
- All Superinterfaces:
org.eclipse.core.runtime.IAdaptable
,ch.ivyteam.ivy.cm.IContentManagementEntity
public interface IContentObject extends ch.ivyteam.ivy.cm.IContentManagementEntity
Interface to access information about a content object- 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 Modifier and Type Method Description IContentObject
addChild(String name, String description, CoType type, String user)
Creates a child ContentObject for this ContentObject.IContentObjectValue
addValue(String description, Date validFrom, Date validTo, Locale language, String user, boolean isDefault, String propertyString)
Creates a new value for this ContentObject withhout any content.void
delete()
Deletes this content object and all its children and children's childrenDate
getChanged()
Gets the timestamp of the last changeString
getChangedBy()
Gets the user who changed the object lastIContentObject
getChild(String name)
Get the child with the given name.List<IContentObject>
getChildren()
Gets all children of this content object sorted by the visual orderIContentObjectType
getContentObjectType()
Gets the content object type of this ContentObject.String
getDescription()
Gets the descriptionString
getName()
Gets the nameIContentObject
getParent()
Gets the parent content objectString
getUri()
Gets the uriIContentObjectValue
getValue(Date time, Locale lang)
Get the value with given language, which is valid at the provided time.List<IContentObjectValue>
getValues()
Gets all values of this content object.boolean
hasChildren()
Checks, if this content object has any child objects.boolean
hasValues()
Checks if this content object has any values.boolean
isValid()
Returns true if the entry is valid.void
setDescription(String description, String user)
Sets the description.void
setName(String name, String user)
Sets the name of the content object.void
touch(String user)
Update the "last changed by" date to current time and given user.
-
-
-
Method Detail
-
getName
String getName()
Gets the name- Returns:
- name
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setName
void setName(String name, String user)
Sets the name of the content object. Note that changing a content objects name also changes its uri and the uri of all children and their descendants content objects. Therefore all references to the changed or a descendants content object are going invalid.- Parameters:
name
- the new name of the content objectuser
- the user who changes the name- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
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 description is null, then empty string will be used.- Parameters:
description
- descriptionuser
- the user who changes the description- 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 the timestamp of the last change- 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 who changed the object last- Returns:
- changed by
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getUri
String getUri()
Gets the uri- Returns:
- uri
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getParent
IContentObject getParent()
Gets the parent content object- Returns:
- parent content object of this content object;
null
if this content object is already the root of the CMS - 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 content object type of this ContentObject.- Returns:
- content object type
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
hasChildren
boolean hasChildren()
Checks, if this content object has any child objects. Clients can assume that this method is optimized compared to a check withgetChildren().size() > 0
.- Returns:
- true, if content object has children
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getChildren
List<IContentObject> getChildren()
Gets all children of this content object sorted by the visual order- Returns:
- List with all children
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getChild
IContentObject getChild(String name)
Get the child with the given name.- Parameters:
name
- the name of the child to retrieve- Returns:
- child with the given name or null if name does not exist
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
addChild
IContentObject addChild(String name, String description, CoType type, String user)
Creates a child ContentObject for this ContentObject. If a visual order is to be provided, it should be set using the returned instance.- Parameters:
name
- the name of the child to createdescription
- description (optional)type
- type of the child to createuser
- the user who creates the child- Returns:
- a new ContentObject instance
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
hasValues
boolean hasValues()
Checks if this content object has any values.- Returns:
- true, if values are present, false otherwise
- Throws:
PersistencyException
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getValues
List<IContentObjectValue> getValues()
Gets all values of this content object.- Returns:
- List with all values
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getValue
IContentObjectValue getValue(Date time, Locale lang)
Get the value with given language, which is valid at the provided time. If no time is provided, then the current time will be assumed. For the locale argument, both country and language are considered.If none of the existing values matches the given time restraint then
null
will be returned.If locale is given as fr_CH then a search for a valid Swiss-French value will be performed. If no Swiss-French value exists for the specified time, then the search will be repeated for a any french value, country left aside. If no French value exists either, then the default value of the content object will be returned (or the first found value, if no default is specified or null).
If the default value is returned, the language may not be consistent with the request-parameters.
If multiple (default) values exist, which match with the query, then the first one will be returned.
- Parameters:
time
- optional date/time where value should be valid (if null: assumes current time)lang
- language of value to retrieve- Returns:
- ContentObjectValue in requested language, valid at given time (or default value, if no value for lang exists)
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
addValue
IContentObjectValue addValue(String description, Date validFrom, Date validTo, Locale language, String user, boolean isDefault, String propertyString)
Creates a new value for this ContentObject withhout any content. Content can be set on the returned ContentObjectValue.- Parameters:
description
- description of the valuevalidFrom
- the value is valid fromvalidTo
- the value is valid until, null means foreverlanguage
- the language of the value, if null: use default language of cmsuser
- user which creates the objectisDefault
- flag indicating a default valuepropertyString
- optinal- Returns:
- the created value
- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
delete
void delete()
Deletes this content object and all its children and children's children- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
touch
void touch(String user)
Update the "last changed by" date to current time and given user.- Parameters:
user
- the user to touch with- Throws:
PersistencyException
- if db access fails- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
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.
-
-