import org.argeo.jcr.JcrUtils;
import org.argeo.slc.SlcException;
import org.argeo.slc.core.execution.PrimitiveSpecAttribute;
+import org.argeo.slc.core.execution.PrimitiveValue;
import org.argeo.slc.core.execution.RefSpecAttribute;
import org.argeo.slc.core.execution.RefValueChoice;
import org.argeo.slc.deploy.ModuleDescriptor;
*/
public class JcrExecutionModulesListener implements ExecutionModulesListener,
SlcNames {
- private final static String SLC_EXECUTION_MODRULES_PROPERTY = "slc.executionModules";
+ private final static String SLC_EXECUTION_MODULES_PROPERTY = "slc.executionModules";
private final static Log log = LogFactory
.getLog(JcrExecutionModulesListener.class);
List<ModuleDescriptor> moduleDescriptors = modulesManager
.listModules();
String executionModules = System
- .getProperty(SLC_EXECUTION_MODRULES_PROPERTY);
+ .getProperty(SLC_EXECUTION_MODULES_PROPERTY);
if (executionModules != null)
try {
Node agentNode = session.getNode(agent.getNodePath());
SlcTypes.SLC_EXECUTION_FLOW);
}
}
+
+ // name, description
flowNode.setProperty(SLC_NAME, efd.getName());
String[] tokens = relativePath.split("/");
- flowNode.setProperty(Property.JCR_TITLE, tokens[tokens.length - 1]);
+ String endName = tokens[tokens.length - 1];
if (efd.getDescription() != null
- && efd.getDescription().trim().equals(""))
- flowNode.setProperty(Property.JCR_DESCRIPTION, efd.getDescription());
+ && !efd.getDescription().trim().equals("")) {
+ flowNode.setProperty(Property.JCR_TITLE, efd.getDescription());
+ } else {
+ flowNode.setProperty(Property.JCR_TITLE, endName);
+ }
+ flowNode.setProperty(Property.JCR_DESCRIPTION, endName);
// execution spec
ExecutionSpec executionSpec = efd.getExecutionSpec();
String esName = executionSpec.getName();
if (!(esName == null || esName.equals(ExecutionSpec.INTERNAL_NAME))) {
+ // reference spec node
Node executionSpecsNode = moduleNode.hasNode(SLC_EXECUTION_SPECS) ? moduleNode
.getNode(SLC_EXECUTION_SPECS) : moduleNode
.addNode(SLC_EXECUTION_SPECS);
mapExecutionSpec(executionSpecNode, executionSpec);
flowNode.setProperty(SLC_SPEC, executionSpecNode);
} else {
+ // internal spec node
mapExecutionSpec(flowNode, executionSpec);
}
+
+ // values
+ for (String attr : efd.getValues().keySet()) {
+ ExecutionSpecAttribute esa = executionSpec.getAttributes()
+ .get(attr);
+ if (esa instanceof PrimitiveSpecAttribute) {
+ PrimitiveSpecAttribute psa = (PrimitiveSpecAttribute) esa;
+ Node valueNode = flowNode.addNode(attr);
+ valueNode.setProperty(SLC_TYPE, psa.getType());
+ SlcJcrUtils.setPrimitiveAsProperty(valueNode, SLC_VALUE,
+ (PrimitiveValue) efd.getValues().get(attr));
+ }
+ }
+
return flowNode;
}