com.flexive.shared.structure
Class FxType

java.lang.Object
  extended by com.flexive.shared.AbstractSelectableObjectWithLabel
      extended by com.flexive.shared.structure.FxType
All Implemented Interfaces:
ObjectWithLabel, SelectableObject, SelectableObjectWithLabel, java.io.Serializable
Direct Known Subclasses:
FxTypeEdit

public class FxType
extends AbstractSelectableObjectWithLabel
implements java.io.Serializable, SelectableObjectWithLabel

Type definition

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
           
protected  java.util.List<FxGroupAssignment> assignedGroups
           
protected  java.util.List<FxPropertyAssignment> assignedProperties
           
protected  TypeCategory category
           
static java.lang.String CONTACTDATA
          Name of the account contact data type
protected  java.util.List<FxType> derivedTypes
           
protected  FxString description
           
static java.lang.String FOLDER
          Name of the folder data type.
protected  long historyAge
           
protected  FxReference icon
           
protected  long id
           
protected  LanguageMode language
           
protected  LifeCycleInfo lifeCycleInfo
           
protected  int maxRelDestination
           
protected  int maxRelSource
           
protected  long maxVersions
           
protected  TypeMode mode
           
protected  java.lang.String name
           
protected  FxType parent
           
protected  byte permissions
           
protected  java.util.List<FxTypeRelation> relations
           
static long ROOT_ID
          Virtual ROOT_ID type
protected  java.util.List<FxAssignment> scriptedAssignments
           
protected  java.util.Map<FxScriptEvent,long[]> scriptMapping
           
protected  TypeState state
           
protected  TypeStorageMode storageMode
           
protected  boolean trackHistory
           
protected  java.util.List<FxProperty> uniqueProperties
           
protected  Workflow workflow
           
 
Constructor Summary
FxType(long id, ACL acl, Workflow workflow, java.lang.String name, FxString description, FxType parent, TypeStorageMode storageMode, TypeCategory category, TypeMode mode, LanguageMode language, TypeState state, byte permissions, boolean trackHistory, long historyAge, long maxVersions, int maxRelSource, int maxRelDestination, LifeCycleInfo lifeCycleInfo, java.util.List<FxType> derivedTypes, java.util.List<FxTypeRelation> relations)
           
 
Method Summary
 FxTypeEdit asEditable()
          Get this FxType as editable
 java.lang.String buildXPathPrefix(FxPK pk)
          Build an XPath prefix for addressing an instance in XPath's
 FxGroupData createEmptyData(java.lang.String xpPrefix)
          Create an empty FxData hierarchy for a new FxContent starting with a virtual root group.
 FxGroupData createRandomData(FxPK pk, FxEnvironment env, java.util.Random rnd, int maxMultiplicity)
          Create a base group with random data
 ACL getACL()
          Get the ACL of this type
 java.util.List<FxGroupAssignment> getAssignedGroups()
          Get all group assignments that are attached to the type's root
 java.util.List<FxPropertyAssignment> getAssignedProperties()
          Get all property assignments that are attached to the type's root
 FxAssignment getAssignment(java.lang.String parentXPath)
          Get the assignment for the given XPath
 java.util.List<FxPropertyAssignment> getAssignmentsForDataType(FxDataType dataType)
          Get a list of all FxPropertyAssignments connected to this type that are of the given FxDataType.
 java.util.List<FxPropertyAssignment> getAssignmentsForProperty(long propertyId)
          Get a list of all FxPropertyAssignments connected to this type that are assigned to the requested property
 byte getBitCodedPermissions()
          Get the permissions set for this type bit coded
 TypeCategory getCategory()
          Get the category of this FxType (System, User, ...)
 java.util.List<FxAssignment> getConnectedAssignments(java.lang.String parentXPath)
          Get all assignments directly connected to the given XPath
 java.util.List<FxType> getDerivedTypes()
          Get all FxTypes that are derived from this Type
 FxString getDescription()
          Get the description (=label) of this FxType
 java.lang.String getDisplayName()
          Returrn a localized, human-readable name for the type.
 FxGroupAssignment getGroupAssignment(java.lang.String parentXPath)
          Get the FxGroupAssignment for the given XPath.
 long getHistoryAge()
          Get how many days history is tracked (0 = forever)
 FxReference getIcon()
          Get the preview icon of this type.
 long getId()
          Internal id of this FxType
 FxString getLabel()
          Return the localized label of the object.
 LanguageMode getLanguage()
          How are languages handled? (None, Single, Multiple, ...)
 LifeCycleInfo getLifeCycleInfo()
          Get information about changes
 int getMaxRelDestination()
          How many destination instances may be related to this instance in total? (infinte = <0)
 int getMaxRelSource()
          How many source instances may be related to this instance in total? (infinte = <0)
 long getMaxVersions()
          Get how many versions of instances are kept (-1 = infinite, 0 = none)
 TypeMode getMode()
          Is this FxType defining a content or relation?
 java.lang.String getName()
          Get the name of this FxType
 FxType getParent()
          If this FxType is derived from another FxType get the 'super' FxType
 FxPropertyAssignment getPropertyAssignment(java.lang.String parentXPath)
          Get the FxPropertyAssignment for the given XPath.
 java.util.List<FxTypeRelation> getRelations()
          Get all possible relation combinations
 java.util.List<FxAssignment> getScriptedAssignments(FxScriptEvent event)
          Get a list with all assignments that have scripts assigned for the given script type
 java.util.Set<FxScriptEvent> getScriptEvents()
          Get a Set of all events that have script mappings for this type
 long[] getScriptMapping(FxScriptEvent event)
          Get the script id's that are mapped to this type for the requested script type
 TypeState getState()
          Get the state of this type
 TypeStorageMode getStorageMode()
          Get how is data stored internally.
 java.util.List<FxProperty> getUniqueProperties()
          Get all properties used in this type that have a unique constraint set
 Workflow getWorkflow()
          Getter for the assigned Workflow
 boolean hasScriptedAssignments()
          Do scripted assignments exists for this type?
 boolean hasScriptMapping(FxScriptEvent event)
          Does this type have mappings for the requested script event type?
 boolean hasUniqueProperties()
          Do unique properties for this type exist?
 boolean isDerived()
          Is this FxType derived from another?
 boolean isRelation()
          Is this type a relation?
 boolean isTrackHistory()
          Track history of changes?
 boolean isXPathValid(java.lang.String XPath, boolean checkProperty)
          Check if the given XPath is valid for this content
 void reloadWorkflow(FxEnvironment environment)
          Reload this types workflow, internal method, called from the StructureLoader upon Workflow changes
 void resolveReferences(FxEnvironment fxStructure)
          Resolve references after initial loading
 java.lang.String toString()
          
 boolean useInstancePermissions()
          Use content instance permissions?
 boolean usePermissions()
          Use permissions at all?
 boolean usePropertyPermissions()
          Use property permissions?
 boolean useStepPermissions()
          Use step permissions?
 boolean useTypePermissions()
          Use type permissions?
 
Methods inherited from class com.flexive.shared.AbstractSelectableObjectWithLabel
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT_ID

public static final long ROOT_ID
Virtual ROOT_ID type

See Also:
Constant Field Values

CONTACTDATA

public static final java.lang.String CONTACTDATA
Name of the account contact data type

See Also:
Constant Field Values

FOLDER

public static final java.lang.String FOLDER
Name of the folder data type.

See Also:
Constant Field Values

id

protected long id

ACL

protected ACL ACL

workflow

protected Workflow workflow

name

protected java.lang.String name

description

protected FxString description

parent

protected FxType parent

storageMode

protected TypeStorageMode storageMode

category

protected TypeCategory category

