Revision 50485
Added by Michele Artini about 6 years ago
modules/dnet-modular-repositories-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/RepoApisEntryPointController.java | ||
---|---|---|
13 | 13 |
import org.dom4j.Document; |
14 | 14 |
import org.dom4j.Node; |
15 | 15 |
import org.dom4j.io.SAXReader; |
16 |
import org.springframework.beans.factory.annotation.Autowired; |
|
16 | 17 |
import org.springframework.beans.factory.annotation.Required; |
17 | 18 |
import org.springframework.ui.ModelMap; |
18 | 19 |
|
... | ... | |
21 | 22 |
import com.google.common.collect.Sets; |
22 | 23 |
import com.google.gson.Gson; |
23 | 24 |
|
24 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerService; |
|
25 |
import eu.dnetlib.enabling.datasources.common.Api; |
|
26 |
import eu.dnetlib.enabling.datasources.common.Datasource; |
|
27 |
import eu.dnetlib.enabling.datasources.common.LocalDatasourceManager; |
|
25 | 28 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
26 | 29 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
27 | 30 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
... | ... | |
41 | 44 |
private String validatorAddress; |
42 | 45 |
private String validatorServiceAddress; |
43 | 46 |
|
47 |
@Autowired |
|
48 |
private LocalDatasourceManager<Datasource<?, ?>, Api<?>> dsManager; |
|
49 |
|
|
44 | 50 |
public class RepoHIWorkflow implements Comparable<RepoHIWorkflow> { |
45 | 51 |
|
46 |
private String id; |
|
47 |
private String name; |
|
48 |
private Set<String> ifaceTypes; |
|
49 |
private Set<String> compliances; |
|
52 |
private final String id;
|
|
53 |
private final String name;
|
|
54 |
private final Set<String> ifaceTypes;
|
|
55 |
private final Set<String> compliances;
|
|
50 | 56 |
private List<Pair<String, String>> fields; |
51 | 57 |
|
52 | 58 |
/** |
... | ... | |
123 | 129 |
final Set<String> ifcTypes = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(type)); |
124 | 130 |
final Set<String> compliances = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(compliance)); |
125 | 131 |
|
126 |
final List<Pair<String, String>> fields = new ArrayList<Pair<String, String>>();
|
|
132 |
final List<Pair<String, String>> fields = new ArrayList<>(); |
|
127 | 133 |
for (final Object o : doc.selectNodes(".//FIELD")) { |
128 | 134 |
final Node currentNode = (Node) o; |
129 | 135 |
final String key = currentNode.valueOf("@name"); |
130 | 136 |
final String value = currentNode.getText(); |
131 |
fields.add(new Pair<String, String>(key, value));
|
|
137 |
fields.add(new Pair<>(key, value)); |
|
132 | 138 |
} |
133 | 139 |
return new RepoHIWorkflow(id, name, ifcTypes, compliances, fields); |
134 | 140 |
} catch (final Exception e) { |
... | ... | |
156 | 162 |
final Gson gson = new Gson(); |
157 | 163 |
map.addAttribute("availableRepohiWfs", gson.toJson(listRepoHIWorkflows())); |
158 | 164 |
map.addAttribute("compatibilityLevels", gson.toJson(repoUIUtils.fetchVocabularyTerms(getCompatibilityLevelsVocabulary()))); |
159 |
map.addAttribute("browseFields", gson.toJson(serviceLocator.getService(DatasourceManagerService.class).listBrowsableFields()));
|
|
165 |
map.addAttribute("browseFields", gson.toJson(dsManager.listBrowsableFields()));
|
|
160 | 166 |
map.addAttribute("validatorAddress", getValidatorAddress()); |
161 | 167 |
map.addAttribute("validatorServiceAddress", getValidatorServiceAddress()); |
162 | 168 |
} |
modules/dnet-modular-repositories-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/RepoUIUtils.java | ||
---|---|---|
26 | 26 |
import eu.dnetlib.data.collector.rmi.CollectorService; |
27 | 27 |
import eu.dnetlib.data.collector.rmi.ProtocolDescriptor; |
28 | 28 |
import eu.dnetlib.data.collector.rmi.ProtocolParameter; |
29 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceConstants; |
|
30 | 29 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; |
31 | 30 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
32 | 31 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
... | ... | |
41 | 40 |
@Resource |
42 | 41 |
private UniqueServiceLocator serviceLocator; |
43 | 42 |
|
44 |
private ClassPathResource getRepoApiQueryTmpl = new ClassPathResource("/eu/dnetlib/functionality/modular/ui/repositories/templates/getRepoApi.xquery.st"); |
|
43 |
private final ClassPathResource getRepoApiQueryTmpl = |
|
44 |
new ClassPathResource("/eu/dnetlib/functionality/modular/ui/repositories/templates/getRepoApi.xquery.st"); |
|
45 | 45 |
|
46 | 46 |
private static final Log log = LogFactory.getLog(RepoUIUtils.class); |
47 | 47 |
|
48 |
private Map<String, List<ProtocolParameter>> parametersMap = Maps.newHashMap(); |
|
48 |
private final Map<String, List<ProtocolParameter>> parametersMap = Maps.newHashMap();
|
|
49 | 49 |
|
50 | 50 |
public RepoInterfaceEntry getApi(final String repoId, final String ifaceId) throws Exception { |
51 | 51 |
final RepoInterfaceEntry ifc = new RepoInterfaceEntry(); |
... | ... | |
64 | 64 |
|
65 | 65 |
ifc.setId(doc.valueOf("/api/id")); |
66 | 66 |
ifc.setLabel(doc.valueOf("/api/label")); |
67 |
ifc.setRemovable((doc.valueOf("/api/removable").equalsIgnoreCase("true")) && doc.selectNodes("//metaWF").isEmpty());
|
|
67 |
ifc.setRemovable(doc.valueOf("/api/removable").equalsIgnoreCase("true") && doc.selectNodes("//metaWF").isEmpty());
|
|
68 | 68 |
ifc.setRepoId(doc.valueOf("/api/repo/@id")); |
69 | 69 |
ifc.setRepoName(StringEscapeUtils.unescapeHtml(doc.valueOf("/api/repo"))); |
70 | 70 |
ifc.setRepoCountry(doc.valueOf("/api/repo/@country")); |
... | ... | |
100 | 100 |
final Node n = (Node) o; |
101 | 101 |
final String name = n.valueOf("@name"); |
102 | 102 |
final String value = n.getText(); |
103 |
if (name.equalsIgnoreCase(DatasourceConstants.OVERRIDING_COMPLIANCE_FIELD)) {
|
|
103 |
if (name.equalsIgnoreCase("overriding_compliance")) {
|
|
104 | 104 |
for (final SimpleParamEntry e : ifc.getCommonParams()) { |
105 | 105 |
if (e.getName().equals("compliance")) { |
106 | 106 |
// The original compliance (assigned by the validator) is stored in otherValue |
107 |
e.setOtherValue(e.getValue()); |
|
108 |
e.setValue(value); |
|
107 |
e.setOtherValue(value); |
|
109 | 108 |
} |
110 | 109 |
} |
111 | 110 |
} else if (name.equalsIgnoreCase("last_aggregation_date")) { |
modules/dnet-modular-repositories-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/RepoInternalController.java | ||
---|---|---|
9 | 9 |
import javax.servlet.http.HttpServletRequest; |
10 | 10 |
import javax.servlet.http.HttpServletResponse; |
11 | 11 |
|
12 |
import com.google.common.cache.Cache; |
|
13 | 12 |
import org.apache.commons.io.IOUtils; |
14 | 13 |
import org.apache.commons.lang.StringUtils; |
15 | 14 |
import org.apache.commons.lang.exception.ExceptionUtils; |
16 | 15 |
import org.apache.commons.logging.Log; |
17 | 16 |
import org.apache.commons.logging.LogFactory; |
17 |
import org.springframework.beans.factory.annotation.Autowired; |
|
18 | 18 |
import org.springframework.cache.annotation.CacheEvict; |
19 | 19 |
import org.springframework.cache.annotation.Cacheable; |
20 | 20 |
import org.springframework.http.HttpStatus; |
... | ... | |
28 | 28 |
|
29 | 29 |
import com.google.common.collect.Maps; |
30 | 30 |
import com.google.gson.Gson; |
31 |
import com.google.gson.reflect.TypeToken; |
|
31 | 32 |
|
32 | 33 |
import eu.dnetlib.data.collector.rmi.CollectorService; |
33 | 34 |
import eu.dnetlib.data.collector.rmi.CollectorServiceException; |
34 | 35 |
import eu.dnetlib.data.collector.rmi.ProtocolParameterValue; |
35 |
import eu.dnetlib.enabling.datasources.rmi.BrowseTerm; |
|
36 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceDesc; |
|
37 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerService; |
|
38 |
import eu.dnetlib.enabling.datasources.rmi.DatasourceManagerServiceException; |
|
39 |
import eu.dnetlib.enabling.datasources.rmi.IfaceDesc; |
|
40 |
import eu.dnetlib.enabling.datasources.rmi.RepositoryMapEntry; |
|
41 |
import eu.dnetlib.enabling.datasources.rmi.SearchInterfacesEntry; |
|
42 |
import eu.dnetlib.enabling.datasources.rmi.SimpleDatasourceDesc; |
|
36 |
import eu.dnetlib.enabling.datasources.common.Api; |
|
37 |
import eu.dnetlib.enabling.datasources.common.ApiParam; |
|
38 |
import eu.dnetlib.enabling.datasources.common.ApiParamImpl; |
|
39 |
import eu.dnetlib.enabling.datasources.common.BrowseTerm; |
|
40 |
import eu.dnetlib.enabling.datasources.common.Datasource; |
|
41 |
import eu.dnetlib.enabling.datasources.common.DsmException; |
|
42 |
import eu.dnetlib.enabling.datasources.common.Identity; |
|
43 |
import eu.dnetlib.enabling.datasources.common.LocalDatasourceManager; |
|
44 |
import eu.dnetlib.enabling.datasources.common.Organization; |
|
45 |
import eu.dnetlib.enabling.datasources.common.SearchApisEntry; |
|
46 |
import eu.dnetlib.enabling.datasources.common.SimpleDatasource; |
|
43 | 47 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException; |
44 | 48 |
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; |
45 | 49 |
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService; |
... | ... | |
54 | 58 |
@Controller |
55 | 59 |
public class RepoInternalController { |
56 | 60 |
|
61 |
@Autowired |
|
62 |
private LocalDatasourceManager<Datasource<?, ?>, Api<?>> dsManager; |
|
63 |
|
|
57 | 64 |
@Resource |
58 | 65 |
private UniqueServiceLocator serviceLocator; |
59 | 66 |
|
... | ... | |
69 | 76 |
private static final Log log = LogFactory.getLog(RepoInternalController.class); |
70 | 77 |
|
71 | 78 |
@RequestMapping(value = "/ui/browseRepoField.do") |
72 |
public @ResponseBody List<BrowseTerm> browseRepoField(@RequestParam(value = "field", required = true) final String field) throws Exception { |
|
73 |
return serviceLocator.getService(DatasourceManagerService.class).browseField(field);
|
|
79 |
public @ResponseBody List<? extends BrowseTerm> browseRepoField(@RequestParam(value = "field", required = true) final String field) throws Exception {
|
|
80 |
return dsManager.browseField(field);
|
|
74 | 81 |
} |
75 | 82 |
|
76 | 83 |
@Cacheable(cacheNames = "repoUIJsonCache", key = "#param, #value", condition = "#refresh == false") |
77 | 84 |
@RequestMapping(value = "/ui/listApis.do") |
78 |
public @ResponseBody List<SearchInterfacesEntry> listApis(
|
|
85 |
public @ResponseBody List<? extends SearchApisEntry> listApis(
|
|
79 | 86 |
@RequestParam(value = "param", required = true) final String param, |
80 | 87 |
@RequestParam(value = "value", required = true) final String value, |
81 | 88 |
@RequestParam(value = "refresh", required = false) final String refresh) throws Exception { |
82 | 89 |
|
83 |
return serviceLocator.getService(DatasourceManagerService.class).searchInterface(param, value);
|
|
90 |
return dsManager.searchApis(param, value);
|
|
84 | 91 |
} |
85 | 92 |
|
86 |
@RequestMapping(value = "/ui/listRepositories.map") |
|
87 |
public @ResponseBody List<RepositoryMapEntry> listRepositories_asMap() throws Exception { |
|
88 |
return serviceLocator.getService(DatasourceManagerService.class).getRepositoryMap(); |
|
89 |
} |
|
90 |
|
|
91 | 93 |
@RequestMapping(value = "/ui/listRepositories.json") |
92 |
public @ResponseBody List<SimpleDatasourceDesc> listRepositories(@RequestParam(value = "type", required = true) final String type) throws Exception {
|
|
93 |
return serviceLocator.getService(DatasourceManagerService.class).simpleListDatasourcesByType(type);
|
|
94 |
public @ResponseBody List<SimpleDatasource> listRepositories(@RequestParam(value = "type", required = true) final String type) throws Exception { |
|
95 |
return dsManager.searchDatasourcesByType(type);
|
|
94 | 96 |
} |
95 | 97 |
|
96 | 98 |
@CacheEvict("repoUIJsonCache") |
... | ... | |
99 | 101 |
@RequestParam(value = "b", required = true) final boolean b) throws Exception { |
100 | 102 |
|
101 | 103 |
final String query = "count(/*[.//RESOURCE_TYPE/@value='MetaWorkflowDSResourceType' and .//DATAPROVIDER/@id='" + id + "'])"; |
102 |
if (!b && (Integer.parseInt(serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(query)) > 0)) { throw new Exception("Repo " + id
|
|
104 |
if (!b && Integer.parseInt(serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(query)) > 0) { throw new Exception("Repo " + id
|
|
103 | 105 |
+ " can be invalidated: it is related to some metawfs"); } |
104 | 106 |
|
105 | 107 |
final String newId = b ? serviceLocator.getService(ISRegistryService.class).validateProfile(id) |
... | ... | |
150 | 152 |
return repoUIUtils.getApi(repoId, ifaceId); |
151 | 153 |
} |
152 | 154 |
|
153 |
@SuppressWarnings("unchecked") |
|
154 | 155 |
@RequestMapping("/ui/repoApi.update") |
155 | 156 |
public @ResponseBody boolean updateRepoApi( |
156 | 157 |
@RequestParam(value = "id", required = true) final String repoId, |
... | ... | |
158 | 159 |
@RequestParam(value = "accessParams", required = false) final String accessParamsJson, |
159 | 160 |
@RequestParam(value = "mdIdPath", required = false) final String mdIdPath) throws Exception { |
160 | 161 |
|
161 |
final DatasourceManagerService dsManager = serviceLocator.getService(DatasourceManagerService.class); |
|
162 |
|
|
163 | 162 |
if (!StringUtils.isEmpty(accessParamsJson)) { |
164 |
dsManager.bulkUpdateApiAccessParams(repoId, ifaceId, new Gson().fromJson(accessParamsJson, Map.class)); |
|
163 |
final Map<String, String> params = new Gson().fromJson(accessParamsJson, new TypeToken<Map<String, String>>() {}.getType()); |
|
164 |
final String baseUrl = params.remove("baseUrl"); |
|
165 |
dsManager.updateApiDetails(repoId, ifaceId, mdIdPath, baseUrl, params); |
|
165 | 166 |
} |
166 |
if (mdIdPath != null) { |
|
167 |
dsManager.updateExtraField(repoId, ifaceId, "metadata_identifier_path", mdIdPath, true); |
|
168 |
} |
|
169 | 167 |
|
170 | 168 |
return true; |
171 | 169 |
} |
... | ... | |
174 | 172 |
public @ResponseBody boolean updateRepoApi( |
175 | 173 |
@RequestParam(value = "repo", required = true) final String repoId, |
176 | 174 |
@RequestParam(value = "iface", required = true) final String ifaceId) throws Exception { |
177 |
return serviceLocator.getService(DatasourceManagerService.class).deleteInterface(repoId, ifaceId); |
|
175 |
dsManager.deleteApi(repoId, ifaceId); |
|
176 |
return true; |
|
178 | 177 |
} |
179 | 178 |
|
180 | 179 |
@CacheEvict("repoUIJsonCache") |
... | ... | |
185 | 184 |
|
186 | 185 |
log.debug("SET COMPLIANCE TO " + compliance); |
187 | 186 |
|
188 |
serviceLocator.getService(DatasourceManagerService.class).overrideCompliance(repoId, ifaceId, compliance);
|
|
187 |
dsManager.updateCompliance(repoId, ifaceId, compliance, true);
|
|
189 | 188 |
|
190 | 189 |
return true; |
191 | 190 |
} |
... | ... | |
197 | 196 |
|
198 | 197 |
log.debug("RESET COMPLIANCE"); |
199 | 198 |
|
200 |
serviceLocator.getService(DatasourceManagerService.class).overrideCompliance(repoId, ifaceId, null);
|
|
199 |
dsManager.updateCompliance(repoId, ifaceId, null, true);
|
|
201 | 200 |
|
202 | 201 |
return true; |
203 | 202 |
} |
... | ... | |
207 | 206 |
|
208 | 207 |
@RequestMapping("/ui/repoApi.new") |
209 | 208 |
public @ResponseBody boolean addRepoApi(@RequestParam(value = "repoId", required = true) final String repoId, |
210 |
@RequestParam(value = "iface", required = true) final String ifaceJson) throws DatasourceManagerServiceException {
|
|
211 |
final IfaceDesc iface = new Gson().fromJson(ifaceJson, IfaceDesc.class);
|
|
209 |
@RequestParam(value = "iface", required = true) final String ifaceJson) throws DsmException {
|
|
210 |
final Api<ApiParam> iface = new Gson().fromJson(ifaceJson, new TypeToken<Api<ApiParamImpl>>() {}.getType());
|
|
212 | 211 |
|
213 |
log.info("Adding interface " + iface.getId() + " to repository " + repoId);
|
|
212 |
iface.setDatasource(repoId);
|
|
214 | 213 |
|
215 |
final DatasourceManagerService dsManager = serviceLocator.getService(DatasourceManagerService.class); |
|
216 |
return dsManager.addInterface(repoId, iface); |
|
214 |
log.info("Adding api " + iface.getId() + " to repository " + repoId); |
|
215 |
|
|
216 |
dsManager.addApi(iface); |
|
217 |
|
|
218 |
return true; |
|
217 | 219 |
} |
218 | 220 |
|
219 | 221 |
@RequestMapping("/ui/repo.new") |
220 |
public @ResponseBody boolean addRepoApi(@RequestParam(value = "repo", required = true) final String repoJson) throws DatasourceManagerServiceException { |
|
221 |
final DatasourceDesc ds = new Gson().fromJson(repoJson, DatasourceDesc.class); |
|
222 |
ds.setDateOfCollection(new Date()); |
|
222 |
public @ResponseBody boolean addRepoApi(@RequestParam(value = "repo", required = true) final String repoJson) throws DsmException { |
|
223 |
final Datasource<Organization<?>, Identity> ds = new Gson().fromJson(repoJson, new TypeToken<Datasource<Organization<?>, Identity>>() {}.getType()); |
|
224 |
final Date now = new Date(); |
|
225 |
ds.setDateofcollection(new java.sql.Date(now.getTime())); |
|
223 | 226 |
|
224 |
if (StringUtils.isBlank(ds.getEnglishName())) {
|
|
225 |
ds.setEnglishName(ds.getOfficialName());
|
|
227 |
if (StringUtils.isBlank(ds.getEnglishname())) {
|
|
228 |
ds.setEnglishname(ds.getOfficialname());
|
|
226 | 229 |
} |
227 | 230 |
|
228 |
log.info("Adding datasource " + ds.getId() + " - name " + ds.getOfficialName());
|
|
231 |
log.info("Adding datasource " + ds.getId() + " - name " + ds.getOfficialname());
|
|
229 | 232 |
|
230 |
final DatasourceManagerService dsManager = serviceLocator.getService(DatasourceManagerService.class);
|
|
233 |
dsManager.saveDs(ds);
|
|
231 | 234 |
|
232 |
return dsManager.addDatasource(ds);
|
|
235 |
return true;
|
|
233 | 236 |
} |
234 | 237 |
|
235 | 238 |
@RequestMapping("/ui/listValidValuesForParam.do") |
modules/dnet-modular-repositories-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/objects/RepoInterfaceEntry.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.functionality.modular.ui.repositories.objects; |
2 | 2 |
|
3 |
import java.util.ArrayList; |
|
3 | 4 |
import java.util.List; |
4 | 5 |
|
5 |
import com.google.common.collect.Lists;
|
|
6 |
import eu.dnetlib.enabling.datasources.common.SearchApisEntry;
|
|
6 | 7 |
|
7 |
import eu.dnetlib.enabling.datasources.rmi.SearchInterfacesEntry;
|
|
8 |
public class RepoInterfaceEntry extends SearchApisEntry {
|
|
8 | 9 |
|
9 |
public class RepoInterfaceEntry extends SearchInterfacesEntry { |
|
10 |
|
|
11 | 10 |
private String label; |
12 | 11 |
private boolean removable = false; |
13 | 12 |
private String collDate = ""; |
... | ... | |
19 | 18 |
private String downloadObjId = ""; |
20 | 19 |
private String repoType; |
21 | 20 |
private String email; |
22 |
private List<SimpleParamEntry> commonParams = Lists.newArrayList();
|
|
23 |
private List<SimpleParamEntry> accessParams = Lists.newArrayList();
|
|
24 |
private List<SimpleParamEntry> otherParams = Lists.newArrayList();
|
|
25 |
private List<RepoMetaWfEntry> metaWFs = Lists.newArrayList();
|
|
21 |
private List<SimpleParamEntry> commonParams = new ArrayList<>();
|
|
22 |
private List<SimpleParamEntry> accessParams = new ArrayList<>();
|
|
23 |
private List<SimpleParamEntry> otherParams = new ArrayList<>();
|
|
24 |
private List<RepoMetaWfEntry> metaWFs = new ArrayList<>();
|
|
26 | 25 |
|
27 | 26 |
public String getLabel() { |
28 | 27 |
return label; |
... | ... | |
140 | 139 |
return removable; |
141 | 140 |
} |
142 | 141 |
|
143 |
public void setRemovable(boolean removable) { |
|
142 |
public void setRemovable(final boolean removable) {
|
|
144 | 143 |
this.removable = removable; |
145 | 144 |
} |
146 | 145 |
|
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/addRepo.st | ||
---|---|---|
27 | 27 |
<fieldset> |
28 | 28 |
<legend>General Info</legend> |
29 | 29 |
<ng-simple-edit-field label="Datasource ID (template: 12Chars_____::theId)" selection="repo.id" regex="^\w{12}::\w+\$"></ng-simple-edit-field> |
30 |
<ng-simple-edit-field label="Official Name" selection="repo.officialName"></ng-simple-edit-field>
|
|
31 |
<ng-simple-edit-field label="English Name" selection="repo.englishName" optional="true"></ng-simple-edit-field>
|
|
32 |
<ng-simple-edit-field label="Organization" selection="repo.organization"></ng-simple-edit-field>
|
|
33 |
<ng-select-vocabulary-field label="Typology Class" vocabulary="validTypes" selection="repo.datasourceClass"></ng-select-vocabulary-field>
|
|
30 |
<ng-simple-edit-field label="Official Name" selection="repo.officialname"></ng-simple-edit-field>
|
|
31 |
<ng-simple-edit-field label="English Name" selection="repo.englishname" optional="true"></ng-simple-edit-field>
|
|
32 |
<ng-simple-edit-field label="Organization" selection="org.legalname"></ng-simple-edit-field>
|
|
33 |
<ng-select-vocabulary-field label="Typology Class" vocabulary="validTypes" selection="repo.typology"></ng-select-vocabulary-field>
|
|
34 | 34 |
</fieldset> |
35 | 35 |
|
36 | 36 |
<fieldset> |
37 | 37 |
<legend>Contacts</legend> |
38 |
<ng-simple-edit-field label="WebSite Url" selection="repo.websiteUrl" regex="^(http|https):\/\/"></ng-simple-edit-field>
|
|
39 |
<ng-simple-edit-field label="Contact Email" selection="repo.contactEmail" regex="^.+@.+"></ng-simple-edit-field>
|
|
38 |
<ng-simple-edit-field label="WebSite Url" selection="repo.websiteurl" regex="^(http|https):\/\/"></ng-simple-edit-field>
|
|
39 |
<ng-simple-edit-field label="Contact Email" selection="repo.contactemail" regex="^.+@.+"></ng-simple-edit-field>
|
|
40 | 40 |
</fieldset> |
41 | 41 |
|
42 | 42 |
<fieldset> |
43 | 43 |
<legend>Geographical Info</legend> |
44 |
<ng-select-vocabulary-field label="Country" vocabulary="validCountries" selection="repo.countryCode"></ng-select-vocabulary-field>
|
|
44 |
<ng-select-vocabulary-field label="Country" vocabulary="validCountries" selection="org.country"></ng-select-vocabulary-field>
|
|
45 | 45 |
<ng-simple-edit-field label="Latitude" selection="repo.latitude" type="NUMBER"></ng-simple-edit-field> |
46 | 46 |
<ng-simple-edit-field label="Longitude" selection="repo.longitude" type="NUMBER"></ng-simple-edit-field> |
47 | 47 |
</fieldset> |
48 | 48 |
|
49 | 49 |
<fieldset> |
50 | 50 |
<legend>Technical Info</legend> |
51 |
<ng-simple-edit-field label="Namespace Prefix (12 chars)" selection="repo.namespacePrefix" regex="^\w{12}\$"></ng-simple-edit-field>
|
|
52 |
<ng-simple-edit-field label="Software Typology" selection="repo.typology" optional="true"></ng-simple-edit-field>
|
|
53 |
<ng-simple-edit-field label="Logo Url" selection="repo.logoUrl" regex="^(http|https):\/\/" optional="true"></ng-simple-edit-field>
|
|
51 |
<ng-simple-edit-field label="Namespace Prefix (12 chars)" selection="repo.namespaceprefix" regex="^\w{12}\$"></ng-simple-edit-field>
|
|
52 |
<ng-simple-edit-field label="Software Typology" selection="repo.platform" optional="true"></ng-simple-edit-field>
|
|
53 |
<ng-simple-edit-field label="Logo Url" selection="repo.logourl" regex="^(http|https):\/\/" optional="true"></ng-simple-edit-field>
|
|
54 | 54 |
</fieldset> |
55 | 55 |
|
56 | 56 |
<br /><br /> |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/repos/repoApi.st | ||
---|---|---|
75 | 75 |
<a role="menuitem" tabindex="-1" href="javascript:void(0)" ng-click="overrideApiCompliance(l.name)">override to <b>{{l.name}}</b> (<i>{{l.desc}}</i>)</a> |
76 | 76 |
</li> |
77 | 77 |
<li class="divider" role="presentation" ng-show="p.otherValue"></li> |
78 |
<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" ng-show="p.otherValue" ng-click="resetApiCompliance()">reset to the validator value: <b>{{p.otherValue}}</b></a></li>
|
|
78 |
<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" ng-show="p.otherValue" ng-click="resetApiCompliance()">reset to the original value</b></a></li>
|
|
79 | 79 |
</ul> |
80 | 80 |
</div> |
81 | 81 |
</div> |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/addRepoApi.st | ||
---|---|---|
47 | 47 |
<ng-fixed-value-field label="Typology" value="api.typology"></ng-fixed-value-field> |
48 | 48 |
<ng-api-id-field label="Api ID" prefix="api_________::{{repo.origId}}::" exclusion="repo.apis" selection="api.id"></ng-api-id-field> |
49 | 49 |
<!-- <ng-select-vocabulary-field label="Typology" vocabulary="values.types" selection="api.typology"></ng-select-vocabulary-field> --> |
50 |
<ng-select-vocabulary-field label="Compatibility level" vocabulary="values.compliances" selection="api.compliance"></ng-select-vocabulary-field>
|
|
51 |
<ng-select-vocabulary-field label="Content description" vocabulary="values.contentDescriptions" selection="api.contentDescription"></ng-select-vocabulary-field>
|
|
52 |
<ng-select-vocabulary-field label="Protocol" vocabulary="values.protocols" selection="api.accessProtocol" contextual-params="currentParams"></ng-select-vocabulary-field>
|
|
53 |
<ng-simple-edit-field label="BaseURL" selection="api.baseUrl" regex="^(http|https|ftp|file|sftp|jar):\/\/"></ng-simple-edit-field>
|
|
50 |
<ng-select-vocabulary-field label="Compatibility level" vocabulary="values.compliances" selection="api.compatibility"></ng-select-vocabulary-field>
|
|
51 |
<ng-select-vocabulary-field label="Content description" vocabulary="values.contentDescriptions" selection="api.contentdescription"></ng-select-vocabulary-field>
|
|
52 |
<ng-select-vocabulary-field label="Protocol" vocabulary="values.protocols" selection="api.protocol" contextual-params="currentParams"></ng-select-vocabulary-field>
|
|
53 |
<ng-simple-edit-field label="BaseURL" selection="api.baseurl" regex="^(http|https|ftp|file|sftp|jar):\/\/"></ng-simple-edit-field>
|
|
54 | 54 |
|
55 | 55 |
|
56 | 56 |
|
57 | 57 |
<ng-simple-edit-field |
58 | 58 |
ng-repeat="param in currentParams | filter: { functionPopulated : false }" |
59 |
label="{{param.name}} [{{api.accessProtocol}} protocol]"
|
|
60 |
selection="api.accessParams[param.name]"
|
|
59 |
label="{{param.name}} [{{api.protocol}} protocol]"
|
|
60 |
selection="apiParams[param.name]" |
|
61 | 61 |
optional="{{param.optional}}" |
62 | 62 |
regex="{{param.regex}}" |
63 | 63 |
type="{{param.type}}"></ng-simple-edit-field> |
64 | 64 |
|
65 | 65 |
<ng-simple-select-field |
66 | 66 |
ng-repeat="param in currentParams | filter: { functionPopulated : true, type : 'TEXT' }" |
67 |
label="{{param.name}} [{{api.accessProtocol}} protocol]"
|
|
68 |
selection="api.accessParams[param.name]"
|
|
69 |
valid-values="validValues[api.baseUrl + '@@@' + param.name]"
|
|
67 |
label="{{param.name}} [{{api.protocol}} protocol]"
|
|
68 |
selection="apiParams[param.name]" |
|
69 |
valid-values="validValues[api.baseurl + '@@@' + param.name]"
|
|
70 | 70 |
refresh-function="listValidValuesForParam(param.name)" |
71 | 71 |
optional="{{param.optional}}"></ng-simple-select-field> |
72 | 72 |
|
73 | 73 |
<ng-multi-select-field |
74 | 74 |
ng-repeat="param in currentParams | filter: { functionPopulated : true, type : 'LIST' }" |
75 |
label="{{param.name}} [{{api.accessProtocol}} protocol]"
|
|
76 |
selection="api.accessParams[param.name]"
|
|
77 |
valid-values="validValues[api.baseUrl + '@@@' + param.name]"
|
|
75 |
label="{{param.name}} [{{api.protocol}} protocol]"
|
|
76 |
selection="apiParams[param.name]" |
|
77 |
valid-values="validValues[api.baseurl + '@@@' + param.name]"
|
|
78 | 78 |
refresh-function="listValidValuesForParam(param.name)" |
79 | 79 |
optional="{{param.optional}}"></ng-multi-select-field> |
80 | 80 |
|
81 |
<ng-simple-edit-field label="Xpath for Metadata Identifier" selection="api.extraFields['metadata_identifier_path']"></ng-simple-edit-field>
|
|
81 |
<ng-simple-edit-field label="Xpath for Metadata Identifier" selection="api.metadataIdentifierPath"></ng-simple-edit-field>
|
|
82 | 82 |
|
83 | 83 |
<div class="form-group"> |
84 | 84 |
<div class="col-sm-offset-3 col-sm-9"> |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/addRepoApi.js | ||
---|---|---|
250 | 250 |
|
251 | 251 |
$scope.$watch('repo', function() { |
252 | 252 |
if ($scope.repo) { |
253 |
$scope.apiParams = {}; |
|
253 | 254 |
$scope.api = { |
254 |
'typology' : $scope.repo.typology, |
|
255 |
'accessParams' : {}, |
|
256 |
'extraFields' : {} |
|
255 |
'typology' : $scope.repo.typology, |
|
256 |
'apiParams' : [] |
|
257 | 257 |
}; |
258 | 258 |
} |
259 | 259 |
}); |
... | ... | |
263 | 263 |
$scope.selectedTypology = ''; |
264 | 264 |
$scope.repo = {}; |
265 | 265 |
$scope.api = {}; |
266 |
$scope.apiParams = {}; |
|
266 | 267 |
$scope.validValues = []; |
267 | 268 |
} |
268 | 269 |
|
269 | 270 |
$scope.registerApi = function() { |
270 | 271 |
if (confirm('Add new api to repository \n\n' + $scope.repo.name + '?')) { |
272 |
|
|
273 |
$scope.api.apiParams = []; |
|
274 |
angular.forEach($scope.apiParams, function(value, param) { |
|
275 |
$scope.api.apiParams.push({ |
|
276 |
'param' : param, |
|
277 |
'value' : value |
|
278 |
}); |
|
279 |
}); |
|
280 |
|
|
271 | 281 |
$scope.showSpinner(); |
272 | 282 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
273 | 283 |
$http.post('repoApi.new', $.param({ |
... | ... | |
297 | 307 |
return; |
298 | 308 |
} |
299 | 309 |
|
300 |
if (!$scope.api.accessProtocol) {
|
|
310 |
if (!$scope.api.protocol) {
|
|
301 | 311 |
$scope.showError("Access Protocol is missing"); |
302 | 312 |
return; |
303 | 313 |
} |
304 |
if (!$scope.api.baseUrl) {
|
|
314 |
if (!$scope.api.baseurl) {
|
|
305 | 315 |
$scope.showError("BaseUrl is missing"); |
306 | 316 |
return; |
307 | 317 |
} |
308 | 318 |
|
309 |
var key = $scope.api.baseUrl + '@@@' + param;
|
|
319 |
var key = $scope.api.baseurl + '@@@' + param;
|
|
310 | 320 |
$scope.validValues[key] = []; |
311 | 321 |
|
312 | 322 |
$scope.showSpinner(); |
313 | 323 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
314 | 324 |
$http.post('listValidValuesForParam.do', $.param({ |
315 |
'protocol' : $scope.api.accessProtocol,
|
|
325 |
'protocol' : $scope.api.protocol,
|
|
316 | 326 |
'param' : param, |
317 |
'baseUrl' : $scope.api.baseUrl,
|
|
327 |
'baseUrl' : $scope.api.baseurl,
|
|
318 | 328 |
})).success(function(data) { |
319 | 329 |
$scope.hideSpinner(); |
320 | 330 |
$scope.validValues[key] = data; |
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/repoControllers.js | ||
---|---|---|
14 | 14 |
enableCellEditOnFocus: false, |
15 | 15 |
enableHighlighting: true, |
16 | 16 |
filterOptions: $scope.filterBrowseData, |
17 |
sortInfo: { fields: ['value'], directions: ['desc'] },
|
|
17 |
sortInfo: { fields: ['term'], directions: ['desc'] },
|
|
18 | 18 |
columnDefs: [ |
19 |
{field: 'name', displayName: 'Name', cellTemplate: '<div class="ngCellText"><a href="javascript:void(0)" ng-click="browseApis(repoBrowseData.id, row.getProperty(\'id\'))">{{row.getProperty(col.field)}}</a></div>' },
|
|
20 |
{field: 'value', displayName: '# datasources', width: '20%', headerClass: 'text-right', cellClass: 'text-right' }
|
|
19 |
{field: 'term', displayName: 'Name', cellTemplate: '<div class="ngCellText"><a href="javascript:void(0)" ng-click="browseApis(repoBrowseData.id, row.getProperty(\'term\'))">{{row.getProperty(col.field)}}</a></div>' },
|
|
20 |
{field: 'total', displayName: '# datasources', width: '20%', headerClass: 'text-right', cellClass: 'text-right' }
|
|
21 | 21 |
] |
22 | 22 |
}; |
23 | 23 |
|
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/addRepo.js | ||
---|---|---|
102 | 102 |
$scope.repo = { |
103 | 103 |
latitude : '0.0', |
104 | 104 |
longitude : '0.0', |
105 |
timezone : '0.0' |
|
105 |
timezone : '0.0',
|
|
106 | 106 |
}; |
107 |
|
|
108 |
$scope.org = {}; |
|
107 | 109 |
} |
108 | 110 |
|
109 | 111 |
$scope.registerRepo = function() { |
110 |
if (confirm('Add new datasource \n\n' + $scope.repo.officialName + '?')) {
|
|
112 |
if (confirm('Add new datasource \n\n' + $scope.repo.officialname + '?')) {
|
|
111 | 113 |
$scope.showSpinner(); |
112 | 114 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
115 |
|
|
116 |
$scope.org.id = 'openaire____::' + $scope.repo.id; |
|
117 |
$scope.repo.organizations = [$scope.org]; |
|
118 |
|
|
113 | 119 |
$http.post('repo.new', $.param({ |
114 | 120 |
'repo' : JSON.stringify($scope.repo) |
115 | 121 |
})).success(function(res) { |
modules/dnet-modular-repositories-ui/trunk/pom.xml | ||
---|---|---|
11 | 11 |
<packaging>jar</packaging> |
12 | 12 |
<version>4.0.18-SNAPSHOT</version> |
13 | 13 |
<scm> |
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-modular-repositories-ui/trunk</developerConnection>
|
|
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-modular-repositories-ui/branches/dsm</developerConnection>
|
|
15 | 15 |
</scm> |
16 | 16 |
<dependencies> |
17 | 17 |
<dependency> |
... | ... | |
26 | 26 |
</dependency> |
27 | 27 |
<dependency> |
28 | 28 |
<groupId>eu.dnetlib</groupId> |
29 |
<artifactId>dnet-datasource-manager-rmi</artifactId>
|
|
30 |
<version>[4.0.0, 5.0.0)</version>
|
|
29 |
<artifactId>dnet-datasource-manager-common</artifactId>
|
|
30 |
<version>[1.0.0-SNAPSHOT,2.0.0)</version>
|
|
31 | 31 |
</dependency> |
32 | 32 |
<dependency> |
33 | 33 |
<groupId>junit</groupId> |
Also available in: Unified diff
merged branch dsm into trunk