diff --git a/distro/changelog.xml b/distro/changelog.xml index 05dbb0c..8af9854 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -14,6 +14,7 @@ Added API to enumerate all Context in Access port type #10610 Exposed API to enumerate all Context in Context port-type #10217 Added support for hierarchical roles in Contexts to support child Context overview #10435 + Using new multiple inheritance support of ISModel to create types when creating new database #5706 Added an API to retrieve Resource instances filtering them #9772 diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java index ce192bb..5dec118 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java @@ -6,11 +6,9 @@ import java.util.Map; import java.util.Properties; import java.util.UUID; -import org.gcube.informationsystem.impl.utils.ISMapper; -import org.gcube.informationsystem.impl.utils.discovery.ERDiscovery; +import org.gcube.informationsystem.impl.utils.discovery.ISMDiscovery; +import org.gcube.informationsystem.impl.utils.discovery.SchemaAction; import org.gcube.informationsystem.model.ISConstants; -import org.gcube.informationsystem.model.embedded.Embedded; -import org.gcube.informationsystem.model.embedded.ValueSchema; import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.ContextSecurityContext; @@ -199,7 +197,9 @@ public class DatabaseEnvironment { schemaSecurityContext.create(); - createEntitiesAndRelations(); + SchemaAction schemaAction = new SchemaActionImpl(); + ISMDiscovery.manageISM(schemaAction); + } } catch(Exception e) { @@ -286,12 +286,4 @@ public class DatabaseEnvironment { return false; } - private static void createEntitiesAndRelations() throws Exception { - ERDiscovery erDiscovery = ISMapper.getErdiscovery(); - SchemaActionImpl entityRegistrationAction = new SchemaActionImpl(); - entityRegistrationAction.manageEmbeddedClass(Embedded.class); - entityRegistrationAction.manageEmbeddedClass(ValueSchema.class); - erDiscovery.manageDiscoveredERTypes(entityRegistrationAction); - } - } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java index 81b15d0..0f77a86 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java @@ -29,7 +29,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFound import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; -import org.gcube.informationsystem.resourceregistry.api.rest.ContextPath; import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPCall.HTTPMETHOD; import org.gcube.informationsystem.resourceregistry.context.ContextManagement; import org.gcube.informationsystem.resourceregistry.er.ERManagement; @@ -275,7 +274,7 @@ public class Access { public String getContext(@PathParam(ID_PATH_PARAM) String uuid) throws ContextNotFoundException, ResourceRegistryException { ContextManagement contextManagement = new ContextManagement(); - if(uuid.compareTo(ContextPath.ALL_PATH_PART)==0) { + if(uuid.compareTo(AccessPath.ALL_PATH_PART)==0) { logger.info("Requested to read all {}s", org.gcube.informationsystem.model.entity.Context.NAME); return contextManagement.all(false); }else { diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java index ef8d811..838e29f 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java @@ -1,6 +1,5 @@ package org.gcube.informationsystem.resourceregistry.rest; -import javax.ws.rs.ApplicationPath; import javax.ws.rs.Consumes; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; @@ -18,7 +17,6 @@ import org.gcube.informationsystem.resourceregistry.ResourceInitializer; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; -import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; import org.gcube.informationsystem.resourceregistry.api.rest.SchemaPath; import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; @@ -28,7 +26,7 @@ import org.slf4j.LoggerFactory; /** * @author Luca Frosini (ISTI - CNR) */ -@ApplicationPath(SchemaPath.SCHEMA_PATH_PART) +@Path(SchemaPath.SCHEMA_PATH_PART) public class SchemaManager { private static Logger logger = LoggerFactory.getLogger(SchemaManager.class); @@ -54,7 +52,7 @@ public class SchemaManager { AccessType accessType = null; try { - accessType = AccessType.valueOf(type); + accessType = AccessType.valueOf(type.toUpperCase()); switch(accessType) { case EMBEDDED: break; @@ -91,10 +89,9 @@ public class SchemaManager { */ @GET @Path("{" + TYPE_PATH_PARAM + "}") - @Consumes({MediaType.TEXT_PLAIN, ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8}) @Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8) public String read(@PathParam(TYPE_PATH_PARAM) String type, - @QueryParam(AccessPath.POLYMORPHIC_PARAM) @DefaultValue("false") Boolean polymorphic) + @QueryParam(SchemaPath.POLYMORPHIC_PARAM) @DefaultValue("false") Boolean polymorphic) throws SchemaNotFoundException, ResourceRegistryException { logger.info("Requested Schema for type {}", type); SchemaManagement schemaManagement = new SchemaManagementImpl();