Revision 54970
Added by Michele Artini about 5 years ago
WorkflowsModule.java | ||
---|---|---|
41 | 41 |
import eu.dnetlib.administration.uis.annotations.SimpleParamFunction; |
42 | 42 |
import eu.dnetlib.administration.uis.functions.ParamValuesFunction; |
43 | 43 |
import eu.dnetlib.administration.uis.functions.Value; |
44 |
import eu.dnetlib.administration.uis.modules.UIModule; |
|
44 |
import eu.dnetlib.administration.uis.modules.datasources.AbstractDsModule; |
|
45 |
import eu.dnetlib.administration.uis.modules.datasources.DatasourceVocabularies; |
|
45 | 46 |
import eu.dnetlib.administration.uis.modules.workflows.objects.WorkflowManagementInfo; |
46 | 47 |
import eu.dnetlib.administration.uis.modules.workflows.objects.WorkflowNotificationInfo; |
48 |
import eu.dnetlib.clients.dsManager.DatasourceDesc; |
|
47 | 49 |
import eu.dnetlib.clients.dsManager.DsManagerClient; |
50 |
import eu.dnetlib.clients.dsManager.IfaceDesc; |
|
48 | 51 |
import eu.dnetlib.clients.is.InformationServiceClient; |
49 | 52 |
import eu.dnetlib.clients.locators.ServiceClientFactory; |
50 | 53 |
import eu.dnetlib.clients.msro.MsroClient; |
... | ... | |
60 | 63 |
@RequestMapping("/ajax/wfs") |
61 | 64 |
@MenuEntry(value = "Infrastructure Management", urlSection = "wfs", order = 10, group = MenuGroup.HIDDEN) |
62 | 65 |
@Authorization(PermissionLevel.IS_ADMIN) |
63 |
public class WorkflowsModule extends UIModule {
|
|
66 |
public class WorkflowsModule extends AbstractDsModule {
|
|
64 | 67 |
|
65 | 68 |
private static final Log log = LogFactory.getLog(WorkflowsModule.class); |
66 | 69 |
|
... | ... | |
79 | 82 |
@Autowired(required = false) |
80 | 83 |
private List<ParamValuesFunction> paramValuesFunctions = new ArrayList<>(); |
81 | 84 |
|
85 |
@Autowired |
|
86 |
private DatasourceVocabularies vocs; |
|
87 |
|
|
82 | 88 |
@Override |
83 |
public void populateModelMap(final ModelMap map, final HttpServletRequest request) throws Exception {} |
|
89 |
public void populateModelMap(final ModelMap map, final HttpServletRequest request) throws Exception { |
|
90 |
map.addAttribute("compatibilityLevels", fetchVocabularyTermsAsJson(vocs.getCompatibilityLevels())); |
|
91 |
} |
|
84 | 92 |
|
85 | 93 |
@RequestMapping("list") |
86 | 94 |
public List<WorkflowItem> listWorkflowsBySection(@RequestParam final String section) throws Exception { |
87 | 95 |
return wfUtils.listWorflowsForSection(section); |
88 | 96 |
} |
89 | 97 |
|
98 |
@RequestMapping("forApi") |
|
99 |
public List<WorkflowItem> listWorkflowsForApi(@RequestParam final String dsId, @RequestParam final String ifaceId) throws Exception { |
|
100 |
return wfUtils.listWorflowsForApi(dsId, ifaceId); |
|
101 |
} |
|
102 |
|
|
90 | 103 |
@RequestMapping(value = "workflowManagementParams", method = RequestMethod.GET) |
91 | 104 |
public WorkflowManagementInfo getWorkflowManagementInfo(@RequestParam final String wfId) throws Exception { |
92 | 105 |
|
... | ... | |
312 | 325 |
|
313 | 326 |
log.debug("RESET COMPLIANCE"); |
314 | 327 |
|
315 |
dsClient.updateLevelOfCompliance(dsId, ifaceId, null, true);
|
|
328 |
dsClient.resetLevelOfCompliance(dsId, ifaceId);
|
|
316 | 329 |
|
317 | 330 |
return true; |
318 | 331 |
} |
... | ... | |
320 | 333 |
@RequestMapping("protocolParameters") |
321 | 334 |
public List<Map<String, String>> getProtocolParameters(@RequestParam final String dsId, @RequestParam final String ifaceId) throws Exception { |
322 | 335 |
|
323 |
final String profile = wfUtils.getDatasourceProfile(dsId); |
|
336 |
final DatasourceDesc ds = dsClient.getDatasource(dsId); |
|
337 |
final IfaceDesc iface = ds.getInterfaces().stream().filter(ifc -> ifc.getId().equals(ifaceId)).findFirst().get(); |
|
338 |
final String protocol = iface.getAccessProtocol(); |
|
324 | 339 |
|
325 |
final SAXReader reader = new SAXReader(); |
|
326 |
final Document doc = reader.read(new StringReader(profile)); |
|
327 |
|
|
328 |
final Node ifcNode = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']"); |
|
329 |
final String protocol = ifcNode.valueOf("./ACCESS_PROTOCOL"); |
|
330 |
|
|
331 | 340 |
final List<Map<String, String>> list = new ArrayList<>(); |
332 | 341 |
final Map<String, String> baseUrlParam = new HashMap<>(); |
333 | 342 |
|
334 | 343 |
baseUrlParam.put("name", "baseUrl"); |
335 | 344 |
baseUrlParam.put("type", "TEXT"); |
336 |
baseUrlParam.put("value", ifcNode.valueOf("./BASE_URL"));
|
|
345 |
baseUrlParam.put("value", iface.getBaseUrl());
|
|
337 | 346 |
baseUrlParam.put("regex", "^(http|https|ftp|ftps|sftp|file):\\/\\/"); |
338 | 347 |
list.add(baseUrlParam); |
339 | 348 |
|
... | ... | |
341 | 350 |
final Map<String, String> res = new HashMap<>(); |
342 | 351 |
res.put("name", pp.getName()); |
343 | 352 |
res.put("type", pp.getType()); |
344 |
res.put("value", ifcNode.valueOf("./ACCESS_PROTOCOL/@" + pp.getName()));
|
|
353 |
res.put("value", iface.getAccessParams().get(pp.getName()));
|
|
345 | 354 |
|
346 | 355 |
if (StringUtils.isNotBlank(pp.getRegex())) { |
347 | 356 |
res.put("regex", pp.getRegex()); |
Also available in: Unified diff