com.flexive.shared.structure
Class FxPropertyAssignment

java.lang.Object
  extended by com.flexive.shared.structure.FxAssignment
      extended by com.flexive.shared.structure.FxPropertyAssignment
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<FxAssignment>
Direct Known Subclasses:
FxPropertyAssignmentEdit

public class FxPropertyAssignment
extends FxAssignment
implements java.io.Serializable

Assignment of a property to a type or group

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

Field Summary
protected  ACL ACL
          Overridden ACL (if the embedded property permits)
protected  long defaultLang
           
protected  FxValue defaultValue
           
protected  FxProperty property
          The property assigned
 
Fields inherited from class com.flexive.shared.structure.FxAssignment
alias, baseAssignment, defaultMultiplicity, enabled, hint, label, multiplicity, NO_BASE, NO_PARENT, options, parentGroupAssignment, position, POSITION_BOTTOM, ROOT_BASE, scriptMapping, TYPE_GROUP, TYPE_PROPERTY, XPath
 
Constructor Summary
FxPropertyAssignment(long assignmentId, boolean enabled, FxType assignedType, java.lang.String alias, java.lang.String xpath, int position, FxMultiplicity multiplicity, int defaultMultiplicity, FxGroupAssignment parentGroupAssignment, long baseAssignment, FxString label, FxString hint, FxValue defaultValue, FxProperty property, ACL ACL, long defaultLang, java.util.List<FxStructureOption> options)
          Constructor
 
Method Summary
 FxPropertyAssignmentEdit asEditable()
          Get this FxPropertyAssignment as editable
 FxData createEmptyData(FxGroupData parent, int index)
          Create an empty FxData entry for this assignment
 FxData createRandomData(java.util.Random rnd, FxEnvironment env, FxGroupData parent, int index, int maxMultiplicity)
          Create a random FxData entry for this assignment
 ACL getACL()
          Get the ACL of the embedded property.
 long getDefaultLanguage()
          Get the default language for this property assignment (if set)
 FxValue getDefaultValue()
          Get the default value for this assignment.
 FxValue getEmptyValue()
          Get an empty FxValue object for this assignment
 int getMaxLength()
          Shortcut to get the maximum input length
 int getMultiLines()
          Get the number of multilines to display or 0 if multiline is not set
 FxMultiplicity getMultiplicity()
          Get the multiplicity of this assignment.
 FxStructureOption getOption(java.lang.String key)
          Get an option entry for the given key, if the key is invalid or not found a FxStructureOption object will be returned with set set to false, overrideable set to false and value set to an empty String.
 FxProperty getProperty()
          Get the property this assignment relates to
 boolean hasAssignmentDefaultValue()
          Is an explicit default value set for this assignment or is it taken from the property?
 boolean hasDefaultLanguage()
          Is a default language defined for this property assignment?
 boolean hasMaxLength()
          Shortcut to determine if a max.
 boolean hasOption(java.lang.String key)
          Check if an option is set for the requested key
 boolean isInOverview()
           
 boolean isMultiLang()
           
 boolean isMultiLine()
          Show as multiple lines in editors?
 boolean isOverridingPropertyACL()
          Check if an ACL is defined for this assignment which overrides the properties ACL
 boolean isOverridingPropertyMultiplicity()
          Check if a multiplicity is defined for this assignment which overrides the properties multiplicity
 boolean isSearchable()
           
 boolean isUseHTMLEditor()
           
 boolean isValid(java.lang.Object value)
          Validate the given value for this assignment.
 
Methods inherited from class com.flexive.shared.structure.FxAssignment
_setSystemInternal, compareTo, equals, getAlias, getAssignedType, getBaseAssignmentId, getDefaultMultiplicity, getDisplayLabel, getDisplayName, getHint, getId, getLabel, getOptions, getParentGroupAssignment, getPosition, getScriptMapping, getXPath, hashCode, hasParentGroupAssignment, hasScriptMapping, hasScriptMappings, isDerivedAssignment, isEnabled, isSystemInternal, resolveParentDependencies, resolvePreloadDependencies, resolveReferences, sort, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

property

protected FxProperty property
The property assigned


ACL

protected ACL ACL
Overridden ACL (if the embedded property permits)


defaultValue

protected FxValue defaultValue

defaultLang

protected long defaultLang
Constructor Detail

FxPropertyAssignment

public FxPropertyAssignment(long assignmentId,
                            boolean enabled,
                            FxType assignedType,
                            java.lang.String alias,
                            java.lang.String xpath,
                            int position,
                            FxMultiplicity multiplicity,
                            int defaultMultiplicity,
                            FxGroupAssignment parentGroupAssignment,
                            long baseAssignment,
                            FxString label,
                            FxString hint,
                            FxValue defaultValue,
                            FxProperty property,
                            ACL ACL,
                            long defaultLang,
                            java.util.List<FxStructureOption> options)
Constructor

Parameters:
assignmentId - internal id of this assignment
enabled - is this assignment enabled?
assignedType - the FxType this assignment belongs to
alias - an optional alias, if null the original name will be used
xpath - XPath relative to the assigned FxType
position - position within the same XPath hierarchy
multiplicity - multiplicity (will only be used if the embedded property allows overriding)
defaultMultiplicity - default multiplicity
parentGroupAssignment - (optional) parent FxGroupAssignment this property assignment belongs to
baseAssignment - base assignment (if derived the parent, if not the root assignment, if its a root assignment FxAssignment.ROOT_BASE)
label - (optional) label
hint - (optional) hint
defaultValue - (optional) default value
property - the assigned property
ACL - the embedded property's ACL (will only be used if the embedded property allows overriding)
defaultLang - default language if multilingual (if 0==SYSTEM then not set)
options - options
Method Detail

getProperty

public FxProperty getProperty()
Get the property this assignment relates to

Returns:
property this assignment relates to

hasAssignmentDefaultValue

public boolean hasAssignmentDefaultValue()
Is an explicit default value set for this assignment or is it taken from the property?

Returns:
if an explicit default value set for this assignment or is it taken from the property

getACL

public ACL getACL()
Get the ACL of the embedded property. If the property does not allow overriding ACL the original property ACL will be returned

Returns:
the ACL

isOverridingPropertyACL

public boolean isOverridingPropertyACL()
Check if an ACL is defined for this assignment which overrides the properties ACL

Returns:
true if an ACL is defined for this assignment which overrides the properties ACL

getMultiplicity

public FxMultiplicity getMultiplicity()
Get the multiplicity of this assignment. Depending on if the assigned element allows overriding of its base multiplicity the base elements multiplicity is returned or the multiplicity of the assignment

Specified by:
getMultiplicity in class FxAssignment
Returns:
multiplicity of this assignment

isOverridingPropertyMultiplicity

public boolean isOverridingPropertyMultiplicity()
Check if a multiplicity is defined for this assignment which overrides the properties multiplicity

Returns:
true if a multiplicity is defined for this assignment which overrides the properties multiplicity

getOption

public FxStructureOption getOption(java.lang.String key)
Get an option entry for the given key, if the key is invalid or not found a FxStructureOption object will be returned with set set to false, overrideable set to false and value set to an empty String.

Overrides:
getOption in class FxAssignment
Parameters:
key - option key
Returns:
the found option or an object that indicates that the option is not set

hasOption

public boolean hasOption(java.lang.String key)
Check if an option is set for the requested key

Overrides:
hasOption in class FxAssignment
Parameters:
key - option key
Returns:
if an option is set for the requested key

isMultiLang

public boolean isMultiLang()

isSearchable

public boolean isSearchable()

isInOverview

public boolean isInOverview()

isUseHTMLEditor

public boolean isUseHTMLEditor()

hasMaxLength

public boolean hasMaxLength()
Shortcut to determine if a max. input length has been set

Returns:
has a max. input length been set?

getMaxLength

public int getMaxLength()
Shortcut to get the maximum input length

Returns:
maximum input length

isMultiLine

public boolean isMultiLine()
Show as multiple lines in editors?

Returns:
if this property appears in multiple lines

getMultiLines

public int getMultiLines()
Get the number of multilines to display or 0 if multiline is not set

Returns:
number of multilines to display or 0 if multiline is not set

getDefaultValue

public FxValue getDefaultValue()
Get the default value for this assignment. If not set a copy of the property default value is returned.

Returns:
FxValue

getEmptyValue

public FxValue getEmptyValue()
Get an empty FxValue object for this assignment

Returns:
empty FxValue object

createEmptyData

public FxData createEmptyData(FxGroupData parent,
                              int index)
                       throws FxCreateException
Create an empty FxData entry for this assignment

Specified by:
createEmptyData in class FxAssignment
Parameters:
parent - the parent group
index - the index of the new entry
Returns:
FxData
Throws:
FxCreateException - on errors

createRandomData

public FxData createRandomData(java.util.Random rnd,
                               FxEnvironment env,
                               FxGroupData parent,
                               int index,
                               int maxMultiplicity)
                        throws FxCreateException
Create a random FxData entry for this assignment

Specified by:
createRandomData in class FxAssignment
Parameters:
rnd - the Random to use
env - environment
parent - the parent group
index - the index of the new entry
maxMultiplicity - the maximum multiplicity
Returns:
FxData
Throws:
FxCreateException - on errors

isValid

public boolean isValid(java.lang.Object value)
Validate the given value for this assignment.

Overrides:
isValid in class FxAssignment
Parameters:
value - the value to be checked
Returns:
true if it is valid for this assignment, false otherwise

hasDefaultLanguage

public boolean hasDefaultLanguage()
Is a default language defined for this property assignment?

Returns:
if a default language is defined for this property assignment

getDefaultLanguage

public long getDefaultLanguage()
Get the default language for this property assignment (if set)

Returns:
default language for this property assignment (if set)

asEditable

public FxPropertyAssignmentEdit asEditable()
Get this FxPropertyAssignment as editable

Returns:
FxPropertyAssignmentEdit