Compare commits

...

23 Commits

Author SHA1 Message Date
Michele Artini 1b9bf9938c automatic readonly mode when import is running 2024-06-28 10:54:01 +02:00
Michele Artini 8e353f7fa3 added a new working table to import the suggestions 2024-06-11 13:22:22 +02:00
Michele Artini 140e14e48d [maven-release-plugin] prepare for next development iteration 2024-05-17 10:18:09 +02:00
Michele Artini 180aedd918 [maven-release-plugin] prepare release dnet-applications-3.5.4 2024-05-17 10:18:06 +02:00
Michele Artini 8e82868559 Merge pull request 'communities-displayname-field' (#20) from communities-displayname-field into master
Reviewed-on: #20
2024-05-17 10:16:34 +02:00
Michele Artini 1415976a0f communities: display name and shortname 2024-05-13 10:42:52 +02:00
Michele Artini 40db13d562 new fields 2024-05-09 13:17:49 +02:00
Michele Artini 550baf79e4 community plan as enum 2024-05-09 10:11:50 +02:00
Michele Artini 3cbce1024c paging in suggestion api 2024-05-06 11:21:59 +02:00
Michele Artini 760791578b limits in application.properties 2024-05-03 13:55:29 +02:00
Michele Artini 19bc482244 added a default limit in suggestion pages 2024-05-03 12:23:43 +02:00
Michele Artini db18cb601c [maven-release-plugin] prepare for next development iteration 2024-04-04 11:33:49 +02:00
Michele Artini 4ea0d8e0f3 [maven-release-plugin] prepare release dnet-applications-3.5.3 2024-04-04 11:33:27 +02:00
Michele Artini d750fc7180 fixed a NPE 2024-04-04 11:31:30 +02:00
Michele Artini 90effab182 [maven-release-plugin] prepare for next development iteration 2024-03-27 14:10:29 +01:00
Michele Artini e023f3774e [maven-release-plugin] prepare release dnet-applications-3.5.2 2024-03-27 14:10:26 +01:00
Michele Artini 1975d26052 empty params in /context/iis/conf/* 2024-03-27 10:19:10 +01:00
Michele Artini 6620f8463b [maven-release-plugin] prepare for next development iteration 2024-03-22 08:17:29 +01:00
Michele Artini 675b233470 [maven-release-plugin] prepare release dnet-applications-3.5.1 2024-03-22 08:17:25 +01:00
Michele Artini d392f10e4b Merge pull request 'merged the sub classes in the main class' (#19) from dsm_aggregation_info_simplified_model into master
Reviewed-on: #19
2024-03-19 14:32:17 +01:00
Michele Artini ed73d524d8 merged the sub classes in the main class 2024-03-18 11:19:16 +01:00
Michele Artini d2da1a1270 [maven-release-plugin] prepare for next development iteration 2024-03-13 09:51:57 +01:00
Michele Artini cbe02e457c [maven-release-plugin] prepare release dnet-applications-3.5.0 2024-03-13 09:51:54 +01:00
48 changed files with 699 additions and 504 deletions

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId> <artifactId>apps</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId> <artifactId>apps</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId> <artifactId>apps</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId> <artifactId>apps</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId> <artifactId>apps</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -38,6 +38,7 @@ import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails; import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType; import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType;
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization; import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
import eu.dnetlib.openaire.exporter.model.community.CommunityPlanType;
import eu.dnetlib.openaire.exporter.model.community.CommunityProject; import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus; import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
import eu.dnetlib.openaire.exporter.model.community.CommunityType; import eu.dnetlib.openaire.exporter.model.community.CommunityType;
@ -242,6 +243,7 @@ public class CommunityImporterService {
details.setId(c.getId()); details.setId(c.getId());
details.setShortName(c.getLabel()); details.setShortName(c.getLabel());
details.setDisplayShortName(c.getLabel());
details.setLastUpdateDate(CommunityMappingUtils.asLocalDateTime(c.getLastUpdateDate())); details.setLastUpdateDate(CommunityMappingUtils.asLocalDateTime(c.getLastUpdateDate()));
details.setCreationDate(CommunityMappingUtils.asLocalDateTime(c.getCreationDate())); details.setCreationDate(CommunityMappingUtils.asLocalDateTime(c.getCreationDate()));
details.setQueryId(c.getId() + PIPE_SEPARATOR + c.getLabel()); details.setQueryId(c.getId() + PIPE_SEPARATOR + c.getLabel());
@ -259,6 +261,8 @@ public class CommunityImporterService {
} }
details.setName(StringUtils.firstNonBlank(asCsv(CSUMMARY_NAME, c.getParams()), c.getLabel())); details.setName(StringUtils.firstNonBlank(asCsv(CSUMMARY_NAME, c.getParams()), c.getLabel()));
details.setDisplayName(StringUtils.firstNonBlank(asCsv(CSUMMARY_NAME, c.getParams()), c.getLabel()));
details.setZenodoCommunity(asCsv(CSUMMARY_ZENODOC, c.getParams())); details.setZenodoCommunity(asCsv(CSUMMARY_ZENODOC, c.getParams()));
details.setSubjects(splitValues(asValues(CPROFILE_SUBJECT, c.getParams()), CSV_DELIMITER)); details.setSubjects(splitValues(asValues(CPROFILE_SUBJECT, c.getParams()), CSV_DELIMITER));
details.setFos(splitValues(asValues(CPROFILE_FOS, c.getParams()), CSV_DELIMITER)); details.setFos(splitValues(asValues(CPROFILE_FOS, c.getParams()), CSV_DELIMITER));
@ -268,7 +272,7 @@ public class CommunityImporterService {
// In the map the string is the serialization of the json representing the selection criteria so it is a valid json // In the map the string is the serialization of the json representing the selection criteria so it is a valid json
details.setRemoveConstraints(SelectionCriteria.fromJson(asCsv(CPROFILE_REMOVE_CONSTRAINT, c.getParams()))); details.setRemoveConstraints(SelectionCriteria.fromJson(asCsv(CPROFILE_REMOVE_CONSTRAINT, c.getParams())));
details.setSuggestedAcknowledgements(splitValues(asValues(CPROFILE_SUGGESTED_ACKNOWLEDGEMENT, c.getParams()), CSV_DELIMITER)); details.setSuggestedAcknowledgements(splitValues(asValues(CPROFILE_SUGGESTED_ACKNOWLEDGEMENT, c.getParams()), CSV_DELIMITER));
details.setPlan(null); details.setPlan(CommunityPlanType.Default);
try { try {
details.setCreationDate(CommunityMappingUtils.asLocalDateTime(asCsv(CPROFILE_CREATIONDATE, c.getParams()))); details.setCreationDate(CommunityMappingUtils.asLocalDateTime(asCsv(CPROFILE_CREATIONDATE, c.getParams())));
} catch (final Exception e) { } catch (final Exception e) {

View File

@ -27,6 +27,7 @@ import eu.dnetlib.openaire.community.utils.CommunityClaimTypeConverter;
import eu.dnetlib.openaire.community.utils.CommunityMembershipTypeConverter; import eu.dnetlib.openaire.community.utils.CommunityMembershipTypeConverter;
import eu.dnetlib.openaire.exporter.model.community.CommunityClaimType; import eu.dnetlib.openaire.exporter.model.community.CommunityClaimType;
import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType; import eu.dnetlib.openaire.exporter.model.community.CommunityMembershipType;
import eu.dnetlib.openaire.exporter.model.community.CommunityPlanType;
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus; import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
import eu.dnetlib.openaire.exporter.model.community.CommunityType; import eu.dnetlib.openaire.exporter.model.community.CommunityType;
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria; import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
@ -52,6 +53,12 @@ public class DbCommunity implements Serializable {
@Column(name = "shortname") @Column(name = "shortname")
private String shortName; private String shortName;
@Column(name = "displayname")
private String displayName;
@Column(name = "displayshortname")
private String displayShortName;
@Column(name = "description") @Column(name = "description")
private String description; private String description;
@ -115,7 +122,8 @@ public class DbCommunity implements Serializable {
private String[] suggestedAcknowledgements; private String[] suggestedAcknowledgements;
@Column(name = "plan") @Column(name = "plan")
private String plan; @Enumerated(EnumType.STRING)
private CommunityPlanType plan;
public String getId() { public String getId() {
return id; return id;
@ -141,6 +149,22 @@ public class DbCommunity implements Serializable {
this.shortName = shortName; this.shortName = shortName;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(final String displayName) {
this.displayName = displayName;
}
public String getDisplayShortName() {
return displayShortName;
}
public void setDisplayShortName(final String displayShortName) {
this.displayShortName = displayShortName;
}
public String getDescription() { public String getDescription() {
return description; return description;
} }
@ -269,11 +293,11 @@ public class DbCommunity implements Serializable {
this.suggestedAcknowledgements = suggestedAcknowledgements; this.suggestedAcknowledgements = suggestedAcknowledgements;
} }
public String getPlan() { public CommunityPlanType getPlan() {
return plan; return plan;
} }
public void setPlan(final String plan) { public void setPlan(final CommunityPlanType plan) {
this.plan = plan; this.plan = plan;
} }

View File

@ -50,6 +50,8 @@ public class CommunityMappingUtils {
c.setId(details.getId()); c.setId(details.getId());
c.setName(details.getName()); c.setName(details.getName());
c.setShortName(details.getShortName()); c.setShortName(details.getShortName());
c.setDisplayName(details.getDisplayName());
c.setDisplayShortName(details.getDisplayShortName());
c.setDescription(details.getDescription()); c.setDescription(details.getDescription());
c.setStatus(details.getStatus()); c.setStatus(details.getStatus());
c.setLogoUrl(details.getLogoUrl()); c.setLogoUrl(details.getLogoUrl());
@ -77,6 +79,12 @@ public class CommunityMappingUtils {
if (StringUtils.isNotBlank(details.getShortName())) { if (StringUtils.isNotBlank(details.getShortName())) {
c.setShortName(details.getShortName()); c.setShortName(details.getShortName());
} }
if (StringUtils.isNotBlank(details.getDisplayName())) {
c.setDisplayName(details.getDisplayName());
}
if (StringUtils.isNotBlank(details.getDisplayShortName())) {
c.setDisplayShortName(details.getDisplayShortName());
}
if (StringUtils.isNotBlank(details.getDescription())) { if (StringUtils.isNotBlank(details.getDescription())) {
c.setDescription(details.getDescription()); c.setDescription(details.getDescription());
} }
@ -138,8 +146,10 @@ public class CommunityMappingUtils {
private static void populateSummary(final CommunitySummary summary, final DbCommunity c) { private static void populateSummary(final CommunitySummary summary, final DbCommunity c) {
summary.setId(c.getId()); summary.setId(c.getId());
summary.setShortName(c.getShortName());
summary.setName(c.getName()); summary.setName(c.getName());
summary.setShortName(c.getShortName());
summary.setDisplayName(c.getDisplayName());
summary.setDisplayShortName(c.getDisplayShortName());
summary.setLastUpdateDate(c.getLastUpdateDate()); summary.setLastUpdateDate(c.getLastUpdateDate());
summary.setCreationDate(c.getCreationDate()); summary.setCreationDate(c.getCreationDate());
summary.setQueryId(c.getId() + PIPE_SEPARATOR + c.getShortName()); summary.setQueryId(c.getId() + PIPE_SEPARATOR + c.getShortName());

View File

@ -48,11 +48,7 @@ import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo; import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1; import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationStage; import eu.dnetlib.openaire.exporter.model.dsm.AggregationStage;
import eu.dnetlib.openaire.exporter.model.dsm.CollectionInfoV1;
import eu.dnetlib.openaire.exporter.model.dsm.CollectionInfoV2;
import eu.dnetlib.openaire.exporter.model.dsm.CollectionMode; import eu.dnetlib.openaire.exporter.model.dsm.CollectionMode;
import eu.dnetlib.openaire.exporter.model.dsm.TransformationInfoV1;
import eu.dnetlib.openaire.exporter.model.dsm.TransformationInfoV2;
import eu.dnetlib.openaire.info.JdbcInfoDao; import eu.dnetlib.openaire.info.JdbcInfoDao;
/** /**
@ -94,18 +90,19 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
@Cacheable("dsm-aggregationhistory-cache-v1") @Cacheable("dsm-aggregationhistory-cache-v1")
@Deprecated @Deprecated
public List<AggregationInfoV1> getAggregationHistoryV1(final String dsId) throws DsmApiException { public List<AggregationInfoV1> getAggregationHistoryV1(final String dsId) throws DsmApiException {
return getAggregationHistory(dsId, queryForAggregationHistoryV1(dsId, "(collect|transform)"), getMapperV1()); return getAggregationHistoryV1(dsId, queryForAggregationHistoryV1(dsId, "(collect|transform)"), getMapperV1());
} }
@Override @Override
@Cacheable("dsm-aggregationhistory-cache-v2") @Cacheable("dsm-aggregationhistory-cache-v2")
public List<AggregationInfo> getAggregationHistoryV2(final String dsId) throws DsmApiException { public List<AggregationInfo> getAggregationHistoryV2(final String dsId) throws DsmApiException {
return getAggregationHistory(dsId, queryForAggregationHistoryV2(dsId, "(collect|transform)"), getMapperV2()); return getAggregationHistoryV2(dsId, queryForAggregationHistoryV2(dsId, "(collect|transform)"), getMapperV2());
} }
private <T extends AggregationInfo> List<T> getAggregationHistory(final String dsId, @Deprecated
private List<AggregationInfoV1> getAggregationHistoryV1(final String dsId,
final Bson queryForAggregationHistory, final Bson queryForAggregationHistory,
final Function<Document, T> mapper) throws DsmApiException { final Function<Document, AggregationInfoV1> mapper) throws DsmApiException {
log.warn(String.format("getAggregationHistory(dsId = %s): not using cache", dsId)); log.warn(String.format("getAggregationHistory(dsId = %s): not using cache", dsId));
final Datasource conf = config.getDatasource(); final Datasource conf = config.getDatasource();
try { try {
@ -114,7 +111,40 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
.limit(conf.getMongoQueryLimit()) .limit(conf.getMongoQueryLimit())
.sort(dbo("system:startHumanDate", -1)); .sort(dbo("system:startHumanDate", -1));
final List<T> aggregationInfos = Utils.stream(aggregationDocs.iterator()) final List<AggregationInfoV1> aggregationInfos = Utils.stream(aggregationDocs.iterator())
.map(mapper)
.filter(ai -> ai.getNumberOfRecords() >= 0 && StringUtils.isNotBlank(ai.getDate()))
.collect(Collectors.toList());
final Instant loadTime = loadingCache.get(LOADTIME);
if (!Objects.equals(Instant.MIN, loadTime)) {
for (final AggregationInfoV1 a : aggregationInfos) {
if (asInstant(a).isBefore(loadTime) && AggregationStage.COLLECT.equals(a.getAggregationStage())) {
a.setIndexedVersion(true);
break;
}
}
}
return aggregationInfos;
} catch (final Throwable e) {
throw new DsmApiException(HttpStatus.SC_INTERNAL_SERVER_ERROR, String.format("error reading aggregation history for '%s'", dsId), e);
}
}
private List<AggregationInfo> getAggregationHistoryV2(final String dsId,
final Bson queryForAggregationHistory,
final Function<Document, AggregationInfo> mapper) throws DsmApiException {
log.warn(String.format("getAggregationHistory(dsId = %s): not using cache", dsId));
final Datasource conf = config.getDatasource();
try {
final FindIterable<Document> aggregationDocs = getCollection().find(queryForAggregationHistory)
.projection(fields)
.limit(conf.getMongoQueryLimit())
.sort(dbo("system:startHumanDate", -1));
final List<AggregationInfo> aggregationInfos = Utils.stream(aggregationDocs.iterator())
.map(mapper) .map(mapper)
.filter(ai -> ai.getNumberOfRecords() >= 0 && StringUtils.isNotBlank(ai.getDate())) .filter(ai -> ai.getNumberOfRecords() >= 0 && StringUtils.isNotBlank(ai.getDate()))
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -146,6 +176,11 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
return Instant.parse(a.getDate() + "T00:00:00Z"); return Instant.parse(a.getDate() + "T00:00:00Z");
} }
@Deprecated
private Instant asInstant(final AggregationInfoV1 a) {
return Instant.parse(a.getDate() + "T00:00:00Z");
}
@Override @Override
@CacheEvict(cacheNames = { @CacheEvict(cacheNames = {
"dsm-aggregationhistory-cache-v1", "dsm-aggregationhistory-cache-v2", "dsm-firstharvestdate-cache" "dsm-aggregationhistory-cache-v1", "dsm-aggregationhistory-cache-v2", "dsm-firstharvestdate-cache"
@ -166,20 +201,18 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
switch (stage) { switch (stage) {
case COLLECT: case COLLECT:
final CollectionInfoV1 cInfo = new CollectionInfoV1(); final AggregationInfoV1 cInfo = new AggregationInfoV1();
cInfo.setAggregationStage(stage); cInfo.setAggregationStage(stage);
cInfo.setCollectionMode(getCollectionMode(d)); cInfo.setCollectionMode(getCollectionMode(d));
cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
cInfo.setDate(getDate(d)); cInfo.setDate(getDate(d));
cInfo.setCompletedSuccessfully(success);
info = cInfo; info = cInfo;
break; break;
case TRANSFORM: case TRANSFORM:
final TransformationInfoV1 tInfo = new TransformationInfoV1(); final AggregationInfoV1 tInfo = new AggregationInfoV1();
tInfo.setAggregationStage(stage); tInfo.setAggregationStage(stage);
tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
tInfo.setDate(getDate(d)); tInfo.setDate(getDate(d));
tInfo.setCompletedSuccessfully(success);
info = tInfo; info = tInfo;
break; break;
} }
@ -197,7 +230,7 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
switch (stage) { switch (stage) {
case COLLECT: case COLLECT:
final CollectionInfoV2 cInfo = new CollectionInfoV2(); final AggregationInfo cInfo = new AggregationInfo();
cInfo.setAggregationStage(stage); cInfo.setAggregationStage(stage);
cInfo.setCollectionMode(getCollectionMode(d)); cInfo.setCollectionMode(getCollectionMode(d));
cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
@ -206,7 +239,7 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
info = cInfo; info = cInfo;
break; break;
case TRANSFORM: case TRANSFORM:
final TransformationInfoV2 tInfo = new TransformationInfoV2(); final AggregationInfo tInfo = new AggregationInfo();
tInfo.setAggregationStage(stage); tInfo.setAggregationStage(stage);
tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0); tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
tInfo.setDate(getDate(d)); tInfo.setDate(getDate(d));
@ -230,14 +263,10 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
final String sinkSize = d.getString("mainlog:sinkSize"); final String sinkSize = d.getString("mainlog:sinkSize");
final String total = d.getString("mainlog:total"); final String total = d.getString("mainlog:total");
if (StringUtils.isNotBlank(sinkSize)) { if (StringUtils.isNotBlank(sinkSize)) { return Ints.tryParse(sinkSize); }
return Ints.tryParse(sinkSize); if (StringUtils.isNotBlank(total)) { return Ints.tryParse(total); }
} else if (StringUtils.isNotBlank(total)) {
return Ints.tryParse(total);
} else {
return -1; return -1;
} }
}
private String getDate(final Document d) { private String getDate(final Document d) {
final String dateString = d.getString("system:startHumanDate"); final String dateString = d.getString("system:startHumanDate");

View File

@ -9,6 +9,8 @@ CREATE TABLE communities (
id text PRIMARY KEY, id text PRIMARY KEY,
name text NOT NULL, name text NOT NULL,
shortname text NOT NULL, -- in the profile is label shortname text NOT NULL, -- in the profile is label
displayname text,
displayshortname text,
description text NOT NULL DEFAULT '', description text NOT NULL DEFAULT '',
status text NOT NULL DEFAULT 'hidden', -- all, manager, hidden, members status text NOT NULL DEFAULT 'hidden', -- all, manager, hidden, members
membership text NOT NULL DEFAULT 'by-invitation', -- open, by-invitation membership text NOT NULL DEFAULT 'by-invitation', -- open, by-invitation
@ -25,7 +27,7 @@ CREATE TABLE communities (
last_update timestamp NOT NULL DEFAULT now(), last_update timestamp NOT NULL DEFAULT now(),
logo_url text, logo_url text,
suggested_acknowledgements text[], suggested_acknowledgements text[],
plan text plan text NOT NULL DEFAULT 'Default'
); );
CREATE TABLE community_projects ( CREATE TABLE community_projects (

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId> <artifactId>apps</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -19,6 +19,8 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import eu.dnetlib.organizations.importer.ImportExecutor;
import eu.dnetlib.organizations.importer.ImportStatus;
import eu.dnetlib.organizations.model.SystemConfiguration; import eu.dnetlib.organizations.model.SystemConfiguration;
import eu.dnetlib.organizations.repository.SystemConfigurationRepository; import eu.dnetlib.organizations.repository.SystemConfigurationRepository;
@ -28,6 +30,9 @@ public class HomeController extends AbstractDnetController {
@Autowired @Autowired
private Environment env; private Environment env;
@Autowired
private ImportExecutor importExecutor;
@Autowired @Autowired
private SystemConfigurationRepository systemConfigurationRepository; private SystemConfigurationRepository systemConfigurationRepository;
@ -94,12 +99,17 @@ public class HomeController extends AbstractDnetController {
return systemConfigurationRepository.findById(SystemConfiguration.DEFAULT_ID).get(); return systemConfigurationRepository.findById(SystemConfiguration.DEFAULT_ID).get();
} }
@ModelAttribute("isImportRunning")
public boolean isImportRunning(final Authentication authentication) {
return importExecutor.getLastImportExecution().getStatus() == ImportStatus.RUNNING;
}
@ModelAttribute("supportPages") @ModelAttribute("supportPages")
public Map<String, String> supportPages(final Authentication authentication) throws JsonMappingException, JsonProcessingException { public Map<String, String> supportPages(final Authentication authentication) throws JsonMappingException, JsonProcessingException {
if (supportPages == null) { if (supportPages == null) {
final ObjectMapper mapper = new ObjectMapper(); final ObjectMapper mapper = new ObjectMapper();
final TypeReference<LinkedHashMap<String, String>> typeRef = new TypeReference<LinkedHashMap<String, String>>() {}; final TypeReference<LinkedHashMap<String, String>> typeRef = new TypeReference<LinkedHashMap<String, String>>() {};
this.supportPages = mapper.readValue(supportPagesJson, typeRef); supportPages = mapper.readValue(supportPagesJson, typeRef);
} }
return supportPages; return supportPages;
} }

View File

@ -86,20 +86,16 @@ public class OrganizationController extends AbstractDnetController {
@PostMapping("/save") @PostMapping("/save")
public List<String> save(@RequestBody final OrganizationView org, final Authentication authentication) { public List<String> save(@RequestBody final OrganizationView org, final Authentication authentication) {
if (StringUtils.isBlank(org.getName())) { if (StringUtils.isBlank(org.getName())) { throw new RuntimeException("Missing field: name"); }
throw new RuntimeException("Missing field: name"); if (StringUtils.isBlank(org.getCountry())) { throw new RuntimeException("Missing field: country"); }
} else if (StringUtils.isBlank(org.getCountry())) { if (StringUtils.isBlank(org.getType())) { throw new RuntimeException("Missing field: type"); }
throw new RuntimeException("Missing field: country"); if (UserInfo.isSuperAdmin(authentication)
} else if (StringUtils.isBlank(org.getType())) {
throw new RuntimeException("Missing field: type");
} else if (UserInfo.isSuperAdmin(authentication)
|| userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) { || userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) {
final String orgId = final String orgId =
databaseUtils.insertOrUpdateOrganization(org, UserInfo.getEmail(authentication), UserInfo.isSimpleUser(authentication)); databaseUtils.insertOrUpdateOrganization(org, UserInfo.getEmail(authentication), UserInfo.isSimpleUser(authentication));
return Arrays.asList(orgId); return Arrays.asList(orgId);
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
@GetMapping("/info") @GetMapping("/info")
@ -131,27 +127,24 @@ public class OrganizationController extends AbstractDnetController {
if (UserInfo.isSuperAdmin(authentication) if (UserInfo.isSuperAdmin(authentication)
|| userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) { || userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) {
return org; return org;
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
@GetMapping("/conflicts") @GetMapping("/conflicts")
public List<OrganizationConflict> conflicts(@RequestParam final String id, final Authentication authentication) { public List<OrganizationConflict> conflicts(@RequestParam final String id, final Authentication authentication) {
if (UserInfo.isSuperAdmin(authentication) || userCountryRepository.verifyAuthorizationForId(id, UserInfo.getEmail(authentication))) { if (UserInfo.isSuperAdmin(authentication) || userCountryRepository.verifyAuthorizationForId(id, UserInfo.getEmail(authentication))) {
return databaseUtils.listConflictsForId(id); return databaseUtils.listConflictsForId(id);
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
@GetMapping("/duplicates") @GetMapping("/duplicates")
public List<OpenaireDuplicateView> duplicates(@RequestParam final String id, final Authentication authentication) { public List<OpenaireDuplicateView> duplicates(@RequestParam final String id, final Authentication authentication) {
if (UserInfo.isSuperAdmin(authentication) || userCountryRepository.verifyAuthorizationForId(id, UserInfo.getEmail(authentication))) { if (UserInfo.isSuperAdmin(authentication) || userCountryRepository.verifyAuthorizationForId(id, UserInfo.getEmail(authentication))) {
return listDuplicates(id); return listDuplicates(id);
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
private List<OpenaireDuplicateView> listDuplicates(final String id) { private List<OpenaireDuplicateView> listDuplicates(final String id) {
@ -161,9 +154,8 @@ public class OrganizationController extends AbstractDnetController {
@GetMapping("/conflicts/byCountry/{country}") @GetMapping("/conflicts/byCountry/{country}")
public Collection<Set<OrganizationConflict>> findConflictsByCountry(@PathVariable final String country, final Authentication authentication) { public Collection<Set<OrganizationConflict>> findConflictsByCountry(@PathVariable final String country, final Authentication authentication) {
if (UserInfo.isSuperAdmin(authentication)) { if (UserInfo.isSuperAdmin(authentication)) { return groupConflicts(conflictGroupViewRepository.findByCountry1OrCountry2(country, country).stream()); }
return groupConflicts(conflictGroupViewRepository.findByCountry1OrCountry2(country, country).stream()); if (UserInfo.isSimpleUser(authentication) || UserInfo.isNationalAdmin(authentication)) {
} else if (UserInfo.isSimpleUser(authentication) || UserInfo.isNationalAdmin(authentication)) {
final Stream<ConflictGroupView> list = userCountryRepository.getCountriesForUser(UserInfo.getEmail(authentication)) final Stream<ConflictGroupView> list = userCountryRepository.getCountriesForUser(UserInfo.getEmail(authentication))
.stream() .stream()
.filter(country::equalsIgnoreCase) .filter(country::equalsIgnoreCase)
@ -171,33 +163,33 @@ public class OrganizationController extends AbstractDnetController {
.findFirst() .findFirst()
.orElse(Stream.empty()); .orElse(Stream.empty());
return groupConflicts(list); return groupConflicts(list);
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
@GetMapping("/duplicates/byCountry/{country}") @GetMapping("/duplicates/byCountry/{country}")
public Iterable<DuplicateGroupView> findDuplicatesByCountry(@PathVariable final String country, final Authentication authentication) { public Iterable<DuplicateGroupView> findDuplicatesByCountry(@PathVariable final String country,
@RequestParam(required = false, defaultValue = "0") final int page,
@RequestParam(required = false, defaultValue = "${openorgs.findDuplicatesByCountry.limit.default}") final int size,
final Authentication authentication) {
if (UserInfo.isSuperAdmin(authentication)) { if (UserInfo.isSuperAdmin(authentication)) { return duplicateGroupViewRepository.findByCountry(country, PageRequest.of(page, size)); }
return duplicateGroupViewRepository.findByCountry(country); if (UserInfo.isSimpleUser(authentication) || UserInfo.isNationalAdmin(authentication)) {
} else if (UserInfo.isSimpleUser(authentication) || UserInfo.isNationalAdmin(authentication)) {
return userCountryRepository.getCountriesForUser(UserInfo.getEmail(authentication)) return userCountryRepository.getCountriesForUser(UserInfo.getEmail(authentication))
.stream() .stream()
.filter(country::equalsIgnoreCase) .filter(country::equalsIgnoreCase)
.map(duplicateGroupViewRepository::findByCountry) .map(c -> duplicateGroupViewRepository.findByCountry(c, PageRequest.of(page, size)))
.findFirst() .findFirst()
.orElse(new ArrayList<DuplicateGroupView>()); .orElse(new ArrayList<DuplicateGroupView>());
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
@GetMapping(value = "/duplicates/byCountry/{country}/csv", produces = "text/csv") @GetMapping(value = "/duplicates/byCountry/{country}/csv", produces = "text/csv")
public void findDuplicatesByCountryCSV(@PathVariable final String country, final HttpServletResponse res, final Authentication authentication) public void findDuplicatesByCountryCSV(@PathVariable final String country, final HttpServletResponse res, final Authentication authentication)
throws IOException { throws IOException {
final Iterable<DuplicateGroupView> list = findDuplicatesByCountry(country, authentication); final Iterable<DuplicateGroupView> list = findDuplicatesByCountry(country, 0, Integer.MAX_VALUE, authentication);
CSVConverter.writeCSV(res.getOutputStream(), list, DuplicateGroupView.class, "id", "name", "city", "country", "numberOfDuplicates"); CSVConverter.writeCSV(res.getOutputStream(), list, DuplicateGroupView.class, "id", "name", "city", "country", "numberOfDuplicates");
} }
@ -227,9 +219,8 @@ public class OrganizationController extends AbstractDnetController {
if (b) { if (b) {
databaseUtils.saveDuplicates(simrels, UserInfo.getEmail(authentication)); databaseUtils.saveDuplicates(simrels, UserInfo.getEmail(authentication));
return listDuplicates(simrels.get(0).getLocalId()); return listDuplicates(simrels.get(0).getLocalId());
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
@GetMapping("/search/{page}/{size}") @GetMapping("/search/{page}/{size}")
@ -239,11 +230,11 @@ public class OrganizationController extends AbstractDnetController {
@RequestParam(required = false, defaultValue = "") final String status, @RequestParam(required = false, defaultValue = "") final String status,
final Authentication authentication) { final Authentication authentication) {
if (status.equals(SPECIAL_STATUS_FOR_CANDIDATE_DUP)) { if (SPECIAL_STATUS_FOR_CANDIDATE_DUP.equals(status)) {
return UserInfo.isSuperAdmin(authentication) return UserInfo.isSuperAdmin(authentication)
? organizationSimpleViewRepository.searchCandidateDuplicates(q, PageRequest.of(page, size)) ? organizationSimpleViewRepository.searchCandidateDuplicates(q, PageRequest.of(page, size))
: organizationSimpleViewRepository.searchCandidateDuplicatesForUser(q, UserInfo.getEmail(authentication), PageRequest.of(page, size)); : organizationSimpleViewRepository.searchCandidateDuplicatesForUser(q, UserInfo.getEmail(authentication), PageRequest.of(page, size));
} else { }
final List<String> statuses; final List<String> statuses;
if (StringUtils.isNotBlank(status)) { if (StringUtils.isNotBlank(status)) {
statuses = Arrays.asList(status.split(",")); statuses = Arrays.asList(status.split(","));
@ -257,7 +248,6 @@ public class OrganizationController extends AbstractDnetController {
? organizationSimpleViewRepository.search(q, statuses, PageRequest.of(page, size)) ? organizationSimpleViewRepository.search(q, statuses, PageRequest.of(page, size))
: organizationSimpleViewRepository.searchForUser(q, UserInfo.getEmail(authentication), statuses, PageRequest.of(page, size)); : organizationSimpleViewRepository.searchForUser(q, UserInfo.getEmail(authentication), statuses, PageRequest.of(page, size));
} }
}
@GetMapping("/byCountry/{status}/{code}/{page}/{size}") @GetMapping("/byCountry/{status}/{code}/{page}/{size}")
public Page<OrganizationSimpleView> findByCountry(@PathVariable final String status, public Page<OrganizationSimpleView> findByCountry(@PathVariable final String status,
@ -265,32 +255,24 @@ public class OrganizationController extends AbstractDnetController {
@PathVariable final int page, @PathVariable final int page,
@PathVariable final int size, @PathVariable final int size,
final Authentication authentication) { final Authentication authentication) {
if (UserInfo.isSuperAdmin(authentication) if (!UserInfo.isSuperAdmin(authentication) && !userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) {
|| userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) {
if (status.equalsIgnoreCase("all")) {
return organizationSimpleViewRepository.findByCountryOrderByName(code, PageRequest.of(page, size));
} else {
return organizationSimpleViewRepository.findByCountryAndStatusOrderByName(code, status, PageRequest.of(page, size));
}
} else {
throw new RuntimeException("User not authorized"); throw new RuntimeException("User not authorized");
} }
if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByCountryOrderByName(code, PageRequest.of(page, size)); }
return organizationSimpleViewRepository.findByCountryAndStatusOrderByName(code, status, PageRequest.of(page, size));
} }
@GetMapping("/byCountry/{status}/{code}") @GetMapping("/byCountry/{status}/{code}")
public Iterable<OrganizationSimpleView> findOrgsByStatusAndCountry(@PathVariable final String status, public List<OrganizationSimpleView> findOrgsByStatusAndCountry(@PathVariable final String status,
@PathVariable final String code, @PathVariable final String code,
@RequestParam(required = false, defaultValue = "0") final int page,
@RequestParam(required = false, defaultValue = "${openorgs.findOrgsByStatusAndCountry.limit.default}") final int size,
final Authentication authentication) { final Authentication authentication) {
if (UserInfo.isSuperAdmin(authentication) if (!UserInfo.isSuperAdmin(authentication) && !userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) {
|| userCountryRepository.verifyAuthorizationForCountry(code, UserInfo.getEmail(authentication))) {
if (status.equalsIgnoreCase("all")) {
return organizationSimpleViewRepository.findByCountryOrderByName(code);
} else {
return organizationSimpleViewRepository.findByCountryAndStatusOrderByName(code, status);
}
} else {
throw new RuntimeException("User not authorized"); throw new RuntimeException("User not authorized");
} }
if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByCountryOrderByName(code, PageRequest.of(page, size)).getContent(); }
return organizationSimpleViewRepository.findByCountryAndStatusOrderByName(code, status, PageRequest.of(page, size)).getContent();
} }
@GetMapping(value = "/byCountry/{status}/{code}/csv", produces = "text/csv") @GetMapping(value = "/byCountry/{status}/{code}/csv", produces = "text/csv")
@ -298,7 +280,7 @@ public class OrganizationController extends AbstractDnetController {
@PathVariable final String code, @PathVariable final String code,
final HttpServletResponse res, final HttpServletResponse res,
final Authentication authentication) throws IOException { final Authentication authentication) throws IOException {
final Iterable<OrganizationSimpleView> list = findOrgsByStatusAndCountry(status, code, authentication); final Iterable<OrganizationSimpleView> list = findOrgsByStatusAndCountry(status, code, 0, Integer.MAX_VALUE, authentication);
CSVConverter.writeCSV(res CSVConverter.writeCSV(res
.getOutputStream(), list, OrganizationSimpleView.class, "id", "name", "type", "city", "country", "acronyms", "urls", "status", "nSimilarDups", "nSuggestedDups", "nDifferentDups"); .getOutputStream(), list, OrganizationSimpleView.class, "id", "name", "type", "city", "country", "acronyms", "urls", "status", "nSimilarDups", "nSuggestedDups", "nDifferentDups");
} }
@ -311,19 +293,14 @@ public class OrganizationController extends AbstractDnetController {
final Authentication authentication) { final Authentication authentication) {
if (UserInfo.isSuperAdmin(authentication)) { if (UserInfo.isSuperAdmin(authentication)) {
if (status.equalsIgnoreCase("all")) { if ("all".equalsIgnoreCase(status)) { return organizationSimpleViewRepository.findByTypeOrderByName(type, PageRequest.of(page, size)); }
return organizationSimpleViewRepository.findByTypeOrderByName(type, PageRequest.of(page, size));
} else {
return organizationSimpleViewRepository.findByTypeAndStatusOrderByName(type, status, PageRequest.of(page, size)); return organizationSimpleViewRepository.findByTypeAndStatusOrderByName(type, status, PageRequest.of(page, size));
} }
} else { if ("all".equalsIgnoreCase(status)) {
if (status.equalsIgnoreCase("all")) {
return organizationSimpleViewRepository.findByTypeForUser(type, UserInfo.getEmail(authentication), PageRequest.of(page, size)); return organizationSimpleViewRepository.findByTypeForUser(type, UserInfo.getEmail(authentication), PageRequest.of(page, size));
} else { }
return organizationSimpleViewRepository return organizationSimpleViewRepository
.findByTypeAndStatusForUser(type, status, UserInfo.getEmail(authentication), PageRequest.of(page, size)); .findByTypeAndStatusForUser(type, status, UserInfo.getEmail(authentication), PageRequest.of(page, size));
}
}
} }
@ -347,9 +324,8 @@ public class OrganizationController extends AbstractDnetController {
|| userCountryRepository.verifyAuthorizationForId(ids.get(0), UserInfo.getEmail(authentication))) { || userCountryRepository.verifyAuthorizationForId(ids.get(0), UserInfo.getEmail(authentication))) {
final String newOrgId = databaseUtils.fixConflictSimilars(ids, UserInfo.getEmail(authentication)); final String newOrgId = databaseUtils.fixConflictSimilars(ids, UserInfo.getEmail(authentication));
return Arrays.asList(newOrgId); return Arrays.asList(newOrgId);
} else {
return new ArrayList<>();
} }
return new ArrayList<>();
} }
@PostMapping("/conflicts/fix/different") @PostMapping("/conflicts/fix/different")
@ -358,9 +334,8 @@ public class OrganizationController extends AbstractDnetController {
|| userCountryRepository.verifyAuthorizationForId(ids.get(0), UserInfo.getEmail(authentication))) { || userCountryRepository.verifyAuthorizationForId(ids.get(0), UserInfo.getEmail(authentication))) {
databaseUtils.fixConflictDifferents(ids, UserInfo.getEmail(authentication)); databaseUtils.fixConflictDifferents(ids, UserInfo.getEmail(authentication));
return ids; return ids;
} else {
return new ArrayList<>();
} }
return new ArrayList<>();
} }
@GetMapping("/note") @GetMapping("/note")
@ -370,9 +345,8 @@ public class OrganizationController extends AbstractDnetController {
if (UserInfo.isSuperAdmin(authentication) if (UserInfo.isSuperAdmin(authentication)
|| userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) { || userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) {
return noteRepository.findById(id).orElse(new Note(id, "", null, null)); return noteRepository.findById(id).orElse(new Note(id, "", null, null));
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
@PostMapping("/note") @PostMapping("/note")
@ -381,21 +355,18 @@ public class OrganizationController extends AbstractDnetController {
final OrganizationView org = organizationViewRepository.findById(orgId).get(); final OrganizationView org = organizationViewRepository.findById(orgId).get();
if (UserInfo.isSuperAdmin(authentication) if (!UserInfo.isSuperAdmin(authentication)
|| userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) { && !userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) {
throw new RuntimeException("User not authorized");
}
if (StringUtils.isNotBlank(note.getNote())) { if (StringUtils.isNotBlank(note.getNote())) {
note.setModifiedBy(UserInfo.getEmail(authentication)); note.setModifiedBy(UserInfo.getEmail(authentication));
note.setModificationDate(OffsetDateTime.now()); note.setModificationDate(OffsetDateTime.now());
return noteRepository.save(note); return noteRepository.save(note);
} else { }
noteRepository.deleteById(orgId); noteRepository.deleteById(orgId);
return new Note(orgId, "", null, null); return new Note(orgId, "", null, null);
} }
} else {
throw new RuntimeException("User not authorized");
}
}
@GetMapping("/journal") @GetMapping("/journal")
public List<JournalEntry> journalEntriesById(@RequestParam final String id, final Authentication authentication) { public List<JournalEntry> journalEntriesById(@RequestParam final String id, final Authentication authentication) {
@ -404,9 +375,8 @@ public class OrganizationController extends AbstractDnetController {
if (UserInfo.isSuperAdmin(authentication) if (UserInfo.isSuperAdmin(authentication)
|| userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) { || userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), UserInfo.getEmail(authentication))) {
return journalEntryRepository.findByOrgIdOrderByDateDesc(id); return journalEntryRepository.findByOrgIdOrderByDateDesc(id);
} else {
throw new RuntimeException("User not authorized");
} }
throw new RuntimeException("User not authorized");
} }
} }

View File

@ -28,6 +28,9 @@ public class SystemConfiguration implements Serializable {
@Column(name = "homepage_msg") @Column(name = "homepage_msg")
private String homepageMessage; private String homepageMessage;
@Column(name = "homepage_msg_import")
private String homepageMessageImport;
@Column(name = "readonly") @Column(name = "readonly")
private Boolean readonly; private Boolean readonly;
@ -85,6 +88,14 @@ public class SystemConfiguration implements Serializable {
this.homepageMessage = homepageMessage; this.homepageMessage = homepageMessage;
} }
public String getHomepageMessageImport() {
return homepageMessageImport;
}
public void setHomepageMessageImport(final String homepageMessageImport) {
this.homepageMessageImport = homepageMessageImport;
}
public Boolean getReadonly() { public Boolean getReadonly() {
return readonly; return readonly;
} }

View File

@ -2,6 +2,7 @@ package eu.dnetlib.organizations.repository.readonly;
import java.util.List; import java.util.List;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import eu.dnetlib.organizations.model.view.DuplicateGroupView; import eu.dnetlib.organizations.model.view.DuplicateGroupView;
@ -9,5 +10,5 @@ import eu.dnetlib.organizations.model.view.DuplicateGroupView;
@Repository @Repository
public interface DuplicateGroupViewRepository extends ReadOnlyRepository<DuplicateGroupView, String> { public interface DuplicateGroupViewRepository extends ReadOnlyRepository<DuplicateGroupView, String> {
List<DuplicateGroupView> findByCountry(String country); List<DuplicateGroupView> findByCountry(String country, Pageable page);
} }

View File

@ -65,10 +65,6 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository<Org
Page<OrganizationSimpleView> findByCountryOrderByName(String country, Pageable pageable); Page<OrganizationSimpleView> findByCountryOrderByName(String country, Pageable pageable);
Iterable<OrganizationSimpleView> findByCountryOrderByName(String code);
Iterable<OrganizationSimpleView> findByCountryAndStatusOrderByName(String code, String status);
Page<OrganizationSimpleView> findByCountryAndStatusOrderByName(String code, String status, Pageable pageable); Page<OrganizationSimpleView> findByCountryAndStatusOrderByName(String code, String status, Pageable pageable);
Page<OrganizationSimpleView> findByTypeOrderByName(String type, Pageable pageable); Page<OrganizationSimpleView> findByTypeOrderByName(String type, Pageable pageable);

View File

@ -42,12 +42,12 @@ public class MailDispatcher {
} }
public void configure(final SystemConfiguration conf) { public void configure(final SystemConfiguration conf) {
this.enabled = conf.getSmtpEnabled(); enabled = conf.getSmtpEnabled();
this.fromMail = conf.getSmtpFromMail(); fromMail = conf.getSmtpFromMail();
this.fromName = conf.getSmtpFromName(); fromName = conf.getSmtpFromName();
this.toMailAdmin = conf.getSmtpToMailAdmin(); toMailAdmin = conf.getSmtpToMailAdmin();
this.newUserMessage = conf.getSmtpNewUserMessage(); newUserMessage = conf.getSmtpNewUserMessage();
this.updateUserMessage = conf.getSmtpUpdateUserMessage(); updateUserMessage = conf.getSmtpUpdateUserMessage();
if (StringUtils.isNotBlank(conf.getSmtpHost())) { if (StringUtils.isNotBlank(conf.getSmtpHost())) {
emailFactory.setSmtpHost(conf.getSmtpHost()); emailFactory.setSmtpHost(conf.getSmtpHost());
@ -70,7 +70,7 @@ public class MailDispatcher {
public void sendRequestRegistrationMail(final UserView user) { public void sendRequestRegistrationMail(final UserView user) {
if (StringUtils.isNotBlank(newUserMessage)) { if (StringUtils.isNotBlank(newUserMessage)) {
final String message = prepareMessage(this.newUserMessage, user); final String message = prepareMessage(newUserMessage, user);
for (final String to : StringUtils.split(toMailAdmin, ",")) { for (final String to : StringUtils.split(toMailAdmin, ",")) {
sendMail("OpenOrgs: new registration request", message, to.trim()); sendMail("OpenOrgs: new registration request", message, to.trim());
@ -82,7 +82,7 @@ public class MailDispatcher {
public void sendUpdatedUserMail(final UserView user) { public void sendUpdatedUserMail(final UserView user) {
if (StringUtils.isNotBlank(updateUserMessage)) { if (StringUtils.isNotBlank(updateUserMessage)) {
final String message = prepareMessage(this.updateUserMessage, user); final String message = prepareMessage(updateUserMessage, user);
sendMail("OpenOrgs: user updated", message, user.getEmail()); sendMail("OpenOrgs: user updated", message, user.getEmail());
} else { } else {
log.warn("Template is empty (updateUserMessage)"); log.warn("Template is empty (updateUserMessage)");
@ -92,12 +92,12 @@ public class MailDispatcher {
private String prepareMessage(final String template, final UserView user) { private String prepareMessage(final String template, final UserView user) {
final String countries = user.getRole().equals(UserRole.ADMIN.toString()) ? "All" : StringUtils.join(user.getCountries(), ", "); final String countries = user.getRole().equals(UserRole.ADMIN.toString()) ? "All" : StringUtils.join(user.getCountries(), ", ");
return template.replaceAll(":email:", user.getEmail()) return template.replaceAll(":email:", "" + user.getEmail())
.replaceAll(":fullname:", user.getFullname()) .replaceAll(":fullname:", "" + user.getFullname())
.replaceAll(":organization:", user.getOrganization()) .replaceAll(":organization:", "" + user.getOrganization())
.replaceAll(":refperson:", user.getReferencePerson()) .replaceAll(":refperson:", "" + user.getReferencePerson())
.replaceAll(":reqmessage:", user.getRequestMessage()) .replaceAll(":reqmessage:", "" + user.getRequestMessage())
.replaceAll(":role:", user.getRole()) .replaceAll(":role:", "" + user.getRole())
.replaceAll(":countries:", countries); .replaceAll(":countries:", countries);
} }

View File

@ -49,6 +49,9 @@ openaire.api.https.proxy = 10.19.65.35
openorgs.support.pages = { "Ask a question": "https://www.openaire.eu/support/helpdesk?view=ticket&layout=open", "FAQ": "https://www.openaire.eu/faqs" } openorgs.support.pages = { "Ask a question": "https://www.openaire.eu/support/helpdesk?view=ticket&layout=open", "FAQ": "https://www.openaire.eu/faqs" }
openorgs.findDuplicatesByCountry.limit.default = 1000
openorgs.findOrgsByStatusAndCountry.limit.default = 1000
openaire.override.logout.url = openaire.override.logout.url =
openaire.explore.organization.baseurl = https://explore.openaire.eu/search/organization?organizationId=%s openaire.explore.organization.baseurl = https://explore.openaire.eu/search/organization?organizationId=%s

View File

@ -1,6 +1,10 @@
CREATE OR REPLACE PROCEDURE import_dedup_events() LANGUAGE plpgsql AS $$ CREATE OR REPLACE PROCEDURE import_dedup_events() LANGUAGE plpgsql AS $$
BEGIN BEGIN
-- MAKE A WORKING COPY OF THE TABLE PREPARED BY THE DEDUP JOB
DROP TABLE IF EXISTS tmp_dedup_events_work;
CREATE TABLE tmp_dedup_events_work AS SELECT * FROM tmp_dedup_events;
DELETE FROM oa_conflicts WHERE created_by = 'dedupWf' and modified_by = 'dedupWf' and reltype = 'suggested'; DELETE FROM oa_conflicts WHERE created_by = 'dedupWf' and modified_by = 'dedupWf' and reltype = 'suggested';
DELETE FROM oa_duplicates WHERE created_by = 'dedupWf' and modified_by = 'dedupWf' and reltype = 'suggested'; DELETE FROM oa_duplicates WHERE created_by = 'dedupWf' and modified_by = 'dedupWf' and reltype = 'suggested';
DELETE FROM organizations WHERE created_by = 'dedupWf' and modified_by = 'dedupWf' and status = 'suggested'; DELETE FROM organizations WHERE created_by = 'dedupWf' and modified_by = 'dedupWf' and status = 'suggested';
@ -10,51 +14,51 @@ DELETE FROM organizations WHERE created_by = 'dedupWf' and modified_by = 'dedupW
UPDATE organizations SET id = 'pending_org_::'||MD5(id) WHERE status = 'suggested' AND id NOT LIKE 'pending_org_::%'; UPDATE organizations SET id = 'pending_org_::'||MD5(id) WHERE status = 'suggested' AND id NOT LIKE 'pending_org_::%';
-- FIX IMPORT DATA -- FIX IMPORT DATA
DELETE FROM tmp_dedup_events WHERE oa_original_id = '' OR oa_original_id IS NULL; DELETE FROM tmp_dedup_events_work WHERE oa_original_id = '' OR oa_original_id IS NULL;
UPDATE tmp_dedup_events SET local_id = oa_original_id WHERE local_id = '' OR local_id IS NULL; UPDATE tmp_dedup_events_work SET local_id = oa_original_id WHERE local_id = '' OR local_id IS NULL;
UPDATE tmp_dedup_events SET oa_country = 'UNKNOWN' WHERE oa_country = '' OR oa_country IS NULL; UPDATE tmp_dedup_events_work SET oa_country = 'UNKNOWN' WHERE oa_country = '' OR oa_country IS NULL;
UPDATE tmp_dedup_events SET oa_name = oa_acronym WHERE oa_name = '' OR oa_name IS NULL; UPDATE tmp_dedup_events_work SET oa_name = oa_acronym WHERE oa_name = '' OR oa_name IS NULL;
DELETE FROM tmp_dedup_events WHERE oa_name = '' OR oa_name IS NULL; DELETE FROM tmp_dedup_events_work WHERE oa_name = '' OR oa_name IS NULL;
-- delete invalid relations (a raw org can not be suggested as duplicate and as new org) -- delete invalid relations (a raw org can not be suggested as duplicate and as new org)
DELETE FROM tmp_dedup_events WHERE oa_original_id IN ( DELETE FROM tmp_dedup_events_work WHERE oa_original_id IN (
SELECT oa_original_id SELECT oa_original_id
FROM tmp_dedup_events FROM tmp_dedup_events_work
GROUP BY oa_original_id HAVING count(oa_original_id) > 1) GROUP BY oa_original_id HAVING count(oa_original_id) > 1)
AND (local_id = '' OR local_id is NULL OR local_id = oa_original_id) AND (local_id = '' OR local_id is NULL OR local_id = oa_original_id)
AND (group_id = '' OR group_id is NULL); AND (group_id = '' OR group_id is NULL);
-- delete invalid relations (a raw org can not be suggested to multiple orgs) -- delete invalid relations (a raw org can not be suggested to multiple orgs)
DELETE FROM tmp_dedup_events WHERE oa_original_id IN ( DELETE FROM tmp_dedup_events_work WHERE oa_original_id IN (
SELECT oa_original_id SELECT oa_original_id
FROM tmp_dedup_events FROM tmp_dedup_events_work
GROUP BY oa_original_id HAVING count(oa_original_id) > 1) GROUP BY oa_original_id HAVING count(oa_original_id) > 1)
AND local_id NOT LIKE 'openorgs____::%'; AND local_id NOT LIKE 'openorgs____::%';
-- delete invalid groups (only one row) -- delete invalid groups (only one row)
DELETE FROM tmp_dedup_events WHERE group_id IN ( DELETE FROM tmp_dedup_events_work WHERE group_id IN (
SELECT group_id SELECT group_id
FROM tmp_dedup_events GROUP BY group_id FROM tmp_dedup_events_work GROUP BY group_id
HAVING count(*) = 1 HAVING count(*) = 1
); );
-- IMPORT MISSING TERMS -- IMPORT MISSING TERMS
INSERT INTO id_types(val, name) SELECT distinct arr[2], arr[2] FROM (SELECT string_to_array(unnest(string_to_array(pid_list, '@@@')), '###') AS arr FROM tmp_dedup_events WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%') as c ON CONFLICT DO NOTHING; INSERT INTO id_types(val, name) SELECT distinct arr[2], arr[2] FROM (SELECT string_to_array(unnest(string_to_array(pid_list, '@@@')), '###') AS arr FROM tmp_dedup_events_work WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%') as c ON CONFLICT DO NOTHING;
-- NEW ORGANIZATIONS (suggested) -- NEW ORGANIZATIONS (suggested)
INSERT INTO organizations(id, name, country, status, ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, created_by, modified_by) INSERT INTO organizations(id, name, country, status, ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, created_by, modified_by)
SELECT 'pending_org_::'||MD5(local_id), oa_name, oa_country, 'suggested', ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, 'dedupWf', 'dedupWf' SELECT 'pending_org_::'||MD5(local_id), oa_name, oa_country, 'suggested', ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, 'dedupWf', 'dedupWf'
FROM tmp_dedup_events FROM tmp_dedup_events_work
WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
INSERT INTO acronyms(id, acronym) INSERT INTO acronyms(id, acronym)
SELECT 'pending_org_::'||MD5(local_id), oa_acronym FROM tmp_dedup_events SELECT 'pending_org_::'||MD5(local_id), oa_acronym FROM tmp_dedup_events_work
WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id AND oa_acronym IS NOT NULL AND oa_acronym != '' WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id AND oa_acronym IS NOT NULL AND oa_acronym != ''
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
INSERT INTO urls(id, url) INSERT INTO urls(id, url)
SELECT 'pending_org_::'||MD5(local_id), oa_url FROM tmp_dedup_events SELECT 'pending_org_::'||MD5(local_id), oa_url FROM tmp_dedup_events_work
WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id AND oa_url IS NOT NULL AND oa_url != '' WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id AND oa_url IS NOT NULL AND oa_url != ''
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
@ -62,7 +66,7 @@ INSERT INTO other_ids(id, otherid, type)
SELECT 'pending_org_::'||MD5(local_id), arr[1] AS otherid, arr[2] AS type SELECT 'pending_org_::'||MD5(local_id), arr[1] AS otherid, arr[2] AS type
FROM ( FROM (
SELECT local_id, string_to_array(unnest(string_to_array(pid_list, '@@@')), '###') AS arr SELECT local_id, string_to_array(unnest(string_to_array(pid_list, '@@@')), '###') AS arr
FROM tmp_dedup_events FROM tmp_dedup_events_work
WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id
) as c ) as c
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
@ -70,7 +74,7 @@ ON CONFLICT DO NOTHING;
-- NEW ORGANIZATIONS (raw) -- NEW ORGANIZATIONS (raw)
INSERT INTO organizations(id, name, country, status, ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, created_by, modified_by) INSERT INTO organizations(id, name, country, status, ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, created_by, modified_by)
SELECT oa_original_id, oa_name, oa_country, 'raw', ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, 'dedupWf', 'dedupWf' SELECT oa_original_id, oa_name, oa_country, 'raw', ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, 'dedupWf', 'dedupWf'
FROM tmp_dedup_events FROM tmp_dedup_events_work
WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%'
ON CONFLICT(id) DO UPDATE SET ON CONFLICT(id) DO UPDATE SET
(name, country, ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, modification_date, modified_by) = (name, country, ec_legalbody, ec_legalperson, ec_nonprofit, ec_researchorganization, ec_highereducation, ec_internationalorganizationeurinterests, ec_internationalorganization, ec_enterprise, ec_smevalidated, ec_nutscode, modification_date, modified_by) =
@ -78,13 +82,13 @@ ON CONFLICT(id) DO UPDATE SET
INSERT INTO acronyms(id, acronym) INSERT INTO acronyms(id, acronym)
SELECT oa_original_id, oa_acronym SELECT oa_original_id, oa_acronym
FROM tmp_dedup_events FROM tmp_dedup_events_work
WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' AND oa_acronym IS NOT NULL AND oa_acronym != '' WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' AND oa_acronym IS NOT NULL AND oa_acronym != ''
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
INSERT INTO urls(id, url) INSERT INTO urls(id, url)
SELECT oa_original_id, oa_url SELECT oa_original_id, oa_url
FROM tmp_dedup_events FROM tmp_dedup_events_work
WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' AND oa_url IS NOT NULL AND oa_url != '' WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' AND oa_url IS NOT NULL AND oa_url != ''
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
@ -93,7 +97,7 @@ SELECT oa_original_id, arr[1] AS otherid, arr[2] AS type
FROM ( FROM (
SELECT oa_original_id, SELECT oa_original_id,
string_to_array(unnest(string_to_array(pid_list, '@@@')), '###') AS arr string_to_array(unnest(string_to_array(pid_list, '@@@')), '###') AS arr
FROM tmp_dedup_events FROM tmp_dedup_events_work
WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%'
) as c ) as c
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
@ -101,23 +105,23 @@ ON CONFLICT DO NOTHING;
-- DUPLICATES (relations to openorgs) -- DUPLICATES (relations to openorgs)
INSERT INTO oa_duplicates (local_id, oa_original_id, oa_collectedfrom, created_by, modified_by) INSERT INTO oa_duplicates (local_id, oa_original_id, oa_collectedfrom, created_by, modified_by)
SELECT local_id, oa_original_id, oa_collectedfrom, 'dedupWf', 'dedupWf' SELECT local_id, oa_original_id, oa_collectedfrom, 'dedupWf', 'dedupWf'
FROM tmp_dedup_events FROM tmp_dedup_events_work
WHERE local_id LIKE 'openorgs\_\_\_\_::%' AND oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' WHERE local_id LIKE 'openorgs\_\_\_\_::%' AND oa_original_id NOT LIKE 'openorgs\_\_\_\_::%'
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
-- DUPLICATES (relations to suggested) -- DUPLICATES (relations to suggested)
INSERT INTO oa_duplicates (local_id, oa_original_id, oa_collectedfrom, created_by, modified_by) INSERT INTO oa_duplicates (local_id, oa_original_id, oa_collectedfrom, created_by, modified_by)
SELECT 'pending_org_::'||MD5(local_id), oa_original_id, oa_collectedfrom, 'dedupWf', 'dedupWf' SELECT 'pending_org_::'||MD5(local_id), oa_original_id, oa_collectedfrom, 'dedupWf', 'dedupWf'
FROM tmp_dedup_events FROM tmp_dedup_events_work
WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND oa_original_id NOT LIKE 'openorgs\_\_\_\_::%'
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
-- CONFLICTS (I generate all the couples) -- CONFLICTS (I generate all the couples)
CREATE TEMPORARY TABLE tmp_conflict_groups AS CREATE TEMPORARY TABLE tmp_conflict_groups AS
SELECT DISTINCT group_id as gid, local_id oid from tmp_dedup_events SELECT DISTINCT group_id as gid, local_id oid from tmp_dedup_events_work
WHERE local_id LIKE 'openorgs\_\_\_\_::%' AND oa_original_id LIKE 'openorgs\_\_\_\_::%' AND local_id != oa_original_id AND group_id IS NOT NULL AND group_id != '' WHERE local_id LIKE 'openorgs\_\_\_\_::%' AND oa_original_id LIKE 'openorgs\_\_\_\_::%' AND local_id != oa_original_id AND group_id IS NOT NULL AND group_id != ''
UNION UNION
SELECT DISTINCT group_id as gid, oa_original_id oid from tmp_dedup_events SELECT DISTINCT group_id as gid, oa_original_id oid from tmp_dedup_events_work
WHERE local_id LIKE 'openorgs\_\_\_\_::%' AND oa_original_id LIKE 'openorgs\_\_\_\_::%' AND local_id != oa_original_id AND group_id IS NOT NULL AND group_id != ''; WHERE local_id LIKE 'openorgs\_\_\_\_::%' AND oa_original_id LIKE 'openorgs\_\_\_\_::%' AND local_id != oa_original_id AND group_id IS NOT NULL AND group_id != '';
INSERT INTO oa_conflicts (id1, id2, idgroup, created_by, modified_by) SELECT DISTINCT INSERT INTO oa_conflicts (id1, id2, idgroup, created_by, modified_by) SELECT DISTINCT

View File

@ -35,6 +35,7 @@ CREATE TABLE sysconf (
id text PRIMARY KEY DEFAULT 'default', id text PRIMARY KEY DEFAULT 'default',
title text NOT NULL, title text NOT NULL,
homepage_msg text NOT NULL DEFAULT '', homepage_msg text NOT NULL DEFAULT '',
homepage_msg_import text NOT NULL DEFAULT '<p>The portal is temporarily in read-only mode because we are updating the suggestions.<br /><br />We apologize for the inconvenience.</p>',
readonly boolean NOT NULL DEFAULT false, readonly boolean NOT NULL DEFAULT false,
smtp_enabled boolean NOT NULL DEFAULT false, smtp_enabled boolean NOT NULL DEFAULT false,
smtp_host text NOT NULL DEFAULT 'localhost', smtp_host text NOT NULL DEFAULT 'localhost',

View File

@ -20,6 +20,12 @@
<textarea class="form-control" ng-model="sysconf.homepageMessage" placeholder="html message here" rows="5"></textarea> <textarea class="form-control" ng-model="sysconf.homepageMessage" placeholder="html message here" rows="5"></textarea>
</div> </div>
</div> </div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Homepage message during the import of the dedup events</label>
<div class="col-sm-10">
<textarea class="form-control" ng-model="sysconf.homepageMessageImport" placeholder="html message here" rows="5"></textarea>
</div>
</div>
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-2 col-form-label">Read only</label> <label class="col-sm-2 col-form-label">Read only</label>
<div class="col-sm-10"> <div class="col-sm-10">

View File

@ -52,9 +52,8 @@
<div class="card-body"> <div class="card-body">
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active text-center p-3" id="tabLogin"> <div class="tab-pane active text-center p-3" id="tabLogin">
<div th:utext="${sysconf.homepageMessage}"></div> <div th:if="${!isImportRunning}" th:utext="${sysconf.homepageMessage}"></div>
<div th:if="${isImportRunning}" th:utext="${sysconf.homepageMessageImport}"></div>
<hr th:if="${sysconf.homepageMessage != '' and sysconf.homepageMessage != null}" />
<a href="./main" class="btn btn-lg btn-primary">Access using OpenAIRE credentials</a> <a href="./main" class="btn btn-lg btn-primary">Access using OpenAIRE credentials</a>
</div> </div>

View File

@ -51,9 +51,8 @@
<div class="card-body"> <div class="card-body">
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="tabLogin"> <div class="tab-pane active" id="tabLogin">
<div th:utext="${sysconf.homepageMessage}"></div> <div th:if="${!isImportRunning}" th:utext="${sysconf.homepageMessage}"></div>
<div th:if="${isImportRunning}" th:utext="${sysconf.homepageMessageImport}"></div>
<hr th:if="${sysconf.homepageMessage != '' and sysconf.homepageMessage != null}" />
<form th:action="@{/login}" method="post"> <form th:action="@{/login}" method="post">
<div th:if="${param.error}"> <div th:if="${param.error}">

View File

@ -150,8 +150,7 @@ fieldset > legend { font-size : 1.2rem !important; }
</nav> </nav>
<div class="alert alert-danger text-center" th:if="${sysconf.readonly}">The portal is running in READ-ONLY mode.</div> <div class="alert alert-danger text-center" th:if="${sysconf.readonly} or ${isImportRunning}">The portal is running in READ-ONLY mode.</div>
<div class="container-fluid small mt-4" ng-view></div> <div class="container-fluid small mt-4" ng-view></div>
@ -243,7 +242,7 @@ fieldset > legend { font-size : 1.2rem !important; }
</script> </script>
<script th:if="${sysconf.readonly}"> <script th:if="${sysconf.readonly} or ${isImportRunning}">
function call_http_post($http, url, obj, onSuccess) { function call_http_post($http, url, obj, onSuccess) {
alert("Method not permitted in READ-ONLY mode !") alert("Method not permitted in READ-ONLY mode !")
} }
@ -254,7 +253,7 @@ fieldset > legend { font-size : 1.2rem !important; }
</script> </script>
<script th:if="${!sysconf.readonly}"> <script th:if="${!sysconf.readonly} and ${!isImportRunning}">
function call_http_post($http, url, obj, onSuccess) { function call_http_post($http, url, obj, onSuccess) {
showSpinner(); showSpinner();
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; $http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dnet-applications</artifactId> <artifactId>dnet-applications</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId> <artifactId>apps</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>cmd-line-apps</artifactId> <artifactId>cmd-line-apps</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dnet-applications</artifactId> <artifactId>dnet-applications</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>libs</artifactId> <artifactId>libs</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>libs</artifactId> <artifactId>libs</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>libs</artifactId> <artifactId>libs</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -149,6 +149,10 @@ public class CommunityDetails extends CommunitySummary {
.append(name) .append(name)
.append(",\n\tshortName = ") .append(",\n\tshortName = ")
.append(shortName) .append(shortName)
.append(",\n\tdisplayName = ")
.append(displayName)
.append(",\n\tdisplayShortName = ")
.append(displayShortName)
.append(",\n\tdescription = ") .append(",\n\tdescription = ")
.append(description) .append(description)
.append(",\n\tlogoUrl = ") .append(",\n\tlogoUrl = ")

View File

@ -0,0 +1,5 @@
package eu.dnetlib.openaire.exporter.model.community;
public enum CommunityPlanType {
Standard, Advanced, Premium, National, Default
}

View File

@ -24,6 +24,12 @@ public class CommunitySummary {
@Schema(description = "community short name") @Schema(description = "community short name")
protected String shortName; protected String shortName;
@Schema(description = "community name for display")
protected String displayName;
@Schema(description = "community short name for display")
protected String displayShortName;
@Schema(description = "community creation date") @Schema(description = "community creation date")
protected LocalDateTime creationDate; protected LocalDateTime creationDate;
@ -49,7 +55,7 @@ public class CommunitySummary {
protected String zenodoCommunity; protected String zenodoCommunity;
@Schema(description = "community plan") @Schema(description = "community plan")
protected String plan; protected CommunityPlanType plan;
public CommunitySummary() {} public CommunitySummary() {}
@ -59,18 +65,22 @@ public class CommunitySummary {
final CommunityType type, final CommunityType type,
final String name, final String name,
final String shortName, final String shortName,
final String displayName,
final String displayShortName,
final LocalDateTime creationDate, final LocalDateTime creationDate,
final LocalDateTime lastUpdateDate, final LocalDateTime lastUpdateDate,
final String description, final String description,
final String logoUrl, final String logoUrl,
final CommunityStatus status, final CommunityStatus status,
final String zenodoCommunity, final String zenodoCommunity,
final String plan) { final CommunityPlanType plan) {
this.id = id; this.id = id;
this.queryId = queryId; this.queryId = queryId;
this.type = type; this.type = type;
this.name = name; this.name = name;
this.shortName = shortName; this.shortName = shortName;
this.displayName = displayName;
this.displayShortName = displayShortName;
this.creationDate = creationDate; this.creationDate = creationDate;
this.lastUpdateDate = lastUpdateDate; this.lastUpdateDate = lastUpdateDate;
this.description = description; this.description = description;
@ -86,6 +96,8 @@ public class CommunitySummary {
summary.getType(), summary.getType(),
summary.getName(), summary.getName(),
summary.getShortName(), summary.getShortName(),
summary.getDisplayName(),
summary.getDisplayShortName(),
summary.getCreationDate(), summary.getCreationDate(),
summary.getLastUpdateDate(), summary.getLastUpdateDate(),
summary.getDescription(), summary.getDescription(),
@ -135,6 +147,22 @@ public class CommunitySummary {
this.shortName = shortName; this.shortName = shortName;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(final String displayName) {
this.displayName = displayName;
}
public String getDisplayShortName() {
return displayShortName;
}
public void setDisplayShortName(final String displayShortName) {
this.displayShortName = displayShortName;
}
public LocalDateTime getCreationDate() { public LocalDateTime getCreationDate() {
return creationDate; return creationDate;
} }
@ -199,11 +227,11 @@ public class CommunitySummary {
this.zenodoCommunity = zenodoCommunity; this.zenodoCommunity = zenodoCommunity;
} }
public String getPlan() { public CommunityPlanType getPlan() {
return plan; return plan;
} }
public void setPlan(final String plan) { public void setPlan(final CommunityPlanType plan) {
this.plan = plan; this.plan = plan;
} }

View File

@ -16,6 +16,12 @@ public class CommunityWritableProperties {
@Schema(description = "community short name") @Schema(description = "community short name")
private String shortName; private String shortName;
@Schema(description = "community name for display")
private String displayName;
@Schema(description = "community short name for display")
private String displayShortName;
@Schema(description = "community description") @Schema(description = "community description")
private String description; private String description;
@ -56,7 +62,7 @@ public class CommunityWritableProperties {
private CommunityClaimType claim; private CommunityClaimType claim;
@Schema(description = "community plan") @Schema(description = "community plan")
private String plan; private CommunityPlanType plan;
public List<String> getFos() { public List<String> getFos() {
return fos; return fos;
@ -98,6 +104,22 @@ public class CommunityWritableProperties {
this.shortName = shortName; this.shortName = shortName;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(final String displayName) {
this.displayName = displayName;
}
public String getDisplayShortName() {
return displayShortName;
}
public void setDisplayShortName(final String displayShortName) {
this.displayShortName = displayShortName;
}
public String getDescription() { public String getDescription() {
return description; return description;
} }
@ -178,11 +200,12 @@ public class CommunityWritableProperties {
this.otherZenodoCommunities = otherZenodoCommunities; this.otherZenodoCommunities = otherZenodoCommunities;
} }
public String getPlan() { public CommunityPlanType getPlan() {
return plan; return plan;
} }
public void setPlan(final String plan) { public void setPlan(final CommunityPlanType plan) {
this.plan = plan; this.plan = plan;
} }
} }

View File

@ -39,12 +39,14 @@ public class IISConfigurationEntry implements Serializable {
} }
public void addParams(final String name, final String... values) { public void addParams(final String name, final String... values) {
if (StringUtils.isNoneBlank(name) && values != null) { if (StringUtils.isBlank(name)) { return; }
if (values == null) {
params.add(new Param().setName(name).setValue(""));
}
for (final String v : values) { for (final String v : values) {
if (StringUtils.isNotBlank(v)) { params.add(new Param().setName(name).setValue(v != null ? v : ""));
params.add(new Param().setName(name).setValue(v));
}
}
} }
} }

View File

@ -9,6 +9,10 @@ public class AggregationHistoryResponseV2 extends Response {
private List<AggregationInfo> aggregationInfo; private List<AggregationInfo> aggregationInfo;
public AggregationHistoryResponseV2() {
super();
}
public AggregationHistoryResponseV2(final List<AggregationInfo> aggregationInfo) { public AggregationHistoryResponseV2(final List<AggregationInfo> aggregationInfo) {
super(); super();
this.aggregationInfo = aggregationInfo; this.aggregationInfo = aggregationInfo;

View File

@ -1,6 +1,16 @@
package eu.dnetlib.openaire.exporter.model.dsm; package eu.dnetlib.openaire.exporter.model.dsm;
public abstract class AggregationInfo { import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonAutoDetect
@JsonInclude(Include.NON_NULL)
public class AggregationInfo implements Serializable {
private static final long serialVersionUID = -4908395195618212510L;
private int numberOfRecords; private int numberOfRecords;
@ -12,6 +22,8 @@ public abstract class AggregationInfo {
private boolean completedSuccessfully = true; private boolean completedSuccessfully = true;
private CollectionMode collectionMode;
public AggregationInfo() {} public AggregationInfo() {}
public int getNumberOfRecords() { public int getNumberOfRecords() {
@ -53,4 +65,13 @@ public abstract class AggregationInfo {
public void setCompletedSuccessfully(final boolean completedSuccessfully) { public void setCompletedSuccessfully(final boolean completedSuccessfully) {
this.completedSuccessfully = completedSuccessfully; this.completedSuccessfully = completedSuccessfully;
} }
public CollectionMode getCollectionMode() {
return collectionMode;
}
public void setCollectionMode(final CollectionMode collectionMode) {
this.collectionMode = collectionMode;
}
} }

View File

@ -1,13 +1,67 @@
package eu.dnetlib.openaire.exporter.model.dsm; package eu.dnetlib.openaire.exporter.model.dsm;
import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.Serializable;
public class AggregationInfoV1 extends AggregationInfo { import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Override @JsonAutoDetect
@JsonIgnore @JsonInclude(Include.NON_NULL)
public boolean isCompletedSuccessfully() { public class AggregationInfoV1 implements Serializable {
return super.isCompletedSuccessfully();
private static final long serialVersionUID = 7333873121568523946L;
private int numberOfRecords;
private String date;
private AggregationStage aggregationStage;
private boolean indexedVersion = false;
private CollectionMode collectionMode;
public AggregationInfoV1() {}
public int getNumberOfRecords() {
return numberOfRecords;
}
public void setNumberOfRecords(final int numberOfRecords) {
this.numberOfRecords = numberOfRecords;
}
public String getDate() {
return date;
}
public void setDate(final String date) {
this.date = date;
}
public AggregationStage getAggregationStage() {
return aggregationStage;
}
public void setAggregationStage(final AggregationStage aggregationStage) {
this.aggregationStage = aggregationStage;
}
public boolean isIndexedVersion() {
return indexedVersion;
}
public void setIndexedVersion(final boolean indexedVersion) {
this.indexedVersion = indexedVersion;
}
public CollectionMode getCollectionMode() {
return collectionMode;
}
public void setCollectionMode(final CollectionMode collectionMode) {
this.collectionMode = collectionMode;
} }
} }

View File

@ -1,22 +0,0 @@
package eu.dnetlib.openaire.exporter.model.dsm;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
/**
* Created by claudio on 29/11/2016.
*/
@JsonAutoDetect
@Deprecated
public class CollectionInfoV1 extends AggregationInfoV1 {
private CollectionMode collectionMode;
public CollectionMode getCollectionMode() {
return collectionMode;
}
public void setCollectionMode(final CollectionMode collectionMode) {
this.collectionMode = collectionMode;
}
}

View File

@ -1,21 +0,0 @@
package eu.dnetlib.openaire.exporter.model.dsm;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
/**
* Created by claudio on 29/11/2016.
*/
@JsonAutoDetect
public class CollectionInfoV2 extends AggregationInfo {
private CollectionMode collectionMode;
public CollectionMode getCollectionMode() {
return collectionMode;
}
public void setCollectionMode(final CollectionMode collectionMode) {
this.collectionMode = collectionMode;
}
}

View File

@ -1,12 +0,0 @@
package eu.dnetlib.openaire.exporter.model.dsm;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
/**
* Created by claudio on 29/11/2016.
*/
@JsonAutoDetect
@Deprecated
public class TransformationInfoV1 extends AggregationInfoV1 {
}

View File

@ -1,11 +0,0 @@
package eu.dnetlib.openaire.exporter.model.dsm;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
/**
* Created by claudio on 29/11/2016.
*/
@JsonAutoDetect
public class TransformationInfoV2 extends AggregationInfo {
}

View File

@ -0,0 +1,25 @@
package eu.dnetlib.openaire.exporter.model.dsm;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
public class DatasourceApiClientTest {
@Test
public void testaAgregationHistoryV2_local() throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final AggregationHistoryResponseV2 res =
mapper.readValue(IOUtils.toString(getClass().getResourceAsStream("aggregation-info-v2.json"), "UTF-8"), AggregationHistoryResponseV2.class);
System.out.println(mapper.writeValueAsString(res));
assertTrue(res.getAggregationInfo().size() > 0);
}
}

View File

@ -0,0 +1,27 @@
{
"header": {
"total": 100,
"page": 0,
"size": 100,
"time": 0,
"statusCode": 0,
"errors": []
},
"aggregationInfo": [
{
"numberOfRecords": 739,
"date": "2024-03-14",
"aggregationStage": "TRANSFORM",
"indexedVersion": false,
"completedSuccessfully": true
},
{
"numberOfRecords": 822,
"date": "2024-03-14",
"aggregationStage": "COLLECT",
"indexedVersion": false,
"completedSuccessfully": true,
"collectionMode": "REFRESH"
}
]
}

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>libs</artifactId> <artifactId>libs</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dnet-applications</artifactId> <artifactId>dnet-applications</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dnet-applications</artifactId> <artifactId>dnet-applications</artifactId>
<version>3.4.5-SNAPSHOT</version> <version>3.5.5-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<licenses> <licenses>