use of org.alfresco.service.cmr.workflow.WorkflowDefinition in project acs-community-packaging by Alfresco.
the class StartWorkflowWizard method initializeWorkflows.
private void initializeWorkflows() {
// NOTE: we don't cache the list of startable workflows as they could get
// updated, in which case we need the latest instance id, they could
// theoretically also get removed.
this.availableWorkflows = new ArrayList<SelectItem>(4);
this.workflows = new HashMap<String, WorkflowDefinition>(4);
List<String> configuredInvitationWorkflows = this.getInvitationServiceWorkflowNames();
List<String> excludedWorkflows = this.getExcludedWorkflows();
List<WorkflowDefinition> workflowDefs = this.getWorkflowService().getDefinitions();
for (WorkflowDefinition workflowDef : workflowDefs) {
String name = workflowDef.name;
if (configuredInvitationWorkflows.contains(name) == false && excludedWorkflows.contains(name) == false) {
// add the workflow if it is not a WCM specific workflow
String label = workflowDef.title;
if (workflowDef.description != null && workflowDef.description.length() > 0) {
label = label + " (" + workflowDef.description + ")";
}
this.availableWorkflows.add(new SelectItem(workflowDef.id, label));
this.workflows.put(workflowDef.id, workflowDef);
}
}
// disable the next button if there are no workflows
if (this.availableWorkflows.size() == 0) {
this.nextButtonDisabled = true;
}
}
use of org.alfresco.service.cmr.workflow.WorkflowDefinition in project acs-community-packaging by Alfresco.
the class StartWorkflowWizard method next.
@Override
public String next() {
String stepName = Application.getWizardManager().getCurrentStepName();
if ("options".equals(stepName) && (this.selectedWorkflow.equals(this.previouslySelectedWorkflow) == false)) {
// retrieve the start task for the selected workflow, get the task
// definition and create a transient node to allow the property
// sheet to collect the required data.
WorkflowDefinition flowDef = this.getWorkflows().get(this.selectedWorkflow);
if (logger.isDebugEnabled())
logger.debug("Selected workflow: " + flowDef);
WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition();
if (taskDef != null) {
if (logger.isDebugEnabled())
logger.debug("Start task definition: " + taskDef);
// create an instance of a task from the data dictionary
this.startTaskNode = TransientNode.createNew(getDictionaryService(), taskDef.metadata, "task_" + System.currentTimeMillis(), null);
}
// we also need to reset the resources list so that the actions get re-evaluated
resetRichList();
}
return null;
}
use of org.alfresco.service.cmr.workflow.WorkflowDefinition in project acs-community-packaging by Alfresco.
the class StartWorkflowWizard method getContainerTitle.
@Override
public String getContainerTitle() {
String wizTitle = null;
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
String stepName = Application.getWizardManager().getCurrentStepName();
if ("choose-workflow".equals(stepName) == false && this.selectedWorkflow != null) {
String titlePattern = bundle.getString("start_named_workflow_wizard");
WorkflowDefinition workflowDef = this.getWorkflows().get(this.selectedWorkflow);
wizTitle = MessageFormat.format(titlePattern, new Object[] { workflowDef.title });
} else {
wizTitle = bundle.getString("start_workflow_wizard");
}
return wizTitle;
}
use of org.alfresco.service.cmr.workflow.WorkflowDefinition in project acs-community-packaging by Alfresco.
the class StartWorkflowWizard method getPackageItemActionGroup.
/**
* Returns the action group the current task uses for each workflow package item
*
* @return action group id
*/
public String getPackageItemActionGroup() {
String actionGroup = null;
WorkflowDefinition flowDef = this.getWorkflows().get(this.selectedWorkflow);
WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition();
if (taskDef != null) {
PropertyDefinition propDef = taskDef.metadata.getProperties().get(WorkflowModel.PROP_PACKAGE_ITEM_ACTION_GROUP);
if (propDef != null) {
actionGroup = propDef.getDefaultValue();
}
}
return actionGroup;
}
use of org.alfresco.service.cmr.workflow.WorkflowDefinition in project alfresco-remote-api by Alfresco.
the class WorkflowDefinitionGet method buildModel.
@Override
protected Map<String, Object> buildModel(WorkflowModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache) {
Map<String, String> params = req.getServiceMatch().getTemplateVars();
// Get the definition id from the params
String workflowDefinitionId = params.get(PARAM_WORKFLOW_DEFINITION_ID);
WorkflowDefinition workflowDefinition = workflowService.getDefinitionById(workflowDefinitionId);
// Workflow definition is not found, 404
if (workflowDefinition == null) {
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find workflow definition with id: " + workflowDefinitionId);
}
Map<String, Object> model = new HashMap<String, Object>();
model.put("workflowDefinition", modelBuilder.buildDetailed(workflowDefinition));
return model;
}
Aggregations