com.flexive.shared.structure.export
Class StructureExporterTools

java.lang.Object
  extended by com.flexive.shared.structure.export.StructureExporterTools

public final class StructureExporterTools
extends java.lang.Object

Tool methods to create Groovy Script code from given structures

Author:
Christopher Blasnik (c.blasnik@flexive.com) UCS - unique computing solutions gmbh (http://www.ucs.at)

Nested Class Summary
protected static class StructureExporterTools.IgnoreProps
          Enumeration of properties which will be ignored
 
Field Summary
static java.util.List<java.lang.String> DATATYPES
           
static java.util.Map<java.lang.String,java.lang.String> DATATYPESSIMPLE
           
 
Method Summary
static java.util.List<java.lang.Long> convertAssignmentsToIds(java.util.List<? extends FxAssignment> assignments)
          Converts a List List of ids
static java.util.List<FxAssignment> convertIdsToAssignments(java.util.List<java.lang.Long> assignIds)
          Converts a List of assignment ids to a List
static java.util.List<FxAssignment> getAllDerivedAssignmentsForType(FxType type)
          This method returns all derived assignments (groups and properties) for a given type (all assignments in groups and subgroups as well).
static java.util.List<FxAssignment> getAllUniqueAssignmentsForGroup(FxGroupAssignment g)
          This method returns a List of all unique (= not derived from another property or group) assignments for a given group.
static long getBaseTypeId(FxAssignment a)
          Method to get an assignment's base type
static java.util.Map<java.lang.Long,java.util.List<java.lang.Long>> getBaseTypeIds(java.util.List<FxAssignment> l)
          Returns a Map of base FxType IDs for a List of FxAssignments The map keys are the type Ids, the values are Lists of assignment ids
static java.lang.String getBaseXPath(FxAssignment a)
          Returns the base XPath of an assignment
static java.util.List<FxAssignment> getCombinedAssignments(java.util.List<FxPropertyAssignment> p, java.util.List<FxGroupAssignment> g)
          Takes a List of FxPropertyAssignments and a List of FxGroupAssignments as parameters and returns a combined List of both (FxAssignment) sorted by their positions
static java.util.Set<java.lang.Long> getDerivedAssTypeIds(java.util.List<FxAssignment> l)
          Returns a Set of base FxType IDs for a List of FxAssignments (Set s.t.
static java.util.Map<FxScriptEvent,java.lang.Long[]> getScript(FxAssignment assignment)
          Examines a given FxAssignments for ScriptEvents --> scripts and returns a Map containing that information
static boolean isSystemProperty(java.lang.String xPath)
          Iterates through the enum IgnoreProps
static
<T> java.util.List<T>
listCompare(java.util.List<T> src, java.util.List<T> cmp)
          Performs a linear list comparison and returns a combination of both,
static java.util.List<FxAssignment> recursiveDerivedAssignmentSearch(FxGroupAssignment a)
          Helper method - a recursive search of all child assignments of a group, returns all derived assignments
static java.util.List<FxAssignment> recursiveParentGroupAssignmentSearch(FxAssignment a)
          Returns all parents for a given assignment, or an empty list if none are found.
static boolean typeHasAssignments(FxType type)
          Checks whether a type has any assignments (properties or groups)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATATYPESSIMPLE

public static final java.util.Map<java.lang.String,java.lang.String> DATATYPESSIMPLE

DATATYPES

public static final java.util.List<java.lang.String> DATATYPES
Method Detail

getAllDerivedAssignmentsForType

public static java.util.List<FxAssignment> getAllDerivedAssignmentsForType(FxType type)
This method returns all derived assignments (groups and properties) for a given type (all assignments in groups and subgroups as well).

Parameters:
type - the FxType
Returns:
returns a list of all derived assignments for the type

recursiveDerivedAssignmentSearch

public static java.util.List<FxAssignment> recursiveDerivedAssignmentSearch(FxGroupAssignment a)
Helper method - a recursive search of all child assignments of a group, returns all derived assignments

Parameters:
a - a given FxGroupAssignment
Returns:
a list of FxAssignments containing only derived child assignments

getAllUniqueAssignmentsForGroup

public static java.util.List<FxAssignment> getAllUniqueAssignmentsForGroup(FxGroupAssignment g)
This method returns a List of all unique (= not derived from another property or group) assignments for a given group.

Parameters:
g - an FxGroupAssignment
Returns:
returns a List of unique properties / groups or NULL if no such assignments were found.

recursiveParentGroupAssignmentSearch

public static java.util.List<FxAssignment> recursiveParentGroupAssignmentSearch(FxAssignment a)
Returns all parents for a given assignment, or an empty list if none are found.

Parameters:
a - a given FxAssignment
Returns:
returns a List of parent (group) FxAssignments

getDerivedAssTypeIds

public static java.util.Set<java.lang.Long> getDerivedAssTypeIds(java.util.List<FxAssignment> l)
Returns a Set of base FxType IDs for a List of FxAssignments (Set s.t. no duplicates will be returned)

Parameters:
l - a list of FxAssignments
Returns:
returns a Set of typeIds

getBaseTypeIds

public static java.util.Map<java.lang.Long,java.util.List<java.lang.Long>> getBaseTypeIds(java.util.List<FxAssignment> l)
Returns a Map of base FxType IDs for a List of FxAssignments The map keys are the type Ids, the values are Lists of assignment ids

Parameters:
l - a list of FxAssignments
Returns:
returns the Map of typeids vs. assignmentIds

getBaseTypeId

public static long getBaseTypeId(FxAssignment a)
Method to get an assignment's base type

Parameters:
a - FxAssignment
Returns:
returns the id of the base property's type

isSystemProperty

public static boolean isSystemProperty(java.lang.String xPath)
Iterates through the enum IgnoreProps

Parameters:
xPath - XPath of a given assignment
Returns:
returns true if the xPath should be ignored

getBaseXPath

public static java.lang.String getBaseXPath(FxAssignment a)
Returns the base XPath of an assignment

Parameters:
a - the FxAssignment
Returns:
returns the XPath as a String

typeHasAssignments

public static boolean typeHasAssignments(FxType type)
Checks whether a type has any assignments (properties or groups)

Parameters:
type - the given FxType
Returns:
returns true if the type has assignments

getScript

public static java.util.Map<FxScriptEvent,java.lang.Long[]> getScript(FxAssignment assignment)
Examines a given FxAssignments for ScriptEvents --> scripts and returns a Map containing that information

Parameters:
assignment - the FxAssignment
Returns:
returns a Map containing all events their respective script assignments for a given FxAssignment

getCombinedAssignments

public static java.util.List<FxAssignment> getCombinedAssignments(java.util.List<FxPropertyAssignment> p,
                                                                  java.util.List<FxGroupAssignment> g)
Takes a List of FxPropertyAssignments and a List of FxGroupAssignments as parameters and returns a combined List of both (FxAssignment) sorted by their positions

Parameters:
p - List of FxPropertyAssignments
g - List of FxGroupAssignments
Returns:
returns sorted List of FxAssignments combining both inputs

listCompare

public static <T> java.util.List<T> listCompare(java.util.List<T> src,
                                                java.util.List<T> cmp)
Performs a linear list comparison and returns a combination of both,

Parameters:
src - the source List (of, for example, assignment ids)
cmp - the List with which src will be compared
Returns:
returns null if both parameters are null, returns src if cmp is null, returns cmp if src is null or returns the combined List

convertIdsToAssignments

public static java.util.List<FxAssignment> convertIdsToAssignments(java.util.List<java.lang.Long> assignIds)
Converts a List of assignment ids to a List

Parameters:
assignIds - the List of assignment ids
Returns:
returns a List of or null if the input is null

convertAssignmentsToIds

public static java.util.List<java.lang.Long> convertAssignmentsToIds(java.util.List<? extends FxAssignment> assignments)
Converts a List List of ids

Parameters:
assignments - the List of FxAssignments
Returns:
returns a List of ids or null if the input is null