Workflow Console: automatically create workflow package and assignee variables on start of console (always required for testing, so saves some typing to create them manually.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5765 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2007-05-23 17:12:06 +00:00
parent 1c46628575
commit 504b174852
2 changed files with 21 additions and 3 deletions

View File

@@ -75,6 +75,13 @@
## Variable Commands ## Variable Commands
## ##
Note: The following variables are defined automatically when the console
starts. They may be deleted or modified.
var bpm:package package 1 (test package of one document)
var bpm:assignee person admin (test assignee who is admin)
ok> var ok> var
Show all defined variables. Show all defined variables.

View File

@@ -70,6 +70,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService; import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.GUID; import org.alfresco.util.GUID;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
@@ -78,7 +79,7 @@ import org.springframework.core.io.ClassPathResource;
* *
* @author davidc * @author davidc
*/ */
public class WorkflowInterpreter public class WorkflowInterpreter implements InitializingBean
{ {
// Service dependencies // Service dependencies
private WorkflowService workflowService; private WorkflowService workflowService;
@@ -120,6 +121,7 @@ public class WorkflowInterpreter
* Main entry point. * Main entry point.
*/ */
public static void main(String[] args) public static void main(String[] args)
throws IOException
{ {
ApplicationContext context = ApplicationContextHelper.getApplicationContext(); ApplicationContext context = ApplicationContextHelper.getApplicationContext();
WorkflowInterpreter console = (WorkflowInterpreter)context.getBean("workflowInterpreter"); WorkflowInterpreter console = (WorkflowInterpreter)context.getBean("workflowInterpreter");
@@ -135,6 +137,15 @@ public class WorkflowInterpreter
fIn = new BufferedReader(new InputStreamReader(System.in)); fIn = new BufferedReader(new InputStreamReader(System.in));
} }
/* (non-Javadoc)
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
public void afterPropertiesSet() throws Exception
{
interpretCommand("var bpm:package package 1");
interpretCommand("var bpm:assignee person admin");
}
/** /**
* @param workflowService The Workflow Service * @param workflowService The Workflow Service
*/ */
@@ -499,7 +510,7 @@ public class WorkflowInterpreter
List<WorkflowTimer> timers = workflowService.getTimers(workflow.id); List<WorkflowTimer> timers = workflowService.getTimers(workflow.id);
for (WorkflowTimer timer : timers) for (WorkflowTimer timer : timers)
{ {
out.println("id: " + timer.id + " , name: " + timer.name + " , due date: " + timer.dueDate + " , path: " + timer.path.id + " , node: " + timer.path.node.name + " , process: " + timer.path.instance.id + " , task: " + timer.task.name); out.println("id: " + timer.id + " , name: " + timer.name + " , due date: " + timer.dueDate + " , path: " + timer.path.id + " , node: " + timer.path.node.name + " , process: " + timer.path.instance.id + " , task: " + timer.task.name + "(" + timer.task.id + ")");
} }
} }
} }
@@ -512,7 +523,7 @@ public class WorkflowInterpreter
List<WorkflowTimer> timers = workflowService.getTimers(workflow.id); List<WorkflowTimer> timers = workflowService.getTimers(workflow.id);
for (WorkflowTimer timer : timers) for (WorkflowTimer timer : timers)
{ {
out.println("id: " + timer.id + " , name: " + timer.name + " , due date: " + timer.dueDate + " , path: " + timer.path.id + " , node: " + timer.path.node.name + " , process: " + timer.path.instance.id + " , task: " + timer.task.name); out.println("id: " + timer.id + " , name: " + timer.name + " , due date: " + timer.dueDate + " , path: " + timer.path.id + " , node: " + timer.path.node.name + " , process: " + timer.path.instance.id + " , task: " + timer.task.name + "(" + timer.task.id + ")");
} }
} }
} }