com.flexive.shared.content
Class FxContent

java.lang.Object
  extended by com.flexive.shared.content.FxContent
All Implemented Interfaces:
java.io.Serializable

public class FxContent
extends java.lang.Object
implements java.io.Serializable

A content instance

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
static int POSITION_BOTTOM
          Bottommost position for relation positioning
static int POSITION_TOP
          Topmost position for relation positioning
 
Constructor Summary
FxContent(FxPK pk, FxLock lock, long typeId, boolean relation, long mandatorId, long aclId, long stepId, int maxVersion, int liveVersion, boolean active, long mainLanguage, FxPK relatedSource, FxPK relatedDestination, int relatedSourcePosition, int relatedDestinationPosition, LifeCycleInfo lifeCycleInfo, FxGroupData data, long binaryPreviewId, long binaryPreviewACL)
          Constructor
 
Method Summary
 java.lang.String addGroup(java.lang.String XPath)
          Add (or create) another group.
 java.lang.String addGroup(java.lang.String XPath, FxGroupData.AddGroupOptions options)
          Add (or create) another group.
 java.lang.String addValue(java.lang.String XPath, FxValue value)
          Add a value for a XPath.
 java.lang.String addValue(java.lang.String XPath, java.lang.Object value)
          Depending on the underlying FxValue's multilanguage setting set either the default translation or the single language value.
 void checkForceSystemPropertyPermissions()
          Checks if isForceLifeCycle() or isForcePkOnCreate() is set and whether the current user set these flags (only the global supervisor is allowed to specify these).
 void checkValidity()
          Check if all required properties are present and valid, etc.
 FxContent compact()
          Convenience method to compact (=remove all empty groups and properties that are not required).
 boolean containsValue(java.lang.String XPath)
          Check if a value exists for the given XPath that is not empty
 boolean containsXPath(java.lang.String XPath)
          Check if a XPath exists in the content instance.
 FxContent copy()
          Create an independent copy of this FxContent
 FxContent copyAsNewInstance()
          Get an independent copy of this FxContent which is a new instance (can be saved as a copy)
 boolean equals(java.lang.Object obj)
          
 java.util.List<java.lang.Long> getAclIds()
          Return all ACLs assigned to this content.
 java.util.List<java.lang.String> getAllPropertyXPaths()
          Get a list of all property XPaths contained in this content in correct order
 java.util.List<java.lang.String> getAllXPaths(java.lang.String groupPostfix)
          Get a list of all XPaths contained in this content in correct order
 long getBinaryPreviewACL()
          ACL that is needed to view the preview image
 long getBinaryPreviewId()
          Id of the binary used for previews
 FxString getCaption()
          Get the caption value of this instance.
 java.util.List<FxData> getData(java.lang.String XPath)
          Get all FxData (Group or Property) entries for the given XPath.
 FxGroupData getGroupData(long assignmentId)
          Get the FxGroupData entry for the given group assignment.
 FxGroupData getGroupData(java.lang.String XPath)
          Get the FxGroupData entry for the given XPath
 long getId()
          Getter for the Id
 LifeCycleInfo getLifeCycleInfo()
          Get the lifecycle information
 int getLiveVersion()
          Get the live version of this content or 0 if no live version exists
 FxLock getLock()
          Get the lock of this content
 long getMainLanguage()
          Get the main language
 long getMandatorId()
          Getter for the mandator id
 int getMaxIndex(java.lang.String XPath)
          Get the maximum index of the last element of an XPath.
 int getMaxVersion()
          Get the max version of this content
 PermissionSet getPermissions()
          Returns the permission set for the calling user.
 FxPK getPk()
          Getter for the primary key
 java.util.List<FxPropertyData> getPropertyData(long propertyId, boolean includeEmpty)
          Get a list of all FxPropertyData entries that are assigned to propertyId
 FxPropertyData getPropertyData(java.lang.String XPath)
          Get the FxPropertyData entry for the given XPath
 FxPropertyData getPropertyDataCreate(java.lang.String XPath)
          Get the FxPropertyData entry for an XPath and create a new entry if it does not exist yet.
 FxPK getRelatedDestination()
          If this is a relation get the assigned "to" (or destination) instance
 int getRelatedDestinationPosition()
          Get the position for the destination content instance
 FxPK getRelatedSource()
          If this is a relation get the assigned "from" (or source) instance
 int getRelatedSourcePosition()
          Get the position for the source content instance
 FxGroupData getRootGroup()
          Get the (virtual) root group of this content
 long getStepId()
          Getter for the step id
 long getTypeId()
          Getter for the type id
