use of org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence in project so by onap.
the class WorkflowResource method getWorkflowActivitySpecSequence.
protected List<WorkflowActivitySpecSequence> getWorkflowActivitySpecSequence(List<String> activityNames, Workflow workflow) throws Exception {
if (activityNames == null || activityNames.isEmpty()) {
return null;
}
List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<>();
int seqNo = 1;
for (String activityName : activityNames) {
ActivitySpec activitySpec = activityRepo.findByName(activityName);
if (activitySpec != null) {
WorkflowActivitySpecSequence workflowActivitySpec = new WorkflowActivitySpecSequence();
workflowActivitySpec.setActivitySpec(activitySpec);
workflowActivitySpec.setWorkflow(workflow);
workflowActivitySpec.setSeqNo(seqNo);
seqNo++;
workflowActivitySpecs.add(workflowActivitySpec);
}
}
return workflowActivitySpecs;
}
use of org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence in project so by onap.
the class WorkflowResourceTest method installWorkflowResource_Test.
@Transactional
@Test
public void installWorkflowResource_Test() throws Exception {
Workflow workflow = new Workflow();
workflow.setArtifactChecksum("12345");
workflow.setArtifactName("myTestWorkflow1");
workflow.setArtifactUUID("a5c59864-8407-4175-8060-de8ff95eab41");
workflow.setBody("my body");
workflow.setDescription("testing workflow");
workflow.setName("myTestWorkflow1");
workflow.setResourceTarget("vnf");
workflow.setSource("sdc");
workflow.setTimeoutMinutes(5000);
workflow.setOperationName("myTestWorkflow");
workflow.setVersion(1.0);
VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow();
vnfResourceWorkflow.setVnfResourceModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
vnfResourceWorkflow.setWorkflow(workflow);
List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<VnfResourceWorkflow>();
vnfResourceWorkflows.add(vnfResourceWorkflow);
workflow.setVnfResourceWorkflow(vnfResourceWorkflows);
WorkflowActivitySpecSequence wfss1 = new WorkflowActivitySpecSequence();
wfss1.setActivitySpecId(1);
wfss1.setWorkflow(workflow);
wfss1.setSeqNo(1);
List<WorkflowActivitySpecSequence> wfss = new ArrayList<WorkflowActivitySpecSequence>();
wfss.add(wfss1);
workflow.setWorkflowActivitySpecSequence(wfss);
workflowRepo.save(workflow);
assertNotNull(workflow);
}
use of org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence in project so by onap.
the class WorkflowResource method installWorkflowResource.
protected void installWorkflowResource(WorkflowArtifact artifact, String vfResourceModelUuid) throws Exception {
IArtifactInfo artifactInfo = artifact.getArtifactInfo();
Workflow workflow = new Workflow();
workflow.setArtifactChecksum(artifactInfo.getArtifactChecksum());
workflow.setArtifactName(artifactInfo.getArtifactName());
workflow.setArtifactUUID(artifactInfo.getArtifactUUID());
workflow.setBody(artifact.getResult());
workflow.setDescription(artifactInfo.getArtifactDescription());
workflow.setName(getWorkflowNameFromArtifactName(artifactInfo.getArtifactName()));
workflow.setResourceTarget(TARGET_RESOURCE_VNF);
workflow.setSource(SOURCE_SDC);
workflow.setTimeoutMinutes(artifactInfo.getArtifactTimeout());
workflow.setOperationName(getWorkflowNameFromArtifactName(artifactInfo.getArtifactName()));
workflow.setVersion(getWorkflowVersionFromArtifactName(artifactInfo.getArtifactName()));
VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow();
vnfResourceWorkflow.setVnfResourceModelUUID(vfResourceModelUuid);
vnfResourceWorkflow.setWorkflow(workflow);
List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<>();
vnfResourceWorkflows.add(vnfResourceWorkflow);
workflow.setVnfResourceWorkflow(vnfResourceWorkflows);
List<String> activityNames = getActivityNameList(artifact.getResult());
List<WorkflowActivitySpecSequence> wfss = getWorkflowActivitySpecSequence(activityNames, workflow);
workflow.setWorkflowActivitySpecSequence(wfss);
workflowRepo.save(workflow);
}
Aggregations