diff --git a/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/config/CoreApiInteractingEntity.java b/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/config/CoreApiInteractingEntity.java index 275425536..1578527c0 100644 --- a/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/config/CoreApiInteractingEntity.java +++ b/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/config/CoreApiInteractingEntity.java @@ -1,5 +1,6 @@ package tech.ebp.oqm.core.api.config; +import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.Getter; @@ -31,30 +32,34 @@ public CoreApiInteractingEntity( ){ this.email = email; } - + @Getter private String email; - + + @JsonProperty(access = JsonProperty.Access.READ_ONLY) @Override public ObjectId getId() { return BS_ID; } - + + @JsonProperty(access = JsonProperty.Access.READ_ONLY) @Override public String getName() { return "Core API"; } - + + @JsonProperty(access = JsonProperty.Access.READ_ONLY) @Override public InteractingEntityType getInteractingEntityType() { return InteractingEntityType.CORE_API; } - + + @JsonProperty(access = JsonProperty.Access.READ_ONLY) @Override public Set getRoles() { return new HashSet<>(){{add("Yes");}}; } - + @Override public boolean updateFrom(JsonWebToken jwt) { return false; diff --git a/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/model/object/interactingEntity/InteractingEntity.java b/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/model/object/interactingEntity/InteractingEntity.java index 66e0b019f..2234586ed 100644 --- a/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/model/object/interactingEntity/InteractingEntity.java +++ b/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/model/object/interactingEntity/InteractingEntity.java @@ -12,6 +12,7 @@ import org.bson.codecs.pojo.annotations.BsonDiscriminator; import org.eclipse.microprofile.jwt.Claims; import org.eclipse.microprofile.jwt.JsonWebToken; +import tech.ebp.oqm.core.api.config.CoreApiInteractingEntity; import tech.ebp.oqm.core.api.model.object.AttKeywordMainObject; import tech.ebp.oqm.core.api.model.object.interactingEntity.externalService.GeneralService; import tech.ebp.oqm.core.api.model.object.interactingEntity.externalService.plugin.PluginService; @@ -29,6 +30,7 @@ @JsonSubTypes.Type(value = User.class, name = "USER"), @JsonSubTypes.Type(value = PluginService.class, name = "SERVICE_PLUGIN"), @JsonSubTypes.Type(value = GeneralService.class, name = "SERVICE_GENERAL"), + @JsonSubTypes.Type(value = CoreApiInteractingEntity.class, name = "CORE_API"), }) @BsonDiscriminator @Data diff --git a/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/service/importExport/importing/DataImportService.java b/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/service/importExport/importing/DataImportService.java index 5050aad64..16e3ef264 100644 --- a/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/service/importExport/importing/DataImportService.java +++ b/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/service/importExport/importing/DataImportService.java @@ -109,12 +109,6 @@ private static List getObjectHistoryFiles(Path directory) throws IOExcepti @Inject OqmDatabaseService oqmDatabaseService; - @Inject - InteractingEntityService interactingEntityService; - - @Inject - CustomUnitService customUnitService; - @Inject ImageService imageService; diff --git a/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/service/importExport/importing/importer/InteractingEntityImporter.java b/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/service/importExport/importing/importer/InteractingEntityImporter.java index af321908b..ea61f3f37 100644 --- a/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/service/importExport/importing/importer/InteractingEntityImporter.java +++ b/software/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/service/importExport/importing/importer/InteractingEntityImporter.java @@ -5,7 +5,9 @@ import jakarta.inject.Inject; import lombok.AccessLevel; import lombok.Getter; +import lombok.extern.slf4j.Slf4j; import org.bson.types.ObjectId; +import tech.ebp.oqm.core.api.config.CoreApiInteractingEntity; import tech.ebp.oqm.core.api.model.object.MainObject; import tech.ebp.oqm.core.api.model.object.ObjectUtils; import tech.ebp.oqm.core.api.model.object.interactingEntity.InteractingEntity; @@ -20,6 +22,7 @@ import java.util.*; import java.util.stream.Collectors; +@Slf4j @ApplicationScoped public class InteractingEntityImporter extends TopLevelImporter { @@ -27,6 +30,10 @@ public class InteractingEntityImporter extends TopLevelImporter getCollection(DbCacheEntry db) { + log.debug("Getting collection for cache entry {}", db); if(!this.collections.containsKey(db.getDbId())){ + log.info("Collection for db cache entry not present. Creating. Cache entry: {}", db); this.collections.put( db.getDbId(), db.getMongoDatabase().getCollection(this.collectionName, this.clazz)