Skip to content

Commit

Permalink
#279 extend Dependency instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
kovax committed Sep 9, 2019
1 parent ca4accb commit 81ffacb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Expand Up @@ -29,6 +29,8 @@ public enum BuiltInCollections {
*/
ACTIVITY("Activity"),

AGGREGATE_SCRIPT("AggregateScript"),

/**
* Dependency Collection of Module. ....
*/
Expand All @@ -40,6 +42,8 @@ public enum BuiltInCollections {
*/
INCLUDE("Include"),

MASTER_SCHEMA("MasterSchema"),

/**
* CollectionDescription of elementary ActivityDef. It is instantiated as two Activity properties (see bellow).
* Also it is Dependency Collection of Activity.
Expand All @@ -51,8 +55,6 @@ public enum BuiltInCollections {

SCHEMA_INITIALISE("SchemaInitialise"),

SCHEMA_MASTER("SchemaMaster"),

/**
* CollectionDescription of elementary ActivityDef. It is instantiated as two Activity properties (see bellow).
* Also it is Dependency Collection of Workflow.
Expand Down
Expand Up @@ -30,6 +30,8 @@
import static org.cristalise.kernel.graph.model.BuiltInVertexProperties.STATE_MACHINE_NAME;
import static org.cristalise.kernel.graph.model.BuiltInVertexProperties.STATE_MACHINE_VERSION;
import static org.cristalise.kernel.graph.model.BuiltInVertexProperties.VERSION;
import static org.cristalise.kernel.property.BuiltInItemProperties.AGGREGATE_SCRIPT_URN;
import static org.cristalise.kernel.property.BuiltInItemProperties.MASTER_SCHEMA_URN;
import static org.cristalise.kernel.property.BuiltInItemProperties.QUERY_URN;
import static org.cristalise.kernel.property.BuiltInItemProperties.SCHEMA_URN;
import static org.cristalise.kernel.property.BuiltInItemProperties.SCRIPT_URN;
Expand All @@ -38,6 +40,7 @@

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.cristalise.kernel.common.InvalidCollectionModification;
import org.cristalise.kernel.common.InvalidDataException;
Expand Down Expand Up @@ -307,11 +310,12 @@ public void removeMember(int memberId) throws ObjectNotFoundException {
public void addToItemProperties(PropertyArrayList props) throws InvalidDataException, ObjectNotFoundException {
Logger.msg(2, "Dependency.addToItemProperties("+getName()+") - Starting ...");

if (convertToItemPropertyByScript(props)) return;

//convert to BuiltInCollections
BuiltInCollections builtInColl = BuiltInCollections.getValue(getName());

//Do not process this member further if Script has done the job already or this is not a BuiltInCollection
if (convertToItemPropertyByScript(props) || builtInColl == null) return;

for (DependencyMember member : getMembers().list) {
String memberUUID = member.getChildUUID();
Integer memberVer = LocalObjectLoader.deriveVersionNumber(member.getBuiltInProperty(VERSION));
Expand All @@ -327,6 +331,16 @@ public void addToItemProperties(PropertyArrayList props) throws InvalidDataExcep
//LocalObjectLoader checks if data is valid and loads object to cache
switch (builtInColl) {
//***************************************************************************************************
case AGGREGATE_SCRIPT:
LocalObjectLoader.getSchema(memberUUID, memberVer);
props.put(new Property(AGGREGATE_SCRIPT_URN, memberUUID+":"+memberVer));
break;
//***************************************************************************************************
case MASTER_SCHEMA:
LocalObjectLoader.getSchema(memberUUID, memberVer);
props.put(new Property(MASTER_SCHEMA_URN, memberUUID+":"+memberVer));
break;
//***************************************************************************************************
case SCHEMA:
LocalObjectLoader.getSchema(memberUUID, memberVer);
props.put(new Property(SCHEMA_URN, memberUUID+":"+memberVer));
Expand Down
Expand Up @@ -28,6 +28,8 @@
* Helper enumeration to make built-in Property names easier to maintain and document
*/
public enum BuiltInItemProperties {
AGGREGATE_SCRIPT_URN("AggregateScriptURN"),

/**
* Store the Agent name used used to call the {@link CreateItemFromDescription} predefined Step.
*/
Expand All @@ -40,6 +42,8 @@ public enum BuiltInItemProperties {

KERNEL_VERSION("KernelVersion"),

MASTER_SCHEMA_URN("MasterSchemaURN"),

/**
* The name or ID of the Item, specified by the Factory Item and sent as the first parameter in the
* {@link CreateItemFromDescription} predefined Step. It will be automatically added even if it was not defined.
Expand Down

0 comments on commit 81ffacb

Please sign in to comment.