Revision 54970
Added by Michele Artini about 5 years ago
modules/dnet-springboot-apps/trunk/dnet-is-application/.project | ||
---|---|---|
25 | 25 |
<arguments> |
26 | 26 |
</arguments> |
27 | 27 |
</buildCommand> |
28 |
<buildCommand> |
|
29 |
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name> |
|
30 |
<arguments> |
|
31 |
</arguments> |
|
32 |
</buildCommand> |
|
28 | 33 |
</buildSpec> |
29 | 34 |
<natures> |
30 | 35 |
<nature>org.springframework.ide.eclipse.core.springnature</nature> |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/datasources/SimpleDatasourceManagerCore.java | ||
---|---|---|
309 | 309 |
public boolean updateLevelOfCompliance(final String dsId, final String ifaceId, final String level, final boolean override) |
310 | 310 |
throws DatasourceManagerServiceException { |
311 | 311 |
try { |
312 |
final String profId = fixDsId(dsId); |
|
313 |
|
|
312 | 314 |
if (override) { |
315 |
final String profile = obtainProfile(profId); |
|
316 |
final SAXReader reader = new SAXReader(); |
|
317 |
final Document doc = reader.read(new StringReader(profile)); |
|
313 | 318 |
|
314 |
final String xq = |
|
315 |
String.format("for $x in doc('/db/DRIVER/%s')//INTERFACE[@id = '%s']/@compliance return update replace $x with '%s'", |
|
316 |
fixDsId(dsId), ifaceId, level); |
|
317 |
return is.xupdate(xq); |
|
318 |
} else { |
|
319 |
final Element iface = (Element) doc.selectSingleNode("//INTERFACE[@id='" + ifaceId + "']"); |
|
320 |
if (iface != null) { |
|
321 |
final Map<String, String> fields = new HashMap<>(); |
|
319 | 322 |
|
320 |
final String profId = fixDsId(dsId); |
|
323 |
if (!StringUtils.isEmpty(level)) { |
|
324 |
fields.put(OVERRIDING_COMPLIANCE_FIELD, level); |
|
325 |
} |
|
321 | 326 |
|
322 |
try { |
|
323 |
final String profile = obtainProfile(profId); |
|
327 |
while (iface.selectNodes("./INTERFACE_EXTRA_FIELD").size() > 0) { |
|
328 |
final Node node = iface.selectSingleNode("./INTERFACE_EXTRA_FIELD"); |
|
329 |
final String name = node.valueOf("@name"); |
|
324 | 330 |
|
325 |
final SAXReader reader = new SAXReader(); |
|
326 |
final Document doc = reader.read(new StringReader(profile)); |
|
327 |
|
|
328 |
final Element iface = (Element) doc.selectSingleNode("//INTERFACE[@id='" + ifaceId + "']"); |
|
329 |
if (iface != null) { |
|
330 |
final Map<String, String> fields = new HashMap<>(); |
|
331 |
|
|
332 |
if (!StringUtils.isEmpty(level)) { |
|
333 |
fields.put(OVERRIDING_COMPLIANCE_FIELD, level); |
|
331 |
if (!name.equals(OVERRIDING_COMPLIANCE_FIELD)) { |
|
332 |
fields.put(node.valueOf("@name"), node.getText()); |
|
334 | 333 |
} |
334 |
node.detach(); |
|
335 |
} |
|
335 | 336 |
|
336 |
while (iface.selectNodes("./INTERFACE_EXTRA_FIELD").size() > 0) { |
|
337 |
final Node node = iface.selectSingleNode("./INTERFACE_EXTRA_FIELD"); |
|
338 |
final String name = node.valueOf("@name"); |
|
339 |
|
|
340 |
if (!name.equals(OVERRIDING_COMPLIANCE_FIELD)) { |
|
341 |
fields.put(node.valueOf("@name"), node.getText()); |
|
342 |
} |
|
343 |
node.detach(); |
|
337 |
for (final Map.Entry<String, String> e : fields.entrySet()) { |
|
338 |
if ((e.getValue() != null) && !e.getValue().isEmpty()) { |
|
339 |
final Element field = iface.addElement("INTERFACE_EXTRA_FIELD"); |
|
340 |
field.addAttribute("name", e.getKey()); |
|
341 |
field.addText(e.getValue()); |
|
344 | 342 |
} |
345 |
|
|
346 |
for (final Map.Entry<String, String> e : fields.entrySet()) { |
|
347 |
if ((e.getValue() != null) && !e.getValue().isEmpty()) { |
|
348 |
final Element field = iface.addElement("INTERFACE_EXTRA_FIELD"); |
|
349 |
field.addAttribute("name", e.getKey()); |
|
350 |
field.addText(e.getValue()); |
|
351 |
} |
|
352 |
} |
|
353 |
is.updateProfile(profId, doc.asXML()); |
|
354 |
} else { |
|
355 |
log.error("Invalid interface: " + ifaceId); |
|
356 |
throw new DatasourceManagerServiceException("Missing interface: " + ifaceId); |
|
357 | 343 |
} |
358 |
} catch (final Exception e) { |
|
359 |
log.error("Error updating API of profile: " + profId); |
|
360 |
throw new DatasourceManagerServiceException("Error updating API of profile: " + profId, e); |
|
344 |
is.updateProfile(profId, doc.asXML()); |
|
345 |
} else { |
|
346 |
log.error("Invalid interface: " + ifaceId); |
|
347 |
throw new DatasourceManagerServiceException("Missing interface: " + ifaceId); |
|
361 | 348 |
} |
362 |
|
|
363 | 349 |
return true; |
350 |
} else { |
|
351 |
final String xq = |
|
352 |
String.format("for $x in doc('/db/DRIVER/%s')//INTERFACE[@id = '%s']/@compliance return update replace $x with '%s'", |
|
353 |
profId, ifaceId, level); |
|
354 |
return is.xupdate(xq); |
|
364 | 355 |
} |
365 | 356 |
} catch (final Exception e) { |
366 | 357 |
log.error("Error updating profile: " + dsId, e); |
... | ... | |
369 | 360 |
} |
370 | 361 |
|
371 | 362 |
@Override |
363 |
public boolean resetLevelOfCompliance(final String dsId, final String ifaceId) throws DatasourceManagerServiceException { |
|
364 |
return deleteExtraField(dsId, ifaceId, OVERRIDING_COMPLIANCE_FIELD); |
|
365 |
} |
|
366 |
|
|
367 |
@Override |
|
372 | 368 |
public boolean updateBaseUrl(final String dsId, final String ifaceId, final String baseUrl) throws DatasourceManagerServiceException { |
373 | 369 |
try { |
374 | 370 |
final String xq = |
... | ... | |
480 | 476 |
try { |
481 | 477 |
|
482 | 478 |
final String profile = obtainProfile(profId); |
479 |
|
|
480 |
System.out.println(profile); |
|
481 |
|
|
483 | 482 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
484 | 483 |
|
485 | 484 |
final Node ef = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']/INTERFACE_EXTRA_FIELD[@name = '" + field + "']"); |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/datasources/DatasourceManagerController.java | ||
---|---|---|
4 | 4 |
import java.util.List; |
5 | 5 |
import java.util.Map; |
6 | 6 |
|
7 |
import org.apache.commons.lang3.StringUtils; |
|
7 | 8 |
import org.springframework.beans.factory.annotation.Autowired; |
8 | 9 |
import org.springframework.web.bind.annotation.PathVariable; |
9 | 10 |
import org.springframework.web.bind.annotation.RequestBody; |
... | ... | |
67 | 68 |
@RequestMapping(value = "api/compliance", method = RequestMethod.GET) |
68 | 69 |
public boolean updateLevelOfCompliance(@RequestParam final String dsId, |
69 | 70 |
@RequestParam final String ifaceId, |
70 |
@RequestParam final String level, |
|
71 |
@RequestParam(required = false, defaultValue = "") final String level,
|
|
71 | 72 |
@RequestParam(required = false, defaultValue = "false") final boolean override) throws DatasourceManagerServiceException { |
72 |
return core.updateLevelOfCompliance(dsId, ifaceId, level, override); |
|
73 |
|
|
74 |
if (override && StringUtils.isBlank(level)) { |
|
75 |
return core.resetLevelOfCompliance(dsId, ifaceId); |
|
76 |
} else { |
|
77 |
return core.updateLevelOfCompliance(dsId, ifaceId, level, override); |
|
78 |
} |
|
73 | 79 |
} |
74 | 80 |
|
75 | 81 |
@RequestMapping(value = "api/baseUrl", method = RequestMethod.GET) |
modules/dnet-springboot-apps/trunk/dnet-is-application/src/main/java/eu/dnetlib/enabling/datasources/DatasourceManagerCore.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
List<SimpleDatasourceDesc> simpleListDatasourcesByType(String type) throws DatasourceManagerServiceException; |
64 | 64 |
|
65 |
boolean resetLevelOfCompliance(String dsId, String ifaceId) throws DatasourceManagerServiceException; |
|
66 |
|
|
65 | 67 |
} |
modules/dnet-springboot-apps/trunk/dnet-is-application/.settings/org.springframework.ide.eclipse.prefs | ||
---|---|---|
1 |
boot.validation.initialized=true |
|
2 |
eclipse.preferences.version=1 |
modules/dnet-springboot-apps/trunk/dnet-administration-uis/.factorypath | ||
---|---|---|
1 | 1 |
<factorypath> |
2 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-velocity/1.4.4.RELEASE/spring-boot-starter-velocity-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
|
2 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-cache/1.4.4.RELEASE/spring-boot-starter-cache-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
|
3 | 3 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter/1.4.4.RELEASE/spring-boot-starter-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
4 | 4 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot/1.4.4.RELEASE/spring-boot-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
5 | 5 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-autoconfigure/1.4.4.RELEASE/spring-boot-autoconfigure-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
... | ... | |
10 | 10 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/jul-to-slf4j/1.7.22/jul-to-slf4j-1.7.22.jar" enabled="true" runInBatchMode="false"/> |
11 | 11 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/log4j-over-slf4j/1.7.22/log4j-over-slf4j-1.7.22.jar" enabled="true" runInBatchMode="false"/> |
12 | 12 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar" enabled="true" runInBatchMode="false"/> |
13 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar" enabled="true" runInBatchMode="false"/> |
|
14 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar" enabled="true" runInBatchMode="false"/> |
|
15 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-digester/commons-digester/2.1/commons-digester-2.1.jar" enabled="true" runInBatchMode="false"/> |
|
16 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/velocity/velocity/1.7/velocity-1.7.jar" enabled="true" runInBatchMode="false"/> |
|
17 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar" enabled="true" runInBatchMode="false"/> |
|
18 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.jar" enabled="true" runInBatchMode="false"/> |
|
19 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-chain/commons-chain/1.1/commons-chain-1.1.jar" enabled="true" runInBatchMode="false"/> |
|
20 |
<factorypathentry kind="VARJAR" id="M2_REPO/commons-validator/commons-validator/1.3.1/commons-validator-1.3.1.jar" enabled="true" runInBatchMode="false"/> |
|
21 |
<factorypathentry kind="VARJAR" id="M2_REPO/oro/oro/2.0.8/oro-2.0.8.jar" enabled="true" runInBatchMode="false"/> |
|
22 |
<factorypathentry kind="VARJAR" id="M2_REPO/sslext/sslext/1.2-0/sslext-1.2-0.jar" enabled="true" runInBatchMode="false"/> |
|
23 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/struts/struts-core/1.3.8/struts-core-1.3.8.jar" enabled="true" runInBatchMode="false"/> |
|
24 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/struts/struts-taglib/1.3.8/struts-taglib-1.3.8.jar" enabled="true" runInBatchMode="false"/> |
|
25 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/struts/struts-tiles/1.3.8/struts-tiles-1.3.8.jar" enabled="true" runInBatchMode="false"/> |
|
26 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context-support/4.3.6.RELEASE/spring-context-support-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
13 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context/4.3.6.RELEASE/spring-context-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
27 | 14 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-beans/4.3.6.RELEASE/spring-beans-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
28 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-cache/1.4.4.RELEASE/spring-boot-starter-cache-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
29 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context/4.3.6.RELEASE/spring-context-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
30 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-aop/4.3.6.RELEASE/spring-aop-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
31 | 15 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-expression/4.3.6.RELEASE/spring-expression-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
16 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context-support/4.3.6.RELEASE/spring-context-support-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
32 | 17 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-web/1.4.4.RELEASE/spring-boot-starter-web-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
33 | 18 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-tomcat/1.4.4.RELEASE/spring-boot-starter-tomcat-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
34 | 19 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/tomcat/embed/tomcat-embed-core/8.5.11/tomcat-embed-core-8.5.11.jar" enabled="true" runInBatchMode="false"/> |
... | ... | |
42 | 27 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.8.6/jackson-core-2.8.6.jar" enabled="true" runInBatchMode="false"/> |
43 | 28 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-web/4.3.6.RELEASE/spring-web-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
44 | 29 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-webmvc/4.3.6.RELEASE/spring-webmvc-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
30 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-aop/1.4.4.RELEASE/spring-boot-starter-aop-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
31 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-aop/4.3.6.RELEASE/spring-aop-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
32 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar" enabled="true" runInBatchMode="false"/> |
|
33 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-freemarker/1.4.4.RELEASE/spring-boot-starter-freemarker-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
34 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/freemarker/freemarker/2.3.25-incubating/freemarker-2.3.25-incubating.jar" enabled="true" runInBatchMode="false"/> |
|
45 | 35 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-configuration-processor/1.4.4.RELEASE/spring-boot-configuration-processor-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
46 | 36 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/json/json/20140107/json-20140107.jar" enabled="true" runInBatchMode="false"/> |
47 | 37 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-test/1.4.4.RELEASE/spring-boot-starter-test-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
... | ... | |
61 | 51 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-core/4.3.6.RELEASE/spring-core-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
62 | 52 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-test/4.3.6.RELEASE/spring-test-4.3.6.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
63 | 53 |
<factorypathentry kind="VARJAR" id="M2_REPO/junit/junit/4.12/junit-4.12.jar" enabled="true" runInBatchMode="false"/> |
54 |
<factorypathentry kind="VARJAR" id="M2_REPO/io/prometheus/simpleclient_spring_boot/0.0.21/simpleclient_spring_boot-0.0.21.jar" enabled="true" runInBatchMode="false"/> |
|
55 |
<factorypathentry kind="VARJAR" id="M2_REPO/io/prometheus/simpleclient/0.0.21/simpleclient-0.0.21.jar" enabled="true" runInBatchMode="false"/> |
|
56 |
<factorypathentry kind="VARJAR" id="M2_REPO/io/prometheus/simpleclient_common/0.0.21/simpleclient_common-0.0.21.jar" enabled="true" runInBatchMode="false"/> |
|
57 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-actuator/1.3.3.RELEASE/spring-boot-actuator-1.3.3.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
58 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.6.5/jackson-databind-2.6.5.jar" enabled="true" runInBatchMode="false"/> |
|
59 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.6.5/jackson-core-2.6.5.jar" enabled="true" runInBatchMode="false"/> |
|
60 |
<factorypathentry kind="VARJAR" id="M2_REPO/io/prometheus/simpleclient_hotspot/0.0.21/simpleclient_hotspot-0.0.21.jar" enabled="true" runInBatchMode="false"/> |
|
61 |
<factorypathentry kind="VARJAR" id="M2_REPO/io/prometheus/simpleclient_servlet/0.0.21/simpleclient_servlet-0.0.21.jar" enabled="true" runInBatchMode="false"/> |
|
64 | 62 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar" enabled="true" runInBatchMode="false"/> |
65 | 63 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-webmvc/4.2.5.RELEASE/spring-webmvc-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
66 | 64 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-core/4.2.5.RELEASE/spring-core-4.2.5.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
... | ... | |
108 | 106 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
109 | 107 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/plugin/spring-plugin-metadata/1.2.0.RELEASE/spring-plugin-metadata-1.2.0.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
110 | 108 |
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-swagger-ui/2.4.0/springfox-swagger-ui-2.4.0.jar" enabled="true" runInBatchMode="false"/> |
109 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/jhades/jhades/1.0.4/jhades-1.0.4.jar" enabled="true" runInBatchMode="false"/> |
|
110 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-actuator/1.4.4.RELEASE/spring-boot-actuator-1.4.4.RELEASE.jar" enabled="true" runInBatchMode="false"/> |
|
111 | 111 |
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/gson/gson/2.7/gson-2.7.jar" enabled="true" runInBatchMode="false"/> |
112 | 112 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar" enabled="true" runInBatchMode="false"/> |
113 | 113 |
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.jar" enabled="true" runInBatchMode="false"/> |
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/java/eu/dnetlib/administration/uis/modules/datasources/ApisModule.java | ||
---|---|---|
31 | 31 |
import eu.dnetlib.administration.uis.annotations.MenuGroup; |
32 | 32 |
import eu.dnetlib.administration.uis.annotations.PermissionLevel; |
33 | 33 |
import eu.dnetlib.clients.dsManager.BrowseTerm; |
34 |
import eu.dnetlib.clients.dsManager.DatasourceDesc; |
|
34 | 35 |
import eu.dnetlib.clients.dsManager.DsManagerClient; |
35 | 36 |
import eu.dnetlib.clients.dsManager.SearchInterfacesEntry; |
36 | 37 |
import eu.dnetlib.clients.is.InformationServiceClient; |
... | ... | |
67 | 68 |
map.addAttribute("browseFields", gson.toJson(dsManager.listBrowsableFields())); |
68 | 69 |
} |
69 | 70 |
|
71 |
@RequestMapping(value = "ds") |
|
72 |
public DatasourceDesc getDS(@RequestParam final String id) throws Exception { |
|
73 |
return dsManager.getDatasource(id); |
|
74 |
} |
|
75 |
|
|
70 | 76 |
@RequestMapping(value = "browse/{field}") |
71 | 77 |
public List<BrowseTerm> browseField(@PathVariable final String field) throws Exception { |
72 | 78 |
return dsManager.browseField(field); |
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/java/eu/dnetlib/administration/uis/modules/workflows/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()); |
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/java/eu/dnetlib/administration/uis/modules/workflows/WorkflowsOtherController.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.IOException; |
4 | 4 |
import java.io.StringReader; |
5 |
import java.util.HashMap; |
|
6 | 5 |
import java.util.Map; |
6 |
import java.util.Map.Entry; |
|
7 | 7 |
|
8 | 8 |
import javax.servlet.http.HttpServletResponse; |
9 | 9 |
|
10 | 10 |
import org.apache.commons.io.IOUtils; |
11 | 11 |
import org.dom4j.Document; |
12 | 12 |
import org.dom4j.Element; |
13 |
import org.dom4j.Node; |
|
14 | 13 |
import org.dom4j.io.SAXReader; |
15 | 14 |
import org.springframework.beans.factory.annotation.Autowired; |
16 | 15 |
import org.springframework.beans.factory.annotation.Value; |
... | ... | |
19 | 18 |
import org.springframework.web.bind.annotation.RequestMapping; |
20 | 19 |
import org.springframework.web.bind.annotation.RequestParam; |
21 | 20 |
|
22 |
import eu.dnetlib.administration.uis.modules.datasources.VocabularyEntry; |
|
21 |
import eu.dnetlib.clients.dsManager.DatasourceDesc; |
|
22 |
import eu.dnetlib.clients.dsManager.DsManagerClient; |
|
23 |
import eu.dnetlib.clients.dsManager.IfaceDesc; |
|
23 | 24 |
import eu.dnetlib.clients.is.InformationServiceClient; |
24 | 25 |
import eu.dnetlib.miscutils.functional.xml.ApplyXsltDom4j; |
25 | 26 |
|
... | ... | |
30 | 31 |
private String compatibilityLevelsVocabulary; |
31 | 32 |
|
32 | 33 |
@Autowired |
33 |
private WorkflowsUIUtils wfUtils;
|
|
34 |
private InformationServiceClient isClient;
|
|
34 | 35 |
|
35 | 36 |
@Autowired |
36 |
private InformationServiceClient isClient;
|
|
37 |
private DsManagerClient dsManagerClient;
|
|
37 | 38 |
|
38 | 39 |
@RequestMapping("/page/datasource_api") |
39 | 40 |
public void getDatasourceApiHtml(final HttpServletResponse res, @RequestParam final String dsId, @RequestParam final String ifaceId) throws Exception { |
40 | 41 |
|
41 |
final String profile = wfUtils.getDatasourceProfile(dsId); |
|
42 |
|
|
43 |
final SAXReader reader = new SAXReader(); |
|
44 |
final Document doc = reader.read(new StringReader(profile)); |
|
45 |
|
|
46 |
final Node ifcNode = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']"); |
|
47 |
|
|
48 |
final String profileId = doc.valueOf("//RESOURCE_IDENTIFIER/@value"); |
|
49 |
|
|
50 |
final String protocol = ifcNode.valueOf("./ACCESS_PROTOCOL"); |
|
51 |
final Element extra = doc.getRootElement().addElement("extra_info"); |
|
52 |
|
|
53 |
final Element compLevels = extra.addElement("compatibilityLevels"); |
|
54 |
for (final VocabularyEntry e : wfUtils.fetchVocabularyTerms(compatibilityLevelsVocabulary)) { |
|
55 |
final Element l = compLevels.addElement("level"); |
|
56 |
l.setText(e.getName()); |
|
57 |
} |
|
58 |
|
|
59 |
final Element parameters = extra.addElement("parameters"); |
|
60 |
for (final Object o : ifcNode.selectNodes("./ACCESS_PROTOCOL/@*")) { |
|
61 |
final Element p = parameters.addElement("param"); |
|
62 |
p.addAttribute("name", ((Node) o).getName()); |
|
63 |
p.setText(((Node) o).getText()); |
|
64 |
} |
|
65 |
|
|
66 |
final Element extraFields = extra.addElement("extraFields"); |
|
67 |
for (final Object o : ifcNode.selectNodes("./INTERFACE_EXTRA_FIELD")) { |
|
68 |
final Element f = extraFields.addElement("field"); |
|
69 |
f.addAttribute("name", ((Node) o).valueOf("@name")); |
|
70 |
f.setText(((Node) o).getText()); |
|
71 |
} |
|
72 |
|
|
73 |
final Element wfs = extra.addElement("workflows"); |
|
74 |
for (final WorkflowItem item : wfUtils.listWorflowsForApi(profileId, ifaceId)) { |
|
75 |
final Element wf = wfs.addElement("workflow"); |
|
76 |
wf.addAttribute("id", item.getWfId()); |
|
77 |
wf.addAttribute("name", item.getName()); |
|
78 |
wf.addAttribute("description", item.getDesc()); |
|
79 |
if (item.isDestroy()) { |
|
80 |
wf.addAttribute("destroy", "1"); |
|
81 |
} |
|
82 |
} |
|
83 |
final Map<String, String> params = new HashMap<>(); |
|
84 |
params.put("profileId", doc.valueOf("//RESOURCE_IDENTIFIER/@value")); |
|
85 |
params.put("ifaceId", ifaceId); |
|
86 |
params.put("protocol", protocol); |
|
87 |
params.put("baseUrl", ifcNode.valueOf("./BASE_URL")); |
|
88 |
params.put("prefix", doc.valueOf(".//FIELD[./key = 'NamespacePrefix']/value")); |
|
89 |
params.put("typology", ifcNode.valueOf("@typology")); |
|
90 |
params.put("compliance", ifcNode.valueOf("@compliance")); |
|
91 |
params.put("overrideCompliance", ifcNode.valueOf("./INTERFACE_EXTRA_FIELD[@name='overriding_compliance']")); |
|
92 |
|
|
93 |
doc.selectSingleNode("/RESOURCE_PROFILE/HEADER").detach(); |
|
94 |
doc.selectSingleNode("/RESOURCE_PROFILE/BODY/CONFIGURATION/INTERFACES").detach(); |
|
95 |
doc.selectSingleNode("/RESOURCE_PROFILE/BODY/CONFIGURATION/EXTRA_FIELDS").detach(); |
|
96 |
doc.selectSingleNode("/RESOURCE_PROFILE/BODY/QOS").detach(); |
|
97 |
doc.selectSingleNode("/RESOURCE_PROFILE/BODY/STATUS").detach(); |
|
98 |
doc.selectSingleNode("/RESOURCE_PROFILE/BODY/SECURITY_PARAMETERS").detach(); |
|
99 |
doc.selectSingleNode("/RESOURCE_PROFILE/BODY/BLACKBOARD").detach(); |
|
100 |
|
|
101 |
applyXsltAndSend(res, doc, "/xslt/datasource_api.xslt", params); |
|
42 |
// final String profile = wfUtils.getDatasourceProfile(dsId); |
|
43 |
/* |
|
44 |
* final DatasourceDesc ds = dsManagerClient.getDatasource(dsId); |
|
45 |
* |
|
46 |
* final SAXReader reader = new SAXReader(); final Document doc = reader.read(new StringReader(profile)); |
|
47 |
* |
|
48 |
* final Node ifcNode = doc.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']"); |
|
49 |
* |
|
50 |
* final String profileId = doc.valueOf("//RESOURCE_IDENTIFIER/@value"); |
|
51 |
* |
|
52 |
* final String protocol = ifcNode.valueOf("./ACCESS_PROTOCOL"); final Element extra = |
|
53 |
* doc.getRootElement().addElement("extra_info"); |
|
54 |
* |
|
55 |
* final Element compLevels = extra.addElement("compatibilityLevels"); for (final VocabularyEntry e : |
|
56 |
* wfUtils.fetchVocabularyTerms(compatibilityLevelsVocabulary)) { final Element l = compLevels.addElement("level"); |
|
57 |
* l.setText(e.getName()); } |
|
58 |
* |
|
59 |
* final Element parameters = extra.addElement("parameters"); for (final Object o : ifcNode.selectNodes("./ACCESS_PROTOCOL/@*")) { |
|
60 |
* final Element p = parameters.addElement("param"); p.addAttribute("name", ((Node) o).getName()); p.setText(((Node) o).getText()); |
|
61 |
* } |
|
62 |
* |
|
63 |
* final Element extraFields = extra.addElement("extraFields"); for (final Object o : |
|
64 |
* ifcNode.selectNodes("./INTERFACE_EXTRA_FIELD")) { final Element f = extraFields.addElement("field"); f.addAttribute("name", |
|
65 |
* ((Node) o).valueOf("@name")); f.setText(((Node) o).getText()); } |
|
66 |
* |
|
67 |
* final Element wfs = extra.addElement("workflows"); for (final WorkflowItem item : wfUtils.listWorflowsForApi(profileId, ifaceId)) |
|
68 |
* { final Element wf = wfs.addElement("workflow"); wf.addAttribute("id", item.getWfId()); wf.addAttribute("name", item.getName()); |
|
69 |
* wf.addAttribute("description", item.getDesc()); if (item.isDestroy()) { wf.addAttribute("destroy", "1"); } } final Map<String, |
|
70 |
* String> params = new HashMap<>(); params.put("profileId", doc.valueOf("//RESOURCE_IDENTIFIER/@value")); params.put("ifaceId", |
|
71 |
* ifaceId); params.put("protocol", protocol); params.put("baseUrl", ifcNode.valueOf("./BASE_URL")); params.put("prefix", |
|
72 |
* doc.valueOf(".//FIELD[./key = 'NamespacePrefix']/value")); params.put("typology", ifcNode.valueOf("@typology")); |
|
73 |
* params.put("compliance", ifcNode.valueOf("@compliance")); params.put("overrideCompliance", |
|
74 |
* ifcNode.valueOf("./INTERFACE_EXTRA_FIELD[@name='overriding_compliance']")); |
|
75 |
* |
|
76 |
* doc.selectSingleNode("/RESOURCE_PROFILE/HEADER").detach(); |
|
77 |
* doc.selectSingleNode("/RESOURCE_PROFILE/BODY/CONFIGURATION/INTERFACES").detach(); |
|
78 |
* doc.selectSingleNode("/RESOURCE_PROFILE/BODY/CONFIGURATION/EXTRA_FIELDS").detach(); |
|
79 |
* doc.selectSingleNode("/RESOURCE_PROFILE/BODY/QOS").detach(); doc.selectSingleNode("/RESOURCE_PROFILE/BODY/STATUS").detach(); |
|
80 |
* doc.selectSingleNode("/RESOURCE_PROFILE/BODY/SECURITY_PARAMETERS").detach(); |
|
81 |
* doc.selectSingleNode("/RESOURCE_PROFILE/BODY/BLACKBOARD").detach(); |
|
82 |
* |
|
83 |
* applyXsltAndSend(res, doc, "/xslt/datasource_api.xslt", params); |
|
84 |
* |
|
85 |
*/ |
|
102 | 86 |
} |
103 | 87 |
|
104 | 88 |
@RequestMapping("/page/wf") |
... | ... | |
110 | 94 |
if (dsNode != null) { |
111 | 95 |
final String dsId = dsNode.valueOf("@id"); |
112 | 96 |
final String ifaceId = dsNode.valueOf("@interface"); |
113 |
final String dsProfile = wfUtils.getDatasourceProfile(dsId);; |
|
114 |
final Document doc2 = reader.read(new StringReader(dsProfile)); |
|
115 |
dsNode.addAttribute("name", doc2.valueOf("//OFFICIAL_NAME")); |
|
116 |
dsNode.addAttribute("protocol", doc2.valueOf("//INTERFACE[@id = '" + ifaceId + "']/ACCESS_PROTOCOL")); |
|
117 |
final Node ifcNode = doc2.selectSingleNode("//INTERFACE[@id = '" + ifaceId + "']"); |
|
97 |
|
|
98 |
final DatasourceDesc ds = dsManagerClient.getDatasource(dsId); |
|
99 |
final IfaceDesc iface = ds.getInterfaces().stream().filter(ifc -> ifc.getId().equals(ifaceId)).findFirst().get(); |
|
100 |
|
|
101 |
dsNode.addAttribute("name", ds.getOfficialName()); |
|
102 |
dsNode.addAttribute("protocol", iface.getAccessProtocol()); |
|
118 | 103 |
final Element extraFields = dsNode.addElement("extraFields"); |
119 |
for (final Object o : ifcNode.selectNodes("./INTERFACE_EXTRA_FIELD")) { |
|
104 |
|
|
105 |
for (final Entry<String, String> e : iface.getExtraFields().entrySet()) { |
|
120 | 106 |
final Element f = extraFields.addElement("field"); |
121 |
f.addAttribute("name", ((Node) o).valueOf("@name"));
|
|
122 |
f.setText(((Node) o).getText());
|
|
107 |
f.addAttribute("name", e.getKey());
|
|
108 |
f.setText(e.getValue());
|
|
123 | 109 |
} |
124 | 110 |
} |
125 | 111 |
|
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/java/eu/dnetlib/administration/uis/modules/workflows/WorkflowsUIUtils.java | ||
---|---|---|
14 | 14 |
import eu.dnetlib.administration.uis.modules.datasources.ProtocolParameter; |
15 | 15 |
import eu.dnetlib.administration.uis.modules.datasources.VocabularyEntry; |
16 | 16 |
import eu.dnetlib.clients.is.InformationServiceClient; |
17 |
import eu.dnetlib.exceptions.DnetGenericException; |
|
18 | 17 |
import eu.dnetlib.exceptions.InformationServiceException; |
19 | 18 |
|
20 | 19 |
@Component |
... | ... | |
25 | 24 |
@Autowired |
26 | 25 |
private InformationServiceClient isClient; |
27 | 26 |
|
28 |
public String getDatasourceProfile(final String dsId) throws DnetGenericException { |
|
29 |
try { |
|
30 |
return dsId.startsWith("entity/datasource") |
|
31 |
? isClient.getProfile(dsId) |
|
32 |
: isClient.findOne("collection('/db/DRIVER/entity/datasource')/*[.//DATASOURCE_ORIGINAL_ID='" + dsId + "']"); |
|
33 |
} catch (final InformationServiceException e) { |
|
34 |
log.error("Datasource profile not found: " + dsId, e); |
|
35 |
throw new DnetGenericException("Datasource profile not found: " + dsId, e); |
|
36 |
} |
|
37 |
} |
|
38 |
|
|
39 | 27 |
public List<VocabularyEntry> fetchVocabularyTerms(final String voc) throws InformationServiceException { |
40 | 28 |
final String xquery = "for $x in collection('/db/DRIVER/conf/vocabulary')[.//VOCABULARY_NAME/@code = '" |
41 | 29 |
+ voc.trim() + "']//TERM return concat($x/@code, ' @@@ ', $x/@english_name)"; |
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/resources/static/html/wf/repo-hi-workflow-modal.html | ||
---|---|---|
7 | 7 |
<h4 class="modal-title">Workflow creation and assignement</h4> |
8 | 8 |
</div> |
9 | 9 |
<div class="modal-body"> |
10 |
|
|
11 | 10 |
<form class="form-horizontal"> |
12 | 11 |
<div class="form-group"> |
13 | 12 |
<label class="col-sm-2 control-label">Workflow</label> |
... | ... | |
113 | 112 |
</div> |
114 | 113 |
</div> |
115 | 114 |
</div> |
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 | 115 |
</form> |
116 |
</div> |
|
121 | 117 |
|
122 |
|
|
123 |
|
|
124 |
</div> |
|
125 | 118 |
<div class="modal-footer"> |
126 | 119 |
<button type="button" class="btn btn-default" data-dismiss="modal" |
127 | 120 |
ng-disabled="!selectedRepoHiWf.id || !selectedMsroWorker.serviceId" |
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/resources/static/html/datasources/api.html | ||
---|---|---|
1 |
<div class="row small"> |
|
2 |
<div class="col-xs-12 col-lg-4"> |
|
3 |
<div class="panel panel-primary"> |
|
4 |
<div class="panel-heading">Description</div> |
|
5 |
<div class="panel-body"> |
|
6 |
<form class="form-horizontal"> |
|
7 |
<wf-form-row-static name="Datasource name" value="{{ds.officialName}}"></wf-form-row-static> |
|
8 |
<wf-form-row-static name="Datasource typology" value="{{ds.datasourceClass}}"></wf-form-row-static> |
|
9 |
<wf-form-row-static name="API typology" value="{{api.typology}}" ng-if="api.typology != ds.datasourceClass" style="color: #dd9900"></wf-form-row-static> |
|
10 |
<wf-form-row-static name="Institution" value="{{ds.organization}}" url="{{ds.websiteUrl}}"></wf-form-row-static> |
|
11 |
<wf-form-row-static name="Contact email" value="{{ds.contactEmail}}" url="mailto:{{ds.contactEmail}}"></wf-form-row-static> |
|
12 |
<wf-form-row-static name="Country" value="{{ds.countryCode}}" img="/img/flags/{{ds.countryCode}}.gif" ng-if="ds.countryCode"></wf-form-row-static> |
|
13 |
<wf-form-row-static name="Software typology" value="{{ds.typology}}"></wf-form-row-static> |
|
14 |
<hr /> |
|
15 |
<wf-form-row-static name="API id" value="{{currentIfaceId}}"></wf-form-row-static> |
|
16 |
<wf-form-row-static name="Datasource id" value="{{ds.id}}" ng-if="ds.id.indexOf('entity/datasource/') != 0"></wf-form-row-static> |
|
17 |
<wf-form-row-static name="Datasource Id" value="{{ds.id}}" ng-if="ds.id.indexOf('entity/datasource/') == 0" url="is#/profile/{{ds.id}}"></wf-form-row-static> |
|
18 |
<wf-form-row-static name="Datasource prefix" value="{{ds.namespacePrefix}}"></wf-form-row-static> |
|
19 |
<hr /> |
|
20 |
<div class="form-group" ng-class="{'has-warning': overrideCompliance}"> |
|
21 |
<label class="col-sm-3 control-label">Level of compliance</label> |
|
22 |
<div class="col-sm-9"> |
|
23 |
<select class="form-control" ng-model="overrideCompliance" ng-change="updateCompatibilityLevel(overrideCompliance)"> |
|
24 |
<option value="{{l.name}}" ng-repeat="l in compatibilityLevels">{{l.name}} (override)</option> |
|
25 |
<option disabled="disabled" style="border-top: 1px solid lightgrey; margin-top: 10px;" value="-"></option> |
|
26 |
<option value="">{{api.compliance}} (by validator)</option> |
|
27 |
</select> |
|
28 |
</div> |
|
29 |
</div> |
|
30 |
</form> |
|
31 |
</div> |
|
32 |
</div> |
|
33 |
</div> |
|
34 |
|
|
35 |
<div class="col-xs-12 col-lg-4"> |
|
36 |
<div class="panel panel-primary"> |
|
37 |
<div class="panel-heading">Access protocol</div> |
|
38 |
<div class="panel-body"> |
|
39 |
<form class="form-horizontal"> |
|
40 |
<wf-form-row-static name="Protocol" value="{{api.accessProtocol}}"></wf-form-row-static> |
|
41 |
<wf-form-row-static name="Base URL" value="{{api.baseUrl}}"></wf-form-row-static> |
|
42 |
<div class="form-group"> |
|
43 |
<label class="col-sm-3 control-label">Parameters</label> |
|
44 |
<div class="col-sm-9"> |
|
45 |
<p class="form-control-static"> |
|
46 |
<table class="table table-condensed table-striped"> |
|
47 |
<tr ng-repeat="(k,v) in api.accessParams"> |
|
48 |
<th class="col-xs-2">{{k}}</th> |
|
49 |
<td>{{v}}</td> |
|
50 |
</tr> |
|
51 |
</table> |
|
52 |
</p> |
|
53 |
</div> |
|
54 |
</div> |
|
55 |
<hr /> |
|
56 |
<div class="form-group"> |
|
57 |
<label class="col-sm-3 control-label">Extra fields</label> |
|
58 |
<div class="col-sm-9"> |
|
59 |
<p class="form-control-static"> |
|
60 |
<table class="table table-condensed table-striped"> |
|
61 |
<tr ng-repeat="(k,v) in api.extraFields" ng-if="k.indexOf('last_') != 0"> |
|
62 |
<th class="col-xs-2">{{k}}</th> |
|
63 |
<td>{{v}}</td> |
|
64 |
</tr> |
|
65 |
</table> |
|
66 |
</p> |
|
67 |
</div> |
|
68 |
</div> |
|
69 |
<hr ng-if="((api.extraFields['last_collection_date']) || (api.extraFields['last_aggregation_date']) || (api.extraFields['last_download_date']))" /> |
|
70 |
<wf-form-row-store-link name="Last collection" |
|
71 |
date="{{api.extraFields['last_collection_date']}}" |
|
72 |
total="{{api.extraFields['last_collection_total']}}" |
|
73 |
url="../inspector/mdstore.do?id={{api.extraFields['last_collection_mdId']}}" |
|
74 |
ng-if="api.extraFields['last_collection_date']"></wf-form-row-store-link> |
|
75 |
<wf-form-row-store-link name="Last aggregation" |
|
76 |
date="{{api.extraFields['last_aggregation_date']}}" |
|
77 |
total="{{api.extraFields['last_aggregation_total']}}" |
|
78 |
url="../inspector/mdstore.do?id={{api.extraFields['last_aggregation_mdId']}}" |
|
79 |
ng-if="api.extraFields['last_aggregation_date']"></wf-form-row-store-link> |
|
80 |
<wf-form-row-store-link name="Last download" |
|
81 |
date="{{api.extraFields['last_download_date']}}" |
|
82 |
total="{{api.extraFields['last_download_total']}}" |
|
83 |
url="objectstoreInspector.do#/inspect.do/{{api.extraFields['last_download_mdId']}}" |
|
84 |
ng-if="api.extraFields['last_download_date']"></wf-form-row-store-link> |
|
85 |
<div class="form-group"> |
|
86 |
<div class="col-sm-offset-3 col-sm-9"> |
|
87 |
<button type="button" class="btn btn-sm btn-primary" ng-click="editAccessParams()">configure</button> |
|
88 |
<a href="oaiExplorer?oaiBaseUrl={{api.baseUrl}}" class="btn btn-sm btn-default" ng-if="(api.accessProtocol == 'oai') || (api.accessProtocol == 'OAI')">test oai</a> |
|
89 |
</div> |
|
90 |
</div> |
|
91 |
</form> |
|
92 |
</div> |
|
93 |
</div> |
|
94 |
</div> |
|
95 |
|
|
96 |
</div> |
|
97 |
|
|
98 |
<hr /> |
|
99 |
|
|
100 |
<p ng-if="wfs.length == 0"> No workflows</p> |
|
101 |
|
|
102 |
<div ng-repeat="wf in wfs"> |
|
103 |
<a href="wfs#/wf/{{wf.wfId}}">{{wf.name}}</a> |
|
104 |
<button class="btn btn-sm btn-primary pull-right" ng-if="wf.destroy" ng-click="destroyRepoWorkflow(wf.wfId)">delete</button> |
|
105 |
<br /> |
|
106 |
<span class="small text-muted" ng-if="wf.desc">{{wf.desc}}<br /></span> |
|
107 |
<hr /> |
|
108 |
</div> |
|
109 |
|
|
110 |
<button type="button" class="btn btn-sm btn-primary" ng-click="prepareRepoHiModal()">add workflow</button> |
|
111 |
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="refresh()"> |
|
112 |
<span class="glyphicon glyphicon-refresh"></span> |
|
113 |
</button> |
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
<wf-process-modal proc-id="currentProcId" visible="showProcModal" worker="currentWorker"></wf-process-modal> |
|
118 |
<repo-access-params-modal ds-id="{{currentDsId}}" iface="{{currentIfaceId}}" protocol="{{api.accessProtocol}}" visible="showAccessParamsModal" reload="1"></repo-access-params-modal> |
|
119 |
<repo-hi-workflow-modal |
|
120 |
compliance="{{api.compliance}}" |
|
121 |
typology="{{api.typology}}" |
|
122 |
selected-repo-hi-wf="selectedRepoHiWf" |
|
123 |
selected-msro-worker="selectedMsroWorker" |
|
124 |
visible="showRepoHiModal" |
|
125 |
repo-hi-function="newRepoWorkflow()"> |
|
126 |
</repo-hi-workflow-modal> |
|
127 |
|
|
128 |
<pre>{{ds | json}}</pre> |
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/resources/static/js/wfs/repo-hi-workflow-modal.js | ||
---|---|---|
12 | 12 |
'selectedRepoHiWf' : '=', |
13 | 13 |
'selectedMsroWorker' : '=', |
14 | 14 |
'repoHiFunction' : '&' |
15 |
|
|
16 |
|
|
17 | 15 |
}, |
18 | 16 |
templateUrl: '/html/wf/repo-hi-workflow-modal.html', |
19 | 17 |
|
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/resources/static/js/wfs/wfs.js | ||
---|---|---|
26 | 26 |
}).when('/ds/:repoId*/api/:ifaceId*', { |
27 | 27 |
controller: 'repoApiCtrl', |
28 | 28 |
templateUrl: function (params) { |
29 |
return '/page/datasource_api?dsId=' + params.repoId + "&ifaceId=" + params.ifaceId + '&dt=' + new Date().getTime();
|
|
29 |
return '/html/datasources/api.html';
|
|
30 | 30 |
} |
31 | 31 |
}) |
32 | 32 |
.otherwise({redirectTo: '/'}); |
... | ... | |
307 | 307 |
$scope.selectedRepoHiWf = {}; |
308 | 308 |
$scope.selectedMsroWorker = {}; |
309 | 309 |
|
310 |
$scope.currentDsId = $routeParams.repoId; |
|
311 |
$scope.currentIfaceId = $routeParams.ifaceId; |
|
312 |
|
|
313 |
$scope.ds = {}; |
|
314 |
$scope.api = {}; |
|
315 |
$scope.wfs = []; |
|
316 |
$scope.overrideCompliance = ''; |
|
317 |
$scope.compatibilityLevels = getCompatibilityLevels(); |
|
318 |
|
|
310 | 319 |
$scope.refresh = function () { |
311 |
$route.reload(); |
|
320 |
showSpinner(); |
|
321 |
$http.get('/ajax/apis/ds?id=' + $scope.currentDsId).success(function (data) { |
|
322 |
hideSpinner(); |
|
323 |
$scope.ds = data; |
|
324 |
for(var i=0; i<data.interfaces.length; i++) { |
|
325 |
if (data.interfaces[i].id == $scope.currentIfaceId) { |
|
326 |
$scope.api = data.interfaces[i]; |
|
327 |
if ($scope.api.extraFields['overriding_compliance']) { |
|
328 |
$scope.overrideCompliance = $scope.api.extraFields['overriding_compliance']; |
|
329 |
} |
|
330 |
} |
|
331 |
} |
|
332 |
}).error(function (err) { |
|
333 |
hideSpinner(); |
|
334 |
show_notification('error', 'Error getting datasource'); |
|
335 |
}); |
|
336 |
|
|
337 |
$http.get('/ajax/wfs/forApi?dsId=' + $scope.currentDsId + "&ifaceId=" + $scope.currentIfaceId).success(function (data) { |
|
338 |
hideSpinner(); |
|
339 |
$scope.wfs = data; |
|
340 |
}).error(function (err) { |
|
341 |
hideSpinner(); |
|
342 |
show_notification('error', 'Error getting wfs'); |
|
343 |
}); |
|
312 | 344 |
}; |
313 |
|
|
345 |
|
|
314 | 346 |
$scope.editAccessParams = function () { |
315 | 347 |
$scope.showAccessParamsModal = true; |
316 | 348 |
}; |
... | ... | |
319 | 351 |
$scope.showRepoHiModal = true; |
320 | 352 |
}; |
321 | 353 |
|
322 |
$scope.updateCompatibilityLevel = function(dsId, ifaceId, level) {
|
|
354 |
$scope.updateCompatibilityLevel = function(level) { |
|
323 | 355 |
var url = ''; |
324 |
if (level) { url = '/ajax/wfs/ds/compliance/override/' + level + '?dsId=' + dsId + '&ifaceId=' + ifaceId }
|
|
325 |
else { url = '/ajax/wfs/ds/compliance/reset?dsId=' + dsId + '&ifaceId=' + ifaceId }
|
|
356 |
if (level) { url = '/ajax/wfs/ds/compliance/override/' + level + '?dsId=' + $scope.currentDsId + '&ifaceId=' + $scope.currentIfaceId }
|
|
357 |
else { url = '/ajax/wfs/ds/compliance/reset?dsId=' + $scope.currentDsId + '&ifaceId=' + $scope.currentIfaceId }
|
|
326 | 358 |
|
327 | 359 |
showSpinner(); |
328 | 360 |
$http.get(url).success(function (data) { |
... | ... | |
335 | 367 |
}); |
336 | 368 |
}; |
337 | 369 |
|
338 |
|
|
339 |
|
|
340 |
$scope.newRepoWorkflow = function (repoId, ifaceId) { |
|
370 |
$scope.newRepoWorkflow = function() { |
|
341 | 371 |
showSpinner(); |
342 | 372 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
343 | 373 |
$http.post('/ajax/apis/repohi/start', $.param({ |
344 |
'dsId' : repoId,
|
|
345 |
'iface' : ifaceId,
|
|
374 |
'dsId' : $scope.currentDsId,
|
|
375 |
'iface' : $scope.currentIfaceId,
|
|
346 | 376 |
'wfId' : $scope.selectedRepoHiWf.id, |
347 | 377 |
'workerId' : $scope.selectedMsroWorker.serviceId |
348 | 378 |
})).success(function (data) { |
... | ... | |
366 | 396 |
show_notification('error', 'Error starting REPO_BYE workflow:' + err.message); |
367 | 397 |
}); |
368 | 398 |
}; |
399 |
|
|
400 |
$scope.refresh(); |
|
369 | 401 |
}); |
370 | 402 |
|
modules/dnet-springboot-apps/trunk/dnet-administration-uis/src/main/resources/templates/wfs/header.ftl | ||
---|---|---|
10 | 10 |
<script type="text/javascript" src="/js/datasources/dnet_param_values_functions.js"></script> |
11 | 11 |
|
12 | 12 |
<link rel="stylesheet" type="text/css" media="screen" href="/css/dnet_workflows.css"> |
13 |
|
|
14 |
<script type="text/javascript"> |
|
15 |
function getCompatibilityLevels() { return ${compatibilityLevels}; } |
|
16 |
</script> |
modules/dnet-springboot-apps/trunk/dnet-common-utils/src/main/java/eu/dnetlib/clients/dsManager/DsManagerClient.java | ||
---|---|---|
72 | 72 |
ImmutableMap.of("dsId", dsId, "ifaceId", ifaceId, "level", level, "override", override)); |
73 | 73 |
} |
74 | 74 |
|
75 |
public void resetLevelOfCompliance(final String dsId, final String ifaceId) { |
|
76 |
(new RestTemplate()).getForObject(props.getDatasourceManagerUrl() + "/api/compliance?dsId={dsId}&ifaceId={ifaceId}&override=true", |
|
77 |
Object.class, |
|
78 |
ImmutableMap.of("dsId", dsId, "ifaceId", ifaceId)); |
|
79 |
} |
|
80 |
|
|
75 | 81 |
public void updateBaseUrl(final String dsId, final String ifaceId, final String baseUrl) { |
76 | 82 |
(new RestTemplate()).getForObject( |
77 | 83 |
props.getDatasourceManagerUrl() + "/api/baseUrl?dsId={dsId}&ifaceId={ifaceId}&baseUrl={baseUrl}", |
Also available in: Unified diff