public WorkItemManager getWorkItemManager() {
if ( workItemManager == null ) {
workItemManager = new WorkItemManager() {
public void completeWorkItem(long id,
Map<String, Object> results) {
CompleteWorkItemCommand command = new CompleteWorkItemCommand();
command.setWorkItemId( id );
command.setResults( results );
commandService.execute( command );
}
public void abortWorkItem(long id) {
AbortWorkItemCommand command = new AbortWorkItemCommand();
command.setWorkItemId( id );
commandService.execute( command );
}
public void registerWorkItemHandler(String workItemName,
WorkItemHandler handler) {
RegisterWorkItemHandlerCommand command = new RegisterWorkItemHandlerCommand();
command.setWorkItemName( workItemName );
command.setHandler( handler );
commandService.execute( command );
}
public WorkItem getWorkItem(long id) {
GetWorkItemCommand command = new GetWorkItemCommand();
command.setWorkItemId( id );
return commandService.execute( command );
}
public void clear() {
throw new UnsupportedOperationException();