fix wf family for repo wfs

This commit is contained in:
Michele Artini 2024-01-04 09:57:19 +01:00
parent 2e00545711
commit 6b3db1f10c
3 changed files with 26 additions and 5 deletions

View File

@ -136,7 +136,7 @@ public class ApiController extends DnetRestController {
@PostMapping("/repo-hi/{id}/start")
public WfJournalEntry startRepoHi(@PathVariable final String id, @RequestBody final WfRepoHiParams params) {
return wfManagerService
.prepareNewJob(id, null, WorkflowsConstants.REPO_HI_JOB, WorkflowsConstants.REPO_HI_JOB, params.getDsId(), params.getDsName(), params
.prepareNewJob(id, null, WorkflowsConstants.REPO_HI_FAMILY, WorkflowsConstants.REPO_HI_FAMILY, params.getDsId(), params.getDsName(), params
.getApiId());
}

View File

@ -114,7 +114,25 @@ public class WorkflowManagerService {
final String wfTemplateId = destroy ? conf.getDestroyWf() : conf.getWorkflow();
final String wfConfId = conf.getId();
final String name = conf.getName();
final String family = conf.getSection();
final String family;
if (destroy) {
if (StringUtils.isNotBlank(conf.getDsId())) {
family = WorkflowsConstants.REPO_BYE_FAMILY;
} else {
family = WorkflowsConstants.GENERIC_DESTROY_WF_FAMILY;
}
} else if (StringUtils.isBlank(conf.getSection())) {
if (StringUtils.isNotBlank(conf.getDsId())) {
family = WorkflowsConstants.AGGREGATION_FAMILY;
} else {
family = WorkflowsConstants.UNKNOWN_FAMILY;
}
} else {
family = conf.getSection();
}
final String dsId = conf.getDsId();
final String dsName = conf.getDsName();
final String apiId = conf.getApiId();
@ -193,7 +211,7 @@ public class WorkflowManagerService {
public List<WfRepoHiDesc> listRepoHis() {
final SimpleResourceClient client = clientFactory.getClient(SimpleResourceClient.class);
return client.findResources(WorkflowsConstants.WF_TEMPLATE, WorkflowsConstants.REPO_HI_JOB)
return client.findResources(WorkflowsConstants.WF_TEMPLATE, WorkflowsConstants.REPO_HI_FAMILY)
.stream()
.map(r -> {
final WfTemplate tmpl = client.findResourceContent(r.getId(), WfTemplate.class);

View File

@ -40,8 +40,11 @@ public class WorkflowsConstants {
public static final String WF_TEMPLATE = "wf_template";
public static final String REPO_HI_JOB = "REPO-HI";
public static final String REPO_BYE_JOB = "REPO-BYE";
public static final String REPO_HI_FAMILY = "REPO-HI";
public static final String REPO_BYE_FAMILY = "REPO-BYE";
public static final String GENERIC_DESTROY_WF_FAMILY = "DESTROY-WF";
public static final String AGGREGATION_FAMILY = "aggregation";
public static final String UNKNOWN_FAMILY = "UNKNOWN";
public static final String WF_CREATED_NOTIFICATION_CHANNEL = "CREATED_WF";