1. Change hash function on piwik.
2. Bug fixes on repository / broker / validator api 3/ Add field on simple subscription domain.
This commit is contained in:
parent
f8a2dbae90
commit
edd2e4aa02
|
@ -72,8 +72,8 @@ public interface BrokerApi {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
EventsPage getNotificationsBySubscriptionId(String subscriptionId,String page,String size) throws BrokerException;
|
EventsPage getNotificationsBySubscriptionId(String subscriptionId,String page,String size) throws BrokerException;
|
||||||
|
|
||||||
@RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET
|
/*@RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET
|
||||||
,produces = MediaType.APPLICATION_JSON_VALUE)
|
,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody*/
|
||||||
Map<String, List<Subscription>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
|
Map<String, List<Subscription>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,8 +367,8 @@ public class BrokerApiImpl implements BrokerApi {
|
||||||
return resp.getBody();
|
return resp.getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//@Override
|
||||||
public Map<String, List<Subscription>> getSubscriptionsOfUser(@PathVariable("userEmail") String userEmail)
|
public Map<String, List<Subscription>> getSubscriptionsOfUser(/*@PathVariable("userEmail")*/ String userEmail)
|
||||||
throws BrokerException {
|
throws BrokerException {
|
||||||
|
|
||||||
Map<String, List<SimpleSubscriptionDesc>> simpleSubs = getSimpleSubscriptionsOfUser(userEmail);
|
Map<String, List<SimpleSubscriptionDesc>> simpleSubs = getSimpleSubscriptionsOfUser(userEmail);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.dnetlib.repo.manager.service.controllers;
|
||||||
|
|
||||||
import eu.dnetlib.domain.data.PiwikInfo;
|
import eu.dnetlib.domain.data.PiwikInfo;
|
||||||
import eu.dnetlib.utils.md5.MD5;
|
import eu.dnetlib.utils.md5.MD5;
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.dao.EmptyResultDataAccessException;
|
import org.springframework.dao.EmptyResultDataAccessException;
|
||||||
|
@ -79,16 +80,8 @@ public class PiWikApiImpl implements PiWikApi{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOpenaireId(@PathVariable("repositoryId") String repositoryId) {
|
public String getOpenaireId(@PathVariable("repositoryId") String repositoryId) {
|
||||||
LOGGER.debug("Getting openaire id for repository: " + repositoryId);
|
if (repositoryId != null && repositoryId.contains("::"))
|
||||||
try {
|
return repositoryId.split("::")[0] + "::" + DigestUtils.md5Hex(repositoryId.split("::")[1]);
|
||||||
if (repositoryId != null && repositoryId.contains("::")) {
|
|
||||||
return repositoryId.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryId.split("::")[1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
LOGGER.debug(e);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public interface RepositoryApi {
|
||||||
@RequestMapping(value = "/addRepository", method = RequestMethod.POST,
|
@RequestMapping(value = "/addRepository", method = RequestMethod.POST,
|
||||||
consumes = MediaType.APPLICATION_JSON_VALUE)
|
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
void addRepository(String datatype, Repository repository) throws Exception;
|
Repository addRepository(String datatype, Repository repository) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/deleteInterface", method = RequestMethod.DELETE)
|
@RequestMapping(value = "/deleteInterface", method = RequestMethod.DELETE)
|
||||||
|
|
|
@ -227,12 +227,14 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException {
|
public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException {
|
||||||
|
|
||||||
LOGGER.debug("Retreiving repositories with id : " + id );
|
LOGGER.debug("Retreiving repositories with id : " + id );
|
||||||
|
Repository repo = null;
|
||||||
UriComponents uriComponents = searchDatasource("0","100");
|
UriComponents uriComponents = searchDatasource("0","100");
|
||||||
RequestFilter requestFilter = new RequestFilter();
|
RequestFilter requestFilter = new RequestFilter();
|
||||||
requestFilter.setId(id);
|
requestFilter.setId(id);
|
||||||
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
|
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class);
|
||||||
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||||
Repository repo = Converter.jsonToRepositoryObject(jsonArray.getJSONObject(0));
|
if(jsonArray.length() > 0)
|
||||||
|
repo = Converter.jsonToRepositoryObject(jsonArray.getJSONObject(0));
|
||||||
if (repo != null)
|
if (repo != null)
|
||||||
getRepositoryInfo(repo);
|
getRepositoryInfo(repo);
|
||||||
return repo;
|
return repo;
|
||||||
|
@ -294,23 +296,9 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addRepository(@RequestParam("datatype") String datatype,
|
public Repository addRepository(@RequestParam("datatype") String datatype,
|
||||||
@RequestBody Repository repository) throws Exception {
|
@RequestBody Repository repository) throws Exception {
|
||||||
|
|
||||||
/*JSONObject json_params = new JSONObject(params);
|
|
||||||
String datatype = json_params.getString("datatype");
|
|
||||||
String json_repository = json_params.getString("repository");
|
|
||||||
Repository repository = null;*/
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
|
||||||
try {
|
|
||||||
String json_repo = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(repository);
|
|
||||||
LOGGER.debug("repository -> " + json_repo);
|
|
||||||
// repository = mapper.readValue(json_repository, Repository.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.debug("Error parsing repository ", e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
repository = this.setRepositoryFeatures(datatype,repository);
|
repository = this.setRepositoryFeatures(datatype,repository);
|
||||||
|
|
||||||
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
||||||
|
@ -346,6 +334,7 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRepository(Repository repository) {
|
private void updateRepository(Repository repository) {
|
||||||
|
@ -451,7 +440,7 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
iFace.setRemovable(true);
|
iFace.setRemovable(true);
|
||||||
iFace.setAccessProtocol("oai");
|
iFace.setAccessProtocol("oai");
|
||||||
iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']");
|
iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']");
|
||||||
// iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8));
|
iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8));
|
||||||
if (iFace.getAccessSet().isEmpty()) {
|
if (iFace.getAccessSet().isEmpty()) {
|
||||||
LOGGER.debug("set is empty: " + iFace.getAccessSet());
|
LOGGER.debug("set is empty: " + iFace.getAccessSet());
|
||||||
iFace.removeAccessSet();
|
iFace.removeAccessSet();
|
||||||
|
@ -488,21 +477,6 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype,
|
public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype,
|
||||||
@RequestParam("repoId") String repoId,
|
@RequestParam("repoId") String repoId,
|
||||||
@RequestBody RepositoryInterface repositoryInterface) throws JSONException {
|
@RequestBody RepositoryInterface repositoryInterface) throws JSONException {
|
||||||
|
|
||||||
/* JSONObject json_params = new JSONObject(params);
|
|
||||||
// LOGGER.debug(params);
|
|
||||||
//TODO iFace parameter from gui. Object to json
|
|
||||||
String datatype = json_params.getString("datatype");
|
|
||||||
String repoId = json_params.getString("repoId");
|
|
||||||
String json_iFace = json_params.getString("iFace");
|
|
||||||
RepositoryInterface iFace = null;
|
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
try {
|
|
||||||
iFace = mapper.readValue(json_iFace, RepositoryInterface.class);
|
|
||||||
} catch (Exception e1) {
|
|
||||||
LOGGER.debug("Error parsing repository interface ", e1);
|
|
||||||
}*/
|
|
||||||
return registerRepositoryInterface(repoId,repositoryInterface,datatype);
|
return registerRepositoryInterface(repoId,repositoryInterface,datatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +485,6 @@ public class RepositoryApiImpl implements RepositoryApi {
|
||||||
try {
|
try {
|
||||||
e = this.getRepositoryById(repoId);
|
e = this.getRepositoryById(repoId);
|
||||||
iFace = createRepositoryInterface(e,iFace,datatype);
|
iFace = createRepositoryInterface(e,iFace,datatype);
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
|
|
||||||
String json_interface = Converter.repositoryInterfaceObjectToJson(e,iFace);
|
String json_interface = Converter.repositoryInterfaceObjectToJson(e,iFace);
|
||||||
LOGGER.debug("iFace equals -> " + json_interface);
|
LOGGER.debug("iFace equals -> " + json_interface);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public interface ValidatorApi {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
int getStoredJobsTotalNumberNew(String user, String jobType, String validationStatus) throws ValidatorServiceException;
|
int getStoredJobsTotalNumberNew(String user, String jobType, String validationStatus) throws ValidatorServiceException;
|
||||||
|
|
||||||
@RequestMapping(value = "/getInterfaceInformation/" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/getInterfaceInformation" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException;
|
InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package eu.dnetlib.repo.manager.shared.broker;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by stefanos on 10-Mar-17.
|
* Created by stefanos on 10-Mar-17.
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +13,8 @@ public class SimpleSubscriptionDesc implements IsSerializable {
|
||||||
private String datasource;
|
private String datasource;
|
||||||
private String topic;
|
private String topic;
|
||||||
private long count;
|
private long count;
|
||||||
|
private Date creationDate;
|
||||||
|
private Date lastNotificationDate;
|
||||||
|
|
||||||
public SimpleSubscriptionDesc() {
|
public SimpleSubscriptionDesc() {
|
||||||
}
|
}
|
||||||
|
@ -54,4 +58,19 @@ public class SimpleSubscriptionDesc implements IsSerializable {
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getCreationDate() {
|
||||||
|
return creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreationDate(Date creationDate) {
|
||||||
|
this.creationDate = creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastNotificationDate() {
|
||||||
|
return lastNotificationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastNotificationDate(Date lastNotificationDate) {
|
||||||
|
this.lastNotificationDate = lastNotificationDate;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,8 @@ public class Subscription implements IsSerializable {
|
||||||
|
|
||||||
private Date lastNotificationDate;
|
private Date lastNotificationDate;
|
||||||
|
|
||||||
|
private Date creationDate;
|
||||||
|
|
||||||
private String conditions;
|
private String conditions;
|
||||||
|
|
||||||
private List<MapConditions> conditionsAsList;
|
private List<MapConditions> conditionsAsList;
|
||||||
|
@ -96,5 +98,12 @@ public class Subscription implements IsSerializable {
|
||||||
this.conditionsAsList = conditionsAsList;
|
this.conditionsAsList = conditionsAsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getCreationDate() {
|
||||||
|
return creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreationDate(Date creationDate) {
|
||||||
|
this.creationDate = creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue