com.flexive.shared.content
Class FxPropertyData

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

public class FxPropertyData
extends FxData

FxData extension for properties

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

Field Summary
 
Fields inherited from class com.flexive.shared.content.FxData
parent, POSITION_BOTTOM, POSITION_TOP, xpAlias, XPathFull, xpIndex, xpPrefix
 
Constructor Summary
FxPropertyData(FxPropertyData other, FxGroupData parent)
          Copy constructor.
FxPropertyData(java.lang.String xpPrefix, java.lang.String alias, int index, java.lang.String xPath, java.lang.String xPathFull, int[] indices, long assignmentId, long propertyId, FxMultiplicity assignmentMultiplicity, int pos, FxGroupData parent, FxValue value, boolean systemInternal, FxStructureOption maxLength)
           
 
Method Summary
protected  void applyIndices()
          Apply the multiplicity to XPath and children if its a group
 void checkMaxLength()
          Check if the maximum length is valid (if applicable)
 void checkRequired()
          Check if this property is required and present in its minimal multiplicity
(package private)  FxPropertyData copy(FxGroupData parent)
          Create an independent copy of this group or property FxData
 boolean equals(java.lang.Object obj)
          
 int getCreateableElements()
          Get the number of (same) FxData elements that may be created within the same hierarchy level
 FxStructureOption getMaxLength()
          Returns the value of the assignment's FxStructureOption.MAXLENGTH, or -1 of the option is not set.
 FxPropertyAssignment getPropertyAssignment()
          Get the assignment cast to FxProperyAssignment
 long getPropertyId()
          Get the id of the property used by the assignment
 int getRemoveableElements()
          Get the number of elements that may be removed within the same hierarchy level
 FxValue getValue()
          Get the assigned value
 java.util.List<FxValue> getValues(boolean includeEmpty)
          Return a list of all values of this assignment.
 int hashCode()
          
 boolean isContainsDefaultValue()
          Is the value contained created from a default value?
 boolean isEmpty()
          Is this data empty?
 boolean isGroup()
          Is this FxData a property or group?
 boolean isProperty()
          Is this FxData a property or group?
 boolean isRemoveable()
          Is this data removeable?
 boolean isRequiredPropertiesPresent()
          Are there any required properties (empty or non-empty) present?
 void setContainsDefaultValue(boolean containsDefaultValue)
          Set if the value is created from a default value - internal method!
 void setEmpty()
          Replace all data with empty values/groups
 void setValue(FxValue value)
          Set a new value for this property data
protected  void setXPathFull(java.lang.String xpathFull)
          Update the XPath with indices.
 
Methods inherited from class com.flexive.shared.content.FxData
compact, createNew, getAlias, getAssignment, getAssignmentId, getAssignmentMultiplicity, getElements, getIndex, getIndices, getOccurances, getParent, getPos, getXPath, getXPathElement, getXPathFull, getXPathPrefix, isSystemInternal, mayCreateMore, move, moveIndex, setPos, toString, xpCached
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FxPropertyData

public FxPropertyData(java.lang.String xpPrefix,
                      java.lang.String alias,
                      int index,
                      java.lang.String xPath,
                      java.lang.String xPathFull,
                      int[] indices,
                      long assignmentId,
                      long propertyId,
                      FxMultiplicity assignmentMultiplicity,
                      int pos,
                      FxGroupData parent,
                      FxValue value,
                      boolean systemInternal,
                      FxStructureOption maxLength)

FxPropertyData

public FxPropertyData(FxPropertyData other,
                      FxGroupData parent)
Copy constructor.

Parameters:
other - the property data instance to copy
Since:
3.2.0
Method Detail

getValue

public FxValue getValue()
Get the assigned value

Returns:
value

isProperty

public boolean isProperty()
Is this FxData a property or group?

Specified by:
isProperty in class FxData
Returns:
if this FxData is a property or group

isGroup

public boolean isGroup()
Is this FxData a property or group?

Specified by:
isGroup in class FxData
Returns:
if this FxData is a property or group

getPropertyId

public long getPropertyId()
Get the id of the property used by the assignment

Returns:
id of the property used by the assignment

getPropertyAssignment

public FxPropertyAssignment getPropertyAssignment()
Get the assignment cast to FxProperyAssignment

Returns:
property assignment
Since:
3.1

setValue

public void setValue(FxValue value)
Set a new value for this property data

Parameters:
value - the value to set

isEmpty

public boolean isEmpty()
Is this data empty?

Specified by:
isEmpty in class FxData
Returns:
empty

setEmpty

public void setEmpty()
Replace all data with empty values/groups

Specified by:
setEmpty in class FxData

isRequiredPropertiesPresent

public boolean isRequiredPropertiesPresent()
Are there any required properties (empty or non-empty) present?

Specified by:
isRequiredPropertiesPresent in class FxData
Returns:
true if there any required properties (empty or non-empty) present

isContainsDefaultValue

public boolean isContainsDefaultValue()
Is the value contained created from a default value?

Returns:
value contained created from a default value

setContainsDefaultValue

public void setContainsDefaultValue(boolean containsDefaultValue)
Set if the value is created from a default value - internal method!

Parameters:
containsDefaultValue - if the value is created from a default value

applyIndices

protected void applyIndices()
Apply the multiplicity to XPath and children if its a group

Specified by:
applyIndices in class FxData

setXPathFull

protected void setXPathFull(java.lang.String xpathFull)
Update the XPath with indices.

Specified by:
setXPathFull in class FxData
Parameters:
xpathFull - the complete XPath including indices.

checkRequired

public void checkRequired()
                   throws FxInvalidParameterException
Check if this property is required and present in its minimal multiplicity

Throws:
FxInvalidParameterException - if required properties are empty

checkMaxLength

public void checkMaxLength()
                    throws FxInvalidParameterException
Check if the maximum length is valid (if applicable)

Throws:
FxInvalidParameterException - on errors

getCreateableElements

public int getCreateableElements()
Get the number of (same) FxData elements that may be created within the same hierarchy level

Overrides:
getCreateableElements in class FxData
Returns:
number of (same) FxData elements that may be created within the same hierarchy level

getRemoveableElements

public int getRemoveableElements()
Get the number of elements that may be removed within the same hierarchy level

Overrides:
getRemoveableElements in class FxData
Returns:
number of elements that may be removed within the same hierarchy level

isRemoveable

public boolean isRemoveable()
Is this data removeable?

Overrides:
isRemoveable in class FxData
Returns:
if this data is removeable

getMaxLength

public FxStructureOption getMaxLength()
Returns the value of the assignment's FxStructureOption.MAXLENGTH, or -1 of the option is not set.

Returns:
the value of the assignment's FxStructureOption.MAXLENGTH, or -1 of the option is not set

getValues

public java.util.List<FxValue> getValues(boolean includeEmpty)
Return a list of all values of this assignment.

Parameters:
includeEmpty - true to include empty (i.e. newly initialized) values
Returns:
a list of all values of this assignment.

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class FxData

hashCode

public int hashCode()

Overrides:
hashCode in class FxData

copy

FxPropertyData copy(FxGroupData parent)
Create an independent copy of this group or property FxData

Specified by:
copy in class FxData
Parameters:
parent - parent group
Returns:
independent copy