<T extends FxValue>
T
getValue(java.lang.Class<T> clazz, java.lang.String XPath)
          Get the value of a given class (eg FxString) and (property) XPath.
 FxValue getValue(java.lang.String XPath)
          Get the value of a (property) XPath.
<T extends FxValue>
java.util.List<T>
getValues(java.lang.Class<T> clazz, java.lang.String XPath)
          Get all values of a given class (eg FxString) and XPath, ordered by multiplicity.
 java.util.List<FxValue> getValues(java.lang.String XPath)
          Get all values of a given XPath, ordered by multiplicty.
 int getVersion()
          Getter for the version
 boolean hasCaption()
          Check if this content instance has a caption property assigned
 int hashCode()
           
 FxContent initSystemProperties()
           
 boolean isActive()
          Is this content active?
 boolean isForceLifeCycle()
          If true, forces the content engine to use the lifecycle (created at, ...) of the content instance when creating or updating the content, instead of calculating the values.
 boolean isForcePkOnCreate()
          If true, the ID and/or version of the content will be used for saving.
 boolean isGroupXPath(java.lang.String XPath)
          Check if the given XPath is a valid group XPath for this content.
 boolean isLiveVersion()
          Is this content instance the live version
 boolean isLocked()
          Is this content locked?
 boolean isMaxVersion()
          Is this content instance the max version
 boolean isPreviewAvailable()
          Is a preview available that is not a default image?
 boolean isPropertyXPath(java.lang.String XPath)
          Check if the given XPath is a valid property XPath for this content.
 boolean isRelation()
          Is this content a relation?
 void loadReferences(ContentEngine ce)
          Load all FxContent instances from properties of type FxReference
 boolean matchesPk(FxPK otherPk)
          Checks if the given PK matches the content PK.
 void move(java.lang.String XPath, int delta)
          Move data (group or property) within its hierarchy for delta positions up or down depending on the sign of delta without wrapping around if top or bottom position is reached.
 FxContent randomize()
          Drop all data and create random entries for testing purposes
 FxContent randomize(int maxMultiplicity)
          Drop all data and create random entries with a maximum multiplicity for testing purposes
 void remove(java.lang.String XPath)
          Remove the property or group denoted by XPath
 void replaceData(FxContent con)
          Replace our data with data from another content
 void replaceData(java.lang.String xpath, FxContent con)
          Replace our data with data from another content but only for the requested xpath
 void resetBinaryPreview()
          Reset the preview image to show the default BinaryDescriptor.SYS_UNKNOWN image.
 void resolveBinaryPreview()
          Internal method that tries to find a matching preview image.
 FxContent save()
          Convenience method which saves this FxContent and returns the loaded instance.
 FxContent saveNewVersion()
          Convenience method which saves this FxContent in a new version and returns the loaded instance.
 void setAclId(long aclId)
          Set the content ACL id.
 void setAclIds(java.util.Collection<java.lang.Long> aclIds)
          Sets the new ACL ids and performs necessary enviroment synchronisatons.
 void setActive(boolean active)
          (De-)activate this content
 void setBinaryPreview(long binaryId)
          Set the binary preview.
 void setBinaryPreview(java.lang.String XPath)
          Set the binary preview to an XPath.
 void setForceLifeCycle(boolean forceLifeCycle)
          If true, forces the content engine to use the lifecycle (created at, ...) of the content instance when creating or updating the content, instead of calculating the values.
 void setForcePkOnCreate(boolean forcePkOnCreate)
          If true, the ID and/or version of the content will be used for saving.
 void setMainLanguage(long mainLanguage)
          Set the main language
 FxContent setRelatedDestination(FxPK dst)
          Set the primary key of the destination relation
 void setRelatedDestinationPosition(int relatedDestinationPosition)
           
 FxContent setRelatedSource(FxPK src)
          Set the primary key of the source relation
 void setRelatedSourcePosition(int relatedSourcePosition)
           
 boolean setStepByDefinition(long stepDefinitionId)
          Set the workflow step using the given step definition ID.
 void setStepId(long stepId)
          Set the workflow step id
 FxContent setValue(java.lang.String XPath, FxValue value)
          Set a properties value, needed groups will be created
 FxContent setValue(java.lang.String XPath, long languageId, java.lang.Object value)
          Depending on the underlying FxValue's multilanguage setting set either the translation in the requested language or the single language value
 FxContent setValue(java.lang.String XPath, java.lang.Object value)
          Depending on the underlying FxValue's multilanguage setting set either the default translation or the single language value
 void sortData()
          Sorts the current data (=root data) according to the order of the type
 void updateLock(FxLock lock)
          Update the lock of this instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POSITION_TOP

