public InputStream execute(final CommandContext commandContext) { DecisionDefinition decisionDefinition = new GetDeploymentDecisionDefinitionCmd(decisionDefinitionId).execute(commandContext); final String deploymentId = decisionDefinition.getDeploymentId(); final String resourceName = decisionDefinition.getDiagramResourceName(); if (resourceName == null) { log.info("Resource name is null! No decision diagram stream exists."); return null; } else { return commandContext.runWithoutAuthorization( new Callable<InputStream>() { public InputStream call() throws Exception { return new GetDeploymentResourceCmd(deploymentId, resourceName) .execute(commandContext); } }); } }
public DecisionDefinition build() { DecisionDefinition mockDefinition = mock(DecisionDefinition.class); when(mockDefinition.getId()).thenReturn(id); when(mockDefinition.getCategory()).thenReturn(category); when(mockDefinition.getName()).thenReturn(name); when(mockDefinition.getKey()).thenReturn(key); when(mockDefinition.getVersion()).thenReturn(version); when(mockDefinition.getResourceName()).thenReturn(resource); when(mockDefinition.getDiagramResourceName()).thenReturn(diagramResource); when(mockDefinition.getDeploymentId()).thenReturn(deploymentId); when(mockDefinition.getTenantId()).thenReturn(tenantId); when(mockDefinition.getDecisionRequirementsDefinitionId()) .thenReturn(decisionRequirementsDefinitionId); when(mockDefinition.getDecisionRequirementsDefinitionKey()) .thenReturn(decisionRequirementsDefinitionKey); return mockDefinition; }