org.eaglei.repository
Class FakeFlow

java.lang.Object
  extended by org.openrdf.query.TupleQueryResultHandlerBase
      extended by org.eaglei.repository.FakeFlow
All Implemented Interfaces:
org.openrdf.query.TupleQueryResultHandler

public class FakeFlow
extends org.openrdf.query.TupleQueryResultHandlerBase

Object Model for "fake workflow", RDF annotations on a resource instance that takes the place of a full workflow implementation for "cycle 1". A FakeFlow instance is associated with a resource instance. All of the statements implementing workflow are in the Metadata graph.

Version:
$Id: $
Author:
Larry Stone Started May 17, 2010

Method Summary
 void claim(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI newOwner)
          Lets user assert a claim on this workflow state.
 void clear(javax.servlet.http.HttpServletRequest request)
          Remove this workflow state from its resource instance.
static FakeFlow create(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI resource)
          Create fake workflow state for given resource.
static FakeFlow find(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI resource)
          Get current workflow on a resource if any, or null if not found.
 org.openrdf.model.URI getOwner()
          Getter for the field owner.
 java.lang.String getOwnerLabel()
          Getter for the field ownerLabel.
 org.openrdf.model.URI getResource()
          Getter for the field resource.
 org.openrdf.model.URI getState()
          Getter for the field state.
 java.lang.String getStateLabel()
          Getter for the field stateLabel.
 void handleSolution(org.openrdf.query.BindingSet bs)
           Query handler to pick up what SHOULD be the single result..
static boolean isWorkflowPredicate(org.openrdf.model.URI uri)
          Predicate that is true if this is a predicate managed by fake workflow
static boolean isWorkflowState(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI uri)
          Predicate that is true if uri is one of the workflow states.
static boolean isWorkflowState(org.openrdf.repository.RepositoryConnection rc, org.openrdf.model.URI uri)
          Predicate that is true if uri is one of the workflow states.
 void promote(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI newState)
          Advance workflow state to the given new state.
 
Methods inherited from class org.openrdf.query.TupleQueryResultHandlerBase
endQueryResult, startQueryResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isWorkflowState

public static boolean isWorkflowState(javax.servlet.http.HttpServletRequest request,
                                      org.openrdf.model.URI uri)
Predicate that is true if uri is one of the workflow states.

Parameters:
request - a HttpServletRequest object.
uri - a URI object.
Returns:
a boolean, true if given URI is subject of a Workflow state.

isWorkflowState

public static boolean isWorkflowState(org.openrdf.repository.RepositoryConnection rc,
                                      org.openrdf.model.URI uri)
Predicate that is true if uri is one of the workflow states. Optional version called with RepositoryConnection instead of Request.

Parameters:
rc - a RepositoryConnection object.
uri - a URI object.
Returns:
a boolean, true if given URI is subject of a Workflow state.

isWorkflowPredicate

public static boolean isWorkflowPredicate(org.openrdf.model.URI uri)
Predicate that is true if this is a predicate managed by fake workflow

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

find

public static FakeFlow find(javax.servlet.http.HttpServletRequest request,
                            org.openrdf.model.URI resource)
Get current workflow on a resource if any, or null if not found.

Parameters:
request - a HttpServletRequest object.
resource - the subject URI of the eagle-i resource instance.
Returns:
workflow as a FakeFlow object, or null if none found.

handleSolution

public void handleSolution(org.openrdf.query.BindingSet bs)
                    throws org.openrdf.query.TupleQueryResultHandlerException
Query handler to pick up what SHOULD be the single result..

Specified by:
handleSolution in interface org.openrdf.query.TupleQueryResultHandler
Overrides:
handleSolution in class org.openrdf.query.TupleQueryResultHandlerBase
Throws:
org.openrdf.query.TupleQueryResultHandlerException

create

public static FakeFlow create(javax.servlet.http.HttpServletRequest request,
                              org.openrdf.model.URI resource)
Create fake workflow state for given resource. There MUST NOT be a wf state already. Initial state is the default, initial owner is current user.

Parameters:
request - a HttpServletRequest object.
resource - the subject URI of the eagle-i resource instance.
Returns:
new workflow as a FakeFlow object, NEVER null.

clear

public void clear(javax.servlet.http.HttpServletRequest request)
Remove this workflow state from its resource instance.

Parameters:
request - a HttpServletRequest object.

promote

public void promote(javax.servlet.http.HttpServletRequest request,
                    org.openrdf.model.URI newState)
Advance workflow state to the given new state. This also contains any side effects, hardcoded -- e.g. moving instance to the "published" graph. Also must hardcode all checks, e.g. cannot jump from draft to publsihed. NOTE: this DOES NOT commit, caller must call rc.commit()

Parameters:
request - a HttpServletRequest object.
newState - URI of new workflow state

claim

public void claim(javax.servlet.http.HttpServletRequest request,
                  org.openrdf.model.URI newOwner)
Lets user assert a claim on this workflow state. Just clears the old claim if user URI is null. NOTE: this DOES NOT commit, caller must call rc.commit()

Parameters:
request - a HttpServletRequest object.
newOwner - new owner as a :Person URI object.

getResource

public org.openrdf.model.URI getResource()

Getter for the field resource.

Returns:
a URI object.

getState

public org.openrdf.model.URI getState()

Getter for the field state.

Returns:
a URI object.

getOwner

public org.openrdf.model.URI getOwner()

Getter for the field owner.

Returns:
a URI object.

getStateLabel

public java.lang.String getStateLabel()

Getter for the field stateLabel.

Returns:
a String object.

getOwnerLabel

public java.lang.String getOwnerLabel()

Getter for the field ownerLabel.

Returns:
a String object.


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