mode

protected TypeMode mode

language

protected LanguageMode language

state

protected TypeState state

permissions

protected byte permissions

trackHistory

protected boolean trackHistory

historyAge

protected long historyAge

maxVersions

protected long maxVersions

maxRelSource

protected int maxRelSource

maxRelDestination

protected int maxRelDestination

lifeCycleInfo

protected LifeCycleInfo lifeCycleInfo

derivedTypes

protected java.util.List<FxType> derivedTypes

relations

protected java.util.List<FxTypeRelation> relations

assignedProperties

protected java.util.List<FxPropertyAssignment> assignedProperties

uniqueProperties

protected java.util.List<FxProperty> uniqueProperties

assignedGroups

protected java.util.List<FxGroupAssignment> assignedGroups

scriptedAssignments

protected java.util.List<FxAssignment> scriptedAssignments

scriptMapping

protected java.util.Map<FxScriptEvent,long[]> scriptMapping

icon

protected FxReference icon
Constructor Detail

FxType

public FxType(long id,
              ACL acl,
              Workflow workflow,
              java.lang.String name,
              FxString description,
              FxType parent,
              TypeStorageMode storageMode,
              TypeCategory category,
              TypeMode mode,
              LanguageMode language,
              TypeState state,
              byte permissions,
              boolean trackHistory,
              long historyAge,
              long maxVersions,
              int maxRelSource,
              int maxRelDestination,
              LifeCycleInfo lifeCycleInfo,
              java.util.List<FxType> derivedTypes,
              java.util.List<FxTypeRelation> relations)
Method Detail

getCategory

public TypeCategory getCategory()
Get the category of this FxType (System, User, ...)

Returns:
the category.

getId

public long getId()
Internal id of this FxType

Specified by:
getId in interface SelectableObject
Returns:
the internal id of this FxType

getACL

public ACL getACL()
Get the ACL of this type

Returns:
ACL of this type

getWorkflow

public Workflow getWorkflow()
Getter for the assigned Workflow

Returns:
Workflow

reloadWorkflow

public void reloadWorkflow(FxEnvironment environment)
Reload this types workflow, internal method, called from the StructureLoader upon Workflow changes

Parameters:
environment - environment with updated workflows

getLanguage

public LanguageMode getLanguage()
How are languages handled? (None, Single, Multiple, ...)

Returns:
how languages are handled

getState

public TypeState getState()
Get the state of this type

Returns:
TypeState

getMode

public TypeMode getMode()
Is this FxType defining a content or relation?

Returns:
mode (Content or Relation)

getName

public java.lang.String getName()
Get the name of this FxType

Returns:
name

getDescription

public FxString getDescription()
Get the description (=label) of this FxType

Returns:
description (=label)

getLabel

public FxString getLabel()
Return the localized label of the object.

Specified by:
getLabel in interface ObjectWithLabel
Returns:
the localized label for the object.

getDisplayName

public java.lang.String getDisplayName()
Returrn a localized, human-readable name for the type.

Returns:
a localized, human-readable name for the type.

isRelation

public boolean isRelation()
Is this type a relation?

Returns:
if this type is a relation

isDerived

public boolean isDerived()
Is this FxType derived from another?

Returns:
if this FxType is derived from another
See Also:
getParent()

getParent

public FxType getParent()
If this FxType is derived from another FxType get the 'super' FxType

Returns:
FxType this one is derived from or null

getDerivedTypes

public java.util.List<FxType> getDerivedTypes()
Get all FxTypes that are derived from this Type

Returns:
Iterator of all derived types

getStorageMode

public TypeStorageMode getStorageMode()
Get how is data stored internally.

Returns:
how data is stored internally

usePermissions

public boolean usePermissions()
Use permissions at all?

Returns:
if permissions are used at all

useInstancePermissions

public boolean useInstancePermissions()
Use content instance permissions?

Returns:
if content instance permissions are used

