本文整理汇总了Java中org.alfresco.repo.workflow.WorkflowModel类的典型用法代码示例。如果您正苦于以下问题:Java WorkflowModel类的具体用法?Java WorkflowModel怎么用?Java WorkflowModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkflowModel类属于org.alfresco.repo.workflow包,在下文中一共展示了WorkflowModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: notify
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
@Override
public void notify(DelegateTask task)
{
// Check all mandatory properties are set. This is checked here instead of in
// the completeTask() to allow taskListeners to set variable values before checking
propertyConverter.checkMandatoryProperties(task);
// Set properties for ended task
Map<String, Object> endTaskVariables = new HashMap<String, Object>();
// Set task status to completed
String statusKey = qNameConverter.mapQNameToName(WorkflowModel.PROP_STATUS);
endTaskVariables.put(statusKey, "Completed");
// Add pooled actors to task-variables to be preserved in history (if any)
addPooledActorsAsVariable(task, endTaskVariables);
// Set variables locally on the task
task.setVariablesLocal(endTaskVariables);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:TaskCompleteListener.java
示例2: getMessageValue
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
private String getMessageValue(WorkflowTask task)
{
String message = I18NUtil.getMessage(MessageFieldProcessor.MSG_VALUE_NONE);
String description = (String)task.getProperties().get(WorkflowModel.PROP_DESCRIPTION);
if (description != null)
{
String taskTitle = task.getTitle();
if (taskTitle == null || !taskTitle.equals(description))
{
message = description;
}
}
return message;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:TaskFormProcessor.java
示例3: getHiddenTransitions
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private List<String> getHiddenTransitions(WorkflowTask task)
{
Serializable hiddenValues = task.getProperties().get(WorkflowModel.PROP_HIDDEN_TRANSITIONS);
if (hiddenValues != null)
{
if (hiddenValues instanceof List<?>)
{
return (List<String>) hiddenValues;
}
else if (hiddenValues instanceof String && ((String)hiddenValues).length() > 0)
{
return Arrays.asList(((String)hiddenValues).split(","));
}
}
return Collections.emptyList();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:TaskFormProcessor.java
示例4: handlePackage
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
private Object handlePackage(Serializable value, String processId)
{
Object currentPckg = runtimeService.getVariableLocal(processId, PCKG_KEY);
// Do not change package if one already exists!
if (currentPckg == null)
{
if (value instanceof NodeRef)
{
return nodeConverter.convertNode((NodeRef)value);
}
else
{
throw getInvalidPropertyValueException(WorkflowModel.ASSOC_PACKAGE, value);
}
}
return DO_NOT_ADD;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:ActivitiPackagePropertyHandler.java
示例5: getOutcome
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
/**
* @return the 'outcome' label from a completed task
*/
public String getOutcome()
{
String outcome = null;
if (task.state.equals(WorkflowTaskState.COMPLETED))
{
// add the outcome label for any completed task
String transition = (String)task.properties.get(WorkflowModel.PROP_OUTCOME);
if (transition != null)
{
WorkflowTransition[] transitions = this.task.definition.node.transitions;
for (WorkflowTransition trans : transitions)
{
if (trans.id.equals(transition))
{
outcome = trans.title;
break;
}
}
}
}
return outcome;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:Workflow.java
示例6: testGenerateDefaultForm
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
public void testGenerateDefaultForm() throws Exception
{
Form form = processForm();
List<String> fieldDefs = form.getFieldDefinitionNames();
assertTrue(fieldDefs.contains(ASSIGNEE_NAME.toPrefixString(namespaceService)));
assertTrue(fieldDefs.contains(PRIORITY_NAME.toPrefixString(namespaceService)));
assertTrue(fieldDefs.contains(PackageItemsFieldProcessor.KEY));
// Check 'default ignored fields' are proerly removed from defaults.
assertFalse(fieldDefs.contains(ACTORS_NAME.toPrefixString(namespaceService)));
assertFalse(fieldDefs.contains(PROP_PACKAGE_ACTION_GROUP.toPrefixString(namespaceService)));
assertFalse(fieldDefs.contains(PROP_PACKAGE_ITEM_ACTION_GROUP.toPrefixString(namespaceService)));
assertFalse(fieldDefs.contains(WorkflowModel.PROP_DESCRIPTION.toPrefixString(namespaceService)));
assertFalse(fieldDefs.contains(WorkflowModel.PROP_DUE_DATE.toPrefixString(namespaceService)));
assertFalse(fieldDefs.contains(WorkflowModel.PROP_PRIORITY.toPrefixString(namespaceService)));
assertFalse(fieldDefs.contains(WorkflowModel.PROP_TASK_ID.toPrefixString(namespaceService)));
Serializable fieldData = (Serializable) Collections.emptyList();
FormData formData = form.getFormData();
assertEquals(fieldData, formData.getFieldData("assoc_bpm_assignee").getValue());
checkPackageActionGroups(formData);
assertEquals(2, formData.getFieldData("prop_bpm_workflowPriority").getValue());
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:WorkflowFormProcessorTest.java
示例7: checkSaveTask
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
private void checkSaveTask(String defName)
{
WorkflowTask task = getWorkflowTask(defName);
QName descName = WorkflowModel.PROP_DESCRIPTION;
Serializable initialDesc = task.getProperties().get(descName);
String testDesc = "Foo-Bar-Test-String";
assertFalse(testDesc.equals(initialDesc));
Item item = new Item("task", task.getId());
FormData data = new FormData();
String descFieldName = FormFieldConstants.PROP_DATA_PREFIX
+ descName.toPrefixString(namespaceService).replace(":", "_");
data.addFieldData(descFieldName, testDesc, true);
formService.saveForm(item, data);
WorkflowTask newTask = workflowService.getTaskById(task.getId());
assertEquals(testDesc, newTask.getProperties().get(descName));
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:FormServiceImplTest.java
示例8: getWorkflowTask
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
private WorkflowTask getWorkflowTask(String definitionName)
{
WorkflowDefinition reviewDef = workflowService.getDefinitionByName(definitionName);
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(WorkflowModel.ASSOC_ASSIGNEE, personManager.get(USER_ONE));
properties.put(WorkflowModel.ASSOC_PACKAGE, folder);
WorkflowPath path = workflowService.startWorkflow(reviewDef.getId(), properties);
WorkflowTask task = getTaskForPath(path);
String startTaskId = reviewDef.getStartTaskDefinition().getId();
if (startTaskId.equals(task.getDefinition().getId()))
{
workflowService.endTask(task.getId(), null);
task = getTaskForPath(path);
}
return task;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:FormServiceImplTest.java
示例9: testPriorityIsValid
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
/**
* Actually tests if the priority is the default value. This is based on the assumption that custom
* tasks are defaulted to a priority of 50 (which is invalid). I'm testing that the code I wrote decides this is an
* invalid number and sets it to the default value (2).
*/
public void testPriorityIsValid()
{
WorkflowDefinition definition = deployDefinition("activiti/testCustomActiviti.bpmn20.xml");
personManager.setUser(USER1);
// Start the Workflow
WorkflowPath path = workflowService.startWorkflow(definition.getId(), null);
String instanceId = path.getInstance().getId();
// Check the Start Task is completed.
WorkflowTask startTask = workflowService.getStartTask(instanceId);
assertEquals(WorkflowTaskState.COMPLETED, startTask.getState());
List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.getId());
for (WorkflowTask workflowTask : tasks)
{
Map<QName, Serializable> props = workflowTask.getProperties();
TypeDefinition typeDefinition = workflowTask.getDefinition().getMetadata();
Map<QName, PropertyDefinition> propertyDefs = typeDefinition.getProperties();
PropertyDefinition priorDef = propertyDefs.get(WorkflowModel.PROP_PRIORITY);
assertEquals(props.get(WorkflowModel.PROP_PRIORITY),Integer.valueOf(priorDef.getDefaultValue()));
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:ActivitiWorkflowServiceIntegrationTest.java
示例10: createContentAndSwitchToWorkflow
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
/**
* Deploy as a normal content node, then switch the type to bpm:workflowDefinition.
* <p>
* This should not be allowed to happen if you are non-admin.
*/
private WorkflowDefinition createContentAndSwitchToWorkflow(String processName, String resource, NodeRef parent)
{
InputStream input = getInputStream(resource);
ChildAssociationRef childAssoc = nodeService.createNode(
parent,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "test"),
ContentModel.TYPE_CONTENT,
null);
NodeRef workflowNode = childAssoc.getChildRef();
ContentWriter writer = serviceRegistry.getContentService().getWriter(workflowNode, ContentModel.PROP_CONTENT, true);
writer.putContent(input);
// Now change to WorkflowModel.TYPE_WORKFLOW_DEF
nodeService.setType(workflowNode, WorkflowModel.TYPE_WORKFLOW_DEF);
// Activate it
nodeService.setProperty(workflowNode, WorkflowModel.PROP_WORKFLOW_DEF_DEPLOYED, true);
return workflowService.getDefinitionByName(processName);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:ActivitiWorkflowServiceIntegrationTest.java
示例11: getHiddenTransitions
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
/**
* @param properties Map<QName, Serializable>
* @return List
*/
private List<?> getHiddenTransitions(Map<QName, Serializable> properties)
{
Serializable hiddenSer = properties.get(WorkflowModel.PROP_HIDDEN_TRANSITIONS);
if (hiddenSer instanceof List<?>)
{
return (List<?>) hiddenSer;
}
else if (hiddenSer instanceof String)
{
if(((String) hiddenSer).isEmpty())
{
return Collections.emptyList();
}
else
{
String hiddenStr = (String) hiddenSer;
return Arrays.asList(hiddenStr.split(","));
}
}
else if (hiddenSer == null)
{
return Collections.emptyList();
}
return null;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:30,代码来源:WorkflowModelBuilder.java
示例12: setOutcome
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
/**
* Set bpm:outcome variable to the local variables of the specified task.
* <br>The variables should be set separately via {@link org.activiti.engine.TaskService}
* @param localVariables The variable, that will be set to the task
* @param taskId The id of the task
*/
private void setOutcome(String taskId)
{
org.activiti.engine.task.Task task = activitiProcessEngine.getTaskService().createTaskQuery().taskId(taskId).singleResult();
String outcomeValue = ActivitiConstants.DEFAULT_TRANSITION_NAME;
HashMap<QName, Serializable> updates = new HashMap<QName, Serializable>();
Map<QName, Serializable> properties = propertyConverter.getTaskProperties(task);
QName outcomePropName = (QName) properties.get(WorkflowModel.PROP_OUTCOME_PROPERTY_NAME);
if (outcomePropName != null)
{
Serializable rawOutcome = properties.get(outcomePropName);
if (rawOutcome != null)
{
outcomeValue = DefaultTypeConverter.INSTANCE.convert(String.class, rawOutcome);
}
}
updates.put(WorkflowModel.PROP_OUTCOME, outcomeValue);
propertyConverter.updateTask(task, updates, null, null);
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:TasksImpl.java
示例13: createWorkflow
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
/**
* Creates a workflow and attaches it to all of the node refs
*
* @param workflowParams - any extra parameters in a map
* @param nodeRefs The node refs to attach the workflow to
* @return the ID of the workflow that was created
*/
private WorkflowInstance createWorkflow(String workflowDefId, final NodeRef assignee, String description, final NodeRef... nodeRefs) {
final NodeRef wfPackage = createWorkflowPackage(Arrays.asList(nodeRefs));
final Map<QName, Serializable> parameters = new HashMap<>();
parameters.put(WorkflowModel.ASSOC_ASSIGNEE, assignee);
parameters.put(WorkflowModel.ASSOC_PACKAGE, wfPackage);
parameters.put(WorkflowModel.PROP_CONTEXT, wfPackage);
parameters.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, description);
parameters.put(WorkflowModel.PROP_SEND_EMAIL_NOTIFICATIONS, false);
final WorkflowPath wfPath = workflowService.startWorkflow(workflowDefId, parameters);
final String workflowId = wfPath.getInstance().getId();
final WorkflowTask startTask = workflowService.getStartTask(workflowId);
workflowService.endTask(startTask.getId(), null);
return wfPath.getInstance();
}
开发者ID:ixxus,项目名称:alfresco-test-assertions,代码行数:24,代码来源:WorkflowAssertTest.java
示例14: setDefaultStartTaskDescription
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
/**
* Sets default description for the Task
*
* @param instance
* task instance
*/
public void setDefaultStartTaskDescription(TaskInstance instance)
{
String description = instance.getTask().getDescription();
if (description == null || description.length() == 0)
{
description = (String) instance.getContextInstance().getVariable(
factory.mapQNameToName(WorkflowModel.PROP_WORKFLOW_DESCRIPTION));
if (description != null && description.length() > 0)
{
Map<QName, Serializable> defaultValues = new HashMap<QName, Serializable>();
defaultValues.put(WorkflowModel.PROP_DESCRIPTION, description);
setTaskProperties(instance, defaultValues);
}
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:JBPMEngine.java
示例15: startPublishingWorkflow
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
public String startPublishingWorkflow(NodeRef eventNode, Calendar scheduledTime)
{
//Set parameters
Map<QName, Serializable> parameters = new HashMap<QName, Serializable>();
parameters.put(PROP_WF_PUBLISHING_EVENT, eventNode);
parameters.put(WorkflowModel.ASSOC_PACKAGE, workflowService.createPackage(null));
parameters.put(PROP_WF_SCHEDULED_PUBLISH_DATE, scheduledTime);
//Start workflow
WorkflowPath path = workflowService.startWorkflow(getPublshingWorkflowDefinitionId(), parameters);
String instanceId = path.getInstance().getId();
//Set the Workflow Id on the event node.
nodeService.setProperty(eventNode, PROP_PUBLISHING_EVENT_WORKFLOW_ID, instanceId);
//End the start task.
//TODO Replace with endStartTask() call after merge to HEAD.
WorkflowTask startTask = workflowService.getStartTask(instanceId);
workflowService.endTask(startTask.getId(), null);
return instanceId;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:PublishingEventHelper.java
示例16: testTimerException
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
public void testTimerException() throws Exception
{
defId = deployDefinition(exceptionDefLocation);
NodeRef pckg = workflowService.createPackage(null);
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(WorkflowModel.ASSOC_PACKAGE, pckg);
params.put(WorkflowModel.ASSOC_ASSIGNEE, AuthenticationUtil.getAdminUserName());
WorkflowPath path = workflowService.startWorkflow(defId, params);
String instanceId = path.getInstance().getId();
WorkflowTask start = workflowService.getStartTask(instanceId);
workflowService.endTask(start.getId(), null);
Thread.sleep(30000);
System.out.println("Done!");
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:17,代码来源:JbpmTimerTest.java
示例17: testTimerIsReassignable
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
public void testTimerIsReassignable() throws Exception
{
defId = deployDefinition(simpleDefLocation);
NodeRef pckg = workflowService.createPackage(null);
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(WorkflowModel.ASSOC_PACKAGE, pckg);
params.put(WorkflowModel.ASSOC_ASSIGNEE, AuthenticationUtil.getAdminUserName());
WorkflowPath path = workflowService.startWorkflow(defId, params);
String instanceId = path.getInstance().getId();
WorkflowTask start = workflowService.getStartTask(instanceId);
workflowService.endTask(start.getId(), null);
List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.getId());
WorkflowTask task = tasks.get(0);
assertTrue(workflowService.isTaskReassignable(task, AuthenticationUtil.getAdminUserName()));
// Wait for timer to end task
Thread.sleep(30000);
assertFalse(workflowService.isTaskReassignable(task, AuthenticationUtil.getAdminUserName()));
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:JbpmTimerTest.java
示例18: testCompletedItems
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
public void testCompletedItems()
{
WorkflowDefinition workflowDef = testWorkflowDef;
List<NodeRef> nodeRefs = new ArrayList<NodeRef>();
nodeRefs.add(testNodeRef);
nodeRefs.add(testNodeRef);
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(WorkflowModel.ASSOC_PACKAGE, testNodeRef);
params.put(WorkflowModel.PROP_COMPLETED_ITEMS, (Serializable)nodeRefs);
Date reviewDueDate = new Date();
params.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, reviewDueDate);
NodeRef reviewer = personService.getPerson(AuthenticationUtil.getAdminUserName());
params.put(WorkflowModel.ASSOC_ASSIGNEE, reviewer);
WorkflowPath path = workflowComponent.startWorkflow(workflowDef.getId(), params);
assertNotNull(path);
List<WorkflowTask> tasks1 = workflowComponent.getTasksForWorkflowPath(path.getId());
assertNotNull(tasks1);
assertEquals(1, tasks1.size());
WorkflowTask task = tasks1.get(0);
assertTrue(task.getProperties().containsKey(WorkflowModel.PROP_COMPLETED_ITEMS));
assertEquals(2, ((List<?>)task.getProperties().get(WorkflowModel.PROP_COMPLETED_ITEMS)).size());
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:27,代码来源:ReviewAndApproveTest.java
示例19: startWorkflow
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
private WorkflowPath startWorkflow(Calendar scheduledTime)
{
WorkflowDefinition definition = workflowService.getDefinitionByName(getWorkflowDefinitionName());
assertNotNull("The definition is null!", definition);
NodeRef pckg = workflowService.createPackage(null);
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(PROP_WF_PUBLISHING_EVENT, event);
params.put(PROP_WF_SCHEDULED_PUBLISH_DATE, scheduledTime);
params.put(WorkflowModel.ASSOC_PACKAGE, pckg);
WorkflowPath path = workflowService.startWorkflow(definition.getId(), params);
assertNotNull(path);
this.instanceId = path.getInstance().getId();
return path;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:18,代码来源:PublishWebContentProcessTest.java
示例20: getPackageActionGroup
import org.alfresco.repo.workflow.WorkflowModel; //导入依赖的package包/类
/**
* Returns the action group the current task uses for the workflow package
*
* @return action group id
*/
public String getPackageActionGroup()
{
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_ACTION_GROUP);
if (propDef != null)
{
actionGroup = propDef.getDefaultValue();
}
}
return actionGroup;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:StartWorkflowWizard.java
注:本文中的org.alfresco.repo.workflow.WorkflowModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论