Merge branch 'dmp-refactoring' of code-repo.d4science.org:MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Efstratios Giannopoulos 2023-11-07 10:32:02 +02:00
commit 05f73889be
8 changed files with 201 additions and 98 deletions

View File

@ -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<DMP, UUID> {
@Column(name = "\"Version\"")
private Integer version;
@OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
@Transient
private Set<DescriptionEntity> descriptionEntity;

View File

@ -38,11 +38,7 @@ public class Registry implements DataEntity<Registry, UUID> {
@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<DescriptionEntity> descriptionEntities;
@Column(name = "\"Status\"", nullable = false)

View File

@ -4,16 +4,17 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.types.xml.XmlBuilder;
import eu.eudat.data.DescriptionEntity;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.data.DmpEntity;
import eu.eudat.data.*;
import eu.eudat.data.old.UserDMP;
import eu.eudat.data.old.UserInfo;
import eu.eudat.depositinterface.models.*;
import eu.eudat.query.DescriptionQuery;
import eu.eudat.query.DescriptionTemplateQuery;
import jakarta.persistence.EntityManager;
import jakarta.persistence.criteria.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@ -30,11 +31,13 @@ public class DmpEntityDepositMapper {
private static final Logger logger = LoggerFactory.getLogger(DmpEntityDepositMapper.class);
private final ObjectMapper mapper;
private final ApplicationContext applicationContext;
private final EntityManager entityManager;
public DmpEntityDepositMapper(EntityManager entityManager) {
public DmpEntityDepositMapper(ApplicationContext applicationContext, EntityManager entityManager) {
this.applicationContext = applicationContext;
this.entityManager = entityManager;
this.mapper = new ObjectMapper();
}
@ -59,11 +62,8 @@ public class DmpEntityDepositMapper {
}
private List<DescriptionEntity> getDescriptions(UUID dmpId) {
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<DescriptionEntity> query = builder.createQuery(DescriptionEntity.class);
Root<DescriptionEntity> root = query.from(DescriptionEntity.class);
query = query.where(builder.and(builder.equal(root.get("dmp"), dmpId), builder.equal(root.get("isActive"), IsActive.Active)));
return entityManager.createQuery(query).getResultList();
DescriptionQuery descriptionQuery = this.applicationContext.getBean(DescriptionQuery.class);
return descriptionQuery.dmpIds(dmpId).isActive(IsActive.Active).collect();
}
@ -79,11 +79,8 @@ public class DmpEntityDepositMapper {
}
private DescriptionTemplateEntity getDescriptionTemplate(UUID descId) {
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<DescriptionTemplateEntity> query = builder.createQuery(DescriptionTemplateEntity.class);
Root<DescriptionTemplateEntity> root = query.from(DescriptionTemplateEntity.class);
query = query.where(builder.and(builder.equal(root.get("id"), descId), builder.equal(root.get("isActive"), IsActive.Active)));
return entityManager.createQuery(query).getSingleResult();
DescriptionTemplateQuery descriptionTemplateQuery = this.applicationContext.getBean(DescriptionTemplateQuery.class);
return descriptionTemplateQuery.ids(descId).isActive(IsActive.Active).first();
}
private List<DatasetFieldsDepositModel> fromDefinitionAndProperties(String definition, String properties){

View File

@ -0,0 +1,57 @@
package eu.eudat.model.persist;
import eu.eudat.commons.validation.FieldNotNullIfOtherSet;
import eu.eudat.commons.validation.ValidId;
import jakarta.validation.constraints.NotNull;
import java.util.UUID;
@FieldNotNullIfOtherSet(message = "{validation.hashempty}")
public class DmpDescriptionTemplatePersist {
@ValidId(message = "{validation.invalidid}")
private UUID id;
@ValidId(message = "{validation.invalidid}")
@NotNull(message = "{validation.empty}")
private UUID descriptionTemplate;
@ValidId(message = "{validation.invalidid}")
@NotNull(message = "{validation.empty}")
private UUID sectionId;
private String hash;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public UUID getDescriptionTemplate() {
return descriptionTemplate;
}
public void setDescriptionTemplate(UUID descriptionTemplate) {
this.descriptionTemplate = descriptionTemplate;
}
public UUID getSectionId() {
return sectionId;
}
public void setSectionId(UUID sectionId) {
this.sectionId = sectionId;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
}

View File

@ -24,6 +24,8 @@ public class DmpPersist {
private List<DmpReferencePersist> references;
private List<DmpDescriptionTemplatePersist> descriptionTemplates;
private String hash;
public UUID getId() {
@ -82,6 +84,14 @@ public class DmpPersist {
this.references = references;
}
public List<DmpDescriptionTemplatePersist> getDescriptionTemplates() {
return descriptionTemplates;
}
public void setDescriptionTemplates(List<DmpDescriptionTemplatePersist> descriptionTemplates) {
this.descriptionTemplates = descriptionTemplates;
}
public String getHash() {
return hash;
}

View File

@ -189,6 +189,14 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
notInClause.value(item);
predicates.add(notInClause.not());
}
if (this.entityIds != null) {
CriteriaBuilder.In<UUID> noInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(EntityDoiEntity._entityId));
for (UUID item: this.entityIds) {
noInClause.value(item);
predicates.add(noInClause.not());
}
}
if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
return queryContext.CriteriaBuilder.and(predicatesArray);

View File

@ -9,9 +9,7 @@ import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.types.reference.DefinitionEntity;
import eu.eudat.commons.types.reference.FieldEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DmpEntity;
import eu.eudat.data.DmpReferenceEntity;
import eu.eudat.data.ReferenceEntity;
import eu.eudat.data.*;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.DmpTouchedEvent;
import eu.eudat.event.EventBroker;
@ -19,16 +17,16 @@ import eu.eudat.model.Dmp;
import eu.eudat.model.Reference;
import eu.eudat.model.builder.DmpBuilder;
import eu.eudat.model.deleter.DmpDeleter;
import eu.eudat.model.deleter.DmpDescriptionTemplateDeleter;
import eu.eudat.model.deleter.DmpReferenceDeleter;
import eu.eudat.model.deleter.ReferenceDeleter;
import eu.eudat.model.persist.DmpDescriptionTemplatePersist;
import eu.eudat.model.persist.DmpPersist;
import eu.eudat.model.persist.DmpReferencePersist;
import eu.eudat.model.persist.ReferencePersist;
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
import eu.eudat.model.persist.referencedefinition.FieldPersist;
import eu.eudat.query.DmpQuery;
import eu.eudat.query.DmpReferenceQuery;
import eu.eudat.query.ReferenceQuery;
import eu.eudat.query.*;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.deleter.DeleterFactory;
@ -119,7 +117,9 @@ public class DmpServiceImpl implements DmpService {
DmpEntity data = this.patchAndSave(model);
this.patchAndSave(model.getReferences(), data.getId());
this.patchAndSaveReferences(model.getReferences(), data.getId());
this.patchAndSaveTemplates(model.getDescriptionTemplates(), data.getId());
this.eventBroker.emit(new DmpTouchedEvent(data.getId()));
@ -202,7 +202,7 @@ public class DmpServiceImpl implements DmpService {
return data;
}
private void patchAndSave(List<DmpReferencePersist> models, UUID dmpId) throws InvalidApplicationException {
private void patchAndSaveReferences(List<DmpReferencePersist> models, UUID dmpId) throws InvalidApplicationException {
if (models == null || models.isEmpty())
return;
@ -269,6 +269,41 @@ public class DmpServiceImpl implements DmpService {
}
private void patchAndSaveTemplates(List<DmpDescriptionTemplatePersist> models, UUID dmpId) throws InvalidApplicationException {
if (models == null || models.isEmpty())
return;
List<DmpDescriptionTemplateEntity> templates = this.queryFactory.query(DmpDescriptionTemplateQuery.class).dmpIds(dmpId).collect();
Map<UUID, List<DmpDescriptionTemplateEntity>> templatesLookup = this.conventionService.toDictionaryOfList(templates, DmpDescriptionTemplateEntity::getDmp);
List<DescriptionTemplateEntity> existingTemplates;
if (templatesLookup.containsKey(dmpId))
existingTemplates = this.queryFactory.query(DescriptionTemplateQuery.class).ids(templatesLookup.get(dmpId).stream().map(DmpDescriptionTemplateEntity::getId).toList()).collect();
else existingTemplates = new ArrayList<>();
List<UUID> updatedTemplatesIds = models.stream().map(DmpDescriptionTemplatePersist::getDescriptionTemplate).filter(this.conventionService::isValidGuid).distinct().toList();
List<DescriptionTemplateEntity> toDelete = existingTemplates.stream().filter(x -> !updatedTemplatesIds.contains(x.getId())).toList();
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateRecordsToDelete = this.queryFactory.query(DmpDescriptionTemplateQuery.class).descriptionTemplateIds(toDelete.stream().map(DescriptionTemplateEntity::getId).toList()).collect();
this.deleterFactory.deleter(DmpDescriptionTemplateDeleter.class).delete(dmpDescriptionTemplateRecordsToDelete);
for (DmpDescriptionTemplatePersist model : models) {
boolean shouldAdd = existingTemplates.stream().noneMatch(x -> x.getId().equals(model.getDescriptionTemplate()));
if (shouldAdd) {
DmpDescriptionTemplateEntity dmpTemplate = new DmpDescriptionTemplateEntity();
dmpTemplate.setDescriptionTemplate(model.getDescriptionTemplate());
dmpTemplate.setDmp(dmpId);
dmpTemplate.setSectionId(model.getSectionId());
dmpTemplate.setCreatedAt(Instant.now());
dmpTemplate.setUpdatedAt(Instant.now());
dmpTemplate.setIsActive(IsActive.Active);
this.entityManager.persist(dmpTemplate);
}
}
this.entityManager.flush();
}
private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist){
DefinitionEntity data = new DefinitionEntity();
if (persist == null) return data;

View File

@ -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<Path> 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<Path> 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");
}