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 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.
 long getAssignmentInstanceCount(long assignmentId)
          Get the number of content instances for a given assignment, (works for group and property assignments)
 long getPropertyInstanceCount(long propertyId)
          Get the number of existing content instances using a given property.
 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
 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.
 

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

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