[Yanel-commits] rev 55055 -
public/yanel/trunk/src/core/java/org/wyona/yanel/core/workflow
michi at wyona.com
michi at wyona.com
Mon Nov 29 23:29:41 CET 2010
Author: michi
Date: 2010-11-29 23:29:40 +0100 (Mon, 29 Nov 2010)
New Revision: 55055
Modified:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/workflow/WorkflowHelper.java
Log:
error handling improved
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/workflow/WorkflowHelper.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/workflow/WorkflowHelper.java 2010-11-29 18:50:26 UTC (rev 55054)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/workflow/WorkflowHelper.java 2010-11-29 22:29:40 UTC (rev 55055)
@@ -180,6 +180,8 @@
/**
* Get workflow which is associated with resource
+ * @param resource Resource
+ * @return Workflow instance
*/
public static Workflow getWorkflow(Resource resource) throws WorkflowException {
try {
@@ -188,9 +190,11 @@
return null;
}
WorkflowBuilder builder = new WorkflowBuilder();
- InputStream stream = resource.getRealm().getRepository().getNode(workflowSchema).getInputStream();
- // TODO: cache of workflow
- return builder.buildWorkflow(stream);
+ if (resource.getRealm().getRepository().existsNode(workflowSchema)) {
+ return builder.buildWorkflow(resource.getRealm().getRepository().getNode(workflowSchema).getInputStream()); // TODO: Cache result of workflow builder for performance reasons
+ } else {
+ throw new WorkflowException("No such workflow instance '" + workflowSchema + "' within repository: " + resource.getRealm().getRepository() + " (configured within resource config with request path: " + resource.getPath() + ")");
+ }
} catch (Exception e) {
log.error(e, e);
throw new WorkflowException(e.getMessage(), e);
More information about the Yanel-commits
mailing list