Search in sources :

Example 1 with BuiltInVertexProperties

use of org.cristalise.kernel.graph.model.BuiltInVertexProperties in project kernel by cristal-ise.

the class CompositeActivityDef method propagateCollectionProperties.

/**
 * Reading collections during configureInstance() the properties of CAInstance can be updated to
 * contain CastorHashMaps, which contain properties to be propagated to the Vertices of CAInstance.
 *
 * @param caInstance the CompAct instance beeing instantiated
 * @throws InvalidDataException
 */
private void propagateCollectionProperties(CompositeActivity caInstance) throws InvalidDataException {
    // Propagate now properties to Vertices
    CastorHashMap caProps = caInstance.getProperties();
    List<String> keysToDelete = new ArrayList<String>();
    for (Entry<String, Object> aCAProp : caProps.entrySet()) {
        if (aCAProp.getValue() instanceof CastorHashMap) {
            for (Vertex vertex : caInstance.getChildrenGraphModel().getVertices()) {
                CastorHashMap propsToPropagate = (CastorHashMap) aCAProp.getValue();
                propsToPropagate.dump(8);
                BuiltInVertexProperties builtInProp = BuiltInVertexProperties.getValue(aCAProp.getKey());
                if (builtInProp == null) {
                    ((GraphableVertex) vertex).updatePropertiesFromCollection(Integer.parseInt(aCAProp.getKey()), propsToPropagate);
                } else {
                    ((GraphableVertex) vertex).updatePropertiesFromCollection(builtInProp, propsToPropagate);
                }
            }
            keysToDelete.add(aCAProp.getKey());
        }
    }
    for (String key : keysToDelete) caProps.remove(key);
}
Also used : Vertex(org.cristalise.kernel.graph.model.Vertex) WfVertex(org.cristalise.kernel.lifecycle.instance.WfVertex) GraphableVertex(org.cristalise.kernel.graph.model.GraphableVertex) CastorHashMap(org.cristalise.kernel.utils.CastorHashMap) ArrayList(java.util.ArrayList) CollectionArrayList(org.cristalise.kernel.collection.CollectionArrayList) GraphableVertex(org.cristalise.kernel.graph.model.GraphableVertex) BuiltInVertexProperties(org.cristalise.kernel.graph.model.BuiltInVertexProperties)

Aggregations

ArrayList (java.util.ArrayList)1 CollectionArrayList (org.cristalise.kernel.collection.CollectionArrayList)1 BuiltInVertexProperties (org.cristalise.kernel.graph.model.BuiltInVertexProperties)1 GraphableVertex (org.cristalise.kernel.graph.model.GraphableVertex)1 Vertex (org.cristalise.kernel.graph.model.Vertex)1 WfVertex (org.cristalise.kernel.lifecycle.instance.WfVertex)1 CastorHashMap (org.cristalise.kernel.utils.CastorHashMap)1