Updated domain classes
This commit is contained in:
parent
9d2fd6d51c
commit
d72e669eff
|
@ -1,7 +1,7 @@
|
|||
package eu.dnetlib.repo.manager.controllers;
|
||||
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.*;
|
||||
import eu.dnetlib.repo.manager.domain.dto.RepositoryTerms;
|
||||
import eu.dnetlib.repo.manager.domain.dto.User;
|
||||
|
|
|
@ -0,0 +1,188 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
public class ApiDetails {
|
||||
protected String id = null;
|
||||
protected String protocol = null;
|
||||
protected String datasource = null;
|
||||
protected String contentdescription = null;
|
||||
protected String eoscDatasourceType = null;
|
||||
protected String compatibility;
|
||||
protected String compatibilityOverride;
|
||||
protected Integer lastCollectionTotal;
|
||||
protected Date lastCollectionDate;
|
||||
protected Integer lastAggregationTotal;
|
||||
protected Date lastAggregationDate;
|
||||
protected Integer lastDownloadTotal;
|
||||
protected Date lastDownloadDate;
|
||||
protected String baseurl;
|
||||
protected Boolean removable = false;
|
||||
protected Set<ApiParamDetails> apiParams;
|
||||
protected String metadataIdentifierPath = "";
|
||||
@Deprecated
|
||||
protected String typology = null;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public String getDatasource() {
|
||||
return datasource;
|
||||
}
|
||||
|
||||
public String getContentdescription() {
|
||||
return contentdescription;
|
||||
}
|
||||
|
||||
public String getCompatibility() {
|
||||
return compatibility;
|
||||
}
|
||||
|
||||
public Integer getLastCollectionTotal() {
|
||||
return lastCollectionTotal;
|
||||
}
|
||||
|
||||
public Date getLastCollectionDate() {
|
||||
return lastCollectionDate;
|
||||
}
|
||||
|
||||
public Integer getLastAggregationTotal() {
|
||||
return lastAggregationTotal;
|
||||
}
|
||||
|
||||
public Date getLastAggregationDate() {
|
||||
return lastAggregationDate;
|
||||
}
|
||||
|
||||
public Integer getLastDownloadTotal() {
|
||||
return lastDownloadTotal;
|
||||
}
|
||||
|
||||
public Date getLastDownloadDate() {
|
||||
return lastDownloadDate;
|
||||
}
|
||||
|
||||
public String getBaseurl() {
|
||||
return baseurl;
|
||||
}
|
||||
|
||||
public ApiDetails setId(final String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setProtocol(final String protocol) {
|
||||
this.protocol = protocol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setDatasource(final String datasource) {
|
||||
this.datasource = datasource;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setContentdescription(final String contentdescription) {
|
||||
this.contentdescription = contentdescription;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setCompatibility(final String compatibility) {
|
||||
this.compatibility = compatibility;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setLastCollectionTotal(final Integer lastCollectionTotal) {
|
||||
this.lastCollectionTotal = lastCollectionTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setLastCollectionDate(final Date lastCollectionDate) {
|
||||
this.lastCollectionDate = lastCollectionDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setLastAggregationTotal(final Integer lastAggregationTotal) {
|
||||
this.lastAggregationTotal = lastAggregationTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setLastAggregationDate(final Date lastAggregationDate) {
|
||||
this.lastAggregationDate = lastAggregationDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setLastDownloadTotal(final Integer lastDownloadTotal) {
|
||||
this.lastDownloadTotal = lastDownloadTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setLastDownloadDate(final Date lastDownloadDate) {
|
||||
this.lastDownloadDate = lastDownloadDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApiDetails setBaseurl(final String baseurl) {
|
||||
this.baseurl = baseurl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Set<ApiParamDetails> getApiParams() {
|
||||
return apiParams;
|
||||
}
|
||||
|
||||
public void setApiParams(final Set<ApiParamDetails> apiParams) {
|
||||
this.apiParams = apiParams;
|
||||
}
|
||||
|
||||
public String getCompatibilityOverride() {
|
||||
return compatibilityOverride;
|
||||
}
|
||||
|
||||
public ApiDetails setCompatibilityOverride(final String compatibilityOverride) {
|
||||
this.compatibilityOverride = compatibilityOverride;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getRemovable() {
|
||||
return removable;
|
||||
}
|
||||
|
||||
public ApiDetails setRemovable(final Boolean removable) {
|
||||
this.removable = removable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMetadataIdentifierPath() {
|
||||
return metadataIdentifierPath;
|
||||
}
|
||||
|
||||
public ApiDetails setMetadataIdentifierPath(final String metadataIdentifierPath) {
|
||||
this.metadataIdentifierPath = metadataIdentifierPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEoscDatasourceType() {
|
||||
return eoscDatasourceType;
|
||||
}
|
||||
|
||||
public ApiDetails setEoscDatasourceType(final String eoscDatasourceType) {
|
||||
this.eoscDatasourceType = eoscDatasourceType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTypology() {
|
||||
return typology;
|
||||
}
|
||||
|
||||
public ApiDetails setTypology(final String typology) {
|
||||
this.typology = typology;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ApiDetailsResponse extends Response {
|
||||
|
||||
private List<ApiDetails> api;
|
||||
|
||||
|
||||
public List<ApiDetails> getApi() {
|
||||
return api;
|
||||
}
|
||||
|
||||
public ApiDetailsResponse setApi(final List<ApiDetails> api) {
|
||||
this.api = api;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
public class ApiParamDetails {
|
||||
|
||||
protected String param;
|
||||
protected String value;
|
||||
|
||||
|
||||
public String getParam() {
|
||||
return param;
|
||||
}
|
||||
|
||||
public void setParam(final String param) {
|
||||
this.param = param;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,331 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
public class DatasourceDetails {
|
||||
|
||||
protected String id;
|
||||
@Transient
|
||||
protected String openaireId;
|
||||
protected String officialname;
|
||||
protected String englishname;
|
||||
protected String websiteurl;
|
||||
protected String logourl;
|
||||
protected String contactemail;
|
||||
protected Double latitude = 0.0;
|
||||
protected Double longitude = 0.0;
|
||||
protected Double timezone = 0.0;
|
||||
// protected String timezone;
|
||||
protected String namespaceprefix;
|
||||
protected String languages;
|
||||
protected Date dateofvalidation;
|
||||
protected String eoscDatasourceType;
|
||||
protected Date dateofcollection;
|
||||
protected String platform;
|
||||
protected String activationId;
|
||||
protected String description;
|
||||
protected String issn;
|
||||
protected String eissn;
|
||||
protected String lissn;
|
||||
protected String registeredby;
|
||||
protected String subjects;
|
||||
protected String aggregator = "OPENAIRE";
|
||||
protected String collectedfrom;
|
||||
protected Boolean managed;
|
||||
protected Boolean consentTermsOfUse;
|
||||
protected Boolean fullTextDownload;
|
||||
protected Date consentTermsOfUseDate;
|
||||
protected Date lastConsentTermsOfUseDate;
|
||||
protected Set<OrganizationDetails> organizations;
|
||||
protected Set<IdentitiesDetails> identities;
|
||||
protected String status;
|
||||
@Deprecated
|
||||
protected String typology;
|
||||
protected Date registrationdate;
|
||||
|
||||
public DatasourceDetails() {
|
||||
// no arg constructor
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOpenaireId() {
|
||||
return openaireId;
|
||||
}
|
||||
|
||||
public void setOpenaireId(String openaireId) {
|
||||
this.openaireId = openaireId;
|
||||
}
|
||||
|
||||
public String getOfficialname() {
|
||||
return officialname;
|
||||
}
|
||||
|
||||
public void setOfficialname(String officialname) {
|
||||
this.officialname = officialname;
|
||||
}
|
||||
|
||||
public String getEnglishname() {
|
||||
return englishname;
|
||||
}
|
||||
|
||||
public void setEnglishname(String englishname) {
|
||||
this.englishname = englishname;
|
||||
}
|
||||
|
||||
public String getWebsiteurl() {
|
||||
return websiteurl;
|
||||
}
|
||||
|
||||
public void setWebsiteurl(String websiteurl) {
|
||||
this.websiteurl = websiteurl;
|
||||
}
|
||||
|
||||
public String getLogourl() {
|
||||
return logourl;
|
||||
}
|
||||
|
||||
public void setLogourl(String logourl) {
|
||||
this.logourl = logourl;
|
||||
}
|
||||
|
||||
public String getContactemail() {
|
||||
return contactemail;
|
||||
}
|
||||
|
||||
public void setContactemail(String contactemail) {
|
||||
this.contactemail = contactemail;
|
||||
}
|
||||
|
||||
public Double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(Double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public Double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(Double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
// public String getTimezone() {
|
||||
// return timezone;
|
||||
// }
|
||||
//
|
||||
// public void setTimezone(String timezone) {
|
||||
// this.timezone = timezone;
|
||||
// }
|
||||
|
||||
public String getNamespaceprefix() {
|
||||
return namespaceprefix;
|
||||
}
|
||||
|
||||
public void setNamespaceprefix(String namespaceprefix) {
|
||||
this.namespaceprefix = namespaceprefix;
|
||||
}
|
||||
|
||||
public String getLanguages() {
|
||||
return languages;
|
||||
}
|
||||
|
||||
public void setLanguages(String languages) {
|
||||
this.languages = languages;
|
||||
}
|
||||
|
||||
public Date getDateofvalidation() {
|
||||
return dateofvalidation;
|
||||
}
|
||||
|
||||
public void setDateofvalidation(Date dateofvalidation) {
|
||||
this.dateofvalidation = dateofvalidation;
|
||||
}
|
||||
|
||||
public String getEoscDatasourceType() {
|
||||
return eoscDatasourceType;
|
||||
}
|
||||
|
||||
public void setEoscDatasourceType(String eoscDatasourceType) {
|
||||
this.eoscDatasourceType = eoscDatasourceType;
|
||||
}
|
||||
|
||||
public Date getDateofcollection() {
|
||||
return dateofcollection;
|
||||
}
|
||||
|
||||
public void setDateofcollection(Date dateofcollection) {
|
||||
this.dateofcollection = dateofcollection;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public String getActivationId() {
|
||||
return activationId;
|
||||
}
|
||||
|
||||
public void setActivationId(String activationId) {
|
||||
this.activationId = activationId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getIssn() {
|
||||
return issn;
|
||||
}
|
||||
|
||||
public void setIssn(String issn) {
|
||||
this.issn = issn;
|
||||
}
|
||||
|
||||
public String getEissn() {
|
||||
return eissn;
|
||||
}
|
||||
|
||||
public void setEissn(String eissn) {
|
||||
this.eissn = eissn;
|
||||
}
|
||||
|
||||
public String getLissn() {
|
||||
return lissn;
|
||||
}
|
||||
|
||||
public void setLissn(String lissn) {
|
||||
this.lissn = lissn;
|
||||
}
|
||||
|
||||
public String getRegisteredby() {
|
||||
return registeredby;
|
||||
}
|
||||
|
||||
public void setRegisteredby(String registeredby) {
|
||||
this.registeredby = registeredby;
|
||||
}
|
||||
|
||||
public String getSubjects() {
|
||||
return subjects;
|
||||
}
|
||||
|
||||
public void setSubjects(String subjects) {
|
||||
this.subjects = subjects;
|
||||
}
|
||||
|
||||
public String getAggregator() {
|
||||
return aggregator;
|
||||
}
|
||||
|
||||
public void setAggregator(String aggregator) {
|
||||
this.aggregator = aggregator;
|
||||
}
|
||||
|
||||
public String getCollectedfrom() {
|
||||
return collectedfrom;
|
||||
}
|
||||
|
||||
public void setCollectedfrom(String collectedfrom) {
|
||||
this.collectedfrom = collectedfrom;
|
||||
}
|
||||
|
||||
public Boolean getManaged() {
|
||||
return managed;
|
||||
}
|
||||
|
||||
public void setManaged(Boolean managed) {
|
||||
this.managed = managed;
|
||||
}
|
||||
|
||||
public Boolean getConsentTermsOfUse() {
|
||||
return consentTermsOfUse;
|
||||
}
|
||||
|
||||
public void setConsentTermsOfUse(Boolean consentTermsOfUse) {
|
||||
this.consentTermsOfUse = consentTermsOfUse;
|
||||
}
|
||||
|
||||
public Boolean getFullTextDownload() {
|
||||
return fullTextDownload;
|
||||
}
|
||||
|
||||
public void setFullTextDownload(Boolean fullTextDownload) {
|
||||
this.fullTextDownload = fullTextDownload;
|
||||
}
|
||||
|
||||
public Date getConsentTermsOfUseDate() {
|
||||
return consentTermsOfUseDate;
|
||||
}
|
||||
|
||||
public void setConsentTermsOfUseDate(Date consentTermsOfUseDate) {
|
||||
this.consentTermsOfUseDate = consentTermsOfUseDate;
|
||||
}
|
||||
|
||||
public Date getLastConsentTermsOfUseDate() {
|
||||
return lastConsentTermsOfUseDate;
|
||||
}
|
||||
|
||||
public void setLastConsentTermsOfUseDate(Date lastConsentTermsOfUseDate) {
|
||||
this.lastConsentTermsOfUseDate = lastConsentTermsOfUseDate;
|
||||
}
|
||||
|
||||
public Set<OrganizationDetails> getOrganizations() {
|
||||
return organizations;
|
||||
}
|
||||
|
||||
public void setOrganizations(Set<OrganizationDetails> organizations) {
|
||||
this.organizations = organizations;
|
||||
}
|
||||
|
||||
public Set<IdentitiesDetails> getIdentities() {
|
||||
return identities;
|
||||
}
|
||||
|
||||
public void setIdentities(Set<IdentitiesDetails> identities) {
|
||||
this.identities = identities;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getTypology() {
|
||||
return typology;
|
||||
}
|
||||
|
||||
public void setTypology(String typology) {
|
||||
this.typology = typology;
|
||||
}
|
||||
|
||||
public Date getRegistrationdate() {
|
||||
return registrationdate;
|
||||
}
|
||||
|
||||
public void setRegistrationdate(Date registrationdate) {
|
||||
this.registrationdate = registrationdate;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
|
||||
/**
|
||||
* Created by stefania on 12/17/15.
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DatasourceResponse extends Response {
|
||||
|
||||
private List<DatasourceDetails> datasourceInfo = Lists.newArrayList();
|
||||
|
||||
public DatasourceResponse addDatasourceInfo(final DatasourceDetails datasourceInfo) {
|
||||
getDatasourceInfo().add(datasourceInfo);
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DatasourceDetails> getDatasourceInfo() {
|
||||
return datasourceInfo;
|
||||
}
|
||||
|
||||
public DatasourceResponse setDatasourceInfo(final List<DatasourceDetails> datasourceInfo) {
|
||||
this.datasourceInfo = datasourceInfo;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Header {
|
||||
|
||||
private long total;
|
||||
private int page;
|
||||
private int size;
|
||||
private long time;
|
||||
private int statusCode;
|
||||
private List<String> errors = Lists.newArrayList();
|
||||
|
||||
private Queue<Throwable> exceptions = Lists.newLinkedList();
|
||||
public static Header newInsance() {
|
||||
return new Header();
|
||||
}
|
||||
public Header() {
|
||||
}
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
public Header setTime(final long time) {
|
||||
this.time = time;
|
||||
return this;
|
||||
}
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
public Header setStatusCode(final int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return this;
|
||||
}
|
||||
public long getTotal() {
|
||||
return total;
|
||||
}
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
public Header setPage(final int page) {
|
||||
this.page = page;
|
||||
return this;
|
||||
}
|
||||
public Header setSize(final int size) {
|
||||
this.size = size;
|
||||
return this;
|
||||
}
|
||||
public Header setTotal(final long total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
public Queue<Throwable> getExceptions() {
|
||||
return exceptions;
|
||||
}
|
||||
public Header setExceptions(final Queue<Throwable> exceptions) {
|
||||
this.exceptions = exceptions;
|
||||
return this;
|
||||
}
|
||||
public List<String> getErrors() {
|
||||
return getExceptions().stream()
|
||||
.map(Throwable::getMessage)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
public Header setErrors(final List<String> errors) {
|
||||
this.errors = errors;
|
||||
return this;
|
||||
}
|
||||
public String toJson() {
|
||||
return new GsonBuilder().setPrettyPrinting().create().toJson(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
public class IdentitiesDetails {
|
||||
private String pid;
|
||||
private String issuertype;
|
||||
|
||||
public IdentitiesDetails() {
|
||||
// no arg constructor
|
||||
}
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public String getIssuertype() {
|
||||
return issuertype;
|
||||
}
|
||||
|
||||
public IdentitiesDetails setPid(final String pid) {
|
||||
this.pid = pid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IdentitiesDetails setIssuertype(final String issuertype) {
|
||||
this.issuertype = issuertype;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
public class OrganizationDetails {
|
||||
|
||||
private String legalshortname;
|
||||
private String legalname;
|
||||
private String websiteurl;
|
||||
private String logourl;
|
||||
private String country;
|
||||
|
||||
public OrganizationDetails() {
|
||||
// no arg constructor
|
||||
}
|
||||
|
||||
public String getLegalshortname() {
|
||||
return legalshortname;
|
||||
}
|
||||
|
||||
public void setLegalshortname(String legalshortname) {
|
||||
this.legalshortname = legalshortname;
|
||||
}
|
||||
|
||||
public String getLegalname() {
|
||||
return legalname;
|
||||
}
|
||||
|
||||
public void setLegalname(String legalname) {
|
||||
this.legalname = legalname;
|
||||
}
|
||||
|
||||
public String getWebsiteurl() {
|
||||
return websiteurl;
|
||||
}
|
||||
|
||||
public void setWebsiteurl(String websiteurl) {
|
||||
this.websiteurl = websiteurl;
|
||||
}
|
||||
|
||||
public String getLogourl() {
|
||||
return logourl;
|
||||
}
|
||||
|
||||
public void setLogourl(String logourl) {
|
||||
this.logourl = logourl;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,382 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import eu.dnetlib.domain.data.DataCollectionType;
|
||||
import eu.dnetlib.domain.data.PiwikInfo;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The domain object for the Repository resource data structure
|
||||
*
|
||||
*/
|
||||
public class Repository extends DatasourceDetails {
|
||||
private static final long serialVersionUID = -7241644234046760972L;
|
||||
|
||||
@Deprecated
|
||||
private String datasourceType;
|
||||
|
||||
private List<RepositoryInterface> interfaces = new ArrayList<>();
|
||||
|
||||
private static List<DataCollectionType> dataCollectionTypes = new ArrayList<>();
|
||||
|
||||
|
||||
private PiwikInfo piwikInfo;
|
||||
|
||||
private List<String> environments = new ArrayList<>();
|
||||
|
||||
public Repository() {
|
||||
// this.setDateOfCreation(new Date()); // FIXME: remove this ???
|
||||
// this.setResourceKind("RepositoryServiceResources");
|
||||
// this.setResourceType("RepositoryServiceResourceType");
|
||||
}
|
||||
|
||||
public String getRegisteredBy() {
|
||||
return registeredby;
|
||||
}
|
||||
|
||||
public void setRegisteredBy(String registeredBy) {
|
||||
this.registeredby = registeredBy;
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return englishname;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishname = englishName;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getOfficialName() {
|
||||
return officialname;
|
||||
}
|
||||
|
||||
public void setOfficialName(String officialName) {
|
||||
this.officialname = officialName;
|
||||
}
|
||||
|
||||
public List<RepositoryInterface> getInterfaces() {
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
public void setInterfaces(List<RepositoryInterface> interfaces) {
|
||||
this.interfaces = interfaces;
|
||||
}
|
||||
|
||||
public String getTypology() {
|
||||
return typology;
|
||||
}
|
||||
|
||||
public void setTypology(String typology) {
|
||||
this.typology = typology;
|
||||
}
|
||||
|
||||
public Double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public Double getTimezone() {
|
||||
return timezone;
|
||||
}
|
||||
|
||||
public void setTimezone(Double timezone) throws IllegalArgumentException {
|
||||
if (timezone < -12 || timezone > 12 || (timezone % 0.5) != 0) {
|
||||
String t = String.valueOf(timezone);
|
||||
throw new IllegalArgumentException(
|
||||
"timezone must be in the range [-12.0, 12.0] and must me divided by 0.5. Value given is "
|
||||
+ t);
|
||||
}
|
||||
this.timezone = timezone;
|
||||
}
|
||||
|
||||
public List<DataCollectionType> getDataCollectionTypes() {
|
||||
return dataCollectionTypes;
|
||||
}
|
||||
|
||||
public void setDataCollectionTypes(
|
||||
List<DataCollectionType> dataCollectionTypes) {
|
||||
this.dataCollectionTypes = dataCollectionTypes;
|
||||
}
|
||||
|
||||
public void setEnvironments(List<String> environments) {
|
||||
this.environments = environments;
|
||||
}
|
||||
|
||||
public List<String> getEnvironments() {
|
||||
return environments;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public String getSubjects() {
|
||||
return subjects;
|
||||
}
|
||||
|
||||
public void setSubjects(String subjects) {
|
||||
this.subjects = subjects;
|
||||
}
|
||||
|
||||
// new
|
||||
|
||||
public String getWebsiteUrl() {
|
||||
return websiteurl;
|
||||
}
|
||||
|
||||
public void setWebsiteUrl(String websiteUrl) {
|
||||
this.websiteurl = websiteUrl;
|
||||
}
|
||||
|
||||
public String getLogoUrl() {
|
||||
return logourl;
|
||||
}
|
||||
|
||||
public void setLogoUrl(String logoUrl) {
|
||||
this.logourl = logoUrl;
|
||||
}
|
||||
|
||||
public String getContactEmail() {
|
||||
return contactemail;
|
||||
}
|
||||
|
||||
public void setContactEmail(String contactEmail) {
|
||||
this.contactemail = contactEmail;
|
||||
}
|
||||
|
||||
public Double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(Double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public String getNamespacePrefix() {
|
||||
return namespaceprefix;
|
||||
}
|
||||
|
||||
public void setNamespacePrefix(String namespacePrefix) {
|
||||
this.namespaceprefix = namespacePrefix;
|
||||
}
|
||||
|
||||
public String getLanguages() {
|
||||
return languages;
|
||||
}
|
||||
|
||||
public void setLanguages(String languages) {
|
||||
this.languages = languages;
|
||||
}
|
||||
|
||||
public String getCollectedFrom() {
|
||||
return collectedfrom;
|
||||
}
|
||||
|
||||
public void setCollectedFrom(String collectedFrom) {
|
||||
this.collectedfrom = collectedFrom;
|
||||
}
|
||||
|
||||
public Boolean getManaged() {
|
||||
return managed;
|
||||
}
|
||||
|
||||
public void setManaged(Boolean managed) {
|
||||
this.managed = managed;
|
||||
}
|
||||
|
||||
public String getEoscDatasourceType() {
|
||||
return eoscDatasourceType;
|
||||
}
|
||||
|
||||
public void setEoscDatasourceType(String eoscDatasourceType) {
|
||||
this.eoscDatasourceType = eoscDatasourceType;
|
||||
}
|
||||
|
||||
public Date getDateOfValidation() {
|
||||
return dateofvalidation;
|
||||
}
|
||||
|
||||
public void setDateOfValidation(Date dateOfValidation) {
|
||||
this.dateofvalidation = dateOfValidation;
|
||||
}
|
||||
|
||||
public Date getDateOfCollection() {
|
||||
return dateofcollection;
|
||||
}
|
||||
|
||||
public void setDateOfCollection(Date dateOfCollection) {
|
||||
this.dateofcollection = dateOfCollection;
|
||||
}
|
||||
|
||||
public String getActivationId() {
|
||||
return activationId;
|
||||
}
|
||||
|
||||
public void setActivationId(String activationId) {
|
||||
this.activationId = activationId;
|
||||
}
|
||||
|
||||
public String getAggregator() {
|
||||
return aggregator;
|
||||
}
|
||||
|
||||
public void setAggregator(String aggregator) {
|
||||
this.aggregator = aggregator;
|
||||
}
|
||||
|
||||
public String getIssn() {
|
||||
return issn;
|
||||
}
|
||||
|
||||
public void setIssn(String issn) {
|
||||
this.issn = issn;
|
||||
}
|
||||
|
||||
public String getEissn() {
|
||||
return eissn;
|
||||
}
|
||||
|
||||
public void setEissn(String eissn) {
|
||||
this.eissn = eissn;
|
||||
}
|
||||
|
||||
public String getLissn() {
|
||||
return lissn;
|
||||
}
|
||||
|
||||
public void setLissn(String lissn) {
|
||||
this.lissn = lissn;
|
||||
}
|
||||
|
||||
public void setLatitude(Double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public PiwikInfo getPiwikInfo() {
|
||||
return piwikInfo;
|
||||
}
|
||||
|
||||
public void setPiwikInfo(PiwikInfo piwikInfo) {
|
||||
this.piwikInfo = piwikInfo;
|
||||
}
|
||||
|
||||
public Boolean getConsentTermsOfUse() {
|
||||
return consentTermsOfUse;
|
||||
}
|
||||
|
||||
public void setConsentTermsOfUse(Boolean consentTermsOfUse) {
|
||||
this.consentTermsOfUse = consentTermsOfUse;
|
||||
}
|
||||
|
||||
public Boolean getFullTextDownload() {
|
||||
return fullTextDownload;
|
||||
}
|
||||
|
||||
public void setFullTextDownload(Boolean fullTextDownload) {
|
||||
this.fullTextDownload = fullTextDownload;
|
||||
}
|
||||
|
||||
public Date getConsentTermsOfUseDate() {
|
||||
return consentTermsOfUseDate;
|
||||
}
|
||||
|
||||
public void setConsentTermsOfUseDate(Date consentTermsOfUseDate) {
|
||||
this.consentTermsOfUseDate = consentTermsOfUseDate;
|
||||
}
|
||||
|
||||
public Date getLastConsentTermsOfUseDate() {
|
||||
return lastConsentTermsOfUseDate;
|
||||
}
|
||||
|
||||
public void setLastConsentTermsOfUseDate(Date lastConsentTermsOfUseDate) {
|
||||
this.lastConsentTermsOfUseDate = lastConsentTermsOfUseDate;
|
||||
}
|
||||
|
||||
public Set<OrganizationDetails> getOrganizations() {
|
||||
return organizations;
|
||||
}
|
||||
|
||||
public void setOrganizations(Set<OrganizationDetails> organizations) {
|
||||
this.organizations = organizations;
|
||||
}
|
||||
|
||||
public Set<IdentitiesDetails> getIdentities() {
|
||||
return identities;
|
||||
}
|
||||
|
||||
public void setIdentities(Set<IdentitiesDetails> identities) {
|
||||
this.identities = identities;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDatasourceType() {
|
||||
return datasourceType;
|
||||
}
|
||||
|
||||
public void setDatasourceType(String datasourceType) {
|
||||
this.datasourceType = datasourceType;
|
||||
}
|
||||
|
||||
public Date getRegistrationdate() {
|
||||
return registrationdate;
|
||||
}
|
||||
|
||||
public void setRegistrationdate(Date registrationdate) {
|
||||
this.registrationdate = registrationdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return officialname.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof eu.dnetlib.domain.data.Repository))
|
||||
return false;
|
||||
else
|
||||
return this.equals((eu.dnetlib.domain.data.Repository) o);
|
||||
}
|
||||
|
||||
public boolean equals(eu.dnetlib.domain.data.Repository r) {
|
||||
// TODO: fill with required fields...
|
||||
|
||||
if (this.getEnglishName() != null && r.getEnglishName() == null) {
|
||||
return false;
|
||||
} else if (this.getEnglishName() == null
|
||||
&& r.getEnglishName() != null) {
|
||||
return false;
|
||||
} else if (this.getEnglishName() != null
|
||||
&& r.getEnglishName() != null) {
|
||||
return this.getEnglishName().equals(r.getEnglishName());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RepositoryInterface extends ApiDetails {
|
||||
|
||||
private static final long serialVersionUID = 8013272950607614479L;
|
||||
|
||||
public void updateApiParam(String param, String value) {
|
||||
for (ApiParamDetails entry : apiParams) {
|
||||
if (entry.getParam().equals(param)) {
|
||||
entry.setValue(value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ApiParamDetails newSet = new ApiParamDetails();
|
||||
newSet.setParam(param);
|
||||
newSet.setValue(value);
|
||||
this.apiParams.add(newSet);
|
||||
}
|
||||
|
||||
public void setAccessSet(String accessSet) {
|
||||
if (accessSet != null) {
|
||||
updateApiParam("set", accessSet);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAccessSet() {
|
||||
Map<String, String> map;
|
||||
if (apiParams != null) {
|
||||
map = apiParams.stream().collect(Collectors.toMap(ApiParamDetails::getParam, ApiParamDetails::getValue));
|
||||
return map.get("set");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setAccessFormat(String accessFormat) {
|
||||
updateApiParam("format", accessFormat);
|
||||
}
|
||||
|
||||
public String getAccessFormat() {
|
||||
Map<String, String> map;
|
||||
if (apiParams != null) {
|
||||
map = apiParams.stream().collect(Collectors.toMap(ApiParamDetails::getParam, ApiParamDetails::getValue));
|
||||
return map.get("format");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ package eu.dnetlib.repo.manager.domain;
|
|||
import eu.dnetlib.domain.data.PiwikInfo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
public class RepositorySnippet {
|
||||
|
||||
|
@ -12,18 +13,20 @@ public class RepositorySnippet {
|
|||
private String officialname;
|
||||
private String englishname;
|
||||
private String websiteurl;
|
||||
private String typology;
|
||||
|
||||
private String registeredby;
|
||||
private Organization[] organizations;
|
||||
private String registrationdate;
|
||||
private Date registrationdate;
|
||||
private String eoscDatasourceType;
|
||||
private String logoUrl;
|
||||
private String description;
|
||||
private String fullTextDownload;
|
||||
private String consentTermsOfUse;
|
||||
private Boolean consentTermsOfUse;
|
||||
private Date consentTermsOfUseDate;
|
||||
|
||||
private Date lastConsentTermsOfUseDate;
|
||||
private String eoscDatasourceType;
|
||||
private Boolean fullTextDownload;
|
||||
private Set<OrganizationDetails> organizations;
|
||||
|
||||
@Deprecated
|
||||
private String typology;
|
||||
|
||||
|
||||
private PiwikInfo piwikInfo;
|
||||
|
@ -79,19 +82,18 @@ public class RepositorySnippet {
|
|||
this.typology = typology;
|
||||
}
|
||||
|
||||
public Organization[] getOrganizations() {
|
||||
public Set<OrganizationDetails> getOrganizations() {
|
||||
return organizations;
|
||||
}
|
||||
|
||||
public void setOrganizations(Organization[] organizations) {
|
||||
public void setOrganizations(Set<OrganizationDetails> organizations) {
|
||||
this.organizations = organizations;
|
||||
}
|
||||
|
||||
public String getRegistrationdate() {
|
||||
public Date getRegistrationdate() {
|
||||
return registrationdate;
|
||||
}
|
||||
|
||||
public void setRegistrationdate(String registrationdate) {
|
||||
public void setRegistrationdate(Date registrationdate) {
|
||||
this.registrationdate = registrationdate;
|
||||
}
|
||||
|
||||
|
@ -119,19 +121,19 @@ public class RepositorySnippet {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public String getFullTextDownload() {
|
||||
public Boolean getFullTextDownload() {
|
||||
return fullTextDownload;
|
||||
}
|
||||
|
||||
public void setFullTextDownload(String fullTextDownload) {
|
||||
public void setFullTextDownload(Boolean fullTextDownload) {
|
||||
this.fullTextDownload = fullTextDownload;
|
||||
}
|
||||
|
||||
public String getConsentTermsOfUse() {
|
||||
public Boolean getConsentTermsOfUse() {
|
||||
return consentTermsOfUse;
|
||||
}
|
||||
|
||||
public void setConsentTermsOfUse(String consentTermsOfUse) {
|
||||
public void setConsentTermsOfUse(Boolean consentTermsOfUse) {
|
||||
this.consentTermsOfUse = consentTermsOfUse;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ public class RequestFilter{
|
|||
|
||||
private String registeredby = null;
|
||||
private String typology = null;
|
||||
private String eoscDatasourceType = null;
|
||||
private String country = null;
|
||||
private String id = null;
|
||||
private String officialname = null;
|
||||
|
@ -28,6 +29,14 @@ public class RequestFilter{
|
|||
this.typology = typology;
|
||||
}
|
||||
|
||||
public String getEoscDatasourceType() {
|
||||
return eoscDatasourceType;
|
||||
}
|
||||
|
||||
public void setEoscDatasourceType(String eoscDatasourceType) {
|
||||
this.eoscDatasourceType = eoscDatasourceType;
|
||||
}
|
||||
|
||||
public String getRegisteredby() {
|
||||
return registeredby;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package eu.dnetlib.repo.manager.domain;
|
||||
|
||||
public class Response {
|
||||
|
||||
private Header header;
|
||||
|
||||
public Response() {
|
||||
this.header = new Header();
|
||||
}
|
||||
|
||||
public Header getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
||||
public Response setHeader(final Header header) {
|
||||
this.header = header;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package eu.dnetlib.repo.manager.service;
|
||||
|
||||
import eu.dnetlib.domain.data.PiwikInfo;
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package eu.dnetlib.repo.manager.service;
|
||||
|
||||
import eu.dnetlib.domain.data.PiwikInfo;
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||
import eu.dnetlib.repo.manager.domain.ValidationServiceException;
|
||||
import eu.dnetlib.utils.MailLibrary;
|
||||
|
@ -226,9 +226,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
String message = "Dear administrator" + ",\n" +
|
||||
"\n" +
|
||||
"We received a request to add the following interface: \n\n" +
|
||||
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
|
||||
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
|
||||
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||
"to " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
||||
|
||||
if (comment != null)
|
||||
|
@ -261,9 +261,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" +
|
||||
"\n" +
|
||||
"We received a request to add the following interface: \n\n" +
|
||||
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
|
||||
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
|
||||
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||
"to " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
||||
|
||||
if (comment != null) {
|
||||
|
@ -301,9 +301,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Please note that it usually takes about 3-4 weeks until a data source is indexed and it’s metadata visible on openaire.eu.\n\n" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||
"\n\n\nPlease do not reply to this email\n"+
|
||||
"This message has been generated manually\n\n"+
|
||||
|
@ -333,9 +333,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"Please note that it usually takes about 3-4 weeks until a data source is indexed and it’s metadata visible on openaire.eu.\n\n" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
"\n\nUser Contact:"+ issuerEmail +""+
|
||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||
"\n\n\nPlease do not reply to this email\n"+
|
||||
|
@ -366,9 +366,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"We will check what caused the problem and get back to you within a couple of days.\n\n" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||
"\n\n\nPlease do not reply to this email\n"+
|
||||
"This message has been generated manually\n\n"+
|
||||
|
@ -398,9 +398,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"We will check what caused the problem and get back to you within a couple of days.\n\n" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
"\n\nUser Contact:"+ issuerEmail +""+
|
||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||
"\n\n\nPlease do not reply to this email\n"+
|
||||
|
@ -430,9 +430,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"We will check your transmitted information and adjust the aggregation settings accordingly. Please note that it usually takes about 3-4 weeks until the changes are visible on openaire.eu."+"\n\n" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||
"\n\n\nPlease do not reply to this email\n"+
|
||||
"This message has been generated manually\n\n"+
|
||||
|
@ -460,9 +460,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"We will check your transmitted information and adjust the aggregation settings accordingly. Please note that it usually takes about 3-4 weeks until the changes are visible on openaire.eu."+"\n\n" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
"\n\nUser Contact:"+ issuerEmail +""+
|
||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||
"\n\n\nPlease do not reply to this email\n"+
|
||||
|
@ -494,9 +494,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||
"\n\n\nPlease do not reply to this email\n"+
|
||||
"This message has been generated manually\n\n"+
|
||||
|
@ -526,9 +526,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" +
|
||||
"Registration identifier in OpenAIRE: "+ repository.getNamespacePrefix()+
|
||||
"\nOfficial Name:" + repository.getOfficialName() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseUrl() +
|
||||
"\n\nBase URL: "+ repositoryInterface.getBaseurl() +
|
||||
"\n\nValidation Set: " + repositoryInterface.getAccessSet() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getDesiredCompatibilityLevel() +
|
||||
"\n\nGuidelines: "+ repositoryInterface.getCompatibilityOverride() +
|
||||
"\n\nUser Contact:"+ issuerEmail +""+
|
||||
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
|
||||
"\n\n\nPlease do not reply to this email\n"+
|
||||
|
@ -598,7 +598,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
|
||||
String message = "Dear admin,\n" +
|
||||
"\n" +
|
||||
"the validation job that was automatically submitted for the update/registration of the interface "+repositoryInterface.getId()+" ("+repositoryInterface.getBaseUrl()+", "+repositoryInterface.getAccessSet()+") of the repository "+repository.getId()+" ("+repository.getOfficialName()+") failed to complete." +
|
||||
"the validation job that was automatically submitted for the update/registration of the interface "+repositoryInterface.getId()+" ("+repositoryInterface.getBaseurl()+", "+repositoryInterface.getAccessSet()+") of the repository "+repository.getId()+" ("+repository.getOfficialName()+") failed to complete." +
|
||||
"This message has been generated automatically.\n\n" +
|
||||
"Regards,\n" +
|
||||
"the OpenAIRE technical team\n";
|
||||
|
@ -666,9 +666,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
String message = "Dear administrator" + ",\n" +
|
||||
"\n" +
|
||||
"We received a request to update the following interface: \n\n" +
|
||||
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
|
||||
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
|
||||
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||
"for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
||||
|
||||
if (comment != null)
|
||||
|
@ -700,9 +700,9 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
String message = "Dear user,\n" +
|
||||
"\n" +
|
||||
"We received a request to update the following interface: \n\n" +
|
||||
"Base URL: " + repositoryInterface.getBaseUrl() + "\n" +
|
||||
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
|
||||
"Set: " + repositoryInterface.getAccessSet() + "\n" +
|
||||
"Guidelines: " + repositoryInterface.getDesiredCompatibilityLevel() + "\n\n" +
|
||||
"Guidelines: " + repositoryInterface.getCompatibilityOverride() + "\n\n" +
|
||||
"for " + repository.getDatasourceType() + "[" + repository.getOfficialName() + "].\n";
|
||||
|
||||
if (comment != null) {
|
||||
|
|
|
@ -2,7 +2,7 @@ package eu.dnetlib.repo.manager.service;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.dnetlib.domain.data.PiwikInfo;
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.OrderByField;
|
||||
import eu.dnetlib.repo.manager.domain.OrderByType;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryServiceException;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package eu.dnetlib.repo.manager.service;
|
||||
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.*;
|
||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||
import org.json.JSONException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.google.gson.JsonArray;
|
|||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.Repository;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||
import eu.dnetlib.domain.enabling.Vocabulary;
|
||||
import eu.dnetlib.domain.functionality.validator.JobForValidation;
|
||||
import eu.dnetlib.repo.manager.domain.*;
|
||||
|
@ -78,11 +78,10 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
private static final Map<String, String> invertedDataSourceClass = new HashMap<>();
|
||||
|
||||
|
||||
private final String[] vocabularyNames = {"dnet:countries", "dnet:datasource_typologies", "dnet:compatibilityLevel"};
|
||||
private final String[] vocabularyNames = {"dnet:countries", "dnet:eosc_datasource_types", "dnet:compatibilityLevel"};
|
||||
private final Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<>();
|
||||
private final Map<String, String> countriesMap = new HashMap<>();
|
||||
private final Map<String, String> inverseCountriesMap = new HashMap<>();
|
||||
|
||||
private HttpHeaders httpHeaders;
|
||||
|
||||
@Autowired
|
||||
|
@ -114,15 +113,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
LOGGER.debug("Updated version!");
|
||||
|
||||
for (String key : this.getVocabulary("dnet:datasource_typologies").getAsMap().keySet()) {
|
||||
if (key.contains("aggregator")) {
|
||||
dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
|
||||
dataSourceClass.get("aggregator").add(key);
|
||||
} else if (key.contains("crissystem")) {
|
||||
dataSourceClass.putIfAbsent("cris", new ArrayList<>());
|
||||
dataSourceClass.get("cris").add(key);
|
||||
} else if (key.contains("pubsrepository::journal")) { // do not change order -->
|
||||
dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
|
||||
} else if (key.contains("pubsrepository")) { // do not change order <--
|
||||
if (key.contains("pubsrepository")) { // do not change order <--
|
||||
dataSourceClass.putIfAbsent("opendoar", new ArrayList<>());
|
||||
dataSourceClass.get("opendoar").add(key);
|
||||
} else if (key.contains("datarepository")) {
|
||||
|
@ -130,6 +121,22 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
}
|
||||
}
|
||||
|
||||
for (String key : this.getVocabulary("dnet:eosc_datasource_types").getAsMap().keySet()) {
|
||||
if (key.contains("Aggregator")) {
|
||||
dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
|
||||
dataSourceClass.get("aggregator").add(key);
|
||||
} else if (key.contains("CRIS system")) {
|
||||
dataSourceClass.putIfAbsent("cris", new ArrayList<>());
|
||||
dataSourceClass.get("cris").add(key);
|
||||
} else if (key.contains("Journal archive")) {
|
||||
dataSourceClass.putIfAbsent("journal", new ArrayList<>());
|
||||
dataSourceClass.get("journal").add(key);
|
||||
} else if (key.contains("Repository")) {
|
||||
dataSourceClass.putIfAbsent("repository", new ArrayList<>());
|
||||
dataSourceClass.get("repository").add(key);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, List<String>> entry : dataSourceClass.entrySet()) {
|
||||
entry.getValue().forEach(v -> invertedDataSourceClass.put(v, entry.getKey()));
|
||||
}
|
||||
|
@ -178,9 +185,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
for (String repoId : ids) {
|
||||
requestFilter.setId(repoId);
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||
List<Repository> rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, List.class);
|
||||
|
||||
repos.addAll(converter.toRepositoryList(new JSONObject(rs)));
|
||||
// repos.addAll(converter.toRepositoryList(new JSONObject(rs)));
|
||||
}
|
||||
|
||||
for (Repository r : repos)
|
||||
|
@ -242,12 +249,10 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
String filterKey = "UNKNOWN";
|
||||
if (mode.equalsIgnoreCase("opendoar"))
|
||||
filterKey = "openaire____::opendoar";
|
||||
else if (mode.equalsIgnoreCase("re3data"))
|
||||
filterKey = "openaire____::re3data";
|
||||
if (mode.equalsIgnoreCase("repository"))
|
||||
filterKey = "Repository";
|
||||
else if (mode.equalsIgnoreCase("cris"))
|
||||
filterKey = "eurocrisdris::dris";
|
||||
filterKey = "CRIS system";
|
||||
|
||||
|
||||
LOGGER.debug("Country code equals : " + country);
|
||||
|
@ -256,7 +261,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
UriComponents uriComponents = searchSnipperDatasource(String.valueOf(page), String.valueOf(size));
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setCountry(country);
|
||||
requestFilter.setCollectedfrom(filterKey);
|
||||
requestFilter.setEoscDatasourceType(filterKey);
|
||||
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||
|
@ -317,10 +322,10 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
* from datasource class
|
||||
* we get the datasource type form the inverted map
|
||||
* */
|
||||
r.setDatasourceType(getRepositoryType(r.getDatasourceClass()));
|
||||
r.setDatasourceType(getRepositoryType(r.getEoscDatasourceType()));
|
||||
r.setInterfaces(this.getRepositoryInterface(r.getId()));
|
||||
r.setPiwikInfo(piWikService.getPiwikSiteForRepo(r.getId()));
|
||||
r.setCountryName(getCountryName(r.getCountryCode()));
|
||||
// r.setCountryName(getCountryName(r.getCountryCode()));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -355,7 +360,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
public RepositorySnippet getRepositorySnippetById(String id) throws JSONException, ResourceNotFoundException {
|
||||
|
||||
LOGGER.debug("Retrieving repositories with id : " + id);
|
||||
RepositorySnippet repo = null;
|
||||
RepositorySnippet repo;
|
||||
UriComponents uriComponents = searchSnipperDatasource("0", "100");
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setId(id);
|
||||
|
@ -374,19 +379,25 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
public Repository getRepositoryById(String id) throws JSONException, ResourceNotFoundException {
|
||||
|
||||
LOGGER.debug("Retrieving repositories with id : " + id);
|
||||
Repository repo = null;
|
||||
Repository repo;
|
||||
UriComponents uriComponents = searchDatasource("0", "100");
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setId(id);
|
||||
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||
JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||
// String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||
// JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo");
|
||||
|
||||
if (jsonArray.length() == 0)
|
||||
DatasourceResponse response;
|
||||
response = (DatasourceResponse) restTemplate.postForObject(uriComponents.toUri(), requestFilter, DatasourceResponse.class);
|
||||
List<DatasourceDetails> datasources = response.getDatasourceInfo();
|
||||
if (datasources.size() == 0)
|
||||
throw new ResourceNotFoundException();
|
||||
|
||||
repo = converter.toRepository(jsonArray.getJSONObject(0));
|
||||
return updateRepositoryInfo(repo);
|
||||
// repo = converter.toRepository(jsonArray.getJSONObject(0));
|
||||
// return updateRepositoryInfo(repo);
|
||||
|
||||
return updateRepositoryInfo(converter.toRepository(datasources.get(0)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -459,8 +470,10 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
.path("/{id}")
|
||||
.build().expand(id).encode();
|
||||
|
||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
return converter.toRepositoryInterfaceList(new JSONObject(rs));
|
||||
// String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
ApiDetailsResponse rs = restTemplate.getForObject(uriComponents.toUri(), ApiDetailsResponse.class);
|
||||
|
||||
return converter.toRepositoryInterfaceList(rs.getApi());
|
||||
|
||||
}
|
||||
|
||||
|
@ -469,7 +482,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
||||
|
||||
repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
||||
// repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
||||
repository.setActivationId(UUID.randomUUID().toString());
|
||||
repository.setCollectedFrom("infrastruct_::openaire");
|
||||
|
||||
|
@ -529,10 +542,11 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
.build()
|
||||
.encode();
|
||||
|
||||
String json_repository = converter.toJson(repository);
|
||||
LOGGER.debug("JSON to add(update) -> " + json_repository);
|
||||
// FIXME: problematic
|
||||
// String json_repository = converter.toJson(repository);
|
||||
// LOGGER.debug("JSON to add(update) -> " + json_repository);
|
||||
|
||||
HttpEntity<String> httpEntity = new HttpEntity<>(json_repository, httpHeaders);
|
||||
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders); // TODO: check if it works (Repository contains extra fields)
|
||||
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
|
||||
|
||||
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
||||
|
@ -555,11 +569,11 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
.build()
|
||||
.encode();
|
||||
|
||||
String json_repository = converter.toJson(repository);
|
||||
// FIXME: problematic
|
||||
// String json_repository = converter.toJson(repository);
|
||||
// LOGGER.debug("JSON to update -> " + json_repository);
|
||||
|
||||
LOGGER.debug("JSON to update -> " + json_repository);
|
||||
|
||||
HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders);
|
||||
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders);
|
||||
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity
|
||||
, ResponseEntity.class);
|
||||
|
||||
|
@ -582,14 +596,14 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
Timestamp date = new Timestamp(utilDate.getTime());
|
||||
repository.setDateOfCollection(date);
|
||||
repository.setAggregator("OPENAIRE");
|
||||
repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
||||
// repository.setCountryCode(countriesMap.get(repository.getCountryName()));
|
||||
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/add/")
|
||||
.build()
|
||||
.encode();
|
||||
String json_repository = converter.toJson(repository);
|
||||
HttpEntity<String> httpEntity = new HttpEntity<String>(json_repository, httpHeaders);
|
||||
// String json_repository = converter.toJson(repository);
|
||||
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders);
|
||||
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
|
||||
|
||||
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
||||
|
@ -622,14 +636,14 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
String comment, RepositoryInterface repositoryInterface) throws Exception {
|
||||
Repository e = this.getRepositoryById(repoId);
|
||||
repositoryInterface = createRepositoryInterface(e, repositoryInterface, datatype);
|
||||
String json_interface = converter.toJson(e, repositoryInterface);
|
||||
// String json_interface = converter.toJson(e, repositoryInterface);
|
||||
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(baseAddress + "/ds/api/add/")
|
||||
.build()
|
||||
.encode();
|
||||
|
||||
HttpEntity<String> httpEntity = new HttpEntity<>(json_interface, httpHeaders);
|
||||
HttpEntity<RepositoryInterface> httpEntity = new HttpEntity<>(repositoryInterface, httpHeaders);
|
||||
|
||||
restTemplate.postForObject(uriComponents.toUri(), httpEntity, String.class);
|
||||
|
||||
|
@ -650,8 +664,8 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
String registeredBy,
|
||||
String comment, RepositoryInterface repositoryInterface) throws Exception {
|
||||
|
||||
this.updateBaseUrl(repoId, repositoryInterface.getId(), repositoryInterface.getBaseUrl());
|
||||
this.updateCompliance(repoId, repositoryInterface.getId(), repositoryInterface.getCompliance());
|
||||
this.updateBaseUrl(repoId, repositoryInterface.getId(), repositoryInterface.getBaseurl());
|
||||
this.updateCompliance(repoId, repositoryInterface.getId(), repositoryInterface.getCompatibility());
|
||||
this.updateValidationSet(repoId, repositoryInterface.getId(), repositoryInterface.getAccessSet());
|
||||
|
||||
Repository repository = this.getRepositoryById(repoId);
|
||||
|
@ -676,9 +690,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
job.setActivationId(UUID.randomUUID().toString());
|
||||
job.setAdminEmails(Collections.singletonList(this.adminEmail));
|
||||
job.setBaseUrl(iFace.getBaseUrl());
|
||||
job.setBaseUrl(iFace.getBaseurl());
|
||||
job.setDatasourceId(repo.getId());
|
||||
job.setDesiredCompatibilityLevel(iFace.getDesiredCompatibilityLevel());
|
||||
job.setDesiredCompatibilityLevel(iFace.getCompatibilityOverride());
|
||||
job.setInterfaceId(iFace.getId());
|
||||
job.setOfficialName(repo.getOfficialName());
|
||||
job.setRepoType(repo.getDatasourceType());
|
||||
|
@ -693,8 +707,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
private RepositoryInterface createRepositoryInterface(Repository repo, RepositoryInterface iFace, String datatype) {
|
||||
|
||||
iFace.setContentDescription("metadata");
|
||||
iFace.setCompliance("UNKNOWN");
|
||||
iFace.setDatasource(repo.getId());
|
||||
iFace.setContentdescription("metadata");
|
||||
iFace.setCompatibility("UNKNOWN");
|
||||
|
||||
if (datatype.equals("re3data"))
|
||||
iFace.setAccessFormat("oai_datacite");
|
||||
|
@ -702,8 +717,9 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
iFace.setAccessFormat("oai_dc");
|
||||
|
||||
|
||||
if (repo.getDatasourceClass() != null && !repo.getDatasourceClass().isEmpty())
|
||||
iFace.setTypology(repo.getDatasourceClass());
|
||||
// FIXME: this will probably not work
|
||||
if (repo.getEoscDatasourceType() != null && !repo.getEoscDatasourceType().isEmpty())
|
||||
iFace.setTypology(repo.getEoscDatasourceType());
|
||||
else if (datatype.equalsIgnoreCase("journal"))
|
||||
iFace.setTypology("pubsrepository::journal");
|
||||
else if (datatype.equalsIgnoreCase("aggregator"))
|
||||
|
@ -714,12 +730,12 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
iFace.setTypology("datarepository::unknown");
|
||||
|
||||
iFace.setRemovable(true);
|
||||
iFace.setAccessProtocol("oai");
|
||||
iFace.setProtocol("oai");
|
||||
iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']");
|
||||
iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8));
|
||||
if (iFace.getAccessSet() == null || iFace.getAccessSet().isEmpty()) {
|
||||
LOGGER.debug("set is empty: " + iFace.getAccessSet());
|
||||
iFace.removeAccessSet();
|
||||
// iFace.removeAccessSet();
|
||||
iFace.setAccessSet("none");
|
||||
}
|
||||
return iFace;
|
||||
|
@ -807,6 +823,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
Map<String, String> retMap = new HashMap<String, String>();
|
||||
|
||||
// TODO: refactor (remove?)
|
||||
for (Map.Entry<String, String> entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) {
|
||||
if (mode.equalsIgnoreCase("aggregator")) {
|
||||
if (entry.getKey().contains("aggregator"))
|
||||
|
@ -861,15 +878,22 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
@Override
|
||||
public Map<String, String> getListLatestUpdate(String mode) throws JSONException {
|
||||
if (mode.equals("opendoar"))
|
||||
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate());
|
||||
Map<String, String> dates = new HashMap<>();
|
||||
if (mode.equals("repository")) {
|
||||
dates.put("opendoar", converter.toString(getRepositoryInterface("openaire____::opendoar").get(0).getLastCollectionDate()));
|
||||
dates.put("re3data", converter.toString(getRepositoryInterface("openaire____::re3data").get(1).getLastCollectionDate()));
|
||||
dates.put("fairsharing", converter.toString(getRepositoryInterface("openaire____::fairsharing").get(0).getLastCollectionDate()));
|
||||
return dates;
|
||||
}
|
||||
else if (mode.equals("cris"))
|
||||
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("eurocrisdris::dris").get(0).getLastCollectionDate());
|
||||
return Collections.singletonMap("lastCollectionDate", converter.toString(getRepositoryInterface("eurocrisdris::dris").get(0).getLastCollectionDate()));
|
||||
else if (mode.equals("opendoar")) // TODO: remove this and else clause
|
||||
return Collections.singletonMap("lastCollectionDate", converter.toString(getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate()));
|
||||
else
|
||||
/*
|
||||
* first api of re3data has null value on collection date
|
||||
* */
|
||||
return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::" + mode).get(1).getLastCollectionDate());
|
||||
return Collections.singletonMap("lastCollectionDate", converter.toString(getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate()));
|
||||
}
|
||||
|
||||
private void updateValidationSet(String repositoryId, String repositoryInterfaceId, String validationSet) throws Exception {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.dnetlib.repo.manager.service;
|
||||
|
||||
import eu.dnetlib.api.functionality.ValidatorServiceException;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||
import eu.dnetlib.domain.functionality.validator.*;
|
||||
import eu.dnetlib.repo.manager.domain.Constants;
|
||||
import eu.dnetlib.repo.manager.domain.InterfaceInformation;
|
||||
|
@ -293,7 +293,11 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
|
||||
@Override
|
||||
public List<StoredJob> getJobsSummary(String repoId, int limit) throws JSONException, ValidatorServiceException {
|
||||
return getValidationService().getJobSummary(repositoryService.getRepositoryInterface(repoId).stream().map(RepositoryInterface::getBaseUrl).collect(Collectors.toList()),limit);
|
||||
return getValidationService().getJobSummary(
|
||||
repositoryService.getRepositoryInterface(repoId)
|
||||
.stream()
|
||||
.map(RepositoryInterface::getBaseurl)
|
||||
.collect(Collectors.toList()), limit);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,7 @@ package eu.dnetlib.repo.manager.utils;
|
|||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.dnetlib.domain.data.Repository;
|
||||
import eu.dnetlib.domain.data.RepositoryInterface;
|
||||
import eu.dnetlib.repo.manager.domain.AggregationDetails;
|
||||
import eu.dnetlib.repo.manager.domain.RepositorySnippet;
|
||||
import eu.dnetlib.repo.manager.domain.Timezone;
|
||||
import eu.dnetlib.repo.manager.domain.*;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.json.JSONArray;
|
||||
|
@ -27,137 +23,23 @@ public class Converter {
|
|||
|
||||
private static final Logger LOGGER = Logger.getLogger(Converter.class);
|
||||
|
||||
public Repository toRepository(JSONObject repositoryObject) throws JSONException {
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
Repository repository = new Repository();
|
||||
public Converter() {
|
||||
objectMapper = new ObjectMapper();
|
||||
}
|
||||
public Repository toRepository(Object repositoryObject) {
|
||||
|
||||
// JSONObject datasource = repositoryObject.getJSONObject("datasource");
|
||||
JSONObject datasource = repositoryObject;
|
||||
|
||||
//if( datasource.equals(null))
|
||||
// return null;
|
||||
|
||||
repository.setId(datasource.get("id").toString());
|
||||
repository.setOfficialName(datasource.get("officialname").toString());
|
||||
|
||||
repository.setEnglishName(datasource.get("englishname").toString());
|
||||
if (repository.getEnglishName().equals("null"))
|
||||
repository.setEnglishName("");
|
||||
|
||||
repository.setWebsiteUrl(datasource.get("websiteurl").toString());
|
||||
if (repository.getWebsiteUrl().equals("null"))
|
||||
repository.setWebsiteUrl("");
|
||||
|
||||
repository.setLogoUrl(datasource.get("logourl").toString());
|
||||
if (repository.getLogoUrl().equals("null"))
|
||||
repository.setLogoUrl("");
|
||||
|
||||
repository.setContactEmail(datasource.get("contactemail").toString());
|
||||
if (repository.getContactEmail().equals("null"))
|
||||
repository.setContactEmail("");
|
||||
|
||||
|
||||
repository.setLatitude(toDouble(datasource.get("latitude").toString()));
|
||||
repository.setLongitude(toDouble(datasource.get("longitude").toString()));
|
||||
Double timezone = toDouble(datasource.get("timezone").toString());
|
||||
repository.setTimezone(timezone != null ? timezone : 0.0);
|
||||
repository.setNamespacePrefix(datasource.get("namespaceprefix").toString());
|
||||
repository.setOdLanguages(datasource.get("languages").toString());
|
||||
repository.setDateOfValidation(toDate(datasource.get("dateofvalidation").toString()));
|
||||
|
||||
/* typology -> platform
|
||||
* datasource class -> typology */
|
||||
repository.setTypology(datasource.get("platform").toString());
|
||||
if (repository.getTypology().equals("null"))
|
||||
repository.setTypology("");
|
||||
|
||||
// // TODO: enable in future release
|
||||
// /* 07-04-2022 | "typology" -> "eoscDatasourceType" */
|
||||
// try { // FIXME: remove attemp to get typology if eoscDatasourceType fails
|
||||
// repository.setDatasourceClass(datasource.get("eoscDatasourceType").toString());
|
||||
// } catch (JSONException e) {
|
||||
// repository.setDatasourceClass(datasource.get("typology").toString());
|
||||
// }
|
||||
repository.setDatasourceClass(datasource.get("typology").toString());
|
||||
// <--
|
||||
|
||||
repository.setDateOfCollection(toDate(datasource.get("dateofcollection").toString()));
|
||||
repository.setActivationId(datasource.get("activationId").toString());
|
||||
|
||||
repository.setDescription(datasource.get("description").toString());
|
||||
if (repository.getDescription().equals("null"))
|
||||
repository.setDescription("");
|
||||
|
||||
repository.setIssn(datasource.get("issn").toString());
|
||||
repository.setLissn(datasource.get("lissn").toString());
|
||||
if (repository.getLissn().equals("null"))
|
||||
repository.setLissn("");
|
||||
repository.setEissn(datasource.get("eissn").toString());
|
||||
if (repository.getEissn().equals("null"))
|
||||
repository.setEissn("");
|
||||
repository.setRegisteredBy(datasource.get("registeredby").toString());
|
||||
|
||||
/* managed field */
|
||||
repository.setRegistered(Boolean.parseBoolean(datasource.get("managed").toString()));
|
||||
|
||||
//subjects
|
||||
|
||||
repository.setAggregator(datasource.get("aggregator").toString());
|
||||
repository.setCollectedFrom(datasource.get("collectedfrom").toString());
|
||||
|
||||
//TODO change organization to list
|
||||
JSONArray organizations = ((JSONArray) datasource.get("organizations"));
|
||||
if (organizations.length() != 0) {
|
||||
repository.setOrganization(((JSONArray) datasource.get("organizations")).getJSONObject(0).get("legalname").toString());
|
||||
String countryCode = ((JSONArray) datasource.get("organizations")).getJSONObject(0).get("country").toString();
|
||||
repository.setCountryCode(countryCode);
|
||||
}
|
||||
|
||||
repository.setConsentTermsOfUse(convertStringToBoolean(datasource.get("consentTermsOfUse").toString()));
|
||||
repository.setConsentTermsOfUseDate(null);
|
||||
repository.setLastConsentTermsOfUseDate(null);
|
||||
try {
|
||||
repository.setConsentTermsOfUseDate(toDate(datasource.get("consentTermsOfUseDate").toString()));
|
||||
repository.setLastConsentTermsOfUseDate(toDate(datasource.get("lastConsentTermsOfUseDate").toString()));
|
||||
} catch (JSONException e) {
|
||||
LOGGER.error("Error setting consentTermsOfUseDate date and lastConsentTermsOfUseDate", e);
|
||||
}
|
||||
repository.setFullTextDownload(convertStringToBoolean(datasource.get("fullTextDownload").toString()));
|
||||
|
||||
/* identities field */
|
||||
Repository repository = objectMapper.convertValue(repositoryObject, Repository.class);
|
||||
|
||||
return repository;
|
||||
}
|
||||
|
||||
public RepositorySnippet toRepositorySnippet(JSONObject repositorySnippetObject) throws JSONException {
|
||||
public RepositorySnippet toRepositorySnippet(JSONObject repositorySnippetObject) {
|
||||
|
||||
RepositorySnippet snippet = objectMapper.convertValue(repositorySnippetObject, RepositorySnippet.class);
|
||||
|
||||
RepositorySnippet repositorySnippet = new RepositorySnippet();
|
||||
|
||||
// JSONObject datasource = repositorySnippetObject.getJSONObject("datasource");
|
||||
|
||||
|
||||
repositorySnippet.setId(repositorySnippetObject.get("id").toString());
|
||||
repositorySnippet.setOfficialname(repositorySnippetObject.get("officialname").toString());
|
||||
|
||||
repositorySnippet.setEnglishname(repositorySnippetObject.get("englishname").toString());
|
||||
if (repositorySnippet.getEnglishname().equals("null"))
|
||||
repositorySnippet.setEnglishname("");
|
||||
|
||||
repositorySnippet.setWebsiteurl(repositorySnippetObject.get("websiteurl").toString());
|
||||
if (repositorySnippet.getWebsiteurl().equals("null"))
|
||||
repositorySnippet.setWebsiteurl("");
|
||||
|
||||
repositorySnippet.setRegisteredby(repositorySnippetObject.get("registeredby").toString());
|
||||
if (repositorySnippet.getRegisteredby().equals("null"))
|
||||
repositorySnippet.setRegisteredby("");
|
||||
|
||||
repositorySnippet.setConsentTermsOfUse(repositorySnippetObject.get("consenttermsofuse").toString());
|
||||
repositorySnippet.setFullTextDownload(repositorySnippetObject.get("fulltextdownload").toString());
|
||||
repositorySnippet.setConsentTermsOfUseDate(toDate(repositorySnippetObject.get("consenttermsofusedate").toString()));
|
||||
|
||||
return repositorySnippet;
|
||||
|
||||
return snippet;
|
||||
}
|
||||
|
||||
public List<Repository> toRepositoryList(JSONObject json) throws JSONException {
|
||||
|
@ -178,172 +60,30 @@ public class Converter {
|
|||
return resultSet;
|
||||
}
|
||||
|
||||
public RepositoryInterface toRepositoryInterface(JSONObject repositoryInterfaceObject) throws JSONException {
|
||||
public List<RepositoryInterface> toRepositoryInterfaceList(List<ApiDetails> apiDetailsList) throws JSONException {
|
||||
|
||||
RepositoryInterface repositoryInterface = new RepositoryInterface();
|
||||
List<RepositoryInterface> resultSet = new ArrayList<>();
|
||||
|
||||
repositoryInterface.setId(repositoryInterfaceObject.get("id").toString());
|
||||
repositoryInterface.setAccessProtocol(repositoryInterfaceObject.get("protocol").toString());
|
||||
repositoryInterface.setContentDescription(repositoryInterfaceObject.get("contentdescription").toString());
|
||||
for (ApiDetails entry : apiDetailsList)
|
||||
resultSet.add(toRepositoryInterface(entry));
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
// /* 07-04-2022 | "typology" -> "eoscDatasourceType" */
|
||||
// // TODO: enable in future release
|
||||
// try { // FIXME: remove attemp to get typology if eoscDatasourceType fails
|
||||
// repositoryInterface.setTypology(repositoryInterfaceObject.get("eoscDatasourceType").toString());
|
||||
// } catch (JSONException e) {
|
||||
// repositoryInterface.setTypology(repositoryInterfaceObject.get("typology").toString());
|
||||
// }
|
||||
repositoryInterface.setTypology(repositoryInterfaceObject.get("typology").toString());
|
||||
// <--
|
||||
public RepositoryInterface toRepositoryInterface(Object repositoryInterfaceObject) {
|
||||
|
||||
repositoryInterface.setCompliance(repositoryInterfaceObject.get("compatibility").toString());
|
||||
repositoryInterface.setLastCollectionDate(repositoryInterfaceObject.get("lastCollectionDate").toString());
|
||||
RepositoryInterface repoInterface = objectMapper.convertValue(repositoryInterfaceObject, RepositoryInterface.class);
|
||||
|
||||
repositoryInterface.setBaseUrl(repositoryInterfaceObject.get("baseurl").toString());
|
||||
repositoryInterface.setRemovable(Boolean.parseBoolean(repositoryInterfaceObject.get("removable").toString()));
|
||||
|
||||
|
||||
// repositoryInterface.setMetadataIdentifierPath(repositoryInterfaceObject.get("metadataIdentifierPath").toString());
|
||||
repositoryInterface.setDesiredCompatibilityLevel(repositoryInterfaceObject.get("compatibility").toString());
|
||||
//repositoryInterface.setActive(Boolean.parseBoolean(repositoryInterfaceObject.get("active").toString()));
|
||||
|
||||
|
||||
Map<String, String> accessParams = new HashMap<>();
|
||||
Map<String, String> extraFields = new HashMap<>();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JSONArray apiparams = repositoryInterfaceObject.getJSONArray("apiParams");
|
||||
|
||||
for (int i = 0; i < apiparams.length(); i++)
|
||||
accessParams.put(apiparams.getJSONObject(i).getString("param"), apiparams.getJSONObject(i).getString("value"));
|
||||
|
||||
repositoryInterface.setAccessParams(accessParams);
|
||||
|
||||
return repositoryInterface;
|
||||
return repoInterface;
|
||||
}
|
||||
|
||||
public String toJson(Repository repository) throws JsonProcessingException {
|
||||
|
||||
HashMap<String, Object> repositoryMap = new HashMap<>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
repositoryMap.put("id", repository.getId());
|
||||
repositoryMap.put("openaireId", getOpenaireId(repository.getId()));
|
||||
repositoryMap.put("officialname", repository.getOfficialName());
|
||||
repositoryMap.put("englishname", repository.getEnglishName());
|
||||
repositoryMap.put("websiteurl", repository.getWebsiteUrl());
|
||||
repositoryMap.put("logourl", repository.getLogoUrl());
|
||||
repositoryMap.put("contactemail", repository.getContactEmail());
|
||||
repositoryMap.put("longitude", repository.getLongitude().toString());
|
||||
repositoryMap.put("latitude", repository.getLatitude().toString());
|
||||
repositoryMap.put("timezone", repository.getTimezone());
|
||||
|
||||
repositoryMap.put("namespaceprefix", repository.getNamespacePrefix() != null ? repository.getNamespacePrefix() : "");
|
||||
repositoryMap.put("languages", repository.getOdLanguages() != null ? repository.getOdLanguages() : "");
|
||||
|
||||
repositoryMap.put("dateofcollection", repository.getDateOfCollection() != null ? toString(repository.getDateOfCollection()) : "");
|
||||
|
||||
/*
|
||||
* typology -> platform
|
||||
* datasource class -> typology
|
||||
* */
|
||||
// repositoryMap.put("eoscDatasourceType", repository.getDatasourceClass()); // TODO: enable in future release
|
||||
repositoryMap.put("platform", repository.getTypology());
|
||||
|
||||
repositoryMap.put("dateofvalidation", repository.getDateOfCollection() != null ? toString(repository.getDateOfCollection()) : "");
|
||||
repositoryMap.put("activationId", repository.getActivationId() != null ? repository.getActivationId() : "");
|
||||
|
||||
repositoryMap.put("description", repository.getDescription());
|
||||
|
||||
repositoryMap.put("eissn", repository.getEissn() != null ? repository.getEissn() : "");
|
||||
repositoryMap.put("issn", repository.getIssn() != null ? repository.getIssn() : "");
|
||||
repositoryMap.put("lissn", repository.getLissn() != null ? repository.getLissn() : "");
|
||||
|
||||
repositoryMap.put("registeredby", repository.getRegisteredBy());
|
||||
|
||||
repositoryMap.put("aggregator", repository.getAggregator() != null ? repository.getAggregator() : "");
|
||||
repositoryMap.put("collectedfrom", repository.getCollectedFrom() != null ? repository.getCollectedFrom() : "");
|
||||
|
||||
repositoryMap.put("managed", repository.isRegistered());
|
||||
|
||||
Map<String, String> organization = new HashMap<>();
|
||||
organization.put("legalname", repository.getOrganization());
|
||||
organization.put("country", repository.getCountryCode());
|
||||
organization.put("legalshortname", "");
|
||||
organization.put("websiteurl", "");
|
||||
organization.put("logourl", "");
|
||||
|
||||
List organizations = new ArrayList();
|
||||
organizations.add(organization);
|
||||
repositoryMap.put("organizations", organizations);
|
||||
|
||||
//TODO check identitites
|
||||
//Map<String,String> identity = new HashMap<>();
|
||||
|
||||
if (repository.getPiwikInfo() != null) {
|
||||
Map<String, Object> identity = new HashMap<>();
|
||||
HashSet<Map<String, Object>> identities = new HashSet<>();
|
||||
|
||||
identity.put("issuertype", "piwik");
|
||||
identity.put("pid", "piwik:" + repository.getPiwikInfo().getSiteId());
|
||||
|
||||
identities.add(identity);
|
||||
|
||||
repositoryMap.put("identities", identities);
|
||||
}
|
||||
|
||||
repositoryMap.put("subjects", "");
|
||||
repositoryMap.put("consentTermsOfUse", repository.getConsentTermsOfUse());
|
||||
repositoryMap.put("fullTextDownload", repository.getFullTextDownload());
|
||||
repositoryMap.put("consentTermsOfUseDate", toString(repository.getConsentTermsOfUseDate()));
|
||||
repositoryMap.put("lastConsentTermsOfUseDate", toString(repository.getLastConsentTermsOfUseDate()));
|
||||
|
||||
return mapper.writeValueAsString(repositoryMap);
|
||||
return objectMapper.writeValueAsString(repository);
|
||||
}
|
||||
|
||||
public String toJson(Repository repository, RepositoryInterface repositoryInterface) throws JSONException {
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
jsonObject.put("id", repositoryInterface.getId());
|
||||
jsonObject.put("protocol", repositoryInterface.getAccessProtocol());
|
||||
jsonObject.put("datasource", repository.getId());
|
||||
jsonObject.put("contentdescription", repositoryInterface.getContentDescription());
|
||||
jsonObject.put("typology", repositoryInterface.getTypology());
|
||||
jsonObject.put("compatibility", repositoryInterface.getDesiredCompatibilityLevel());
|
||||
jsonObject.put("compatibilityOverride", repositoryInterface.getDesiredCompatibilityLevel());
|
||||
|
||||
jsonObject.put("lastCollectionTotal", "");
|
||||
|
||||
jsonObject.put("lastCollectionDate", repositoryInterface.getLastCollectionDate());
|
||||
jsonObject.put("lastAggregationTotal", "");
|
||||
jsonObject.put("lastAggregationDate", "");
|
||||
jsonObject.put("lastDownloadTotal", "");
|
||||
jsonObject.put("lastDownloadDate", "");
|
||||
|
||||
jsonObject.put("baseurl", repositoryInterface.getBaseUrl());
|
||||
jsonObject.put("removable", repositoryInterface.isRemovable());
|
||||
|
||||
|
||||
JSONArray apiparams = new JSONArray();
|
||||
for (String param : repositoryInterface.getAccessParams().keySet()) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("param", param);
|
||||
jo.put("value", repositoryInterface.getAccessParams().get(param));
|
||||
apiparams.put(jo);
|
||||
}
|
||||
jsonObject.put("apiParams", apiparams);
|
||||
|
||||
|
||||
// jsonObject.put("metadataIdentifierPath",repositoryInterface.getMetadataIdentifierPath());
|
||||
|
||||
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
public ArrayList<String> readFile(String filename) {
|
||||
public List<String> readFile(String filename) {
|
||||
String line;
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
try {
|
||||
//InputStream in = Converter.class.getResourceAsStream("resources/eu/dnetlib/repo/manager/service/utils/"+filename);
|
||||
InputStream in = Converter.class.getClass().getResourceAsStream("/eu/**/" + filename);
|
||||
|
@ -402,7 +142,7 @@ public class Converter {
|
|||
return null;
|
||||
}
|
||||
|
||||
private String toString(Date date) {
|
||||
public String toString(Date date) {
|
||||
|
||||
if (Objects.equals(date, null))
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue