Project

General

Profile

« Previous | Next » 

Revision 61849

bug fixing

View differences:

modules/dnet-modular-repositories-ui/branches/dismiss_repo_profiles/src/main/java/eu/dnetlib/functionality/modular/ui/repositories/RepoUIUtils.java
42 42

  
43 43
	@Autowired
44 44
	private UniqueServiceLocator serviceLocator;
45

  
45
	@Autowired
46 46
	private LocalDatasourceManager<Datasource<?, ?>, Api<?>> dsManager;
47 47

  
48 48
	private static final Log log = LogFactory.getLog(RepoUIUtils.class);
......
53 53
		final RepoInterfaceEntry ifc = new RepoInterfaceEntry();
54 54

  
55 55
		final Datasource<?, ?> ds = dsManager.getDs(dsId);
56

  
56 57
		final Api<?> api = dsManager.getApis(dsId)
57 58
			.stream()
58 59
			.filter(a -> a.getId().equals(apiId))
......
79 80
		ifc.setProtocol(api.getProtocol());
80 81

  
81 82
		final Set<String> toVerifyParams = getParameterNamesForProtocol(ifc.getProtocol());
82

  
83
		log.debug("****** " + toVerifyParams);
84 83
		ifc.getAccessParams().add(new SimpleParamEntry("baseUrl", api.getBaseurl()));
85 84

  
86 85
		for (final ApiParam p : api.getApiParams()) {
......
97 96
			log.info("Adding missing param [" + pname + "] for protocol " + api.getProtocol() + " in ds " + dsId);
98 97
		}
99 98

  
99
		ifc.setMetadataIdentifierPath(api.getMetadataIdentifierPath());
100 100
		ifc.setCompliance(api.getCompatibility());
101 101
		ifc.setComplianceOverrided(api.isCompatibilityOverrided());
102 102

  
103
		ifc.setAggrDate(DateUtils.calculate_ISO8601(api.getLastAggregationDate().getTime()));
104
		ifc.setAggrTotal(api.getLastAggregationTotal());
105
		ifc.setAggrMdId(api.getLastAggregationMdid());
103
		if (api.getLastAggregationDate() != null) {
104
			ifc.setAggrDate(DateUtils.calculate_ISO8601(api.getLastAggregationDate().getTime()));
105
			ifc.setAggrTotal(api.getLastAggregationTotal());
106
			ifc.setAggrMdId(api.getLastAggregationMdid());
107
		}
108
		if (api.getLastCollectionDate() != null) {
109
			ifc.setCollDate(DateUtils.calculate_ISO8601(api.getLastCollectionDate().getTime()));
110
			ifc.setCollTotal(api.getLastCollectionTotal());
111
			ifc.setCollMdId(api.getLastCollectionMdid());
112
		}
113
		if (api.getLastDownloadDate() != null) {
114
			ifc.setDownloadDate(DateUtils.calculate_ISO8601(api.getLastDownloadDate().getTime()));
115
			ifc.setDownloadTotal(api.getLastDownloadTotal());
116
			ifc.setDownloadObjId(api.getLastDownloadObjid());
117
		}
106 118

  
107
		ifc.setCollDate(DateUtils.calculate_ISO8601(api.getLastCollectionDate().getTime()));
108
		ifc.setCollTotal(api.getLastCollectionTotal());
109
		ifc.setCollMdId(api.getLastCollectionMdid());
110

  
111
		ifc.setDownloadDate(DateUtils.calculate_ISO8601(api.getLastDownloadDate().getTime()));
112
		ifc.setDownloadTotal(api.getLastDownloadTotal());
113
		ifc.setDownloadObjId(api.getLastDownloadObjid());
114

  
115
		ifc.setMetadataIdentifierPath(api.getMetadataIdentifierPath());
116

  
117 119
		final StringTemplate st = new StringTemplate(IOUtils.toString(getClass()
118 120
			.getResourceAsStream("/eu/dnetlib/functionality/modular/ui/repositories/templates/getMetaWfs.xquery.st")));
