From a9eb2b4513d925d68f5b3cc0b0cd42b7b0ecd9bd Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Tue, 7 Nov 2023 10:02:09 +0200 Subject: [PATCH] fix backend build error --- .../src/main/java/eu/eudat/data/old/DMP.java | 20 +-- .../main/java/eu/eudat/data/old/Registry.java | 6 +- .../eudat/logic/managers/MetricsManager.java | 120 +++++++++--------- 3 files changed, 71 insertions(+), 75 deletions(-) diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/DMP.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/DMP.java index 9c715d48d..46b234607 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/DMP.java +++ b/dmp-backend/core/src/main/java/eu/eudat/data/old/DMP.java @@ -38,15 +38,15 @@ import java.util.stream.Collectors; name = "dmpRecentActivity", attributeNodes = { @NamedAttributeNode("users"), @NamedAttributeNode("creator")}), - @NamedEntityGraph( - name = "recentDmpModel", - attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"), - @NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode(value = "dataset", subgraph = "dataset")}, - subgraphs = { - @NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}), - @NamedSubgraph(name = "dataset", attributeNodes = {@NamedAttributeNode("id"), @NamedAttributeNode("label")}) - } - ), +// @NamedEntityGraph( +// name = "recentDmpModel", +// attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"), +// @NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode(value = "dataset", subgraph = "dataset")}, +// subgraphs = { +// @NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}), +// @NamedSubgraph(name = "dataset", attributeNodes = {@NamedAttributeNode("id"), @NamedAttributeNode("label")}) +// } +// ), @NamedEntityGraph( name = "versionListingModel", attributeNodes = {@NamedAttributeNode("id"), @NamedAttributeNode("groupId"), @NamedAttributeNode("version")} @@ -103,7 +103,7 @@ public class DMP implements DataEntity { @Column(name = "\"Version\"") private Integer version; - @OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY) + @Transient private Set descriptionEntity; diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Registry.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Registry.java index 92db305af..29c860824 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Registry.java +++ b/dmp-backend/core/src/main/java/eu/eudat/data/old/Registry.java @@ -38,11 +38,7 @@ public class Registry implements DataEntity { @Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true) private String definition; - @OneToMany(fetch = FetchType.LAZY) - @JoinTable(name = "\"DatasetRegistry\"", - joinColumns = {@JoinColumn(name = "\"Registry\"", referencedColumnName = "\"ID\"")}, - inverseJoinColumns = {@JoinColumn(name = "\"Dataset\"", referencedColumnName = "\"ID\"")} - ) + @Transient private Set descriptionEntities; @Column(name = "\"Status\"", nullable = false) diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java index 899980333..4b1ce0c8d 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java @@ -129,66 +129,66 @@ public class MetricsManager { @Scheduled(initialDelay = 1000 * 60 * 60, fixedDelay = 1000 * 60 * 60) public void init() throws IOException, InvalidApplicationException { logger.info("Start calculating Metrics"); - calculateValue(MetricNames.DMP, (int) countAllDraftDMPs(), MetricNames.DRAFT); - calculateValue(MetricNames.DMP, (int) countAllFinalizedDMPs(), MetricNames.FINALIZED); - calculateValue(MetricNames.DMP, (int) countAllPublishedDMPs(), MetricNames.PUBLISHED); - calculateValue(MetricNames.DMP, (int) countAllDoiedDMPs(), MetricNames.DOIED); - - calculateValue(MetricNames.NEXUS + MetricNames.DMP, (int) countAllDraftDMPs(true), MetricNames.DRAFT); - calculateValue(MetricNames.NEXUS + MetricNames.DMP, (int) countAllFinalizedDMPs(true), MetricNames.FINALIZED); - calculateValue(MetricNames.NEXUS + MetricNames.DMP, (int) countAllPublishedDMPs(true), MetricNames.PUBLISHED); - calculateValue(MetricNames.NEXUS + MetricNames.DMP, (int) countAllDoiedDMPs(true), MetricNames.DOIED); - - calculateValue(MetricNames.DMP_WITH_GRANT, (int) countAllDraftDMPsWithGrantId(), MetricNames.DRAFT); - calculateValue(MetricNames.DMP_WITH_GRANT, (int) countAllFinalizedDMPsWithGrantId(), MetricNames.FINALIZED); - calculateValue(MetricNames.DMP_WITH_GRANT, (int) countAllPublishedDMPsWithGrantId(), MetricNames.PUBLISHED); - calculateValue(MetricNames.DMP_WITH_GRANT, (int) countAllDoiedDMPsWithGrantId(), MetricNames.DOIED); - - calculateValue(MetricNames.NEXUS + MetricNames.DMP_WITH_GRANT, (int) countAllDraftDMPsWithGrantId(true), MetricNames.DRAFT); - calculateValue(MetricNames.NEXUS + MetricNames.DMP_WITH_GRANT, (int) countAllFinalizedDMPsWithGrantId(true), MetricNames.FINALIZED); - calculateValue(MetricNames.NEXUS + MetricNames.DMP_WITH_GRANT, (int) countAllPublishedDMPsWithGrantId(true), MetricNames.PUBLISHED); - calculateValue(MetricNames.NEXUS + MetricNames.DMP_WITH_GRANT, (int) countAllDoiedDMPsWithGrantId(true), MetricNames.DOIED); - - calculateValue(MetricNames.FUNDERS, (int) countAllFunders(), null); - calculateValue(MetricNames.GRANTS, (int) countAllGrants(), null); - calculateValue(MetricNames.PROJECT, (int) countAllProjects(), null); - calculateValue(MetricNames.RESEARCHER, (int) countAllResearchers(), null); - - calculateValue(MetricNames.NEXUS + MetricNames.FUNDERS, (int) countAllFunders(true), null); - calculateValue(MetricNames.NEXUS + MetricNames.GRANTS, (int) countAllGrants(true), null); - calculateValue(MetricNames.NEXUS + MetricNames.PROJECT, (int) countAllProjects(true), null); - calculateValue(MetricNames.NEXUS + MetricNames.RESEARCHER, (int) countAllResearchers(true), null); - - calculateValue(MetricNames.DATASET, (int) countAllDraftDatasets(), MetricNames.DRAFT); - calculateValue(MetricNames.DATASET, (int) countAllFinalizedDatasets(), MetricNames.FINALIZED); - calculateValue(MetricNames.DATASET, (int) countAllPublicDatasets(), MetricNames.PUBLISHED); - calculateValue(MetricNames.DATASET, (int) countAllDatasetsWithDoi(), MetricNames.DOIED); - - calculateValue(MetricNames.NEXUS + MetricNames.DATASET, (int) countAllDraftDatasets(true), MetricNames.DRAFT); - calculateValue(MetricNames.NEXUS + MetricNames.DATASET, (int) countAllFinalizedDatasets(true), MetricNames.FINALIZED); - calculateValue(MetricNames.NEXUS + MetricNames.DATASET, (int) countAllPublicDatasets(true), MetricNames.PUBLISHED); - calculateValue(MetricNames.NEXUS + MetricNames.DATASET, (int) countAllDatasetsWithDoi(true), MetricNames.DOIED); - - calculateValue(MetricNames.DATASET_TEMPLATE, (int) countAllDraftTemplates(), MetricNames.DRAFT); - calculateValue(MetricNames.DATASET_TEMPLATE, (int) countAllFinalizedTemplates(), MetricNames.ACTIVE); - calculateValue(MetricNames.DATASET_TEMPLATE, (int) countAllUsedTemplates(), MetricNames.USED); - - calculateValue(MetricNames.NEXUS + MetricNames.DATASET_TEMPLATE, (int) countAllDraftTemplates(true), MetricNames.DRAFT); - calculateValue(MetricNames.NEXUS + MetricNames.DATASET_TEMPLATE, (int) countAllFinalizedTemplates(true), MetricNames.ACTIVE); - calculateValue(MetricNames.NEXUS + MetricNames.DATASET_TEMPLATE, (int) countAllUsedTemplates(true), MetricNames.USED); - - calculateValue(MetricNames.USERS, (int) userManager.countActiveUsers().intValue(), MetricNames.LOGGEDIN); - calculateValue(MetricNames.USERS, (int) userManager.countAllUsers().intValue(), MetricNames.TOTAL); - - try (Stream paths = Files.list(Paths.get(Objects.requireNonNull(this.environment.getProperty("userguide.path"))))) { - long files = paths.count(); - calculateValue(MetricNames.LANGUAGES, (int) files, null); - } catch (Exception e) { - logger.error("Could not calculate languages."); - } - - calculateValue(MetricNames.INSTALLATIONS, 1, null); - calculateValue(MetricNames.NEXUS + MetricNames.INSTALLATIONS, 1, null); +// calculateValue(MetricNames.DMP, (int) countAllDraftDMPs(), MetricNames.DRAFT); +// calculateValue(MetricNames.DMP, (int) countAllFinalizedDMPs(), MetricNames.FINALIZED); +// calculateValue(MetricNames.DMP, (int) countAllPublishedDMPs(), MetricNames.PUBLISHED); +// calculateValue(MetricNames.DMP, (int) countAllDoiedDMPs(), MetricNames.DOIED); +// +// calculateValue(MetricNames.NEXUS + MetricNames.DMP, (int) countAllDraftDMPs(true), MetricNames.DRAFT); +// calculateValue(MetricNames.NEXUS + MetricNames.DMP, (int) countAllFinalizedDMPs(true), MetricNames.FINALIZED); +// calculateValue(MetricNames.NEXUS + MetricNames.DMP, (int) countAllPublishedDMPs(true), MetricNames.PUBLISHED); +// calculateValue(MetricNames.NEXUS + MetricNames.DMP, (int) countAllDoiedDMPs(true), MetricNames.DOIED); +// +// calculateValue(MetricNames.DMP_WITH_GRANT, (int) countAllDraftDMPsWithGrantId(), MetricNames.DRAFT); +// calculateValue(MetricNames.DMP_WITH_GRANT, (int) countAllFinalizedDMPsWithGrantId(), MetricNames.FINALIZED); +// calculateValue(MetricNames.DMP_WITH_GRANT, (int) countAllPublishedDMPsWithGrantId(), MetricNames.PUBLISHED); +// calculateValue(MetricNames.DMP_WITH_GRANT, (int) countAllDoiedDMPsWithGrantId(), MetricNames.DOIED); +// +// calculateValue(MetricNames.NEXUS + MetricNames.DMP_WITH_GRANT, (int) countAllDraftDMPsWithGrantId(true), MetricNames.DRAFT); +// calculateValue(MetricNames.NEXUS + MetricNames.DMP_WITH_GRANT, (int) countAllFinalizedDMPsWithGrantId(true), MetricNames.FINALIZED); +// calculateValue(MetricNames.NEXUS + MetricNames.DMP_WITH_GRANT, (int) countAllPublishedDMPsWithGrantId(true), MetricNames.PUBLISHED); +// calculateValue(MetricNames.NEXUS + MetricNames.DMP_WITH_GRANT, (int) countAllDoiedDMPsWithGrantId(true), MetricNames.DOIED); +// +// calculateValue(MetricNames.FUNDERS, (int) countAllFunders(), null); +// calculateValue(MetricNames.GRANTS, (int) countAllGrants(), null); +// calculateValue(MetricNames.PROJECT, (int) countAllProjects(), null); +// calculateValue(MetricNames.RESEARCHER, (int) countAllResearchers(), null); +// +// calculateValue(MetricNames.NEXUS + MetricNames.FUNDERS, (int) countAllFunders(true), null); +// calculateValue(MetricNames.NEXUS + MetricNames.GRANTS, (int) countAllGrants(true), null); +// calculateValue(MetricNames.NEXUS + MetricNames.PROJECT, (int) countAllProjects(true), null); +// calculateValue(MetricNames.NEXUS + MetricNames.RESEARCHER, (int) countAllResearchers(true), null); +// +// calculateValue(MetricNames.DATASET, (int) countAllDraftDatasets(), MetricNames.DRAFT); +// calculateValue(MetricNames.DATASET, (int) countAllFinalizedDatasets(), MetricNames.FINALIZED); +// calculateValue(MetricNames.DATASET, (int) countAllPublicDatasets(), MetricNames.PUBLISHED); +// calculateValue(MetricNames.DATASET, (int) countAllDatasetsWithDoi(), MetricNames.DOIED); +// +// calculateValue(MetricNames.NEXUS + MetricNames.DATASET, (int) countAllDraftDatasets(true), MetricNames.DRAFT); +// calculateValue(MetricNames.NEXUS + MetricNames.DATASET, (int) countAllFinalizedDatasets(true), MetricNames.FINALIZED); +// calculateValue(MetricNames.NEXUS + MetricNames.DATASET, (int) countAllPublicDatasets(true), MetricNames.PUBLISHED); +// calculateValue(MetricNames.NEXUS + MetricNames.DATASET, (int) countAllDatasetsWithDoi(true), MetricNames.DOIED); +// +// calculateValue(MetricNames.DATASET_TEMPLATE, (int) countAllDraftTemplates(), MetricNames.DRAFT); +// calculateValue(MetricNames.DATASET_TEMPLATE, (int) countAllFinalizedTemplates(), MetricNames.ACTIVE); +// calculateValue(MetricNames.DATASET_TEMPLATE, (int) countAllUsedTemplates(), MetricNames.USED); +// +// calculateValue(MetricNames.NEXUS + MetricNames.DATASET_TEMPLATE, (int) countAllDraftTemplates(true), MetricNames.DRAFT); +// calculateValue(MetricNames.NEXUS + MetricNames.DATASET_TEMPLATE, (int) countAllFinalizedTemplates(true), MetricNames.ACTIVE); +// calculateValue(MetricNames.NEXUS + MetricNames.DATASET_TEMPLATE, (int) countAllUsedTemplates(true), MetricNames.USED); +// +// calculateValue(MetricNames.USERS, (int) userManager.countActiveUsers().intValue(), MetricNames.LOGGEDIN); +// calculateValue(MetricNames.USERS, (int) userManager.countAllUsers().intValue(), MetricNames.TOTAL); +// +// try (Stream paths = Files.list(Paths.get(Objects.requireNonNull(this.environment.getProperty("userguide.path"))))) { +// long files = paths.count(); +// calculateValue(MetricNames.LANGUAGES, (int) files, null); +// } catch (Exception e) { +// logger.error("Could not calculate languages."); +// } +// +// calculateValue(MetricNames.INSTALLATIONS, 1, null); +// calculateValue(MetricNames.NEXUS + MetricNames.INSTALLATIONS, 1, null); logger.info("Metrics calculation Completed"); }