com.flexive.shared.interfaces
Interface AssignmentEngine

All Known Subinterfaces:
AssignmentEngineLocal

public interface AssignmentEngine

Structure Assignment management

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

Method Summary
 long createGroup(FxGroupEdit group, java.lang.String parentXPath)
          Create a new group and assign it at the given parentXPath to the virtual ROOT_ID type
 long createGroup(long typeId, FxGroupEdit group, java.lang.String parentXPath)
          Create a new group and assign it at the given parentXPath to the given type
 long createGroup(long typeId, FxGroupEdit group, java.lang.String parentXPath, java.lang.String assignmentAlias)
          Create a new group and assign it at the given parentXPath to the given type using assignmentAlias instead of the group's given name
 long createProperty(FxPropertyEdit property, java.lang.String parentXPath)
          Create a new property and assign it at the given parentXPath to the virtual ROOT_ID type
 long createProperty(long typeId, FxPropertyEdit property, java.lang.String parentXPath)
          Create a new property and assign it at the given parentXPath to the given type
 long createProperty(long typeId, FxPropertyEdit property, java.lang.String parentXPath, java.lang.String assignmentAlias)
          Create a new property and assign it at the given parentXPath to the given type using assignmentAlias instead of properties name.
 void flattenAssignment(FxPropertyAssignment assignment)
          Flatten an assignment in the default storage
 void flattenAssignment(java.lang.String storage, FxPropertyAssignment assignment)
          Flatten an assignment
 long getAssignmentInstanceCount(long assignmentId)
          Get the number of content instances for a given assignment, (works for group and property assignments)
 java.util.Map<java.lang.String,java.util.List<FxPropertyAssignment>> getPotentialFlatAssignments(FxType type)
          Analyze a FxType and find potential property assignments that would be suitable for storage in a flat storage
 long getPropertyInstanceCount(long propertyId)
          Get the number of existing content instances using a given property.
 boolean isFlattenable(FxPropertyAssignment pa)
          Check if the given assignment can be flattened
 void removeAssignment(long assignmentId)
          Remove an assignment and all sub-assignments if the assignment is a group.
 void removeAssignment(long assignmentId, boolean removeSubAssignments, boolean removeDerivedAssignments)
          Remove an assignment
 void removeGroup(long groupId)
          Convenience method to remove a group, all its (derived) assignments and all referenced content The group assignment's subassignments are also removed.
 void removeProperty(long propertyId)
          Convenience method to remove a property, all its (derived) assignments and all referenced content
 long save(FxAssignment assignment, boolean createSubAssignments)
          Save an existing or create a new assignment.
 long save(FxGroupEdit group)
          Save an existing group.
 long save(FxPropertyEdit property)
          Save an existing property.
 void unflattenAssignment(FxPropertyAssignment assignment)
          Unflatten an assignment
 

Method Detail

createProperty

long createProperty(FxPropertyEdit property,
                    java.lang.String parentXPath)
                    throws FxApplicationException
Create a new property and assign it at the given parentXPath to the virtual ROOT_ID type

Parameters:
property - property to create
parentXPath - the property's parent xpath
Returns:
assignment id of the property
Throws:
FxApplicationException - on errors
FxCreateException - for create errors
FxInvalidParameterException - if the given parentXPath is not valid
FxEntryExistsException - if a property with this name already exists at the requested parentXPath
FxNoAccessException - if the calling user is not permitted to call this method

createProperty

long createProperty(long typeId,
                    FxPropertyEdit property,
                    java.lang.String parentXPath)
                    throws FxApplicationException
Create a new property and assign it at the given parentXPath to the given type

Parameters:
typeId - id of the type to assign this property to
property - property to create
parentXPath - the property's parent xpath
Returns:
assignment id of the property
Throws:
FxApplicationException - on errors
FxCreateException - for create errors
FxInvalidParameterException - if the given parentXPath is not valid
FxEntryExistsException - if a property with this name already exists at the requested parentXPath
FxNoAccessException - if the calling user is not permitted to call this method

