本文整理汇总了Java中org.activiti.engine.impl.RepositoryServiceImpl类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryServiceImpl类的具体用法?Java RepositoryServiceImpl怎么用?Java RepositoryServiceImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryServiceImpl类属于org.activiti.engine.impl包,在下文中一共展示了RepositoryServiceImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasWorkflowImage
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public boolean hasWorkflowImage(String workflowInstanceId)
{
boolean hasImage = false;
String processInstanceId = createLocalId(workflowInstanceId);
ExecutionEntity pi = (ExecutionEntity) runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstanceId).singleResult();
// If the process is finished, there is no diagram available
if (pi != null)
{
// Fetch the process-definition. Not using query API, since the returned
// processdefinition isn't initialized with all activities
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repoService)
.getDeployedProcessDefinition(pi.getProcessDefinitionId());
hasImage = (processDefinition != null && processDefinition.isGraphicalNotationDefined());
}
return hasImage;
}
示例2: testParseHandler
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
@Test
@Deployment(resources = "chapter6/dynamic-form/leave.bpmn")
public void testParseHandler() throws Exception {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
assertEquals("请假流程-动态表单-被PRE解析器修改", processDefinition.getName());
assertEquals("leave-modified-by-post-parse-handler", processDefinition.getKey());
RepositoryServiceImpl repositoryServiceImpl = (RepositoryServiceImpl) repositoryService;
ReadOnlyProcessDefinition deployedProcessDefinition = repositoryServiceImpl
.getDeployedProcessDefinition(processDefinition.getId());
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) deployedProcessDefinition;
List<ActivityImpl> activitiList = processDefinitionEntity.getActivities();//获得当前任务的所有节点
for (ActivityImpl activity : activitiList) {
System.out.println("Activity Name: " + activity.getProperty("name") + ", async=" + activity.isAsync());
}
InputStream processBpmn = activitiRule.getRepositoryService()
.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName());
String userHomeDir = getClass().getResource("/").getFile();
FileUtils.copyInputStreamToFile(processBpmn,
new File(userHomeDir + "/leave.bpmn20.xml"));
}
示例3: addProcessImage
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
protected void addProcessImage() {
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(processDefinition.getId());
// Only show when graphical notation is defined
if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) {
Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
header.addStyleName(ExplorerLayout.STYLE_H3);
header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
panelLayout.addComponent(header);
StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
.buildStreamResource(processInstance, repositoryService, runtimeService);
Embedded embedded = new Embedded(null, diagram);
embedded.setType(Embedded.TYPE_IMAGE);
panelLayout.addComponent(embedded);
}
}
示例4: testProcessDefinitionEntitySerializable
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"})
public void testProcessDefinitionEntitySerializable() {
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ProcessDefinition processDefinition = ((RepositoryServiceImpl) repositoryService).getProcessDefinition(procDefId);
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ObjectOutputStream(baos).writeObject(processDefinition);
byte[] bytes = baos.toByteArray();
assertTrue(bytes.length > 0);
} catch (IOException e) {
e.printStackTrace();
fail();
}
}
示例5: getTaskDefinitions
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowTaskDefinition> getTaskDefinitions(String workflowDefinitionId)
{
List<WorkflowTaskDefinition> defs = new ArrayList<WorkflowTaskDefinition>();
String processDefinitionId = createLocalId(workflowDefinitionId);
// This should return all task definitions, including the start-task
ReadOnlyProcessDefinition processDefinition =((RepositoryServiceImpl)repoService).getDeployedProcessDefinition(processDefinitionId);
String processName = ((ProcessDefinition)processDefinition).getKey();
factory.checkDomain(processName);
// Process start task definition
PvmActivity startEvent = processDefinition.getInitial();
String startTaskName = null;
StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
if(startFormData != null)
{
startTaskName = startFormData.getFormKey();
}
// Add start task definition
defs.add(typeConverter.getTaskDefinition(startEvent, startTaskName, processDefinition.getId(), true));
// Now, continue through process, finding all user-tasks
Collection<PvmActivity> taskActivities = typeConverter.findUserTasks(startEvent);
for(PvmActivity act : taskActivities)
{
String formKey = typeConverter.getFormKey(act, processDefinition);
defs.add(typeConverter.getTaskDefinition(act, formKey, processDefinition.getId(), false));
}
return defs;
}
示例6: init
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
private void init() {
runtimeService = processEngine.getRuntimeService();
historyService = processEngine.getHistoryService();
repositoryService = (RepositoryServiceImpl) processEngine
.getRepositoryService();
processInstance = null;
processDefinition = null;
highLightedFlows = new ArrayList();
highLightedActivities = new ArrayList();
subProcessInstanceMap = new HashMap<String, ObjectNode>();
// ~
historicActivityInstanceList = new ArrayList<String>();
}
示例7: traceProcess
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
/**
* 流程跟踪图
*
* @param processInstanceId 流程实例ID
* @return 封装了各种节点信息
*/
public List<Map<String, Object>> traceProcess(String processInstanceId) throws Exception {
Execution execution = runtimeService.createExecutionQuery().executionId(processInstanceId).singleResult();//执行实例
Object property = PropertyUtils.getProperty(execution, "activityId");
String activityId = "";
if (property != null) {
activityId = property.toString();
}
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId)
.singleResult();
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
List<ActivityImpl> activitiList = processDefinition.getActivities();//获得当前任务的所有节点
List<Map<String, Object>> activityInfos = new ArrayList<Map<String, Object>>();
for (ActivityImpl activity : activitiList) {
boolean currentActiviti = false;
String id = activity.getId();
// 当前节点
if (id.equals(activityId)) {
currentActiviti = true;
}
Map<String, Object> activityImageInfo = packageSingleActivitiInfo(activity, processInstance, currentActiviti);
activityInfos.add(activityImageInfo);
}
return activityInfos;
}
示例8: selectActivityImplByTask
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
@Override
public ActivityImpl selectActivityImplByTask(String taskId) {
if (StringUtils.isNullOrEmpty(taskId)) {
return new ActivityImpl(null, null);
}
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
ProcessDefinitionEntity entity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId());
List<ActivityImpl> activities = entity.getActivities();
return activities
.stream()
.filter(activity -> "userTask".equals(activity.getProperty("type")) && activity.getProperty("name").equals(task.getName()))
.findFirst()
.orElseThrow(() -> new NotFoundException("获取节点信息失败"));
}
示例9: traceProcess
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
/**
* 流程跟踪图信息
* @param processInstanceId 流程实例ID
* @return 封装了各种节点信息
*/
public List<Map<String, Object>> traceProcess(String processInstanceId) throws Exception {
Execution execution = runtimeService.createExecutionQuery().executionId(processInstanceId).singleResult();//执行实例
Object property = PropertyUtils.getProperty(execution, "activityId");
String activityId = "";
if (property != null) {
activityId = property.toString();
}
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId)
.singleResult();
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
List<ActivityImpl> activitiList = processDefinition.getActivities();//获得当前任务的所有节点
List<Map<String, Object>> activityInfos = new ArrayList<Map<String, Object>>();
for (ActivityImpl activity : activitiList) {
boolean currentActiviti = false;
String id = activity.getId();
// 当前节点
if (id.equals(activityId)) {
currentActiviti = true;
}
Map<String, Object> activityImageInfo = packageSingleActivitiInfo(activity, processInstance, currentActiviti);
activityInfos.add(activityImageInfo);
}
return activityInfos;
}
示例10: testProcessDefinitionIntrospection
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
public void testProcessDefinitionIntrospection() {
String deploymentId = repositoryService
.createDeployment()
.addClasspathResource("org/activiti/engine/test/db/processOne.bpmn20.xml")
.deploymentProperty(DeploymentProperties.DEPLOY_AS_FLOWABLE5_PROCESS_DEFINITION, Boolean.TRUE)
.deploy()
.getId();
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (ProcessEngineConfigurationImpl) processEngineConfiguration.getFlowable5CompatibilityHandler().getRawProcessConfiguration();
ReadOnlyProcessDefinition processDefinition = ((RepositoryServiceImpl) activiti5ProcessEngineConfig.getRepositoryService()).getDeployedProcessDefinition(procDefId);
assertEquals(procDefId, processDefinition.getId());
assertEquals("Process One", processDefinition.getName());
assertEquals("the first process", processDefinition.getProperty("documentation"));
PvmActivity start = processDefinition.findActivity("start");
assertNotNull(start);
assertEquals("start", start.getId());
assertEquals("S t a r t", start.getProperty("name"));
assertEquals("the start event", start.getProperty("documentation"));
assertEquals(Collections.EMPTY_LIST, start.getActivities());
List<PvmTransition> outgoingTransitions = start.getOutgoingTransitions();
assertEquals(1, outgoingTransitions.size());
assertEquals("${a == b}", outgoingTransitions.get(0).getProperty(BpmnParse.PROPERTYNAME_CONDITION_TEXT));
PvmActivity end = processDefinition.findActivity("end");
assertNotNull(end);
assertEquals("end", end.getId());
PvmTransition transition = outgoingTransitions.get(0);
assertEquals("flow1", transition.getId());
assertEquals("Flow One", transition.getProperty("name"));
assertEquals("The only transitions in the process", transition.getProperty("documentation"));
assertSame(start, transition.getSource());
assertSame(end, transition.getDestination());
repositoryService.deleteDeployment(deploymentId);
}
示例11: testGetBpmnXmlFileThroughService
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
@Deployment
public void testGetBpmnXmlFileThroughService() {
String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId);
// verify bpmn file name
assertEquals(1, deploymentResources.size());
String bpmnResourceName = "org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml";
assertEquals(bpmnResourceName, deploymentResources.get(0));
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
assertEquals(bpmnResourceName, processDefinition.getResourceName());
assertNull(processDefinition.getDiagramResourceName());
assertFalse(processDefinition.hasStartFormKey());
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) processEngineConfiguration.getFlowable5CompatibilityHandler()
.getRawProcessConfiguration();
ReadOnlyProcessDefinition readOnlyProcessDefinition = ((RepositoryServiceImpl) activiti5ProcessEngineConfig.getRepositoryService()).getDeployedProcessDefinition(processDefinition.getId());
assertNull(readOnlyProcessDefinition.getDiagramResourceName());
// verify content
InputStream deploymentInputStream = repositoryService.getResourceAsStream(deploymentId, bpmnResourceName);
String contentFromDeployment = readInputStreamToString(deploymentInputStream);
assertTrue(contentFromDeployment.length() > 0);
assertTrue(contentFromDeployment.contains("process id=\"emptyProcess\""));
InputStream fileInputStream = ReflectUtil.getResourceAsStream("org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml");
String contentFromFile = readInputStreamToString(fileInputStream);
assertEquals(contentFromFile, contentFromDeployment);
}
示例12: testProcessDefinitionDescription
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
@Deployment
public void testProcessDefinitionDescription() {
String id = repositoryService.createProcessDefinitionQuery().singleResult().getId();
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) processEngineConfiguration.getFlowable5CompatibilityHandler()
.getRawProcessConfiguration();
ReadOnlyProcessDefinition processDefinition = ((RepositoryServiceImpl) activiti5ProcessEngineConfig.getRepositoryService()).getDeployedProcessDefinition(id);
assertEquals("This is really good process documentation!", processDefinition.getDescription());
}
示例13: testProcessDefinitionIntrospection
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
public void testProcessDefinitionIntrospection() {
String deploymentId = repositoryService
.createDeployment()
.addClasspathResource("org/activiti/engine/test/db/processOne.bpmn20.xml")
.deploy()
.getId();
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ReadOnlyProcessDefinition processDefinition = ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(procDefId);
assertEquals(procDefId, processDefinition.getId());
assertEquals("Process One", processDefinition.getName());
assertEquals("the first process", processDefinition.getProperty("documentation"));
PvmActivity start = processDefinition.findActivity("start");
assertNotNull(start);
assertEquals("start", start.getId());
assertEquals("S t a r t", start.getProperty("name"));
assertEquals("the start event", start.getProperty("documentation"));
assertEquals(Collections.EMPTY_LIST, start.getActivities());
List<PvmTransition> outgoingTransitions = start.getOutgoingTransitions();
assertEquals(1, outgoingTransitions.size());
assertEquals("${a == b}", outgoingTransitions.get(0).getProperty(BpmnParse.PROPERTYNAME_CONDITION_TEXT));
PvmActivity end = processDefinition.findActivity("end");
assertNotNull(end);
assertEquals("end", end.getId());
PvmTransition transition = outgoingTransitions.get(0);
assertEquals("flow1", transition.getId());
assertEquals("Flow One", transition.getProperty("name"));
assertEquals("The only transitions in the process", transition.getProperty("documentation"));
assertSame(start, transition.getSource());
assertSame(end, transition.getDestination());
repositoryService.deleteDeployment(deploymentId);
}
示例14: testGetBpmnXmlFileThroughService
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
@Deployment
public void testGetBpmnXmlFileThroughService() {
String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId);
// verify bpmn file name
assertEquals(1, deploymentResources.size());
String bpmnResourceName = "org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml";
assertEquals(bpmnResourceName, deploymentResources.get(0));
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
assertEquals(bpmnResourceName, processDefinition.getResourceName());
assertNull(processDefinition.getDiagramResourceName());
assertFalse(processDefinition.hasStartFormKey());
ReadOnlyProcessDefinition readOnlyProcessDefinition = ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(processDefinition.getId());
assertNull(readOnlyProcessDefinition.getDiagramResourceName());
// verify content
InputStream deploymentInputStream = repositoryService.getResourceAsStream(deploymentId, bpmnResourceName);
String contentFromDeployment = readInputStreamToString(deploymentInputStream);
assertTrue(contentFromDeployment.length() > 0);
assertTrue(contentFromDeployment.contains("process id=\"emptyProcess\""));
InputStream fileInputStream = ReflectUtil.getResourceAsStream("org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml");
String contentFromFile = readInputStreamToString(fileInputStream);
assertEquals(contentFromFile, contentFromDeployment);
}
示例15: getInstanceDiagram
import org.activiti.engine.impl.RepositoryServiceImpl; //导入依赖的package包/类
@Get
public InputRepresentation getInstanceDiagram() {
if(authenticate() == false) return null;
String processInstanceId = (String) getRequest().getAttributes().get("processInstanceId");
if(processInstanceId == null) {
throw new ActivitiException("No process instance id provided");
}
ExecutionEntity pi =
(ExecutionEntity) ActivitiUtil.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (pi == null) {
throw new ActivitiException("Process instance with id" + processInstanceId + " could not be found");
}
ProcessDefinitionEntity pde = (ProcessDefinitionEntity) ((RepositoryServiceImpl) ActivitiUtil.getRepositoryService())
.getDeployedProcessDefinition(pi.getProcessDefinitionId());
if (pde != null && pde.isGraphicalNotationDefined()) {
InputStream resource = ProcessDiagramGenerator.generateDiagram(pde, "png", ActivitiUtil.getRuntimeService().getActiveActivityIds(processInstanceId));
InputRepresentation output = new InputRepresentation(resource);
return output;
} else {
throw new ActivitiException("Process instance with id " + processInstanceId + " has no graphic description");
}
}