use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class Activity method pushJobsToAgents.
/**
* Collects all Role names which are associated with this Activity and the Transitions of the current State,
* and ....
*
* @param itemPath
*/
protected void pushJobsToAgents(ItemPath itemPath) {
// Shall contain a set of unique role names
Set<String> roleNames = new TreeSet<String>();
String role = getCurrentAgentRole();
if (StringUtils.isNotBlank(role)) {
for (String r : role.split(",")) roleNames.add(r);
}
try {
for (Transition trans : getStateMachine().getState(getState()).getPossibleTransitions().values()) {
role = trans.getRoleOverride(getProperties());
if (StringUtils.isNotBlank(role))
roleNames.add(role);
}
Logger.msg(7, "Activity.pushJobsToAgents() - Pushing jobs to " + roleNames.size() + " roles");
for (String roleName : roleNames) {
pushJobsToAgents(itemPath, Gateway.getLookup().getRolePath(roleName));
}
} catch (InvalidDataException ex) {
Logger.warning("Activity.pushJobsToAgents() - " + ex.getMessage());
} catch (ObjectNotFoundException e) {
Logger.warning("Activity.pushJobsToAgents() - Activity role '" + role + "' not found.");
}
}
use of org.cristalise.kernel.common.ObjectNotFoundException 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");
}
use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class Outcome method setMetaDataFromPath.
/**
* Retrieves the SchemaName, Version, EevetnId triplet from the path. Check getClusterPath() implementation
*
* @param path the ClusterPath to work with
* @throws PersistencyException path was incorrect
* @throws InvalidDataException Schema was not found or the Path has incorrect data
*/
protected void setMetaDataFromPath(String path) throws PersistencyException, InvalidDataException {
StringTokenizer tok = new StringTokenizer(path, "/");
if (tok.countTokens() != 3 && !(tok.nextToken().equals(OUTCOME.getName())))
throw new PersistencyException("Outcome() - Outcome path must have three components:" + path);
String schemaName = tok.nextToken();
String verString = tok.nextToken();
String objId = tok.nextToken();
try {
Integer schemaVersion = Integer.valueOf(verString);
mSchema = LocalObjectLoader.getSchema(schemaName, schemaVersion);
mID = Integer.valueOf(objId);
} catch (NumberFormatException ex) {
throw new InvalidDataException("Outcome() - Version or EventID was an invalid number version:" + verString + " eventID:" + objId);
} catch (ObjectNotFoundException e) {
Logger.error(e);
throw new InvalidDataException("Outcome() - problem loading schema:" + schemaName + " version:" + verString);
}
}
use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class QueryOutcomeInitiator method initOutcomeInstance.
@Override
public Outcome initOutcomeInstance(Job job) throws InvalidDataException {
if (job.hasQuery()) {
try {
Outcome o = new Outcome(-1, job.getItemProxy().executeQuery(job.getQuery()), job.getSchema());
o.validateAndCheck();
return o;
} catch (PersistencyException | ObjectNotFoundException | InvalidItemPathException e) {
throw new InvalidDataException("Error executing Query:" + e.getMessage());
}
} else
throw new InvalidDataException("No Query was defined for job:" + job);
}
use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class Resource method getTextResource.
@Override
public String getTextResource(String ns, String resName) throws ObjectNotFoundException {
Logger.msg(8, "Resource::getTextResource() - Getting resource from namespacce " + ns + ": " + resName);
if (txtCache.containsKey(ns + '/' + resName)) {
return txtCache.get(ns + '/' + resName);
}
try {
String newRes = null;
URL loc;
if (// kernel
ns == null)
loc = getKernelResourceURL(resName);
else
loc = getModuleResourceURL(ns, resName);
Logger.msg(5, "Loading resource: " + loc.toString());
newRes = FileStringUtility.url2String(loc);
txtCache.put(ns + '/' + resName, newRes);
return newRes;
} catch (Exception e) {
Logger.error(e);
throw new ObjectNotFoundException(e.getMessage());
}
}
Aggregations