usePropertyPermissions

public boolean usePropertyPermissions()
Use property permissions?

Returns:
if property permissions are used

useStepPermissions

public boolean useStepPermissions()
Use step permissions?

Returns:
if step permissions are used

useTypePermissions

public boolean useTypePermissions()
Use type permissions?

Returns:
if type permissions are used

isTrackHistory

public boolean isTrackHistory()
Track history of changes?

Returns:
if history of changes is tracked

getHistoryAge

public long getHistoryAge()
Get how many days history is tracked (0 = forever)

Returns:
how many days history is tracked (0 = forever)

getMaxVersions

public long getMaxVersions()
Get how many versions of instances are kept (-1 = infinite, 0 = none)

Returns:
how many versions of instances are kept (-1 = infinite, 0 = none)

getMaxRelSource

public int getMaxRelSource()
How many source instances may be related to this instance in total? (infinte = <0)

Returns:
how many source instances may be related to this instance in total? (infinte = <0)

getMaxRelDestination

public int getMaxRelDestination()
How many destination instances may be related to this instance in total? (infinte = <0)

Returns:
how many destination instances may be related to this instance in total? (infinte = <0)

getLifeCycleInfo

public LifeCycleInfo getLifeCycleInfo()
Get information about changes

Returns:
information about changes

getAssignedGroups

public java.util.List<FxGroupAssignment> getAssignedGroups()
Get all group assignments that are attached to the type's root

Returns:
all group assignments that are attached to the type's root

getAssignedProperties

public java.util.List<FxPropertyAssignment> getAssignedProperties()
Get all property assignments that are attached to the type's root

Returns:
all property assignments that are attached to the type's root

hasUniqueProperties

public boolean hasUniqueProperties()
Do unique properties for this type exist?

Returns:
if unique properties for this type exist

getUniqueProperties

public java.util.List<FxProperty> getUniqueProperties()
Get all properties used in this type that have a unique constraint set

Returns:
all properties used in this type that have a unique constraint set

getRelations

public java.util.List<FxTypeRelation> getRelations()
Get all possible relation combinations

Returns:
possible relation combinations

hasScriptMapping

public boolean hasScriptMapping(FxScriptEvent event)
Does this type have mappings for the requested script event type?

Parameters:
event - requested script event type
Returns:
if mappings exist

hasScriptedAssignments

public boolean hasScriptedAssignments()
Do scripted assignments exists for this type?

Returns:
if scripted assignments exist for this type

getScriptedAssignments

public java.util.List<FxAssignment> getScriptedAssignments(FxScriptEvent event)
Get a list with all assignments that have scripts assigned for the given script type

Parameters:
event - script event
Returns:
list with all assignments that have scripts assigned for the given script type

getScriptMapping

public long[] getScriptMapping(FxScriptEvent event)
Get the script id's that are mapped to this type for the requested script type

Parameters:
event - requested script event
Returns:
mappings or null if mapping does not exist for this type

getScriptEvents

public java.util.Set<FxScriptEvent> getScriptEvents()
Get a Set of all events that have script mappings for this type

Returns:
Set of all events that have script mappings for this type

getBitCodedPermissions

public byte getBitCodedPermissions()
Get the permissions set for this type bit coded

Returns:
bit coded permissions

getIcon

public FxReference getIcon()
Get the preview icon of this type. The icon can be empty if not defined. Version is ignored and always the max version.

Returns:
preview icon (can be empty)

resolveReferences

public void resolveReferences(FxEnvironment fxStructure)
                       throws FxNotFoundException
Resolve references after initial loading

Parameters:
fxStructure - structure for references
Throws:
FxNotFoundException - on errors

createEmptyData

public FxGroupData createEmptyData(java.lang.String xpPrefix)
                            throws FxCreateException
Create an empty FxData hierarchy for a new FxContent starting with a virtual root group.

