use of org.cristalise.kernel.lifecycle.instance.Activity in project kernel by cristal-ise.
the class ItemImplementation method handleError.
/**
* @param agentId
* @param delegateId
* @param stepPath
* @param ex
* @return
* @throws PersistencyException
* @throws ObjectNotFoundException
* @throws AccessRightsException
* @throws InvalidTransitionException
* @throws InvalidDataException
* @throws ObjectAlreadyExistsException
* @throws InvalidCollectionModification
*/
private String handleError(SystemKey agentId, SystemKey delegateId, String stepPath, Workflow lifeCycle, Exception ex) throws PersistencyException, ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, InvalidCollectionModification {
if (!Gateway.getProperties().getBoolean("StateMachine.enableErrorHandling", false))
return null;
int errorTransId = ((Activity) lifeCycle.search(stepPath)).getErrorTransitionId();
if (errorTransId == -1)
return null;
try {
AgentPath agent = new AgentPath(agentId);
AgentPath delegate = delegateId == null ? null : new AgentPath(delegateId);
String errorOutcome = Gateway.getMarshaller().marshall(new ErrorInfo(ex));
lifeCycle.requestAction(agent, delegate, stepPath, mItemPath, errorTransId, errorOutcome);
if (!(stepPath.startsWith("workflow/predefined")))
mStorage.put(mItemPath, lifeCycle, lifeCycle);
return errorOutcome;
} catch (InvalidAgentPathException | ObjectCannotBeUpdated | CannotManageException | MarshalException | ValidationException | IOException | MappingException e) {
Logger.error(e);
return "";
}
}
use of org.cristalise.kernel.lifecycle.instance.Activity in project kernel by cristal-ise.
the class ActivitySlotDef method instantiate.
@Override
public WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException {
Activity newActivity = (Activity) getTheActivityDef().instantiate();
configureInstance(newActivity);
if (newActivity.getProperties().getAbstract().size() > 0) {
throw new InvalidDataException("Abstract properties not overridden: " + newActivity.getProperties().getAbstract().toString());
}
return newActivity;
}
use of org.cristalise.kernel.lifecycle.instance.Activity in project kernel by cristal-ise.
the class PredefinedStep method getPredefStepSchemaName.
public static String getPredefStepSchemaName(String stepName) {
PredefinedStepContainer[] allSteps = { new ItemPredefinedStepContainer(), new AgentPredefinedStepContainer(), new ServerPredefinedStepContainer() };
for (PredefinedStepContainer thisContainer : allSteps) {
String stepPath = thisContainer.getName() + "/" + stepName;
Activity step = (Activity) thisContainer.search(stepPath);
if (step != null) {
return (String) step.getBuiltInProperty(SCHEMA_NAME);
}
}
// default to standard if not found - server may be a newer version
return "PredefinedStepOutcome";
}
use of org.cristalise.kernel.lifecycle.instance.Activity in project kernel by cristal-ise.
the class GraphableVertex method updatePropertiesFromCollection.
public void updatePropertiesFromCollection(BuiltInVertexProperties vertexProp, CastorHashMap newProps) throws InvalidDataException {
switch(vertexProp) {
case ACTIVITY_DEF_URN:
if (this instanceof Activity) {
Object value = null;
Activity thisAct = (Activity) this;
if (newProps.containsKey(thisAct.getID()))
value = newProps.get(thisAct.getID());
else if (newProps.containsKey(thisAct.getTypeName()))
value = newProps.get(thisAct.getTypeName());
if (value != null) {
Logger.msg(5, "GraphableVertex.updatePropertiesFromCollection(" + vertexProp + ") - UPDATING typeName:" + thisAct.getTypeName() + " id:" + thisAct.getID());
mProperties.setBuiltInProperty(ACTIVITY_DEF_URN, value);
} else
Logger.msg(5, "GraphableVertex.updatePropertiesFromCollection(" + vertexProp + ") - SKIPPING typeName:" + thisAct.getTypeName() + " id:" + thisAct.getID());
}
break;
default:
throw new InvalidDataException("Cannot handle BuiltInVertexProperty:" + vertexProp);
}
}
use of org.cristalise.kernel.lifecycle.instance.Activity in project kernel by cristal-ise.
the class LifecycleVertexOutlineCreator method setOutline.
@Override
public void setOutline(Vertex vertex) {
GraphPoint centrePoint = vertex.getCentrePoint();
GraphPoint[] outlinePoints = new GraphPoint[4];
int vertexWidth = 0;
int vertexHeight = 0;
if (vertex instanceof Activity || vertex instanceof ActivitySlotDef || vertex instanceof ActivityDef) {
vertexWidth = mActivityWidth;
vertexHeight = mActivityHeight;
} else {
vertexWidth = mSplitJoinWidth;
vertexHeight = mSplitJoinHeight;
}
outlinePoints[0] = new GraphPoint(centrePoint.x - vertexWidth / 2, centrePoint.y - vertexHeight / 2);
outlinePoints[1] = new GraphPoint(centrePoint.x + vertexWidth / 2, centrePoint.y - vertexHeight / 2);
outlinePoints[2] = new GraphPoint(centrePoint.x + vertexWidth / 2, centrePoint.y + vertexHeight / 2);
outlinePoints[3] = new GraphPoint(centrePoint.x - vertexWidth / 2, centrePoint.y + vertexHeight / 2);
vertex.setOutlinePoints(outlinePoints);
}
Aggregations