Revision 49236
Added by Panagiotis Kanakakis over 6 years ago
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/exception/RepositoryException.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.exception; |
|
2 |
|
|
3 |
|
|
4 |
public class RepositoryException extends RuntimeException { |
|
5 |
|
|
6 |
public RepositoryException(String errorMessage) { |
|
7 |
super(errorMessage); |
|
8 |
} |
|
9 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/config/RepoManagerContextLoaderListener.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.config; |
|
2 |
|
|
3 |
import org.apache.commons.lang.ArrayUtils; |
|
4 |
import org.apache.log4j.Logger; |
|
5 |
import org.springframework.beans.BeansException; |
|
6 |
import org.springframework.context.support.ClassPathXmlApplicationContext; |
|
7 |
import org.springframework.web.context.ContextLoaderListener; |
|
8 |
import org.springframework.web.context.WebApplicationContext; |
|
9 |
import org.springframework.web.context.support.XmlWebApplicationContext; |
|
10 |
|
|
11 |
import javax.servlet.ServletContext; |
|
12 |
import java.util.Properties; |
|
13 |
|
|
14 |
public class RepoManagerContextLoaderListener extends ContextLoaderListener { |
|
15 |
private static Logger logger = Logger.getLogger(RepoManagerContextLoaderListener.class); |
|
16 |
|
|
17 |
|
|
18 |
public RepoManagerContextLoaderListener() { |
|
19 |
super(); |
|
20 |
} |
|
21 |
|
|
22 |
public RepoManagerContextLoaderListener(WebApplicationContext context) { |
|
23 |
super(context); |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
protected WebApplicationContext createWebApplicationContext( |
|
28 |
ServletContext servletContext) |
|
29 |
throws BeansException { |
|
30 |
logger.debug("Creating web application context"); |
|
31 |
Properties props = this.loadProperties(); |
|
32 |
String repoMode = props.getProperty("services.validator.mode.repo"); |
|
33 |
String userMode = props.getProperty("services.validator.mode.user"); |
|
34 |
Boolean standaloneMode = Boolean.parseBoolean(props.getProperty("services.validator.mode.standalone")); |
|
35 |
|
|
36 |
logger.info("User mode: " + userMode); |
|
37 |
logger.info("Repo mode: " + repoMode); |
|
38 |
logger.info("Standalone mode: " + standaloneMode); |
|
39 |
// logger.info("Dnet workflow enabled: " + repoMode); |
|
40 |
XmlWebApplicationContext ctx = new XmlWebApplicationContext(); |
|
41 |
|
|
42 |
ctx.setServletContext(servletContext); |
|
43 |
|
|
44 |
String userApiContext = null; |
|
45 |
if (userMode.equalsIgnoreCase("local")) |
|
46 |
userApiContext = "eu/dnetlib/validator/web/api/impls/users/springContext-validator-user-local.xml"; |
|
47 |
else if (userMode.equalsIgnoreCase("ldap")) |
|
48 |
userApiContext = "eu/dnetlib/users/springContext-users-ldap.xml"; |
|
49 |
|
|
50 |
String[] springContextCore = new String[] { |
|
51 |
"classpath:META-INF/cxf/cxf.xml", |
|
52 |
"classpath:META-INF/cxf/cxf-extension-soap.xml", |
|
53 |
"classpath:META-INF/cxf/cxf-extension-jaxws.xml", |
|
54 |
"classpath:META-INF/cxf/cxf-servlet.xml", |
|
55 |
"classpath*:/cxf.xml", |
|
56 |
"classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml", |
|
57 |
"classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml", |
|
58 |
"classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml", |
|
59 |
// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-struts.xml", |
|
60 |
// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-emailer.xml", |
|
61 |
// "classpath*:/eu/dnetlib/validator/web/config/springContext-validator.xml", |
|
62 |
"classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml", |
|
63 |
// "classpath*:/eu/dnetlib/validator/commons/dao/springContext-*.xml", |
|
64 |
"classpath*:/eu/dnetlib/repos/springContext-repos-" + repoMode + ".xml", |
|
65 |
"classpath*:/" + userApiContext |
|
66 |
}; |
|
67 |
|
|
68 |
|
|
69 |
String[] springContextForStandalone = new String[] { |
|
70 |
}; |
|
71 |
|
|
72 |
String[] springContextForIS = new String[] { |
|
73 |
"classpath*:/gr/uoa/di/driver/util/springContext-locators.xml", |
|
74 |
"classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml", |
|
75 |
"classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml", |
|
76 |
"classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml", |
|
77 |
"classpath*:/gr/uoa/di/driver/app/springContext-commons.xml", |
|
78 |
"classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml" |
|
79 |
}; |
|
80 |
|
|
81 |
if (standaloneMode) { |
|
82 |
logger.debug("Loading contexts for standalone mode"); |
|
83 |
ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForStandalone)); |
|
84 |
} else { |
|
85 |
logger.debug("Loading contexts for dnet"); |
|
86 |
ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForIS)); |
|
87 |
} |
|
88 |
|
|
89 |
ctx.refresh(); |
|
90 |
|
|
91 |
logger.debug("done"); |
|
92 |
|
|
93 |
return ctx; |
|
94 |
} |
|
95 |
|
|
96 |
private Properties loadProperties() { |
|
97 |
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { |
|
98 |
"classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml" |
|
99 |
}); |
|
100 |
|
|
101 |
CascadingPropertyLoader pLoader = (CascadingPropertyLoader) ctx.getBean("propertyLoader"); |
|
102 |
Properties props = pLoader.getProperties(); |
|
103 |
|
|
104 |
ctx.destroy(); |
|
105 |
ctx.close(); |
|
106 |
return props; |
|
107 |
} |
|
108 |
|
|
109 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/config/CascadingPropertyLoader.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.config; |
|
2 |
|
|
3 |
import org.springframework.beans.BeansException; |
|
4 |
import org.springframework.beans.factory.InitializingBean; |
|
5 |
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; |
|
6 |
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; |
|
7 |
|
|
8 |
import java.util.Properties; |
|
9 |
|
|
10 |
/** |
|
11 |
* CascadingPropertyLoader loads a number of property files and mergers them together, so that the last properties |
|
12 |
* override the previous. It also supports property expansion like: |
|
13 |
* |
|
14 |
* <code> |
|
15 |
* something = 1 |
|
16 |
* somethingelse = 2 |
|
17 |
* test = ${something}/${somethingelse} |
|
18 |
* </code> |
|
19 |
* |
|
20 |
* <p> |
|
21 |
* And if you override something to XX, then test will become XX/2 |
|
22 |
* </p> |
|
23 |
* |
|
24 |
* |
|
25 |
* @author marko |
|
26 |
* |
|
27 |
*/ |
|
28 |
public class CascadingPropertyLoader extends PropertyPlaceholderConfigurer implements InitializingBean { |
|
29 |
|
|
30 |
private Properties properties; |
|
31 |
|
|
32 |
public void afterPropertiesSet() throws Exception { |
|
33 |
this.properties = mergeProperties(); |
|
34 |
|
|
35 |
// Convert the merged properties, if necessary. |
|
36 |
convertProperties(this.properties); |
|
37 |
|
|
38 |
logger.debug("Properties: " + properties); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
protected void processProperties(final ConfigurableListableBeanFactory beanFactoryToProcess, final Properties props) throws BeansException { |
|
43 |
super.processProperties(beanFactoryToProcess, props); |
|
44 |
} |
|
45 |
|
|
46 |
public Properties getProperties() { |
|
47 |
return properties; |
|
48 |
} |
|
49 |
|
|
50 |
public void setProperties(final Properties properties) { |
|
51 |
super.setProperties(properties); |
|
52 |
|
|
53 |
this.properties = properties; |
|
54 |
} |
|
55 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/BrokerApi.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
import eu.dnetlib.repo.manager.service.application.shared.broker.DatasourcesBroker; |
|
4 |
import org.springframework.http.MediaType; |
|
5 |
import org.springframework.web.bind.annotation.RequestBody; |
|
6 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
7 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
8 |
import org.springframework.web.bind.annotation.RestController; |
|
9 |
|
|
10 |
@RestController |
|
11 |
@RequestMapping(value = "/broker") |
|
12 |
public interface BrokerApi { |
|
13 |
|
|
14 |
@RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
|
15 |
DatasourcesBroker getDatasourcesOfUser(@RequestBody String params); |
|
16 |
|
|
17 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/RestService.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
import org.springframework.stereotype.Component; |
|
4 |
import org.springframework.web.client.RestTemplate; |
|
5 |
|
|
6 |
@Component |
|
7 |
public class RestService { |
|
8 |
|
|
9 |
private static RestTemplate restTemplate = new org.springframework.web.client.RestTemplate(); |
|
10 |
|
|
11 |
public static String executeGET(String uri){ |
|
12 |
return restTemplate.getForObject(uri,String.class); |
|
13 |
} |
|
14 |
|
|
15 |
public static String executePOST(String uri,String json){ |
|
16 |
return restTemplate.postForObject(uri,json,String.class); |
|
17 |
} |
|
18 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/ValidatorApi.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
import eu.dnetlib.domain.functionality.validator.JobForValidation; |
|
4 |
import eu.dnetlib.domain.functionality.validator.RuleSet; |
|
5 |
import org.springframework.http.MediaType; |
|
6 |
import org.springframework.web.bind.annotation.RequestBody; |
|
7 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
8 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
9 |
import org.springframework.web.bind.annotation.RestController; |
|
10 |
|
|
11 |
import java.util.List; |
|
12 |
|
|
13 |
|
|
14 |
@RestController |
|
15 |
@RequestMapping(value = "/validator") |
|
16 |
public interface ValidatorApi { |
|
17 |
|
|
18 |
@RequestMapping(value = "/submitJobForValidation",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE ) |
|
19 |
void submitJobForValidation(@RequestBody JobForValidation jobForValidation); |
|
20 |
|
|
21 |
@RequestMapping(value = "/reSubmitJobForValidation/",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE ) |
|
22 |
void reSubmitJobForValidation(@RequestBody String jobId); |
|
23 |
|
|
24 |
@RequestMapping(value = "/getRuleSets" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
25 |
List<RuleSet> getRuleSets(); |
|
26 |
|
|
27 |
@RequestMapping(value = "/getSetsOfRepository/{url}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
28 |
List<String> getSetsOfRepository(String url); |
|
29 |
|
|
30 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/BrokerApiImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
|
|
4 |
import eu.dnetlib.domain.data.Repository; |
|
5 |
import eu.dnetlib.repo.manager.service.application.shared.BrokerException; |
|
6 |
import eu.dnetlib.repo.manager.service.application.shared.Tuple; |
|
7 |
import eu.dnetlib.repo.manager.service.application.shared.broker.BrowseEntry; |
|
8 |
import eu.dnetlib.repo.manager.service.application.shared.broker.DatasourcesBroker; |
|
9 |
import org.json.JSONObject; |
|
10 |
import org.springframework.beans.factory.annotation.Autowired; |
|
11 |
import org.springframework.beans.factory.annotation.Value; |
|
12 |
import org.springframework.core.ParameterizedTypeReference; |
|
13 |
import org.springframework.http.HttpMethod; |
|
14 |
import org.springframework.http.ResponseEntity; |
|
15 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
|
16 |
import org.springframework.stereotype.Component; |
|
17 |
import org.springframework.web.client.RestClientException; |
|
18 |
import org.springframework.web.client.RestTemplate; |
|
19 |
import org.springframework.web.util.UriComponentsBuilder; |
|
20 |
|
|
21 |
import java.util.ArrayList; |
|
22 |
import java.util.Collections; |
|
23 |
import java.util.Comparator; |
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
@Component |
|
27 |
public class BrokerApiImpl implements BrokerApi { |
|
28 |
|
|
29 |
|
|
30 |
@Autowired |
|
31 |
private RepositoryApiImpl repoAPI; |
|
32 |
@Value("${services.broker.url}:${services.broker.port}/${services.broker.api}${services.broker.openaire}") |
|
33 |
private String openairePath; |
|
34 |
|
|
35 |
@Override |
|
36 |
public DatasourcesBroker getDatasourcesOfUser(String params) { |
|
37 |
JSONObject json_params = new JSONObject(params); |
|
38 |
|
|
39 |
String userEmail = json_params.getString("userEmail"); |
|
40 |
boolean includeShared = json_params.getBoolean("includeShared"); |
|
41 |
boolean includeByOthers = json_params.getBoolean("includeByOthers"); |
|
42 |
|
|
43 |
DatasourcesBroker ret = new DatasourcesBroker(); |
|
44 |
//set for user |
|
45 |
ret.setDatasourcesOfUser(getDatasourcesOfUserType(repoAPI.getRepositoriesOfUser(userEmail, false))); |
|
46 |
|
|
47 |
//set for shared |
|
48 |
if (includeShared) { |
|
49 |
//TODO whatever nikonas was saying |
|
50 |
List<String> sharedDatasourceIds = new ArrayList<String>(); |
|
51 |
ret.setSharedDatasources(getDatasourcesOfUserType(repoAPI.getReposByIds(sharedDatasourceIds))); |
|
52 |
} |
|
53 |
|
|
54 |
//set others |
|
55 |
if (includeByOthers) { |
|
56 |
ret.setDatasourcesOfOthers(getDatasourcesOfUserType(repoAPI.getRepositoriesOfUser(userEmail, true))); |
|
57 |
} |
|
58 |
return null; |
|
59 |
} |
|
60 |
|
|
61 |
private List<Tuple<BrowseEntry, String>> getDatasourcesOfUserType(List<Repository> repositories) throws BrokerException { |
|
62 |
|
|
63 |
List<Tuple<BrowseEntry, String>> entries = new ArrayList<>(); |
|
64 |
for (Repository repo : repositories) { |
|
65 |
BrowseEntry temp = new BrowseEntry(); |
|
66 |
temp.setValue(repo.getOfficialName()); |
|
67 |
temp.setSize(new Long(0)); |
|
68 |
for (BrowseEntry e : this.getTopicsForDatasource(repo.getOfficialName())) { |
|
69 |
temp.setSize(temp.getSize() + e.getSize()); |
|
70 |
} |
|
71 |
Tuple<BrowseEntry, String> tup = new Tuple<>(temp, repo.getLogoUrl()); |
|
72 |
entries.add(tup); |
|
73 |
} |
|
74 |
|
|
75 |
// sort the collection by the second field of the tuple which is size |
|
76 |
Collections.sort(entries, new Comparator<Tuple<BrowseEntry, String>>() { |
|
77 |
@Override |
|
78 |
public int compare(Tuple<BrowseEntry, String> e1, Tuple<BrowseEntry, String> e2) { |
|
79 |
return (int) (e2.getFirst().getSize().longValue() - e1.getFirst().getSize().longValue()); |
|
80 |
} |
|
81 |
}); |
|
82 |
|
|
83 |
return entries; |
|
84 |
} |
|
85 |
|
|
86 |
public List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException { |
|
87 |
/*final String service = "/topicsForDatasource"; |
|
88 |
|
|
89 |
//build the uri params |
|
90 |
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service) |
|
91 |
.queryParam("ds", datasourceName); |
|
92 |
|
|
93 |
//create new template engine |
|
94 |
RestTemplate template = new RestTemplate(); |
|
95 |
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); |
|
96 |
ResponseEntity<List<BrowseEntry>> resp; |
|
97 |
try { |
|
98 |
//communicate with endpoint |
|
99 |
resp = template.exchange( |
|
100 |
builder.build().encode().toUri(), |
|
101 |
HttpMethod.GET, |
|
102 |
null, |
|
103 |
new ParameterizedTypeReference<List<BrowseEntry>>() { |
|
104 |
}); |
|
105 |
} catch (RestClientException e) { |
|
106 |
throw new BrokerException(e); |
|
107 |
} |
|
108 |
|
|
109 |
return resp.getBody();*/ |
|
110 |
return null; |
|
111 |
} |
|
112 |
|
|
113 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/MonitorApi.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
import eu.dnetlib.domain.functionality.validator.StoredJob; |
|
4 |
import org.springframework.http.MediaType; |
|
5 |
import org.springframework.web.bind.annotation.RequestBody; |
|
6 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
7 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
8 |
import org.springframework.web.bind.annotation.RestController; |
|
9 |
|
|
10 |
import java.util.List; |
|
11 |
|
|
12 |
@RestController |
|
13 |
@RequestMapping(value = "/monitor") |
|
14 |
public interface MonitorApi { |
|
15 |
|
|
16 |
@RequestMapping(value = "/getJobsOfUser" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
|
17 |
List<StoredJob> getJobsOfUser(@RequestBody String params); |
|
18 |
|
|
19 |
@RequestMapping(value = "/getJobsOfUser" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
|
20 |
int getJobsOfUserPerValidationStatus(@RequestBody String params); |
|
21 |
|
|
22 |
@RequestMapping(value = "/getJobSummary" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
|
23 |
StoredJob getJobSummary(@RequestBody String params); |
|
24 |
|
|
25 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/ValidatorApiImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
import eu.dnetlib.api.functionality.ValidatorServiceException; |
|
4 |
import eu.dnetlib.domain.functionality.validator.StoredJob; |
|
5 |
import eu.dnetlib.repo.manager.service.application.utils.OaiTools; |
|
6 |
import gr.uoa.di.driver.util.ServiceLocator; |
|
7 |
import eu.dnetlib.domain.functionality.validator.JobForValidation; |
|
8 |
import eu.dnetlib.domain.functionality.validator.RuleSet; |
|
9 |
import eu.dnetlib.repo.manager.service.application.utils.Constants; |
|
10 |
|
|
11 |
import java.util.*; |
|
12 |
import java.util.concurrent.ConcurrentHashMap; |
|
13 |
import eu.dnetlib.api.functionality.ValidatorService; |
|
14 |
import org.json.JSONObject; |
|
15 |
import org.springframework.beans.factory.annotation.Autowired; |
|
16 |
import org.springframework.stereotype.Component; |
|
17 |
import org.springframework.web.bind.annotation.PathVariable; |
|
18 |
|
|
19 |
import javax.annotation.PostConstruct; |
|
20 |
|
|
21 |
@Component |
|
22 |
public class ValidatorApiImpl implements ValidatorApi{ |
|
23 |
|
|
24 |
@Autowired |
|
25 |
private MonitorApiImpl monitorApi; |
|
26 |
|
|
27 |
private ServiceLocator<ValidatorService> validatorServiceLocator; |
|
28 |
|
|
29 |
private ValidatorService getValidationService() { |
|
30 |
return this.validatorServiceLocator.getService(); |
|
31 |
} |
|
32 |
|
|
33 |
public ServiceLocator<ValidatorService> getValidatorServiceLocator() { |
|
34 |
return validatorServiceLocator; |
|
35 |
} |
|
36 |
|
|
37 |
public void setValidatorServiceLocator(ServiceLocator<ValidatorService> validatorServiceLocator) { |
|
38 |
this.validatorServiceLocator = validatorServiceLocator; |
|
39 |
} |
|
40 |
|
|
41 |
private Map<String, List<RuleSet>> rulesetMap = new ConcurrentHashMap<String, List<RuleSet>>(); |
|
42 |
|
|
43 |
@PostConstruct |
|
44 |
private void loadRules(){ |
|
45 |
|
|
46 |
try { |
|
47 |
for (RuleSet ruleSet : getValidationService().getRuleSets()) { |
|
48 |
if (ruleSet.getVisibility() != null && ruleSet.getVisibility().contains("development")) { |
|
49 |
String key = ""; |
|
50 |
if (ruleSet.getGuidelinesAcronym().matches("^openaire[1-9].0_data$")) |
|
51 |
key = Constants.VALIDATION_MODE_DATA; |
|
52 |
else if (ruleSet.getGuidelinesAcronym().matches("^openaire[1-9].0$") || ruleSet.getGuidelinesAcronym().equals("driver")) |
|
53 |
key = Constants.VALIDATION_MODE_LITERATURE; |
|
54 |
else if (ruleSet.getGuidelinesAcronym().matches("^openaire[1-9].0_cris$")) |
|
55 |
key = Constants.VALIDATION_MODE_CRIS; |
|
56 |
|
|
57 |
if (rulesetMap.containsKey(key)) |
|
58 |
rulesetMap.get(key).add(ruleSet); |
|
59 |
else { |
|
60 |
List<RuleSet> ruleSets = new ArrayList<RuleSet>(); |
|
61 |
ruleSets.add(ruleSet); |
|
62 |
rulesetMap.put(key, ruleSets); |
|
63 |
} |
|
64 |
} |
|
65 |
} |
|
66 |
} catch (ValidatorServiceException e) { |
|
67 |
e.printStackTrace(); |
|
68 |
} |
|
69 |
|
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public void submitJobForValidation(JobForValidation jobForValidation) { |
|
74 |
try { |
|
75 |
this.getValidationService().submitValidationJob(jobForValidation); |
|
76 |
} catch (ValidatorServiceException e) { |
|
77 |
e.printStackTrace(); |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
@Override |
|
82 |
public void reSubmitJobForValidation(String jobId) { |
|
83 |
|
|
84 |
JSONObject jsonObject = new JSONObject(); |
|
85 |
jsonObject.put("jobId",jobId); |
|
86 |
jsonObject.put("groupBy","all"); |
|
87 |
|
|
88 |
StoredJob job = monitorApi.getJobSummary(jsonObject.toString()); |
|
89 |
Set<Integer> contentRules = new HashSet<Integer>(); |
|
90 |
Set<Integer> usageRules = new HashSet<Integer>(); |
|
91 |
|
|
92 |
RuleSet ruleSet = null; |
|
93 |
for (List<RuleSet> ruleSets : this.rulesetMap.values()) { |
|
94 |
for (RuleSet rSet : ruleSets) |
|
95 |
if (rSet.getGuidelinesAcronym().equals(job.getDesiredCompatibilityLevel())) { |
|
96 |
ruleSet = rSet; |
|
97 |
break; |
|
98 |
} |
|
99 |
} |
|
100 |
|
|
101 |
for (int ruleId : job.getRules()) { |
|
102 |
if (ruleSet.getContentRulesIds().contains(ruleId)) |
|
103 |
contentRules.add(ruleId); |
|
104 |
else if (ruleSet.getUsageRulesIds().contains(ruleId)) |
|
105 |
usageRules.add(ruleId); |
|
106 |
} |
|
107 |
if (!contentRules.isEmpty()) |
|
108 |
job.setSelectedContentRules(contentRules); |
|
109 |
if (!usageRules.isEmpty()) |
|
110 |
job.setSelectedUsageRules(usageRules); |
|
111 |
this.submitJobForValidation(job); |
|
112 |
} |
|
113 |
|
|
114 |
@Override |
|
115 |
public List<RuleSet> getRuleSets() { |
|
116 |
return rulesetMap.get(Constants.VALIDATION_MODE_DATA); |
|
117 |
} |
|
118 |
|
|
119 |
@Override |
|
120 |
public List<String> getSetsOfRepository(@PathVariable("url") String url) { |
|
121 |
try { |
|
122 |
return OaiTools.getSetsOfRepo(url); |
|
123 |
} catch (Exception e) { |
|
124 |
e.printStackTrace(); |
|
125 |
} |
|
126 |
return null; |
|
127 |
} |
|
128 |
|
|
129 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/HelpApi.java | ||
---|---|---|
1 |
/* |
|
2 |
package eu.dnetlib.repo.manager.api.application.rest; |
|
3 |
|
|
4 |
import eu.dnetlib.domain.data.RepositoryInterface; |
|
5 |
import eu.dnetlib.gwt.shared.Help; |
|
6 |
import org.springframework.http.MediaType; |
|
7 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
8 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
9 |
import org.springframework.web.bind.annotation.RestController; |
|
10 |
|
|
11 |
@RestController |
|
12 |
@RequestMapping(value = "/help") |
|
13 |
public interface HelpApi { |
|
14 |
|
|
15 |
@RequestMapping(value = "/getHelpById/{id}", method = RequestMethod.GET, |
|
16 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
17 |
Help getHelpById(String id) ; |
|
18 |
|
|
19 |
} |
|
20 |
*/ |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/MonitorApiImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
import eu.dnetlib.api.functionality.ValidatorService; |
|
4 |
import eu.dnetlib.api.functionality.ValidatorServiceException; |
|
5 |
import eu.dnetlib.domain.functionality.validator.StoredJob; |
|
6 |
import gr.uoa.di.driver.util.ServiceLocator; |
|
7 |
import org.json.JSONObject; |
|
8 |
import org.springframework.stereotype.Component; |
|
9 |
import java.util.List; |
|
10 |
|
|
11 |
@Component |
|
12 |
public class MonitorApiImpl implements MonitorApi { |
|
13 |
|
|
14 |
private ServiceLocator<ValidatorService> validatorServiceLocator; |
|
15 |
|
|
16 |
private ValidatorService getValidationService() { |
|
17 |
return this.validatorServiceLocator.getService(); |
|
18 |
} |
|
19 |
|
|
20 |
public ServiceLocator<ValidatorService> getValidatorServiceLocator() { |
|
21 |
return validatorServiceLocator; |
|
22 |
} |
|
23 |
|
|
24 |
public void setValidatorServiceLocator(ServiceLocator<ValidatorService> validatorServiceLocator) { |
|
25 |
this.validatorServiceLocator = validatorServiceLocator; |
|
26 |
} |
|
27 |
|
|
28 |
@Override |
|
29 |
public List<StoredJob> getJobsOfUser(String params) { |
|
30 |
JSONObject json_params = new JSONObject(params); |
|
31 |
|
|
32 |
String user = json_params.getString("user"); |
|
33 |
String jobType = json_params.getString("jobType"); |
|
34 |
Integer offset = Integer.parseInt(json_params.getString("offset")); |
|
35 |
Integer limit = Integer.parseInt(json_params.getString("limit")); |
|
36 |
String dateFrom = json_params.getString("dateFrom"); |
|
37 |
String dateTo = json_params.getString("dateTo"); |
|
38 |
String validationStatus = json_params.getString("validationStatus"); |
|
39 |
|
|
40 |
List<StoredJob> jobs = null; |
|
41 |
try { |
|
42 |
jobs = getValidationService(). |
|
43 |
getStoredJobsNew(user, jobType, offset, limit, dateFrom, dateTo, validationStatus); |
|
44 |
} catch (ValidatorServiceException e) { |
|
45 |
e.printStackTrace(); |
|
46 |
} |
|
47 |
return jobs; |
|
48 |
|
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public int getJobsOfUserPerValidationStatus(String params) { |
|
53 |
JSONObject json_params = new JSONObject(params); |
|
54 |
|
|
55 |
String user = json_params.getString("user"); |
|
56 |
String jobType = json_params.getString("jobType"); |
|
57 |
String validationStatus = json_params.getString("validationStatus"); |
|
58 |
try { |
|
59 |
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus); |
|
60 |
} catch (ValidatorServiceException e) { |
|
61 |
e.printStackTrace(); |
|
62 |
} |
|
63 |
return 0; |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public StoredJob getJobSummary(String params) { |
|
68 |
JSONObject json_params = new JSONObject(params); |
|
69 |
|
|
70 |
String jobId = json_params.getString("jobId"); |
|
71 |
String groupBy = json_params.getString("groupBy"); |
|
72 |
|
|
73 |
try { |
|
74 |
return getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy); |
|
75 |
} catch (ValidatorServiceException e) { |
|
76 |
e.printStackTrace(); |
|
77 |
} |
|
78 |
return null; |
|
79 |
} |
|
80 |
|
|
81 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/HelpApiImpl.java | ||
---|---|---|
1 |
/* |
|
2 |
package eu.dnetlib.repo.manager.api.application.rest; |
|
3 |
|
|
4 |
import eu.dnetlib.gwt.client.help.HelpServiceAsync; |
|
5 |
import eu.dnetlib.gwt.shared.Help; |
|
6 |
import org.springframework.beans.factory.annotation.Autowired; |
|
7 |
import org.springframework.stereotype.Component; |
|
8 |
import org.springframework.web.bind.annotation.PathVariable; |
|
9 |
|
|
10 |
@Component |
|
11 |
public class HelpApiImpl implements HelpApi{ |
|
12 |
|
|
13 |
@Autowired |
|
14 |
private static HelpServiceAsync helpService; |
|
15 |
|
|
16 |
@Override |
|
17 |
public Help getHelpById(@PathVariable("id") String id) { |
|
18 |
return null; |
|
19 |
} |
|
20 |
|
|
21 |
} |
|
22 |
*/ |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/RepositoryApi.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
import eu.dnetlib.domain.data.Repository; |
|
4 |
import eu.dnetlib.domain.data.RepositoryInterface; |
|
5 |
import org.springframework.http.MediaType; |
|
6 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
7 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
8 |
import org.springframework.web.bind.annotation.RestController; |
|
9 |
import java.util.List; |
|
10 |
|
|
11 |
@RestController |
|
12 |
@RequestMapping(value = "/repository") |
|
13 |
public interface RepositoryApi { |
|
14 |
|
|
15 |
@RequestMapping(value = "/getCountries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) |
|
16 |
String getCountries() ; |
|
17 |
|
|
18 |
@RequestMapping(value = "/getRepositoriesByCountry/{country}/{page}/{size}/", method = RequestMethod.GET, |
|
19 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
20 |
List<Repository> getRepositoriesByCountry(String country, |
|
21 |
String page, |
|
22 |
String size) ; |
|
23 |
|
|
24 |
@RequestMapping(value = "/getRepositoriesOfUser/{userEmail}/{page}/{size}") |
|
25 |
List<Repository> getRepositoriesOfUser( String userEmail, |
|
26 |
String page, |
|
27 |
String size); |
|
28 |
|
|
29 |
@RequestMapping(value = "/getRepositoryById/{id}", method = RequestMethod.GET, |
|
30 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
31 |
Repository getRepositoryById(String id) ; |
|
32 |
|
|
33 |
@RequestMapping(value = "/getRepositoriesByName/{name}/{page}/{size}/", method = RequestMethod.GET, |
|
34 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
35 |
List<Repository> getRepositoriesByName(String name, |
|
36 |
String page, |
|
37 |
String size); |
|
38 |
|
|
39 |
@RequestMapping(value = "/getRepositoryInterface/{id}", method = RequestMethod.GET, |
|
40 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
41 |
RepositoryInterface getRepositoyInterface(String id) ; |
|
42 |
|
|
43 |
@RequestMapping(value = "/addRepository", method = RequestMethod.POST, |
|
44 |
consumes = MediaType.APPLICATION_JSON_VALUE) |
|
45 |
String addRepository(Repository repository); |
|
46 |
|
|
47 |
@RequestMapping(value = "/addInterface", method = RequestMethod.POST, |
|
48 |
consumes = MediaType.APPLICATION_JSON_VALUE) |
|
49 |
String addRepositoryInterface(RepositoryInterface repositoryInterface); |
|
50 |
|
|
51 |
@RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET, |
|
52 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
53 |
List<String> getDnetCountries(); |
|
54 |
|
|
55 |
@RequestMapping(value = "/getTypologies", method = RequestMethod.GET, |
|
56 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
57 |
List<String> getTypologies(); |
|
58 |
|
|
59 |
@RequestMapping(value = "/getTimezones", method = RequestMethod.GET, |
|
60 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
61 |
List<String> getTimezones(); |
|
62 |
|
|
63 |
@RequestMapping(value = "/updateManagedStatus", method = RequestMethod.POST, |
|
64 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
65 |
String updateManagedStatus(String id,String managed); |
|
66 |
|
|
67 |
@RequestMapping(value = "/updateEnglishName", method = RequestMethod.POST, |
|
68 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
69 |
String updateEnglishName(String id,String englishName); |
|
70 |
|
|
71 |
@RequestMapping(value = "/updateLatitude", method = RequestMethod.POST, |
|
72 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
73 |
String updateLatitude(String id,String latitude); |
|
74 |
|
|
75 |
@RequestMapping(value = "/updateLongitude", method = RequestMethod.POST, |
|
76 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
77 |
String updateLongitude(String id,String longitude); |
|
78 |
|
|
79 |
@RequestMapping(value = "/updateOfficialName", method = RequestMethod.POST, |
|
80 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
81 |
String updateOfficialName(String id,String officialName); |
|
82 |
|
|
83 |
@RequestMapping(value = "/getUrlsOfUserRepos",method = RequestMethod.GET, |
|
84 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
85 |
String getUrlsOfUserRepos(String user_email); |
|
86 |
|
|
87 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/rest/RepositoryApiImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.rest; |
|
2 |
|
|
3 |
import eu.dnetlib.repo.manager.service.application.utils.Converter; |
|
4 |
import eu.dnetlib.domain.data.Repository; |
|
5 |
import eu.dnetlib.domain.data.RepositoryInterface; |
|
6 |
import org.json.JSONArray; |
|
7 |
import org.json.JSONObject; |
|
8 |
import org.springframework.beans.factory.annotation.Value; |
|
9 |
import org.springframework.stereotype.Component; |
|
10 |
import org.springframework.web.bind.annotation.PathVariable; |
|
11 |
import org.springframework.web.bind.annotation.RequestBody; |
|
12 |
import org.springframework.web.bind.annotation.RequestParam; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
|
|
16 |
@Component |
|
17 |
public class RepositoryApiImpl implements RepositoryApi { |
|
18 |
|
|
19 |
@Value("${service.baseAddress}") |
|
20 |
private String baseAddress; |
|
21 |
|
|
22 |
@Override |
|
23 |
public String getCountries() { |
|
24 |
return RestService.executeGET(baseAddress + "/ds/countries"); |
|
25 |
} |
|
26 |
|
|
27 |
|
|
28 |
@Override |
|
29 |
public List<Repository> getRepositoriesByCountry(@PathVariable("country") String country, |
|
30 |
@PathVariable("page") String page, |
|
31 |
@PathVariable("size") String size){ |
|
32 |
String vars = page+"/"+size+"?country="+country; |
|
33 |
String uri = baseAddress+ "/ds/search/country/" + vars; |
|
34 |
JSONArray jsonArray = new JSONArray(RestService.executeGET(uri)); |
|
35 |
return Converter.jsonToRepositoryList(jsonArray); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public List<Repository> getRepositoriesOfUser(@PathVariable("userEmail") String userEmail, |
|
40 |
@PathVariable("page") String page, |
|
41 |
@PathVariable("size") String size) { |
|
42 |
String vars = page+"/"+size+"?contactemail="+userEmail; |
|
43 |
String uri = baseAddress+ "/ds/search/email/" + vars; |
|
44 |
JSONArray jsonArray = new JSONArray(RestService.executeGET(uri)); |
|
45 |
return Converter.jsonToRepositoryList(jsonArray); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public Repository getRepositoryById(@PathVariable("id") String id) { |
|
50 |
String uri = baseAddress+ "/ds/get/" + id; |
|
51 |
JSONObject jsonObject = new JSONObject( RestService.executeGET(uri) ); |
|
52 |
return Converter.jsonToRepositoryObject(jsonObject); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public List<Repository> getRepositoriesByName(@PathVariable("name") String name, |
|
57 |
@PathVariable("page") String page, |
|
58 |
@PathVariable("size") String size) { |
|
59 |
String vars = page+"/"+size+"?name="+name; |
|
60 |
String uri = baseAddress+ "/ds/search/name/" + vars; |
|
61 |
JSONArray jsonArray = new JSONArray(RestService.executeGET(uri)); |
|
62 |
return Converter.jsonToRepositoryList(jsonArray); |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public RepositoryInterface getRepositoyInterface(@PathVariable("id") String id) { |
|
67 |
String uri = baseAddress+ "/ds/service/" + id; |
|
68 |
JSONArray jsonArray = new JSONArray( RestService.executeGET(uri) ); |
|
69 |
return Converter.jsonToRepositoryInterfaceObject(jsonArray.getJSONObject(0)); |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public String addRepository(@RequestBody Repository repository) { |
|
74 |
String uri = baseAddress+ "/ds/add/"; |
|
75 |
return RestService.executePOST(uri, Converter.repositoryObjectToJson(repository)); |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public String addRepositoryInterface(RepositoryInterface repositoryInterface) { |
|
80 |
String uri = baseAddress+ "/ds/service/add/"; |
|
81 |
return RestService.executePOST(uri, Converter.repositoryInterfaceObjectToJson(repositoryInterface)); |
|
82 |
} |
|
83 |
|
|
84 |
@Override |
|
85 |
public List<String> getDnetCountries() { |
|
86 |
return Converter.readFile("countries.txt"); |
|
87 |
} |
|
88 |
|
|
89 |
@Override |
|
90 |
public List<String> getTypologies() { |
|
91 |
return Converter.readFile("typologies.txt"); |
|
92 |
} |
|
93 |
|
|
94 |
@Override |
|
95 |
public List<String> getTimezones() { |
|
96 |
return Converter.readFile("timezones.txt"); |
|
97 |
} |
|
98 |
|
|
99 |
@Override |
|
100 |
public String updateManagedStatus(@RequestParam(value = "id") String id, |
|
101 |
@RequestParam(value = "managed") String managed) { |
|
102 |
String uri = baseAddress+ "/ds/manage?id="+id+"&managed="+managed; |
|
103 |
return RestService.executePOST(uri,null); |
|
104 |
} |
|
105 |
|
|
106 |
@Override |
|
107 |
public String updateEnglishName(@RequestParam(value = "id") String id, |
|
108 |
@RequestParam(value = "englishname") String englishName) { |
|
109 |
String uri = baseAddress+ "/ds/manage?dsId="+id+"&englishname="+englishName; |
|
110 |
return RestService.executePOST(uri,null); |
|
111 |
} |
|
112 |
|
|
113 |
@Override |
|
114 |
public String updateLatitude(@RequestParam(value = "id") String id, |
|
115 |
@RequestParam(value = "managed") String latitude) { |
|
116 |
String uri = baseAddress+ "/ds/manage?dsId="+id+"&latitude="+latitude; |
|
117 |
return RestService.executePOST(uri,null); |
|
118 |
} |
|
119 |
|
|
120 |
@Override |
|
121 |
public String updateLongitude(@RequestParam(value = "id") String id, |
|
122 |
@RequestParam(value = "longitude") String longitude) { |
|
123 |
String uri = baseAddress+ "/ds/manage?dsId="+id+"&longitude="+longitude; |
|
124 |
return RestService.executePOST(uri,null); |
|
125 |
} |
|
126 |
|
|
127 |
@Override |
|
128 |
public String updateOfficialName(@RequestParam(value = "id") String id, |
|
129 |
@RequestParam(value = "officialname") String officialname) { |
|
130 |
String uri = baseAddress+ "/ds/manage?dsId="+id+"&officialname="+officialname; |
|
131 |
return RestService.executePOST(uri,null); |
|
132 |
} |
|
133 |
|
|
134 |
@Override |
|
135 |
public String getUrlsOfUserRepos(@PathVariable("user_email") String user_email) { |
|
136 |
|
|
137 |
//TODO create service a join datasource d for user u method |
|
138 |
|
|
139 |
return null; |
|
140 |
} |
|
141 |
|
|
142 |
|
|
143 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/BrokerException.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared; |
|
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* Created by stefanos on 27-Oct-16. |
|
6 |
*/ |
|
7 |
public class BrokerException extends Exception { |
|
8 |
|
|
9 |
public BrokerException(Throwable th) { |
|
10 |
super(th); |
|
11 |
} |
|
12 |
|
|
13 |
public BrokerException() { |
|
14 |
} |
|
15 |
|
|
16 |
|
|
17 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/NotificationMode.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
/** |
|
5 |
* Created by stefanos on 10-Mar-17. |
|
6 |
*/ |
|
7 |
public enum NotificationMode implements IsSerializable { |
|
8 |
MOCK, EMAIL |
|
9 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/Range.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
/** |
|
5 |
* Created by stefanos on 26/10/2016. |
|
6 |
*/ |
|
7 |
public class Range implements IsSerializable { |
|
8 |
|
|
9 |
private String min; |
|
10 |
private String max; |
|
11 |
|
|
12 |
public Range() { |
|
13 |
} |
|
14 |
|
|
15 |
public Range(final String min, final String max) { |
|
16 |
super(); |
|
17 |
this.min = min; |
|
18 |
this.max = max; |
|
19 |
} |
|
20 |
|
|
21 |
public String getMin() { |
|
22 |
return this.min; |
|
23 |
} |
|
24 |
|
|
25 |
public void setMin(final String min) { |
|
26 |
this.min = min; |
|
27 |
} |
|
28 |
|
|
29 |
public String getMax() { |
|
30 |
return this.max; |
|
31 |
} |
|
32 |
|
|
33 |
public void setMax(final String max) { |
|
34 |
this.max = max; |
|
35 |
} |
|
36 |
|
|
37 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/SimpleSubscriptionDesc.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
/** |
|
5 |
* Created by stefanos on 10-Mar-17. |
|
6 |
*/ |
|
7 |
public class SimpleSubscriptionDesc implements IsSerializable { |
|
8 |
|
|
9 |
private String id; |
|
10 |
private String datasource; |
|
11 |
private String topic; |
|
12 |
private long count; |
|
13 |
|
|
14 |
public SimpleSubscriptionDesc() { |
|
15 |
} |
|
16 |
|
|
17 |
public SimpleSubscriptionDesc(final String id, final String datasource, final String topic, final long count) { |
|
18 |
this.id = id; |
|
19 |
this.datasource = datasource; |
|
20 |
this.topic = topic; |
|
21 |
this.count = count; |
|
22 |
} |
|
23 |
|
|
24 |
public String getId() { |
|
25 |
return this.id; |
|
26 |
} |
|
27 |
|
|
28 |
public void setId(final String id) { |
|
29 |
this.id = id; |
|
30 |
} |
|
31 |
|
|
32 |
public String getDatasource() { |
|
33 |
return this.datasource; |
|
34 |
} |
|
35 |
|
|
36 |
public void setDatasource(final String datasource) { |
|
37 |
this.datasource = datasource; |
|
38 |
} |
|
39 |
|
|
40 |
public String getTopic() { |
|
41 |
return this.topic; |
|
42 |
} |
|
43 |
|
|
44 |
public void setTopic(final String topic) { |
|
45 |
this.topic = topic; |
|
46 |
} |
|
47 |
|
|
48 |
public long getCount() { |
|
49 |
return this.count; |
|
50 |
} |
|
51 |
|
|
52 |
public void setCount(final long count) { |
|
53 |
this.count = count; |
|
54 |
} |
|
55 |
|
|
56 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/Provenance.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
/** |
|
5 |
* Created by claudio on 26/07/16. |
|
6 |
*/ |
|
7 |
public class Provenance implements IsSerializable { |
|
8 |
|
|
9 |
private String repositoryName; |
|
10 |
|
|
11 |
private String url; |
|
12 |
|
|
13 |
private String id; |
|
14 |
|
|
15 |
public Provenance() { |
|
16 |
} |
|
17 |
|
|
18 |
public String getRepositoryName() { |
|
19 |
return repositoryName; |
|
20 |
} |
|
21 |
|
|
22 |
public void setRepositoryName(String repositoryName) { |
|
23 |
this.repositoryName = repositoryName; |
|
24 |
} |
|
25 |
|
|
26 |
public String getUrl() { |
|
27 |
return url; |
|
28 |
} |
|
29 |
|
|
30 |
public void setUrl(String url) { |
|
31 |
this.url = url; |
|
32 |
} |
|
33 |
|
|
34 |
public String getId() { |
|
35 |
return id; |
|
36 |
} |
|
37 |
|
|
38 |
public void setId(String id) { |
|
39 |
this.id = id; |
|
40 |
} |
|
41 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/EventsPage.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
|
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
/** |
|
8 |
* Created by stefanos on 26/10/2016. |
|
9 |
*/ |
|
10 |
public class EventsPage implements IsSerializable{ |
|
11 |
|
|
12 |
private String datasource; |
|
13 |
private String topic; |
|
14 |
private long currPage; |
|
15 |
private long totalPages; |
|
16 |
private long total; |
|
17 |
private List<OpenAireEventPayload> values; |
|
18 |
|
|
19 |
public EventsPage() { |
|
20 |
|
|
21 |
} |
|
22 |
public EventsPage(final String datasource, final String topic, final long currPage, final long totalPages, final long total, |
|
23 |
final List<OpenAireEventPayload> values) { |
|
24 |
this.datasource = datasource; |
|
25 |
this.topic = topic; |
|
26 |
this.currPage = currPage; |
|
27 |
this.totalPages = totalPages; |
|
28 |
this.total = total; |
|
29 |
this.values = values; |
|
30 |
} |
|
31 |
|
|
32 |
public String getDatasource() { |
|
33 |
return datasource; |
|
34 |
} |
|
35 |
|
|
36 |
public void setDatasource(String datasource) { |
|
37 |
this.datasource = datasource; |
|
38 |
} |
|
39 |
|
|
40 |
public String getTopic() { |
|
41 |
return topic; |
|
42 |
} |
|
43 |
|
|
44 |
public void setTopic(String topic) { |
|
45 |
this.topic = topic; |
|
46 |
} |
|
47 |
|
|
48 |
public long getCurrPage() { |
|
49 |
return currPage; |
|
50 |
} |
|
51 |
|
|
52 |
public void setCurrPage(long currPage) { |
|
53 |
this.currPage = currPage; |
|
54 |
} |
|
55 |
|
|
56 |
public long getTotalPages() { |
|
57 |
return totalPages; |
|
58 |
} |
|
59 |
|
|
60 |
public void setTotalPages(long totalPages) { |
|
61 |
this.totalPages = totalPages; |
|
62 |
} |
|
63 |
|
|
64 |
public long getTotal() { |
|
65 |
return total; |
|
66 |
} |
|
67 |
|
|
68 |
public void setTotal(long total) { |
|
69 |
this.total = total; |
|
70 |
} |
|
71 |
|
|
72 |
public List<OpenAireEventPayload> getValues() { |
|
73 |
return values; |
|
74 |
} |
|
75 |
|
|
76 |
public void setValues(List<OpenAireEventPayload> values) { |
|
77 |
this.values = values; |
|
78 |
} |
|
79 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/ExternalReference.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
/** |
|
5 |
* Created by claudio on 22/07/16. |
|
6 |
*/ |
|
7 |
public class ExternalReference implements IsSerializable { |
|
8 |
|
|
9 |
private String url; |
|
10 |
|
|
11 |
private String sitename; |
|
12 |
|
|
13 |
private String type; |
|
14 |
|
|
15 |
private String refidentifier; |
|
16 |
|
|
17 |
public ExternalReference() { |
|
18 |
} |
|
19 |
|
|
20 |
public String getUrl() { |
|
21 |
return url; |
|
22 |
} |
|
23 |
|
|
24 |
public void setUrl(String url) { |
|
25 |
this.url = url; |
|
26 |
} |
|
27 |
|
|
28 |
public String getSitename() { |
|
29 |
return sitename; |
|
30 |
} |
|
31 |
|
|
32 |
public void setSitename(String sitename) { |
|
33 |
this.sitename = sitename; |
|
34 |
} |
|
35 |
|
|
36 |
public String getType() { |
|
37 |
return type; |
|
38 |
} |
|
39 |
|
|
40 |
public void setType(String type) { |
|
41 |
this.type = type; |
|
42 |
} |
|
43 |
|
|
44 |
public String getRefidentifier() { |
|
45 |
return refidentifier; |
|
46 |
} |
|
47 |
|
|
48 |
public void setRefidentifier(String refidentifier) { |
|
49 |
this.refidentifier = refidentifier; |
|
50 |
} |
|
51 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/ConditionOperator.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
/** |
|
5 |
* Created by stefanos on 17/3/2017. |
|
6 |
*/ |
|
7 |
public enum ConditionOperator implements IsSerializable { |
|
8 |
EXACT, MATCH_ANY, MATCH_ALL, RANGE |
|
9 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/Instance.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
/** |
|
5 |
* Created by claudio on 22/07/16. |
|
6 |
*/ |
|
7 |
public class Instance implements IsSerializable { |
|
8 |
|
|
9 |
private String url; |
|
10 |
|
|
11 |
private String license; |
|
12 |
|
|
13 |
private String hostedby; |
|
14 |
|
|
15 |
private String instancetype; |
|
16 |
|
|
17 |
public Instance() { |
|
18 |
} |
|
19 |
|
|
20 |
public String getUrl() { |
|
21 |
return url; |
|
22 |
} |
|
23 |
|
|
24 |
public void setUrl(String url) { |
|
25 |
this.url = url; |
|
26 |
} |
|
27 |
|
|
28 |
public String getLicense() { |
|
29 |
return license; |
|
30 |
} |
|
31 |
|
|
32 |
public void setLicense(String license) { |
|
33 |
this.license = license; |
|
34 |
} |
|
35 |
|
|
36 |
public String getHostedby() { |
|
37 |
return hostedby; |
|
38 |
} |
|
39 |
|
|
40 |
public void setHostedby(String hostedby) { |
|
41 |
this.hostedby = hostedby; |
|
42 |
} |
|
43 |
|
|
44 |
public String getInstancetype() { |
|
45 |
return instancetype; |
|
46 |
} |
|
47 |
|
|
48 |
public void setInstancetype(String instancetype) { |
|
49 |
this.instancetype = instancetype; |
|
50 |
} |
|
51 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/Project.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
public class Project implements IsSerializable { |
|
5 |
|
|
6 |
private String code; |
|
7 |
private String acronym; |
|
8 |
private String title; |
|
9 |
private String funder; |
|
10 |
private String fundingProgram; |
|
11 |
private String jurisdiction; |
|
12 |
|
|
13 |
public Project() { |
|
14 |
} |
|
15 |
|
|
16 |
public Project(final String code, final String acronym, final String title, final String funder, final String fundingProgram, final String jurisdiction) { |
|
17 |
this.code = code; |
|
18 |
this.acronym = acronym; |
|
19 |
this.title = title; |
|
20 |
this.funder = funder; |
|
21 |
this.fundingProgram = fundingProgram; |
|
22 |
this.jurisdiction = jurisdiction; |
|
23 |
} |
|
24 |
|
|
25 |
public String getCode() { |
|
26 |
return code; |
|
27 |
} |
|
28 |
|
|
29 |
public void setCode(String code) { |
|
30 |
this.code = code; |
|
31 |
} |
|
32 |
|
|
33 |
public String getAcronym() { |
|
34 |
return acronym; |
|
35 |
} |
|
36 |
|
|
37 |
public void setAcronym(String acronym) { |
|
38 |
this.acronym = acronym; |
|
39 |
} |
|
40 |
|
|
41 |
public String getTitle() { |
|
42 |
return title; |
|
43 |
} |
|
44 |
|
|
45 |
public void setTitle(String title) { |
|
46 |
this.title = title; |
|
47 |
} |
|
48 |
|
|
49 |
public String getFunder() { |
|
50 |
return funder; |
|
51 |
} |
|
52 |
|
|
53 |
public void setFunder(String funder) { |
|
54 |
this.funder = funder; |
|
55 |
} |
|
56 |
|
|
57 |
public String getFundingProgram() { |
|
58 |
return fundingProgram; |
|
59 |
} |
|
60 |
|
|
61 |
public void setFundingProgram(String fundingProgram) { |
|
62 |
this.fundingProgram = fundingProgram; |
|
63 |
} |
|
64 |
|
|
65 |
public String getJurisdiction() { |
|
66 |
return jurisdiction; |
|
67 |
} |
|
68 |
|
|
69 |
public void setJurisdiction(String jurisdiction) { |
|
70 |
this.jurisdiction = jurisdiction; |
|
71 |
} |
|
72 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/MapConditions.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
/** |
|
8 |
* Created by stefanos on 17/3/2017. |
|
9 |
*/ |
|
10 |
public class MapConditions implements IsSerializable { |
|
11 |
|
|
12 |
private String field; |
|
13 |
private MapValueType fieldType; |
|
14 |
private ConditionOperator operator; |
|
15 |
private List<ConditionParams> listParams = new ArrayList<>(); |
|
16 |
|
|
17 |
public MapConditions() { |
|
18 |
} |
|
19 |
|
|
20 |
public String getField() { |
|
21 |
return field; |
|
22 |
} |
|
23 |
|
|
24 |
public void setField(String field) { |
|
25 |
this.field = field; |
|
26 |
} |
|
27 |
|
|
28 |
public MapValueType getFieldType() { |
|
29 |
return fieldType; |
|
30 |
} |
|
31 |
|
|
32 |
public void setFieldType(MapValueType fieldType) { |
|
33 |
this.fieldType = fieldType; |
|
34 |
} |
|
35 |
|
|
36 |
public ConditionOperator getOperator() { |
|
37 |
return operator; |
|
38 |
} |
|
39 |
|
|
40 |
public void setOperator(ConditionOperator operator) { |
|
41 |
this.operator = operator; |
|
42 |
} |
|
43 |
|
|
44 |
public List<ConditionParams> getListParams() { |
|
45 |
return listParams; |
|
46 |
} |
|
47 |
|
|
48 |
public void setListParams(List<ConditionParams> listParams) { |
|
49 |
this.listParams = listParams; |
|
50 |
} |
|
51 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/application/shared/broker/OpenaireSubscription.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.application.shared.broker; |
|
2 |
import com.google.gwt.user.client.rpc.IsSerializable; |
|
3 |
|
|
4 |
/** |
|
5 |
* Created by stefanos on 10-Mar-17. |
|
6 |
*/ |
|
7 |
|
|
8 |
public class OpenaireSubscription implements IsSerializable { |
|
9 |
|
|
10 |
private String subscriber; |
|
11 |
private NotificationFrequency frequency; |
|
12 |
private NotificationMode mode; |
|
13 |
private AdvQueryObject query; |
|
14 |
|
|
15 |
public OpenaireSubscription() { |
|
16 |
} |
|
17 |
|
|
18 |
public OpenaireSubscription(final String subscriber, final NotificationFrequency frequency, final |
|
19 |
NotificationMode mode, |
|
20 |
final AdvQueryObject query) { |
|
21 |
this.subscriber = subscriber; |
|
22 |
this.frequency = frequency; |
|
23 |
this.mode = mode; |
|
24 |
this.query = query; |
|
25 |
} |
|
26 |
|
|
27 |
public String getSubscriber() { |
|
28 |
return this.subscriber; |
|
29 |
} |
|
30 |
|
|
31 |
public void setSubscriber(final String subscriber) { |
|
32 |
this.subscriber = subscriber; |
|
33 |
} |
|
34 |
|
|
35 |
public NotificationFrequency getFrequency() { |
|
36 |
return this.frequency; |
|
37 |
} |
Also available in: Unified diff