Revision 42211
Added by Michele Artini over 8 years ago
modules/dnet-modular-repositories-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/RepoApisEntryPointController.java | ||
---|---|---|
38 | 38 |
|
39 | 39 |
private String compatibilityLevelsVocabulary; |
40 | 40 |
|
41 |
private String validatorAddress; |
|
42 |
|
|
41 | 43 |
public class RepoHIWorkflow implements Comparable<RepoHIWorkflow> { |
42 | 44 |
|
43 | 45 |
private String id; |
... | ... | |
48 | 50 |
|
49 | 51 |
/** |
50 | 52 |
* Instantiates a new repo hi workflow. |
51 |
*
|
|
53 |
* |
|
52 | 54 |
* @param id |
53 | 55 |
* the id |
54 | 56 |
* @param name |
... | ... | |
121 | 123 |
final Set<String> compliances = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(compliance)); |
122 | 124 |
|
123 | 125 |
final List<Pair<String, String>> fields = new ArrayList<Pair<String, String>>(); |
124 |
for (Object o : doc.selectNodes(".//FIELD")) { |
|
126 |
for (final Object o : doc.selectNodes(".//FIELD")) {
|
|
125 | 127 |
final Node currentNode = (Node) o; |
126 | 128 |
final String key = currentNode.valueOf("@name"); |
127 | 129 |
final String value = currentNode.getText(); |
128 | 130 |
fields.add(new Pair<String, String>(key, value)); |
129 | 131 |
} |
130 | 132 |
return new RepoHIWorkflow(id, name, ifcTypes, compliances, fields); |
131 |
} catch (Exception e) { |
|
133 |
} catch (final Exception e) {
|
|
132 | 134 |
return null; |
133 | 135 |
} |
134 | 136 |
} |
135 | 137 |
|
136 | 138 |
private List<RepoHIWorkflow> listRepoHIWorkflows() throws ISLookUpException { |
137 | 139 |
|
138 |
final String xquery = "for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType') where $x//WORKFLOW_TYPE='REPO_HI' return <result> <id>{$x//RESOURCE_IDENTIFIER/@value/string()}</id> <name>{$x//WORKFLOW_NAME/text()}</name> <types>{$x//PARAM[@name='expectedInterfaceTypologyPrefixes']/text()}</types> <compliances>{$x//PARAM[@name='expectedCompliancePrefixes']/text()}</compliances> {$x//FIELD} </result>"; |
|
140 |
final String xquery = |
|
141 |
"for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType') where $x//WORKFLOW_TYPE='REPO_HI' return <result> <id>{$x//RESOURCE_IDENTIFIER/@value/string()}</id> <name>{$x//WORKFLOW_NAME/text()}</name> <types>{$x//PARAM[@name='expectedInterfaceTypologyPrefixes']/text()}</types> <compliances>{$x//PARAM[@name='expectedCompliancePrefixes']/text()}</compliances> {$x//FIELD} </result>"; |
|
139 | 142 |
final List<RepoHIWorkflow> list = Lists.newArrayList(); |
140 |
for (String s : serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery)) { |
|
141 |
RepoHIWorkflow repoHiInfo = parseQuery(s); |
|
143 |
for (final String s : serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery)) {
|
|
144 |
final RepoHIWorkflow repoHiInfo = parseQuery(s);
|
|
142 | 145 |
if (repoHiInfo != null) { |
143 | 146 |
list.add(repoHiInfo); |
144 | 147 |
} |
... | ... | |
153 | 156 |
map.addAttribute("availableRepohiWfs", gson.toJson(listRepoHIWorkflows())); |
154 | 157 |
map.addAttribute("compatibilityLevels", gson.toJson(repoUIUtils.fetchVocabularyTerms(getCompatibilityLevelsVocabulary()))); |
155 | 158 |
map.addAttribute("browseFields", gson.toJson(serviceLocator.getService(DatasourceManagerService.class).listBrowsableFields())); |
159 |
map.addAttribute("validatorAddress", getValidatorAddress()); |
|
156 | 160 |
} |
157 | 161 |
|
158 | 162 |
public String getCompatibilityLevelsVocabulary() { |
... | ... | |
164 | 168 |
this.compatibilityLevelsVocabulary = compatibilityLevelsVocabulary; |
165 | 169 |
} |
166 | 170 |
|
171 |
public String getValidatorAddress() { |
|
172 |
return validatorAddress; |
|
173 |
} |
|
174 |
|
|
175 |
@Required |
|
176 |
public void setValidatorAddress(final String validatorAddress) { |
|
177 |
this.validatorAddress = validatorAddress; |
|
178 |
} |
|
179 |
|
|
167 | 180 |
} |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/repositories/webContext-modular-ui-repositories.xml | ||
---|---|---|
10 | 10 |
p:description="DataSource API configuration page" p:group="DataSource Management" |
11 | 11 |
p:order="5" |
12 | 12 |
p:groupOrder="10" |
13 |
p:compatibilityLevelsVocabulary="${repo.ui.compatibilityLevels.vocabulary}"> |
|
13 |
p:compatibilityLevelsVocabulary="${repo.ui.compatibilityLevels.vocabulary}" |
|
14 |
p:validatorAddress="${repo.ui.validator.address}"> |
|
14 | 15 |
<property name="permissionLevels"> |
15 | 16 |
<set> |
16 | 17 |
<value>DS_ADMIN</value> |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/repositories/applicationContext-modular-ui-repositories.properties | ||
---|---|---|
6 | 6 |
repo.ui.validation.show = false |
7 | 7 |
repo.ui.addApi.show = true |
8 | 8 |
repo.ui.addRepo.show = true |
9 |
repo.ui.validator.address = http://dev.openaire.research-infrastructures.eu:8880 |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/repoApis.st | ||
---|---|---|
11 | 11 |
function getAvailableRepohiWfs() { return $availableRepohiWfs$ } |
12 | 12 |
function getCompatibilityLevels() { return $compatibilityLevels$ } |
13 | 13 |
function getBrowseFields() { return $browseFields$ } |
14 |
function getValidatorAddress() { return '$validatorAddress$' } |
|
14 | 15 |
</script> |
15 | 16 |
|
16 | 17 |
<style> |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/repos/repoApi.st | ||
---|---|---|
8 | 8 |
</div> |
9 | 9 |
</div> |
10 | 10 |
|
11 |
|
|
11 | 12 |
<div class="well" style="margin-top: 20px; margin-bottom: 20px"> |
12 | 13 |
<div class="row"> |
13 | 14 |
<div class="input-group input-group-sm col-xs-12" style="padding: 10px; float: left;"> |
... | ... | |
24 | 25 |
</span> |
25 | 26 |
</div> |
26 | 27 |
|
28 |
<div class="input-group input-group-sm col-xs-12" style="padding: 10px; float: left;" ng-show="validatorDetailsAddress || validatorBlacklistAddress"> |
|
29 |
<span class="input-group-addon" style="width: 150px;"><b>Validation</b></span> |
|
30 |
<span class="form-control" ng-show="validatorDetailsAddress"><a href="{{validatorDetailsAddress}}">show last validation details</a></span> |
|
31 |
<span class="form-control" ng-show="validatorBlacklistAddress"><a href="{{validatorBlacklistAddress}}">show blacklist</a></span> |
|
32 |
</div> |
|
33 |
|
|
27 | 34 |
<div class="input-group input-group-sm col-xs-12 col-md-6" style="padding: 10px; float: left;"> |
28 | 35 |
<span class="input-group-addon" style="width: 150px;"><b>API details</b></span> |
29 | 36 |
<span class="form-control" ng-repeat="p in currentRepoApi.commonParams" ng-hide="p.name == 'compliance'" style="white-space: nowrap;"><b>{{p.name}}:</b> {{p.value}}</span> |
... | ... | |
68 | 75 |
<ng-api-mdstore-info label="Collect" date="currentRepoApi.collDate" total="currentRepoApi.collTotal" id="currentRepoApi.collMdId"></ng-api-mdstore-info> |
69 | 76 |
<ng-api-mdstore-info label="Transform" date="currentRepoApi.aggrDate" total="currentRepoApi.aggrTotal" id="currentRepoApi.aggrMdId"></ng-api-mdstore-info> |
70 | 77 |
<ng-api-objectstore-info label="Download" date="currentRepoApi.downloadDate" total="currentRepoApi.downloadTotal" id="currentRepoApi.downloadObjId"></ng-api-objectstore-info> |
71 |
</div> |
|
78 |
</div>
|
|
72 | 79 |
|
73 | 80 |
</div> |
74 | 81 |
</div> |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/repoControllers.js | ||
---|---|---|
133 | 133 |
|
134 | 134 |
$scope.availableRepohiWfs = getAvailableRepohiWfs(); |
135 | 135 |
$scope.compatibilityLevels = getCompatibilityLevels(); |
136 |
|
|
137 |
$scope.validatorBlacklistAddress = ''; |
|
138 |
$scope.validatorBlacklistAddress = ''; |
|
136 | 139 |
|
137 | 140 |
$scope.currentRepoApi = {}; |
138 | 141 |
$scope.currentSets = []; |
... | ... | |
146 | 149 |
function(data) { |
147 | 150 |
$scope.currentRepoApi = data; |
148 | 151 |
$scope.metaworkflows = data.metaWFs; |
152 |
|
|
153 |
if (getValidatorAddress()) { |
|
154 |
angular.forEach(data.otherParams, function(term){ |
|
155 |
if (term.id == 'last_validation_job') { |
|
156 |
$scope.validatorDetailsAddress = getValidatorAddress() + "/validator/prepareSummary.action?jobId=" + term.value; |
|
157 |
$scope.validatorBlacklistAddress = getValidatorAddress() + "/validator-service/workflows?request=GetBlacklistedRecords&datasourceId=" + $routeParams.repoId; |
|
158 |
} |
|
159 |
}); |
|
160 |
} |
|
161 |
|
|
149 | 162 |
if (data.protocol == 'oai') { |
150 | 163 |
var found = false; |
151 | 164 |
angular.forEach(data.accessParams, function(param, pos){ |
Also available in: Unified diff
last validation links