org.eaglei.repository.model.workflow
Class Workflow

java.lang.Object
  extended by org.eaglei.repository.model.workflow.Workflow

public class Workflow
extends java.lang.Object

Collect and manage the workflow properties on an instance.

Version:
$Id: $
Author:
Larry Stone Started October, 2010

Method Summary
 void assertClaim(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI claimer)
          Establish a claim if allowed.
static Workflow create(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI resource, org.openrdf.model.URI workspace)
          Create the workflow properties on a new resource instance.
static Workflow find(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI resource)
          sort of constructor.
 org.openrdf.model.URI getHomeGraph()
          Getter.
 org.openrdf.model.URI getOwner()
          Getter.
 org.openrdf.model.URI getState()
          Getter.
 org.openrdf.model.URI getURI()
          Getter.
 void invokeTransition(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI transitionURI)
          Invoke (follow) a workflow transition on an instance, if allowed.
static boolean isWorkflowPredicate(org.openrdf.model.URI uri)
          Predicate that is true if this is a predicate managed by workflow so e.g.
 void releaseClaim(javax.servlet.http.HttpServletRequest request)
          Release an existing claim, if allowed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

find

public static Workflow find(javax.servlet.http.HttpServletRequest request,
                            org.openrdf.model.URI resource)
sort of constructor.


getURI

public org.openrdf.model.URI getURI()
Getter.


getHomeGraph

public org.openrdf.model.URI getHomeGraph()
Getter.


getState

public org.openrdf.model.URI getState()
Getter.


getOwner

public org.openrdf.model.URI getOwner()
Getter.


create

public static Workflow create(javax.servlet.http.HttpServletRequest request,
                              org.openrdf.model.URI resource,
                              org.openrdf.model.URI workspace)
                       throws javax.servlet.ServletException
Create the workflow properties on a new resource instance. First, check that user has an allowed transition out of NEW state. Then, set the state to the first-found transition's final. Also, assert a claim so the user will be able to edit the instance he's creating. XXX FIXME: there is currently no path in the API to supply a choice of transitions on creation, nor is there any use case as yet. There SHOULD only be ONE transition with all of: 1. Starts in NEW state 2. Matches given workspace 3. Accessible to current user. ...but if there are multiple results, we choose the first. WARNING: transitions with specific matching workspace do NOT get prioity although logically they should.

Throws:
javax.servlet.ServletException

assertClaim

public void assertClaim(javax.servlet.http.HttpServletRequest request,
                        org.openrdf.model.URI claimer)
                 throws javax.servlet.ServletException
Establish a claim if allowed. Validate resource URI and check access - asserted rdf:type and :hasWorkflowState properties in readable graph - no existing claim NOTE that caller still needs to commit the changes.

Throws:
javax.servlet.ServletException

releaseClaim

public void releaseClaim(javax.servlet.http.HttpServletRequest request)
                  throws javax.servlet.ServletException
Release an existing claim, if allowed. Validate resource URI and check access: - there must be a claim (obviously) - user must be owner of the claim or Administrator NOTE that caller still needs to commit the changes.

Throws:
javax.servlet.ServletException

invokeTransition

public void invokeTransition(javax.servlet.http.HttpServletRequest request,
                             org.openrdf.model.URI transitionURI)
                      throws javax.servlet.ServletException
Invoke (follow) a workflow transition on an instance, if allowed. Validate resource URI and check access: - user has READ permission on transition - there must be a claim (obviously) - user must be owner of the claim or Administrator NOTE that caller still needs to commit the changes.

Throws:
javax.servlet.ServletException

isWorkflowPredicate

public static boolean isWorkflowPredicate(org.openrdf.model.URI uri)
Predicate that is true if this is a predicate managed by workflow so e.g. /update can protect against users changing it even in a different graph.

Parameters:
uri - a URI object.
Returns:
a boolean, true if URI is one of the fake workflow predicates.


Copyright © 2009-2011 Eagle-I. All Rights Reserved.