createProperty

long createProperty(long typeId,
                    FxPropertyEdit property,
                    java.lang.String parentXPath,
                    java.lang.String assignmentAlias)
                    throws FxApplicationException
Create a new property and assign it at the given parentXPath to the given type using assignmentAlias instead of properties name.

Parameters:
typeId - id of the type to assign this property to
property - property to create
parentXPath - the property's parent xpath
assignmentAlias - alias to use for the assignment to the type
Returns:
assignment id of the property
Throws:
FxApplicationException - on errors
FxInvalidParameterException - if the given parentXPath is not valid
FxEntryExistsException - if a property with this name already exists at the requested parentXPath
FxNoAccessException - if the calling user is not permitted to call this method

createGroup

long createGroup(FxGroupEdit group,
                 java.lang.String parentXPath)
                 throws FxApplicationException
Create a new group and assign it at the given parentXPath to the virtual ROOT_ID type

Parameters:
group - the group to create
parentXPath - optional parent xpath of the group
Returns:
assignment id of the group
Throws:
FxApplicationException - on errors
FxCreateException - for create errors
FxInvalidParameterException - if the given parentXPath is not valid
FxEntryExistsException - if a group with this name already exists at the requested parentXPath
FxNoAccessException - if the calling user is not permitted to call this method

createGroup

long createGroup(long typeId,
                 FxGroupEdit group,
                 java.lang.String parentXPath)
                 throws FxApplicationException
Create a new group and assign it at the given parentXPath to the given type

Parameters:
typeId - id of the type to assign this group to
group - the group to create
parentXPath - optional parent xpath of the group
Returns:
assignment id of the group
Throws:
FxApplicationException - on errors
FxCreateException - for create errors
FxInvalidParameterException - if the given parentXPath is not valid
FxEntryExistsException - if a group with this name already exists at the requested parentXPath
FxNoAccessException - if the calling user is not permitted to call this method

createGroup

long createGroup(long typeId,
                 FxGroupEdit group,
                 java.lang.String parentXPath,
                 java.lang.String assignmentAlias)
                 throws FxApplicationException
Create a new group and assign it at the given parentXPath to the given type using assignmentAlias instead of the group's given name

Parameters:
typeId - id of the type to assign this group to
group - the group to create
parentXPath - optional parent xpath of the group
assignmentAlias - alias to use for the assignment to the type
Returns:
assignment id of the group
Throws:
FxApplicationException - on errors
FxCreateException - for create errors
FxInvalidParameterException - if the given parentXPath is not valid
FxEntryExistsException - if a group with this name already exists at the requested parentXPath
FxNoAccessException - if the calling user is not permitted to call this method

save

long save(FxAssignment assignment,
          boolean createSubAssignments)
          throws FxApplicationException
Save an existing or create a new assignment.

Parameters:
assignment - instance of FxPropertyAssignmentEdit or FxGroupAssignmentEdit
createSubAssignments - only used when creating a new group assignment, indicates if sub assignments of FxGroupAssignmentEdit should also be created.
Returns:
the id of the created or saved assignment
Throws:
FxApplicationException - on errors
FxInvalidParameterException
FxCreateException
FxUpdateException
FxNoAccessException - if the calling user is not permitted to call this method
See Also:
FxPropertyAssignmentEdit, FxGroupAssignmentEdit

removeAssignment

void removeAssignment(long assignmentId,
                      boolean removeSubAssignments,
                      boolean removeDerivedAssignments)
                      throws FxApplicationException
Remove an assignment

Parameters:
assignmentId - assignment to remove
removeSubAssignments - if assignment is a group, remove all attached properties and groups?
removeDerivedAssignments - if derivates of this assignment in derived types exist, remove them as well?
Throws:
FxApplicationException - on errors
FxNotFoundException - if the assignmentId is invalid
FxRemoveException - on remove errors
FxNoAccessException - if the calling user is not permitted to call this method