public static final int POSITION_TOP
Topmost position for relation positioning

See Also:
Constant Field Values

POSITION_BOTTOM

public static final int POSITION_BOTTOM
Bottommost position for relation positioning

See Also:
Constant Field Values
Constructor Detail

FxContent

public FxContent(FxPK pk,
                 FxLock lock,
                 long typeId,
                 boolean relation,
                 long mandatorId,
                 long aclId,
                 long stepId,
                 int maxVersion,
                 int liveVersion,
                 boolean active,
                 long mainLanguage,
                 FxPK relatedSource,
                 FxPK relatedDestination,
                 int relatedSourcePosition,
                 int relatedDestinationPosition,
                 LifeCycleInfo lifeCycleInfo,
                 FxGroupData data,
                 long binaryPreviewId,
                 long binaryPreviewACL)
Constructor

Parameters:
pk - primary key
lock - lock of this content, if not locked a lock with type FxLockType.None will be set
typeId - used type id
relation - is this a content for a relation?
mandatorId - mandator id
aclId - ACL id
stepId - step id
maxVersion - max. version for this instance
liveVersion - live version for this instance (0=no live version exists)
active - is this instance active
mainLanguage - main language
relatedSource - related source instance (only if this is a relation)
relatedDestination - related destination instance (only if this is a relation)
relatedSourcePosition - position for source instance (only if this is a relation)
relatedDestinationPosition - position for destination instance (only if this is a relation)
lifeCycleInfo - lifecycle
data - data
binaryPreviewId - id of the preview binary
binaryPreviewACL - id of the ACL of the preview binary
Method Detail

getPk

public FxPK getPk()
Getter for the primary key

Returns:
primary key

getId

public long getId()
Getter for the Id

Returns:
id

getVersion

public int getVersion()
Getter for the version

Returns:
version

getTypeId

public long getTypeId()
Getter for the type id

Returns:
type id

getMandatorId

public long getMandatorId()
Getter for the mandator id

Returns:
mandator id

setAclId

public void setAclId(long aclId)
Set the content ACL id. If more than one ACL was assigned, the additional ACLs are removed before assigning the new ACL.

Parameters:
aclId - the ACL id

getAclIds

public java.util.List<java.lang.Long> getAclIds()
Return all ACLs assigned to this content.

Returns:
all ACLs assigned to this content.

setAclIds

public void setAclIds(java.util.Collection<java.lang.Long> aclIds)
Sets the new ACL ids and performs necessary enviroment synchronisatons.

Parameters:
aclIds - ACL ids

getStepId

public long getStepId()
Getter for the step id

Returns:
step id

setStepId

public void setStepId(long stepId)
Set the workflow step id

Parameters:
stepId - workflow step id

setStepByDefinition

public boolean setStepByDefinition(long stepDefinitionId)
Set the workflow step using the given step definition ID.

Parameters:
stepDefinitionId - the step definition ID
Returns:
true if the step was changed
Throws:
FxRuntimeException - if the given step definition ID does not exist for the content's workflow
Since:
3.1

getMaxVersion

public int getMaxVersion()
Get the max version of this content

Returns:
max version of this content

isMaxVersion

public boolean isMaxVersion()
Is this content instance the max version

Returns:
if content instance the max version

getLiveVersion

public int getLiveVersion()
Get the live version of this content or 0 if no live version exists

Returns:
live version of this content or 0 if no live version exists

isLiveVersion

public boolean isLiveVersion()
Is this content instance the live version

Returns:
if content instance the live version

matchesPk

public boolean matchesPk(FxPK otherPk)
Checks if the given PK matches the content PK. This method allows to match PKs with generic version information (including FxPK.LIVE or FxPK.MAX), which the FxPK.equals(Object) FxPK equals method cannot do.

