com.flexive.shared.content
Class FxData

java.lang.Object
  extended by com.flexive.shared.content.FxData
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
FxGroupData, FxPropertyData

public abstract class FxData
extends java.lang.Object
implements java.io.Serializable

Abstract base class for property and group data

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

Field Summary
protected  int[] indices
          Indices for each element in the XPath
static int POSITION_BOTTOM
           
static int POSITION_TOP
           
protected  XPathElement xp
          XPathElement of this entry
protected  java.lang.String XPathFull
          XPath with indices
protected  java.lang.String xpPrefix
          xXPath prefix like "FxType name[@pk=..]"
 
Constructor Summary
protected FxData(java.lang.String xpPrefix, java.lang.String alias, int index, java.lang.String xPath, java.lang.String xPathFull, int[] indices, long assignmentId, FxMultiplicity assignmentMultiplicity, int pos, FxGroupData parent, boolean systemInternal)
           
 
Method Summary
protected abstract  void applyIndices()
          Apply the multiplicity to XPath and children if its a group
 void compact()
          Compact the indices of assignments from the same type closing gaps, etc
(package private) abstract  FxData copy(FxGroupData parent)
          Create an independent copy of this group or property FxData
 FxData createNew(int insertPosition)
          Create a new instance of this FxData with the next available multiplicity at the requested position
 boolean equals(java.lang.Object obj)
          
 java.lang.String getAlias()
          Getter for the XPath alias (current XPath element name)
 FxAssignment getAssignment()
          Get this FxData's associated assignment
 long getAssignmentId()
          Get the id of the assignment of this FxData
 FxMultiplicity getAssignmentMultiplicity()
          Get the multiplicity of the associated assignment
 int getCreateableElements()
          Get the number of (same) FxData elements that may be created within the same hierarchy level
 java.util.List<FxData> getElements()
           
 int getIndex()
           
 int[] getIndices()
          Get the indices of this FxData (min, max)
 int getOccurances()
          Return the number of occurances of this assignment in this FxData instance.
 FxGroupData getParent()
          Get the parent group of this data element
 int getPos()
          Get the position of this data element within its hierarchy level
 int getRemoveableElements()
          Get the number of elements that may be removed within the same hierarchy level
 java.lang.String getXPath()
          Get the XPath of this FxData
 XPathElement getXPathElement()
          Get this FxData as XPathElement
 java.lang.String getXPathFull()
          Get this FxData's XPath with all indices
 java.lang.String getXPathPrefix()
          Get the prefix to use for the XPath (Name of the type and primary key)
 int hashCode()
           
abstract  boolean isEmpty()
          Is this data empty?
abstract  boolean isGroup()
          Is this FxData a property or group?
abstract  boolean isProperty()
          Is this FxData a property or group?
 boolean isRemoveable()
          Is this data removeable?
 boolean isSystemInternal()
          Is this a system internal property or group?
 boolean mayCreateMore()
          May more instances of this element be created within the same hierarchy level
 FxData setPos(int pos)
          Set the position of this data element within its hierarchy level
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

POSITION_TOP

public static final int POSITION_TOP
See Also:
Constant Field Values

POSITION_BOTTOM

public static final int POSITION_BOTTOM
See Also:
Constant Field Values

XPathFull

protected java.lang.String XPathFull
XPath with indices


indices

protected int[] indices
Indices for each element in the XPath


xp

protected XPathElement xp
XPathElement of this entry


xpPrefix

protected java.lang.String xpPrefix
xXPath prefix like "FxType name[@pk=..]"

Constructor Detail

FxData

protected FxData(java.lang.String xpPrefix,
                 java.lang.String alias,
                 int index,
                 java.lang.String xPath,
                 java.lang.String xPathFull,
                 int[] indices,
                 long assignmentId,
                 FxMultiplicity assignmentMultiplicity,
                 int pos,
                 FxGroupData parent,
                 boolean systemInternal)
          throws FxInvalidParameterException
Throws:
FxInvalidParameterException
Method Detail

isProperty

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

Returns:
if this FxData is a property or group

isGroup

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

Returns:
if this FxData is a property or group

isEmpty

public abstract boolean isEmpty()
Is this data empty?

Returns:
empty

isSystemInternal

public boolean isSystemInternal()
Is this a system internal property or group?

Returns:
system internal

getIndex

public int getIndex()

applyIndices

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


getXPathPrefix

public java.lang.String getXPathPrefix()
Get the prefix to use for the XPath (Name of the type and primary key)

Returns:
prefix to use for the XPath

getXPath

public java.lang.String getXPath()
Get the XPath of this FxData

Returns:
XPath

getXPathElement

public XPathElement getXPathElement()
Get this FxData as XPathElement

Returns:
XPathElement

getXPathFull

public java.lang.String getXPathFull()
Get this FxData's XPath with all indices

Returns:
XPath with all indices

getIndices

public int[] getIndices()
Get the indices of this FxData (min, max)

Returns:
indices of this FxData (min, max)

getAssignmentId

public long getAssignmentId()
Get the id of the assignment of this FxData

Returns:
assignment id

getAssignment

public FxAssignment getAssignment()
Get this FxData's associated assignment

Returns:
FxAssignment

mayCreateMore

public boolean mayCreateMore()
May more instances of this element be created within the same hierarchy level

Returns:
if more instances of this element may be created within the same hierarchy level

getCreateableElements

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

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

getOccurances

public int getOccurances()
Return the number of occurances of this assignment in this FxData instance.

Returns:
the number of occurances of this assignment in this FxData instance

getElements

public java.util.List<FxData> getElements()

getRemoveableElements

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

Returns:
number of elements that may be removed within the same hierarchy level

compact

public void compact()
Compact the indices of assignments from the same type closing gaps, etc


createNew

public FxData createNew(int insertPosition)
                 throws FxNotFoundException,
                        FxInvalidParameterException,
                        FxCreateException
Create a new instance of this FxData with the next available multiplicity at the requested position

Parameters:
insertPosition - the requested inserting position
Returns:
a new FxData object
Throws:
FxNotFoundException - on errors
FxInvalidParameterException - on errors
FxCreateException - on errors

getAssignmentMultiplicity

public FxMultiplicity getAssignmentMultiplicity()
Get the multiplicity of the associated assignment

Returns:
multiplicity of the associated assignment

getPos

public int getPos()
Get the position of this data element within its hierarchy level

Returns:
position of this data element within its hierarchy level

setPos

public FxData setPos(int pos)
Set the position of this data element within its hierarchy level

Parameters:
pos - position to set
Returns:
this

getParent

public FxGroupData getParent()
Get the parent group of this data element

Returns:
parent group of this data element

getAlias

public java.lang.String getAlias()
Getter for the XPath alias (current XPath element name)

Returns:
alias

isRemoveable

public boolean isRemoveable()
Is this data removeable?

Returns:
if this data is removeable

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

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

copy

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

Parameters:
parent - parent group
Returns:
independent copy