Skip to content
This repository has been archived by the owner on Mar 31, 2019. It is now read-only.

Commit

Permalink
Add setParameterValues(ActivityProps) to Query to be used by Job -
Browse files Browse the repository at this point in the history
resolve #119
  • Loading branch information
zsmyt committed Nov 21, 2016
1 parent a032804 commit a2e375e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/main/java/org/cristalise/kernel/entity/agent/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@
package org.cristalise.kernel.entity.agent;

import static org.cristalise.kernel.graph.model.BuiltInVertexProperties.OUTCOME_INIT;
import static org.cristalise.kernel.graph.model.BuiltInVertexProperties.VIEW_POINT;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import lombok.Getter;
import lombok.Setter;

import org.cristalise.kernel.common.GTimeStamp;
import org.cristalise.kernel.common.InvalidDataException;
import org.cristalise.kernel.common.ObjectNotFoundException;
Expand Down Expand Up @@ -60,6 +56,9 @@
import org.cristalise.kernel.utils.LocalObjectLoader;
import org.cristalise.kernel.utils.Logger;

import lombok.Getter;
import lombok.Setter;

/**
*
*/
Expand Down Expand Up @@ -88,7 +87,6 @@ public class Job implements C2KLocalObject {
private boolean transitionResolved = false;

private Outcome outcome = null;;
private Query query = null;;

/**
* OutcomeInitiator cache
Expand Down Expand Up @@ -266,9 +264,10 @@ public Script getScript() throws ObjectNotFoundException, InvalidDataException {
}

public Query getQuery() throws ObjectNotFoundException, InvalidDataException {
if (query == null && hasQuery()) {
Query query = null;
if (hasQuery()) {
query = getTransition().getQuery(actProps);
query.setMandatoryParemeters(itemPath.getUUID().toString(), getSchemaName(), getActProp(VIEW_POINT));
query.setParemeterValues(itemPath.getUUID().toString(), getSchemaName(), actProps);
}
return query;
}
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/org/cristalise/kernel/querying/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.cristalise.kernel.process.Gateway;
import org.cristalise.kernel.scripting.ParameterException;
import org.cristalise.kernel.scripting.ScriptParsingException;
import org.cristalise.kernel.utils.CastorHashMap;
import org.cristalise.kernel.utils.DescriptionObject;
import org.cristalise.kernel.utils.FileStringUtility;
import org.cristalise.kernel.utils.LocalObjectLoader;
Expand Down Expand Up @@ -114,10 +115,15 @@ public void setStringParameter(String name, Object value) {
else p.setValue(value);
}

public void setMandatoryParemeters(String uuid, Object schemaName, Object viewPoint) {
public void setParemeterValues(String itemUUID, Object schemaName, CastorHashMap actProps) {
for(Parameter p : parameters) p.setValue(actProps.get(p.getName()));

setMandatoryParemeters(itemUUID, schemaName);
}

public void setMandatoryParemeters(String uuid, Object schemaName) {
setStringParameter("itemUUID", uuid);
setStringParameter("schemaName", schemaName);
setStringParameter("viewPoint", viewPoint);
}

public void validateXML(String xml) throws InvalidDataException, ObjectNotFoundException {
Expand Down

0 comments on commit a2e375e

Please # to comment.