Search in sources :

Example 11 with Viewpoint

use of org.cristalise.kernel.persistency.outcome.Viewpoint in project kernel by cristal-ise.

the class ActDefCache method loadObject.

@Override
public ActivityDef loadObject(String name, int version, ItemProxy proxy) throws ObjectNotFoundException, InvalidDataException {
    String viewName;
    if (isComposite == null) {
        String prop = proxy.getProperty(COMPLEXITY);
        if ("Composite".equals(prop))
            viewName = COMP_ACT_DESC_RESOURCE.getSchemaName();
        else if ("Elementary".equals(prop))
            viewName = ELEM_ACT_DESC_RESOURCE.getSchemaName();
        else
            throw new InvalidDataException("Missing Item property:" + COMPLEXITY);
    } else {
        viewName = isComposite ? COMP_ACT_DESC_RESOURCE.getSchemaName() : ELEM_ACT_DESC_RESOURCE.getSchemaName();
    }
    try {
        Viewpoint actView = (Viewpoint) proxy.getObject(ClusterType.VIEWPOINT + "/" + viewName + "/" + version);
        String marshalledAct = actView.getOutcome().getData();
        return buildObject(name, version, proxy.getPath(), marshalledAct);
    } catch (PersistencyException ex) {
        Logger.error(ex);
        throw new ObjectNotFoundException("Problem loading Activity " + name + " v" + version + ": " + ex.getMessage());
    }
}
Also used : Viewpoint(org.cristalise.kernel.persistency.outcome.Viewpoint) ObjectNotFoundException(org.cristalise.kernel.common.ObjectNotFoundException) InvalidDataException(org.cristalise.kernel.common.InvalidDataException) PersistencyException(org.cristalise.kernel.common.PersistencyException)

Aggregations

Viewpoint (org.cristalise.kernel.persistency.outcome.Viewpoint)11 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)8 PersistencyException (org.cristalise.kernel.common.PersistencyException)7 History (org.cristalise.kernel.events.History)6 Outcome (org.cristalise.kernel.persistency.outcome.Outcome)6 Schema (org.cristalise.kernel.persistency.outcome.Schema)6 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)4 Event (org.cristalise.kernel.events.Event)4 XPathExpressionException (javax.xml.xpath.XPathExpressionException)2 Workflow (org.cristalise.kernel.lifecycle.instance.Workflow)2 AgentPath (org.cristalise.kernel.lookup.AgentPath)2 StringTokenizer (java.util.StringTokenizer)1 CollectionArrayList (org.cristalise.kernel.collection.CollectionArrayList)1 AccessRightsException (org.cristalise.kernel.common.AccessRightsException)1 CannotManageException (org.cristalise.kernel.common.CannotManageException)1 ObjectAlreadyExistsException (org.cristalise.kernel.common.ObjectAlreadyExistsException)1 C2KLocalObject (org.cristalise.kernel.entity.C2KLocalObject)1 TraceableEntity (org.cristalise.kernel.entity.TraceableEntity)1 JobList (org.cristalise.kernel.entity.agent.JobList)1 GraphableVertex (org.cristalise.kernel.graph.model.GraphableVertex)1