use of org.cristalise.kernel.graph.model.GraphableVertex in project kernel by cristal-ise.
the class ActivityDataHelper method get.
/**
* Retrieves the Workflow of the given Item, searches the Activity using the activity path and
* retrieves a single value based on XPath
*/
@Override
public String get(ItemPath itemPath, String actContext, String dataPath, Object locker) throws InvalidDataException, PersistencyException, ObjectNotFoundException {
Logger.msg(5, "ActivityDataHelper.get() - item:" + itemPath + ", actContext:" + actContext + ", dataPath:" + dataPath);
String[] paths = dataPath.split(":");
if (paths.length != 2)
throw new InvalidDataException("Invalid path '" + dataPath + "' it must have one and only one colon (:)");
String actPath = paths[0];
String xpath = paths[1];
if (actPath.startsWith(".")) {
actPath = actContext + (actContext.endsWith("/") ? "" : "/") + actPath.substring(2);
}
// Find the referenced activity, so get the workflow and search
Workflow workflow = (Workflow) Gateway.getStorage().get(itemPath, ClusterType.LIFECYCLE + "/workflow", locker);
GraphableVertex act = workflow.search(actPath);
if (act == null) {
throw new InvalidDataException("Workflow search failed for actPath:" + actPath + " - item:" + itemPath + ", actContext:" + actContext + ", dataPath:" + dataPath);
}
// Get the schema and viewpoint names
String schemaName = act.getBuiltInProperty(SCHEMA_NAME).toString();
Integer schemaVersion = Integer.valueOf(act.getBuiltInProperty(SCHEMA_VERSION).toString());
String viewName = act.getBuiltInProperty(VIEW_POINT).toString();
if (StringUtils.isBlank(viewName))
viewName = "last";
// checks if schema/version was correct
Schema schema = LocalObjectLoader.getSchema(schemaName, schemaVersion);
// get the viewpoint and outcome
Viewpoint view = (Viewpoint) Gateway.getStorage().get(itemPath, ClusterType.VIEWPOINT + "/" + schema.getName() + "/" + viewName, locker);
Outcome outcome = (Outcome) view.getOutcome(locker);
// apply the XPath to its outcome
try {
return outcome.getFieldByXPath(xpath);
} catch (XPathExpressionException e) {
throw new InvalidDataException("Invalid xpath:" + xpath + " - item:" + itemPath + ", actContext:" + actContext + ", dataPath:" + dataPath);
}
}
use of org.cristalise.kernel.graph.model.GraphableVertex in project kernel by cristal-ise.
the class CompositeActivity method verify.
/**
* launch the verification of the subprocess()
*/
@Override
public boolean verify() {
boolean err = super.verify();
GraphableVertex[] vChildren = getChildren();
for (int i = 0; i < vChildren.length; i++) {
if (!((WfVertex) vChildren[i]).verify()) {
mErrors.add("error in children");
return false;
}
}
return err;
}
use of org.cristalise.kernel.graph.model.GraphableVertex in project kernel by cristal-ise.
the class Workflow method requestAction.
public String requestAction(AgentPath agent, AgentPath delegator, String stepPath, ItemPath itemPath, int transitionID, String requestData) throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, PersistencyException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification {
Logger.msg(3, "Workflow::requestAction() - transition:" + transitionID + " step:" + stepPath + " agent:" + agent);
GraphableVertex vert = search(stepPath);
if (vert != null && vert instanceof Activity)
return ((Activity) vert).request(agent, delegator, itemPath, transitionID, requestData, this);
else
throw new ObjectNotFoundException(stepPath + " not found");
}
Aggregations