Parameters:
otherPk - the PK to be matched
Returns:
true if otherPk matches this content

getMainLanguage

public long getMainLanguage()
Get the main language

Returns:
main language

setMainLanguage

public void setMainLanguage(long mainLanguage)
Set the main language

Parameters:
mainLanguage - main language

isActive

public boolean isActive()
Is this content active?

Returns:
content is active

setActive

public void setActive(boolean active)
(De-)activate this content

Parameters:
active - active flag

isRelation

public boolean isRelation()
Is this content a relation?

Returns:
content is relation

getRelatedSource

public FxPK getRelatedSource()
If this is a relation get the assigned "from" (or source) instance

Returns:
the assigned "from" (or source) instance

setRelatedSource

public FxContent setRelatedSource(FxPK src)
Set the primary key of the source relation

Parameters:
src - source relation
Returns:
this

getRelatedDestination

public FxPK getRelatedDestination()
If this is a relation get the assigned "to" (or destination) instance

Returns:
the assigned "to" (or destination) instance

setRelatedDestination

public FxContent setRelatedDestination(FxPK dst)
Set the primary key of the destination relation

Parameters:
dst - destination relation
Returns:
this

getRelatedSourcePosition

public int getRelatedSourcePosition()
Get the position for the source content instance

Returns:
position for the source content instance

getRelatedDestinationPosition

public int getRelatedDestinationPosition()
Get the position for the destination content instance

Returns:
position for the destination content instance

setRelatedDestinationPosition

public void setRelatedDestinationPosition(int relatedDestinationPosition)

setRelatedSourcePosition

public void setRelatedSourcePosition(int relatedSourcePosition)

getLifeCycleInfo

public LifeCycleInfo getLifeCycleInfo()
Get the lifecycle information

Returns:
lifecycle information

isLocked

public boolean isLocked()
Is this content locked?

Returns:
if this content is locked

getLock

public FxLock getLock()
Get the lock of this content

Returns:
lock of this content

getData

public java.util.List<FxData> getData(java.lang.String XPath)
Get all FxData (Group or Property) entries for the given XPath.

Note: If the XPath refers to a group, only its child entries are returned and not the FxData of the group itself. For accessing the group data itself use getGroupData(String) instead.

Parameters:
XPath - requested XPath
Returns:
FxData elements for the given XPath

getPropertyData

public FxPropertyData getPropertyData(java.lang.String XPath)
Get the FxPropertyData entry for the given XPath

Parameters:
XPath - requested XPath
Returns:
FxPropertyData entry for the given XPath

getPropertyData

public java.util.List<FxPropertyData> getPropertyData(long propertyId,
                                                      boolean includeEmpty)
Get a list of all FxPropertyData entries that are assigned to propertyId

Parameters:
propertyId - the property id requested. -1 to return all properties.
includeEmpty - include empty data instances?
Returns:
list of all FxPropertyData entries that are assigned to propertyId

getGroupData

public FxGroupData getGroupData(java.lang.String XPath)
Get the FxGroupData entry for the given XPath

Parameters:
XPath - requested XPath
Returns:
FxGroupData entry for the given XPath

getGroupData

public FxGroupData getGroupData(long assignmentId)
Get the FxGroupData entry for the given group assignment.

Parameters:
assignmentId - the group assignment ID
Returns:
FxGroupData entry for the given assignment
Since:
3.1.4

getRootGroup

public FxGroupData getRootGroup()
Get the (virtual) root group of this content

Returns:
root group

getMaxIndex

public int getMaxIndex(java.lang.String XPath)
Get the maximum index of the last element of an XPath. The multiplicity of the last element is checked. Lets say group and property (/group/property) each have a max. multiplicity > 1: "/group/property" -> returns the maximum multiplicity of property in group[1] "/group[2]/property" -> returns the maximum multiplicity of property in group[2] "/group" -> returns the maximum multipliciy of group

Parameters:
XPath - xpath to get the maximum multiplicity for
Returns:
maximum multiplicity of the xpath or 0 if it does not exist (yet)
Since:
3.1.4

compact

public FxContent compact()
Convenience method to compact (=remove all empty groups and properties that are not required). This method is equivalent to calling getRootGroup().compact().

Returns:
this
Since:
3.1.4