Parameters:
xpPrefix - XPath prefix like "FxType name[@pk=..]"
Returns:
empty FxData hierarchy
Throws:
FxCreateException - on errors

createRandomData

public FxGroupData createRandomData(FxPK pk,
                                    FxEnvironment env,
                                    java.util.Random rnd,
                                    int maxMultiplicity)
                             throws FxCreateException
Create a base group with random data

Parameters:
pk - primary key of instance that uses this random data
env - environment
rnd - Random to use
maxMultiplicity - the maximum multiplicity for groups
Returns:
random data
Throws:
FxCreateException - on errors

getAssignment

public FxAssignment getAssignment(java.lang.String parentXPath)
                           throws FxInvalidParameterException,
                                  FxNotFoundException
Get the assignment for the given XPath

Parameters:
parentXPath - desired XPath
Returns:
FxAssignment
Throws:
FxInvalidParameterException - if XPath is not valid
FxNotFoundException - XPath not found

getPropertyAssignment

public FxPropertyAssignment getPropertyAssignment(java.lang.String parentXPath)
                                           throws FxInvalidParameterException,
                                                  FxNotFoundException
Get the FxPropertyAssignment for the given XPath. This is a convenience method calling internally getAssignment and casting the result to FxPropertyAssignment if appropriate, else throws an FxInvalidParameterException if the assignment is a group.

Parameters:
parentXPath - desired XPath
Returns:
FxAssignment
Throws:
FxInvalidParameterException - if XPath is not valid or a group
FxNotFoundException - XPath not found

getGroupAssignment

public FxGroupAssignment getGroupAssignment(java.lang.String parentXPath)
                                     throws FxInvalidParameterException,
                                            FxNotFoundException
Get the FxGroupAssignment for the given XPath. This is a convenience method calling internally getAssignment and casting the result to FxGroupAssignment if appropriate, else throws an FxInvalidParameterException if the assignment is a property.

Parameters:
parentXPath - desired XPath
Returns:
FxAssignment
Throws:
FxInvalidParameterException - if XPath is not valid or a propery
FxNotFoundException - XPath not found

getAssignmentsForProperty

public java.util.List<FxPropertyAssignment> getAssignmentsForProperty(long propertyId)
Get a list of all FxPropertyAssignments connected to this type that are assigned to the requested property

Parameters:
propertyId - requested property id
Returns:
list of all FxPropertyAssignments connected to this type that are assigned to the requested property

getAssignmentsForDataType

public java.util.List<FxPropertyAssignment> getAssignmentsForDataType(FxDataType dataType)
Get a list of all FxPropertyAssignments connected to this type that are of the given FxDataType.

Parameters:
dataType - the data type
Returns:
list of all FxPropertyAssignments connected to this type that are of the given data type

getConnectedAssignments

public java.util.List<FxAssignment> getConnectedAssignments(java.lang.String parentXPath)
                                                     throws FxInvalidParameterException,
                                                            FxNotFoundException
Get all assignments directly connected to the given XPath

Parameters:
parentXPath - desired XPath
Returns:
ArrayList of FxAssignment
Throws:
FxInvalidParameterException - if XPath is not valid
FxNotFoundException - XPath not found

isXPathValid

public boolean isXPathValid(java.lang.String XPath,
                            boolean checkProperty)
Check if the given XPath is valid for this content

Parameters:
XPath - the XPath to check
checkProperty - should the XPath point to a property?
Returns:
if the XPath is valid or not

toString

public java.lang.String toString()

Overrides:
toString in class AbstractSelectableObjectWithLabel

asEditable

public FxTypeEdit asEditable()
Get this FxType as editable

Returns:
FxTypeEdit

buildXPathPrefix

public java.lang.String buildXPathPrefix(FxPK pk)
Build an XPath prefix for addressing an instance in XPath's

Parameters:
pk - primary key of the instance
Returns:
XPath prefix like "FxType name[@pk=..]"