removeAssignment

void removeAssignment(long assignmentId)
                      throws FxApplicationException
Remove an assignment and all sub-assignments if the assignment is a group. In case the assignment is derived, it will be removed as well - beware of breaking inheritance! All assignments derived from this assignment will *not* be removed as but converted to regular assignments. This method is rather "brute-force" - you should prefer calling #removeAssignment(long assignmentId, boolean removeSubAssignments, boolean removeDerivedAssignments)

Parameters:
assignmentId - the assignment to (completely) remove
Throws:
FxApplicationException - on errors
See Also:
removeAssignment(long, boolean, boolean)

save

long save(FxPropertyEdit property)
          throws FxApplicationException
Save an existing property.

Parameters:
property - instance of FxPropertyEdit
Returns:
the id of the saved property
Throws:
FxApplicationException - on errors
FxInvalidParameterException
FxCreateException
FxUpdateException
FxNoAccessException - if the calling user is not permitted to call this method
See Also:
FxPropertyEdit

save

long save(FxGroupEdit group)
          throws FxApplicationException
Save an existing group.

Parameters:
group - instance of FxGroupEdit
Returns:
the id of the saved property
Throws:
FxApplicationException - on errors
FxInvalidParameterException
FxCreateException
FxUpdateException
FxNoAccessException - if the calling user is not permitted to call this method
See Also:
FxGroupEdit

getAssignmentInstanceCount

long getAssignmentInstanceCount(long assignmentId)
                                throws FxApplicationException
Get the number of content instances for a given assignment, (works for group and property assignments)

Parameters:
assignmentId - id of the requested assignment
Returns:
number of content instances using the assignment
Throws:
FxApplicationException - on errors

getPropertyInstanceCount

long getPropertyInstanceCount(long propertyId)
                              throws FxDbException
Get the number of existing content instances using a given property.

Parameters:
propertyId - id of the requested assignment
Returns:
number of content instances using the assignment
Throws:
FxDbException - on errors

removeProperty

void removeProperty(long propertyId)
                    throws FxApplicationException
Convenience method to remove a property, all its (derived) assignments and all referenced content

Parameters:
propertyId - the property's id
Throws:
FxApplicationException - on errors

removeGroup

void removeGroup(long groupId)
                 throws FxApplicationException
Convenience method to remove a group, all its (derived) assignments and all referenced content The group assignment's subassignments are also removed.

Parameters:
groupId - the group's id
Throws:
FxApplicationException - on errors

getPotentialFlatAssignments

java.util.Map<java.lang.String,java.util.List<FxPropertyAssignment>> getPotentialFlatAssignments(FxType type)
Analyze a FxType and find potential property assignments that would be suitable for storage in a flat storage

Parameters:
type - the FxType to analyze
Returns:
List containing potential property assignments that would be suitable for storage in a flat storage, key=Storage type/column
Since:
3.1

isFlattenable

boolean isFlattenable(FxPropertyAssignment pa)
Check if the given assignment can be flattened

Parameters:
pa - property assignment to check
Returns:
flattenable
Since:
3.1

flattenAssignment

void flattenAssignment(FxPropertyAssignment assignment)
                       throws FxApplicationException
Flatten an assignment in the default storage

Parameters:
assignment - the property assignment to flatten
Throws:
FxApplicationException - on errors
Since:
3.1

flattenAssignment

void flattenAssignment(java.lang.String storage,
                       FxPropertyAssignment assignment)
                       throws FxApplicationException
Flatten an assignment

Parameters:
storage - the storage to use
assignment - the property assignment to flatten
Throws:
FxApplicationException - on errors
Since:
3.1

unflattenAssignment

void unflattenAssignment(FxPropertyAssignment assignment)
                         throws FxApplicationException
Unflatten an assignment

Parameters:
assignment - the property assignment to unflatten
Throws:
FxApplicationException - on errors
Since:
3.1