119 121
		st.setAttribute("dsId", dsId);
......
181 183
		}
182 184
		final Set<String> res = Sets.newHashSet();
183 185
		if (parametersMap.containsKey(protocol.toLowerCase())) {
184
			res.add("baseUrl");
185 186
			for (final ProtocolParameter p : parametersMap.get(protocol.toLowerCase())) {
186 187
				res.add(p.getName());
187 188
			}
modules/dnet-modular-repositories-ui/branches/dismiss_repo_profiles/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/repos/repoApi.st
63 63
		
64 64
		<div class="input-group input-group-sm col-xs-12 col-md-6" style="padding: 10px; float: left;">
65 65
			<span class="input-group-addon" style="width: 150px;"><b>Compliance</b></span>
66
			<span class="form-control" ng-show="currentRepoApi.complianceOverrided" style="color: #c06a00">{{currentRepoApi.compliance}} (override)</span>
67
			<span class="form-control" ng-hide="!currentRepoApi.complianceOverrided">{{currentRepoApi.compliance}} (by validator)</span>
66
			<span class="form-control" ng-show="currentRepoApi.complianceOverrided == true" style="color: #c06a00">{{currentRepoApi.compliance}} (override)</span>
67
			<span class="form-control" ng-show="currentRepoApi.complianceOverrided != true">{{currentRepoApi.compliance}} (by validator)</span>
68 68
		
69 69
			<div class="input-group-btn">
70
				<button type="button" data-toggle="dropdown" class="btn btn-sm dropdown-toggle" ng-class="{ 'btn-primary' : !currentRepoApi.complianceOverrided, 'btn-warning' : currentRepoApi.complianceOverrided }">
70
				<button type="button" data-toggle="dropdown" class="btn btn-sm dropdown-toggle" ng-class="{ 'btn-primary' : currentRepoApi.complianceOverrided != true, 'btn-warning' : currentRepoApi.complianceOverrided  == true}">
71 71
					<span class="caret pull-right"></span>
72 72
				</button>
73 73
			    <ul class="dropdown-menu dropdown-menu-right" role="menu">
......
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="currentRepoApi.complianceOverrided" ng-click="resetApiCompliance()">reset to the original value</b></a></li>
78
			        <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" ng-show="currentRepoApi.complianceOverrided == true" 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/branches/dismiss_repo_profiles/src/main/resources/eu/dnetlib/web/resources/js/repoControllers.js
241 241

  
242 242
		$scope.prepareUpdateRepoApi = function() {
243 243
			$scope.tempAccessParams = angular.copy($scope.currentRepoApi.accessParams); 
244

  
245
			$scope.tempMdIdPath = '';
246
			angular.forEach($scope.currentRepoApi.otherParams, function(param, pos){
247
				if (param.name == 'metadata_identifier_path') {
248
					$scope.tempMdIdPath = param.value;
249
				}
250
			});
244
			$scope.tempMdIdPath = $scope.currentRepoApi.metadataIdentifierPath;
251 245
		}
252 246

  
253 247

  
......
395 389

  
396 390
		$scope.showCreateRemoteSyncApi = function(mongoUrl, mongoDB, mdId, apiSuffix) {
397 391

  
398
			var path = "//*[local-name()='header']/*[local-name()='identifier']";
399
			angular.forEach($scope.currentRepoApi.otherParams, function(p) {
400
				if (p.id=='metadata_identifier_path') {
401
					path = p.value;
402
				}
403
			});
392
			var path = $scope.currentRepoApi.metadataIdentifierPath;
393
			
394
			if (!path) {
395
				path = "//*[local-name()='header']/*[local-name()='identifier']";
396
			}
404 397

  
405 398
			var compliance = "UNKNOWN";
406 399
			angular.forEach($scope.currentRepoApi.commonParams, function(p) {

Also available in: Unified diff