@Test void testStartOperation() { Map<String, Object> parameters = Map.of(Variables.MTA_ID.getName(), "test"); Operation operation = createOperation(null, null, parameters); Mockito.when(operationsHelper.getProcessDefinitionKey(operation)) .thenReturn("deploy"); testedClass.startOperation(mockHttpServletRequest(EXAMPLE_USER), SPACE_GUID, operation); Mockito.verify(flowableFacade) .startProcess(Mockito.any(), Mockito.anyMap()); }
@Override public ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation) { String user = getAuthenticatedUser(request); String processDefinitionKey = operationsHelper.getProcessDefinitionKey(operation); Set<ParameterMetadata> predefinedParameters = operationMetadataMapper.getOperationMetadata(operation.getProcessType()) .getParameters(); operation = addServiceParameters(operation, spaceGuid, user); operation = addParameterValues(operation, predefinedParameters); ensureRequiredParametersSet(operation, predefinedParameters); ProcessInstance processInstance = flowableFacade.startProcess(processDefinitionKey, operation.getParameters()); AuditLoggingProvider.getFacade() .logConfigCreate(operation); return ResponseEntity.accepted() .header("Location", getLocationHeader(processInstance.getProcessInstanceId(), spaceGuid)) .build(); }
OperationsApiServiceImpl implements OperationsApiService { @Override public ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation) { String user = getAuthenticatedUser(request); String processDefinitionKey = operationsHelper.getProcessDefinitionKey(operation); Set<ParameterMetadata> predefinedParameters = operationMetadataMapper.getOperationMetadata(operation.getProcessType()) .getParameters(); operation = addServiceParameters(operation, spaceGuid, user); operation = addParameterValues(operation, predefinedParameters); ensureRequiredParametersSet(operation, predefinedParameters); ProcessInstance processInstance = flowableFacade.startProcess(processDefinitionKey, operation.getParameters()); AuditLoggingProvider.getFacade() .logConfigCreate(operation); return ResponseEntity.accepted() .header("Location", getLocationHeader(processInstance.getProcessInstanceId(), spaceGuid)) .build(); } }
OperationsApiServiceImpl implements OperationsApiService { @Override public ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation) { String user = getAuthenticatedUser(request); String processDefinitionKey = operationsHelper.getProcessDefinitionKey(operation); Set<ParameterMetadata> predefinedParameters = operationMetadataMapper.getOperationMetadata(operation.getProcessType()) .getParameters(); operation = addServiceParameters(operation, spaceGuid, user); operation = addParameterValues(operation, predefinedParameters); ensureRequiredParametersSet(operation, predefinedParameters); ProcessInstance processInstance = flowableFacade.startProcess(processDefinitionKey, operation.getParameters()); AuditLoggingProvider.getFacade() .logConfigCreate(operation); return ResponseEntity.accepted() .header("Location", getLocationHeader(processInstance.getProcessInstanceId(), spaceGuid)) .build(); }  }
OperationsApiServiceImpl implements OperationsApiService { @Override public ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation) { String user = getAuthenticatedUser(request); String processDefinitionKey = operationsHelper.getProcessDefinitionKey(operation); Set<ParameterMetadata> predefinedParameters = operationMetadataMapper.getOperationMetadata(operation.getProcessType()) .getParameters(); operation = addServiceParameters(operation, spaceGuid, user); operation = addParameterValues(operation, predefinedParameters); ensureRequiredParametersSet(operation, predefinedParameters); ProcessInstance processInstance = flowableFacade.startProcess(processDefinitionKey, operation.getParameters()); AuditLoggingProvider.getFacade() .logConfigCreate(operation); return ResponseEntity.accepted() .header("Location", getLocationHeader(processInstance.getProcessInstanceId(), spaceGuid)) .build(); }  @Override ResponseEntity<List<Operation>> getOperations(String spaceGuid, String mtaId, List<String> stateStrings, Integer last); @Override ResponseEntity<Void> executeOperationAction(HttpServletRequest request, String spaceGuid, String operationId, String actionId); @Override ResponseEntity<List<Log>> getOperationLogs(String spaceGuid, String operationId); @Override ResponseEntity<String> getOperationLogContent(String spaceGuid, String operationId, String logId); @Override ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation); @Override ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed); @Override ResponseEntity<List<String>> getOperationActions(String spaceGuid, String operationId); }
OperationsApiServiceImpl implements OperationsApiService { @Override public ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation) { String user = getAuthenticatedUser(request); String processDefinitionKey = operationsHelper.getProcessDefinitionKey(operation); Set<ParameterMetadata> predefinedParameters = operationMetadataMapper.getOperationMetadata(operation.getProcessType()) .getParameters(); operation = addServiceParameters(operation, spaceGuid, user); operation = addParameterValues(operation, predefinedParameters); ensureRequiredParametersSet(operation, predefinedParameters); ProcessInstance processInstance = flowableFacade.startProcess(processDefinitionKey, operation.getParameters()); AuditLoggingProvider.getFacade() .logConfigCreate(operation); return ResponseEntity.accepted() .header("Location", getLocationHeader(processInstance.getProcessInstanceId(), spaceGuid)) .build(); }  @Override ResponseEntity<List<Operation>> getOperations(String spaceGuid, String mtaId, List<String> stateStrings, Integer last); @Override ResponseEntity<Void> executeOperationAction(HttpServletRequest request, String spaceGuid, String operationId, String actionId); @Override ResponseEntity<List<Log>> getOperationLogs(String spaceGuid, String operationId); @Override ResponseEntity<String> getOperationLogContent(String spaceGuid, String operationId, String logId); @Override ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation); @Override ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed); @Override ResponseEntity<List<String>> getOperationActions(String spaceGuid, String operationId);  }