org.alfresco.bm.data
Class WorkflowDataService

java.lang.Object
  extended by org.alfresco.bm.data.WorkflowDataService

public class WorkflowDataService
extends Object

Service providing access to WorkflowData storage. All WorkflowData returned from and persisted with this service will be testrun-specific. The testrun-identifier is set in the constructor.

Author:
Frederik Heremans

Constructor Summary
WorkflowDataService(org.springframework.data.mongodb.core.MongoTemplate mongo, String collectionName, String testRun)
           
 
Method Summary
 void checkIndexes()
          Ensure that the MongoDB collection has the required indexes associated with the WorkflowData.
 long count()
          Count the total number of workflows.
 long countFinishedWorkflows()
          Count the total number of finished workflows.
 WorkflowData findById(String workflowId)
          Find data by id.
 List<WorkflowData> findUnscheduledProcesses(int maxCount)
          Find a number of unscheduled processes.
 void insert(WorkflowData data)
          Insert the given WorkflowData object.
 void markWorkflowAsEnded(String id)
          Mark a workflow as ended.
 void markWorkflowAsScheduled(String id, String userName)
          Mark a workflow as scheduled.
 void markWorkflowAsStarted(String id, String workflowInstanceId)
          Mark a workflow as started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowDataService

public WorkflowDataService(org.springframework.data.mongodb.core.MongoTemplate mongo,
                           String collectionName,
                           String testRun)
Method Detail

checkIndexes

public void checkIndexes()
Ensure that the MongoDB collection has the required indexes associated with the WorkflowData.

Parameters:
mongo - connection to MongoDB
collectionName - name of DB collection containing data

findById

public WorkflowData findById(String workflowId)
Find data by id.

Parameters:
workflowId - id of the workflow in mongo
Returns:
the matching data. Returns null if no data is found for the given id.

markWorkflowAsStarted

public void markWorkflowAsStarted(String id,
                                  String workflowInstanceId)
Mark a workflow as started.

Parameters:
id - id of the workflow in mongo
workflowId - id of the workflow in alfresco

markWorkflowAsScheduled

public void markWorkflowAsScheduled(String id,
                                    String userName)
Mark a workflow as scheduled.

Parameters:
id - id of the workflow in mongo
userName - name of the users that will run the workflow

markWorkflowAsEnded

public void markWorkflowAsEnded(String id)
Mark a workflow as ended.

Parameters:
id - id of the workflow in mongo

count

public long count()
Count the total number of workflows.

Parameters:
mongo -
collectionName -
Returns:
the number of workflows.

countFinishedWorkflows

public long countFinishedWorkflows()
Count the total number of finished workflows.

Parameters:
mongo -
collectionName -
Returns:
the number of finished workflows.

insert

public void insert(WorkflowData data)
Insert the given WorkflowData object. A new id will be assigned?

Parameters:
data - the data to insert

findUnscheduledProcesses

public List<WorkflowData> findUnscheduledProcesses(int maxCount)
Find a number of unscheduled processes.

Parameters:
maxCount - maximum number of results that should be returned
Returns:
unscheduled workflows up to the give maximum


Copyright © 2012. All Rights Reserved.