com.flexive.war.javascript.tree
Class StructureTreeEditor

java.lang.Object
  extended by com.flexive.war.javascript.tree.StructureTreeEditor
All Implemented Interfaces:
java.io.Serializable

public class StructureTreeEditor
extends java.lang.Object
implements java.io.Serializable

Content tree edit actions invoked via JSON/RPC.

Version:
$Rev: 2906 $
Author:
Gerhard Glos (gerhard.glos@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Constructor Summary
StructureTreeEditor()
           
 
Method Summary
 long createDerivedType(long parentId, java.lang.String alias)
          Creates a derived type with the specified alias of the type with the specified parent id and returns the id of the derived type.
 void deleteAssignment(long id)
          Remove an assignment, breaking inheritance if needed
 void deleteType(long id)
          Remove a type
 java.lang.String getLabel(long id, java.lang.String nodeType)
          Returns the display label for the given Type/Group/Assignment with the specified id.
 boolean isAssignmentExists(long id)
          Returns if an assignment exits.
 boolean isAssignmentSearchable(long assId)
          Returns if an FxPropertyAssignment (or its property repsectively) has set OPTION_SEARCHABLE to true
 boolean isDirectChild(long assId, long parentId, java.lang.String parentNodeType)
          Checks if an assignment is the direct child of a given type or group.
 boolean isParentAssignment(long parent, long child)
          Returns if an assignment with the specified id is the parent assignment of a child assignment with specified id.
 boolean isSameLevel(long id1, long id2)
          Compares if two assignments are positioned at the same hierarchy level.
 boolean isTypeExists(long id)
          Returns if a type still.
 void moveAssignmentRelative(long srcId, java.lang.String srcNodeType, long destId, int steps)
          Moves a source assignment to a relative position of another destination assignment.
 long pasteAssignmentInto(long parentAssId, java.lang.String parentNodeType, long targetId, java.lang.String targetNodeType, java.lang.String newName)
          Creates a derived assignment from a given assignment and pastes it into the the target group or type at the first position.
 long pasteAssignmentRelative(long srcId, java.lang.String srcNodeType, long destId, java.lang.String destNodeType, java.lang.String newName, int steps)
          Creates a derived assignment from a given assignment and pastes it at a relative position above or below (indicated by steps) a destination assignment.
 boolean validateAlias(java.lang.String alias)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureTreeEditor

public StructureTreeEditor()
Method Detail

deleteAssignment

public void deleteAssignment(long id)
                      throws com.flexive.shared.exceptions.FxApplicationException
Remove an assignment, breaking inheritance if needed

Parameters:
id - the assignment id to remove
Throws:
com.flexive.shared.exceptions.FxApplicationException - on errors

deleteType

public void deleteType(long id)
                throws com.flexive.shared.exceptions.FxApplicationException
Remove a type

Parameters:
id - id of the type to remove
Throws:
com.flexive.shared.exceptions.FxApplicationException - on errors

pasteAssignmentInto

public long pasteAssignmentInto(long parentAssId,
                                java.lang.String parentNodeType,
                                long targetId,
                                java.lang.String targetNodeType,
                                java.lang.String newName)
                         throws com.flexive.shared.exceptions.FxApplicationException
Creates a derived assignment from a given assignment and pastes it into the the target group or type at the first position. A new alias can also be specified.

Parameters:
parentAssId - the id from which the assignment will be derived
parentNodeType - the nodeType from which the assignment will be derived (i.e. StructureTreeWriter.NODE_TYPE_GROUP, StructureTreeWriter.NODE_TYPE_ASSIGNMENT)
targetId - the id of the group or type the assignment will be pasted into.
targetNodeType - the node type of the target (i.e. StructureTreeWriter.NODE_TYPE_GROUP, StructureTreeWriter.NODE_TYPE_TYPE).
newName - the new alias. if ==null the old will be taken.
Returns:
the id of the newly created assignment
Throws:
com.flexive.shared.exceptions.FxApplicationException - on errors

pasteAssignmentRelative

public long pasteAssignmentRelative(long srcId,
                                    java.lang.String srcNodeType,
                                    long destId,
                                    java.lang.String destNodeType,
                                    java.lang.String newName,
                                    int steps)
                             throws com.flexive.shared.exceptions.FxApplicationException
Creates a derived assignment from a given assignment and pastes it at a relative position above or below (indicated by steps) a destination assignment. A new alias can also be specified.

Parameters:
srcId - the id from which the assignment will be derived
srcNodeType - the nodeType from which the assignment will be derived (i.e. StructureTreeWriter.NODE_TYPE_GROUP, StructureTreeWriter.NODE_TYPE_ASSIGNMENT)
destId - the id of the destination assignment, where the assignment will be pasted at a relative position
destNodeType - the node type of the destination assignment
newName - the new alias. if ==null the old will be taken.
steps - the position relative to the destination assignment, where the derived assignment will be pasted.
Returns:
the id of the newly created assignment
Throws:
com.flexive.shared.exceptions.FxApplicationException - on errors

moveAssignmentRelative

public void moveAssignmentRelative(long srcId,
                                   java.lang.String srcNodeType,
                                   long destId,
                                   int steps)
                            throws com.flexive.shared.exceptions.FxApplicationException
Moves a source assignment to a relative position of another destination assignment. The assignments need to be at the same hierarchy level for positioning to work properly. Steps indicates the relative position offset: If steps is -1,-2..n the source assignment will be moved 1,2..n positions before the destination assignment. If steps is 1,2..n the source assignment will be moved 1,2..n positions after the destination assignment.

Parameters:
srcId - the id of the assignment that shall be moved.
srcNodeType - the node type of the assignment to be moved.
destId - the id of the destination assignment relative to which the source assignment will be moved.
steps - relative position offset.
Throws:
com.flexive.shared.exceptions.FxApplicationException - if the node type doesn't match StructureTreeWriter.NODE_TYPE_GROUP or StructureTreeWriter.NODE_TYPE_ASSIGNMENT

validateAlias

public boolean validateAlias(java.lang.String alias)

isSameLevel

public boolean isSameLevel(long id1,
                           long id2)
Compares if two assignments are positioned at the same hierarchy level.

Parameters:
id1 - id of first assignment
id2 - id of second assignment
Returns:
true if they have the same parent type, or if parent group assignments exist, true if they have the same parent group assignment

isDirectChild

public boolean isDirectChild(long assId,
                             long parentId,
                             java.lang.String parentNodeType)
                      throws com.flexive.shared.exceptions.FxInvalidParameterException,
                             com.flexive.shared.exceptions.FxNotFoundException
Checks if an assignment is the direct child of a given type or group.

Parameters:
assId - id of the assignment
parentId - id of type or group assignment
parentNodeType - the nodeDocType (i.e. StructureTreeWriter.NODE_TYPE_GROUP, StructureTreeWriter.NODE_TYPE_TYPE) of the parent
Returns:
true if the assignment is a direct child of the type or group
Throws:
com.flexive.shared.exceptions.FxInvalidParameterException - for invalid nodeDocTypes
com.flexive.shared.exceptions.FxNotFoundException - on errors

isParentAssignment

public boolean isParentAssignment(long parent,
                                  long child)
Returns if an assignment with the specified id is the parent assignment of a child assignment with specified id.

Parameters:
parent - parent assignment id
child - child assignment id
Returns:
true the parent assignment is the parent of the child assignment.

isAssignmentSearchable

public boolean isAssignmentSearchable(long assId)
Returns if an FxPropertyAssignment (or its property repsectively) has set OPTION_SEARCHABLE to true

Parameters:
assId - assignment id
Returns:
if an assignment is searchable

isTypeExists

public boolean isTypeExists(long id)
Returns if a type still. (Used to check after deletion of a type if the content page is still valid or if it displays a structure element that does not exist anymore).

Parameters:
id - the id of the type
Returns:
if the type with the specified id exists.

isAssignmentExists

public boolean isAssignmentExists(long id)
Returns if an assignment exits. (Used to check after deletion if the content page is still valid or or if it displays a structure element that does not exist anymore).

Parameters:
id - the id of the assignment
Returns:
if the type with the specified id exists.

createDerivedType

public long createDerivedType(long parentId,
                              java.lang.String alias)
                       throws com.flexive.shared.exceptions.FxApplicationException
Creates a derived type with the specified alias of the type with the specified parent id and returns the id of the derived type.

Parameters:
parentId - the id of the parent type
alias - the name of derived type
Returns:
the id of the derived type
Throws:
com.flexive.shared.exceptions.FxApplicationException

getLabel

public java.lang.String getLabel(long id,
                                 java.lang.String nodeType)
Returns the display label for the given Type/Group/Assignment with the specified id.

Parameters:
id - the id
nodeType - the nodeDocType (i.e. StructureTreeWriter.NODE_TYPE_GROUP, StructureTreeWriter.NODE_TYPE_TYPE,..)
Returns:
the display label