addValue

public java.lang.String addValue(java.lang.String XPath,
                                 FxValue value)
Add a value for a XPath. This method helps when setting values for properties with a multiplicity > 1 by adding new entries. If e.g. /property[2] is the current property with the highest multiplicity, a /property[3] entry will be created.

Parameters:
XPath - XPath to add a value for
value - FxValue to add
Returns:
XPath of the added element
Since:
3.1.4

addValue

public java.lang.String addValue(java.lang.String XPath,
                                 java.lang.Object value)
Depending on the underlying FxValue's multilanguage setting set either the default translation or the single language value. This method helps when setting values for properties with a multiplicity > 1 by adding new entries. If e.g. /property[2] is the current property with the highest multiplicity, a /property[3] entry will be created.

Parameters:
XPath - XPath to add a value for
value - the value (has to match the FxValue's data type)
Returns:
XPath of the added element
Since:
3.1.4

addGroup

public java.lang.String addGroup(java.lang.String XPath)
Add (or create) another group. The group to create is the last element in the requested XPath.

Parameters:
XPath - XPath with the group alias as last element
Returns:
XPath of the added group
Since:
3.1.4

addGroup

public java.lang.String addGroup(java.lang.String XPath,
                                 FxGroupData.AddGroupOptions options)
Add (or create) another group. The group to create is the last element in the requested XPath.

Parameters:
XPath - XPath with the group alias as last element
options - options for adding the group
Returns:
XPath of the added group
Since:
3.2.0

getPropertyDataCreate

public FxPropertyData getPropertyDataCreate(java.lang.String XPath)
Get the FxPropertyData entry for an XPath and create a new entry if it does not exist yet.

Parameters:
XPath - requested xpath
Returns:
FxPropertyData
Since:
3.1

setValue

public FxContent setValue(java.lang.String XPath,
                          FxValue value)
Set a properties value, needed groups will be created

Parameters:
XPath - FQ XPath
value - value to apply
Returns:
this FxContent instance to allow chained calls

setValue

public FxContent setValue(java.lang.String XPath,
                          java.lang.Object value)
Depending on the underlying FxValue's multilanguage setting set either the default translation or the single language value

Parameters:
XPath - requested XPath
value - the value (has to match the FxValue's data type)
Returns:
this FxContent instance to allow chained calls
Since:
3.0.2

setValue

public FxContent setValue(java.lang.String XPath,
                          long languageId,
                          java.lang.Object value)
Depending on the underlying FxValue's multilanguage setting set either the translation in the requested language or the single language value

Parameters:
XPath - requested XPath
languageId - requested language (ignored if single value)
value - the value (has to match the FxValue's data type)
Returns:
this FxContent instance to allow chained calls
Since:
3.0.2

save

public FxContent save()
               throws FxApplicationException
Convenience method which saves this FxContent and returns the loaded instance.

Returns:
saved FxContent
Throws:
FxApplicationException - on errors
Since:
3.0.2

saveNewVersion

public FxContent saveNewVersion()
                         throws FxApplicationException
Convenience method which saves this FxContent in a new version and returns the loaded instance.

Returns:
saved FxContent
Throws:
FxApplicationException - on errors
Since:
3.1

getValue

public FxValue getValue(java.lang.String XPath)
Get the value of a (property) XPath. This is actually a convenience method that internally calls getPropertyData(XPath).getValue(). If the XPath is valid but no value is set, null will be returned

Parameters:
XPath - requested XPath
Returns:
FxValue or null if no value is set
See Also:
getPropertyData(String)

getValue

public <T extends FxValue> T getValue(java.lang.Class<T> clazz,
                                      java.lang.String XPath)
Get the value of a given class (eg FxString) and (property) XPath. This is actually a convenience method that internally calls getPropertyData(XPath).getValue() and casts the value to the requested class. If the XPath is valid but no value is set or the value is not of the requested class, null will be returned

Parameters:
clazz - return only instances of this class (eg FxString.class)
XPath - requested XPath
Returns:
FxValue or null if no value is set or not of the requested class
Since:
3.1.4
See Also:
getValue(String)

getValues

public java.util.List<FxValue> getValues(java.lang.String XPath)
Get all values of a given XPath, ordered by multiplicty. If the assignment has a max. multiplicity of 1 return a list with a single entry

Parameters:
XPath - requested XPath
Returns:
all values of a given XPath, ordered by multiplicty
Since:
3.1

getValues

public <T extends FxValue> java.util.List<T> getValues(java.lang.Class<T> clazz,
                                                       java.lang.String XPath)
Get all values of a given class (eg FxString) and XPath, ordered by multiplicity. If the assignment has a max. multiplicity of 1 return a list with a single entry

Parameters:
clazz - collect only instances of this class (eg FxString.class)
XPath - requested XPath
Returns:
all values of a given XPath, ordered by multiplicity
Since:
3.1.4

containsValue

public boolean containsValue(java.lang.String XPath)
Check if a value exists for the given XPath that is not empty

Parameters:
XPath - the XPath to check
Returns:
if a value exists for the given XPath that is not empty

containsXPath

public boolean containsXPath(java.lang.String XPath)
Check if a XPath exists in the content instance. The XPath may refer either to a property or a group.

Parameters:
XPath - the XPath to check
Returns:
if a value exists for the given XPath that is not empty
Since:
3.1

isGroupXPath

public boolean isGroupXPath(java.lang.String XPath)
Check if the given XPath is a valid group XPath for this content. This is a shortcut to the corresponding type's method!

Parameters:
XPath - the XPath to check
Returns:
if the XPath is valid or not
Since:
3.1.4
See Also:
FxType.isXPathValid(String,boolean)

isPropertyXPath

public boolean isPropertyXPath(java.lang.String XPath)
Check if the given XPath is a valid property XPath for this content. This is a shortcut to the corresponding type's method!

Parameters:
XPath - the XPath to check
Returns:
if the XPath is valid or not
Since:
3.1.4
See Also:
FxType.isXPathValid(String,boolean)

randomize

public FxContent randomize(int maxMultiplicity)
Drop all data and create random entries with a maximum multiplicity for testing purposes

Parameters:
maxMultiplicity - the maximum multiplicity for groups
Returns:
this

randomize

public FxContent randomize()
                    throws FxCreateException,
                           FxNotFoundException,
                           FxInvalidParameterException
Drop all data and create random entries for testing purposes

Returns:
this
Throws:
FxCreateException - on errors
FxNotFoundException - on errors
FxInvalidParameterException - on errors

move

public void move(java.lang.String XPath,
                 int delta)
          throws FxInvalidParameterException,
                 FxNotFoundException
Move data (group or property) within its hierarchy for delta positions up or down depending on the sign of delta without wrapping around if top or bottom position is reached. If delta is Integer.MAX_VALUE the data will always be placed at the bottom, Integer.MIN_VALUE will always place it at the top.

Parameters:
XPath - FQ XPath
delta - relative number of positions to move
Throws:
FxInvalidParameterException - for invalid XPath
FxNotFoundException - XPath does not exist for this content

sortData

public void sortData()
Sorts the current data (=root data) according to the order of the type

Since:
3.1.1

remove

public void remove(java.lang.String XPath)
Remove the property or group denoted by XPath

Parameters:
XPath - the XPath to remove

checkValidity

public void checkValidity()
                   throws FxInvalidParameterException
Check if all required properties are present and valid, etc.

Throws:
FxInvalidParameterException - if required properties are not present or the content is not valid

initSystemProperties

public FxContent initSystemProperties()

getAllPropertyXPaths

public java.util.List<java.lang.String> getAllPropertyXPaths()
Get a list of all property XPaths contained in this content in correct order

Returns:
list of all property XPaths contained in this content in correct order

getAllXPaths

public java.util.List<java.lang.String> getAllXPaths(java.lang.String groupPostfix)
Get a list of all XPaths contained in this content in correct order

Parameters:
groupPostfix - String to append to found groups (useful to append "/" to kind of mark those XPaths as group XPaths)
Returns:
list of all XPaths contained in this content in correct order

isPreviewAvailable

public boolean isPreviewAvailable()
Is a preview available that is not a default image?

Returns:
preview available

getBinaryPreviewId

public long getBinaryPreviewId()
Id of the binary used for previews

Returns:
id of the binary used for previews

getBinaryPreviewACL

public long getBinaryPreviewACL()
ACL that is needed to view the preview image

Returns:
ACL that is needed to view the preview image

setBinaryPreview

public void setBinaryPreview(java.lang.String XPath)
Set the binary preview to an XPath. Illegal or non-existing values will be ignored!

Parameters:
XPath - the XPath of the requested binary to set as preview

setBinaryPreview

public void setBinaryPreview(long binaryId)
Set the binary preview. Illegal or non-existing values will be ignored!

Parameters:
binaryId - if of the requested binary to set as preview

resolveBinaryPreview

public void resolveBinaryPreview()
Internal method that tries to find a matching preview image. Searches for images and then regular binaries (preview is then set matching the mime type display). If neither are found the BinaryDescriptor.SYS_UNKNOWN image is used

See Also:
BinaryDescriptor.SYS_UNKNOWN

resetBinaryPreview

public void resetBinaryPreview()
Reset the preview image to show the default BinaryDescriptor.SYS_UNKNOWN image.

See Also:
BinaryDescriptor.SYS_UNKNOWN

copy

public FxContent copy()
Create an independent copy of this FxContent

Returns:
a copy of this FxContent

copyAsNewInstance

public FxContent copyAsNewInstance()
Get an independent copy of this FxContent which is a new instance (can be saved as a copy)

Returns:
a copy of this FxContent with a new pk

loadReferences

public void loadReferences(ContentEngine ce)
                    throws FxApplicationException
Load all FxContent instances from properties of type FxReference

Parameters:
ce - ContentEngine
Throws:
FxApplicationException - on errors

getPermissions

public PermissionSet getPermissions()
Returns the permission set for the calling user.

Returns:
the permission set for the calling user.

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

replaceData

public void replaceData(FxContent con)
Replace our data with data from another content

Parameters:
con - other content to take data from

replaceData

public void replaceData(java.lang.String xpath,
                        FxContent con)
Replace our data with data from another content but only for the requested xpath

Parameters:
xpath - the xpath to replace the data for
con - other content to take data from

hasCaption

public boolean hasCaption()
Check if this content instance has a caption property assigned

Returns:
true if a caption property is assigned to this content instance

getCaption

public FxString getCaption()
Get the caption value of this instance. If no caption property is assigned, this method will return null

Returns:
caption or null if not assigned

updateLock

public void updateLock(FxLock lock)
Update the lock of this instance. Internal use only to reflect changes to lock status for cached contents

Parameters:
lock - the new lock to apply

isForceLifeCycle

public final boolean isForceLifeCycle()
If true, forces the content engine to use the lifecycle (created at, ...) of the content instance when creating or updating the content, instead of calculating the values. Used for imports.

Returns:
true if the lifecycle information should be taken from the content
Since:
3.1.6
See Also:
setForceLifeCycle(boolean)

setForceLifeCycle

public final void setForceLifeCycle(boolean forceLifeCycle)
If true, forces the content engine to use the lifecycle (created at, ...) of the content instance when creating or updating the content, instead of calculating the values. Used for imports.

The flag may be set by anyone, but the content engine will fail if the caller has no global supervisor privileges.

Parameters:
forceLifeCycle - true if the lifecycle information should be taken from the content
Since:
3.1.6

isForcePkOnCreate

public final boolean isForcePkOnCreate()
If true, the ID and/or version of the content will be used for saving. Used for imports that need to preserve the version number or the entire PK.

Returns:
if true, the ID and/or version of the content will be used for saving.
Since:
3.1.6
See Also:
setForcePkOnCreate(boolean)

setForcePkOnCreate

public final void setForcePkOnCreate(boolean forcePkOnCreate)
If true, the ID and/or version of the content will be used for saving.

When both the ID and version are set, a content with the exact PK will be created (unless one already exists, in which case saving will cause an error). If only the version is set, a new ID will be generated as with creating a completely new instance, but the version will be set to the given value.

The flag may be set by anyone, but the content engine will fail if the caller has no global supervisor privileges.

Parameters:
forcePkOnCreate - whether a specific PK should be used for saving the instance
Since:
3.1.6

checkForceSystemPropertyPermissions

public final void checkForceSystemPropertyPermissions()
                                               throws FxNoAccessException
Checks if isForceLifeCycle() or isForcePkOnCreate() is set and whether the current user set these flags (only the global supervisor is allowed to specify these).

Throws:
FxNoAccessException - if PK and/or lifecycle info should be overwritten and the calling user is not a global supervisor
Since:
3.1.6