Merged from branch after release 4.9.0. refs #10253

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@160760 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-12-21 10:09:46 +00:00
parent a5482afa68
commit cc0e645ba5
4 changed files with 10 additions and 21 deletions

View File

@ -14,6 +14,7 @@
<Change>Added API to enumerate all Context in Access port type #10610</Change> <Change>Added API to enumerate all Context in Access port type #10610</Change>
<Change>Exposed API to enumerate all Context in Context port-type #10217</Change> <Change>Exposed API to enumerate all Context in Context port-type #10217</Change>
<Change>Added support for hierarchical roles in Contexts to support child Context overview #10435</Change> <Change>Added support for hierarchical roles in Contexts to support child Context overview #10435</Change>
<Change>Using new multiple inheritance support of ISModel to create types when creating new database #5706</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.information-system.resource-registry.1-6-0" date="2017-10-09"> <Changeset component="org.gcube.information-system.resource-registry.1-6-0" date="2017-10-09">
<Change>Added an API to retrieve Resource instances filtering them #9772</Change> <Change>Added an API to retrieve Resource instances filtering them #9772</Change>

View File

@ -6,11 +6,9 @@ import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.impl.utils.ISMapper; import org.gcube.informationsystem.impl.utils.discovery.ISMDiscovery;
import org.gcube.informationsystem.impl.utils.discovery.ERDiscovery; import org.gcube.informationsystem.impl.utils.discovery.SchemaAction;
import org.gcube.informationsystem.model.ISConstants; 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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext;
import org.gcube.informationsystem.resourceregistry.context.security.ContextSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.ContextSecurityContext;
@ -199,7 +197,9 @@ public class DatabaseEnvironment {
schemaSecurityContext.create(); schemaSecurityContext.create();
createEntitiesAndRelations(); SchemaAction schemaAction = new SchemaActionImpl();
ISMDiscovery.manageISM(schemaAction);
} }
} catch(Exception e) { } catch(Exception e) {
@ -286,12 +286,4 @@ public class DatabaseEnvironment {
return false; 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);
}
} }

View File

@ -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.query.InvalidQueryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; 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.api.rest.httputils.HTTPCall.HTTPMETHOD;
import org.gcube.informationsystem.resourceregistry.context.ContextManagement; import org.gcube.informationsystem.resourceregistry.context.ContextManagement;
import org.gcube.informationsystem.resourceregistry.er.ERManagement; import org.gcube.informationsystem.resourceregistry.er.ERManagement;
@ -275,7 +274,7 @@ public class Access {
public String getContext(@PathParam(ID_PATH_PARAM) String uuid) public String getContext(@PathParam(ID_PATH_PARAM) String uuid)
throws ContextNotFoundException, ResourceRegistryException { throws ContextNotFoundException, ResourceRegistryException {
ContextManagement contextManagement = new ContextManagement(); 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); logger.info("Requested to read all {}s", org.gcube.informationsystem.model.entity.Context.NAME);
return contextManagement.all(false); return contextManagement.all(false);
}else { }else {

View File

@ -1,6 +1,5 @@
package org.gcube.informationsystem.resourceregistry.rest; package org.gcube.informationsystem.resourceregistry.rest;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue; import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET; 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.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; 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.api.rest.SchemaPath;
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement;
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl;
@ -28,7 +26,7 @@ import org.slf4j.LoggerFactory;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@ApplicationPath(SchemaPath.SCHEMA_PATH_PART) @Path(SchemaPath.SCHEMA_PATH_PART)
public class SchemaManager { public class SchemaManager {
private static Logger logger = LoggerFactory.getLogger(SchemaManager.class); private static Logger logger = LoggerFactory.getLogger(SchemaManager.class);
@ -54,7 +52,7 @@ public class SchemaManager {
AccessType accessType = null; AccessType accessType = null;
try { try {
accessType = AccessType.valueOf(type); accessType = AccessType.valueOf(type.toUpperCase());
switch(accessType) { switch(accessType) {
case EMBEDDED: case EMBEDDED:
break; break;
@ -91,10 +89,9 @@ public class SchemaManager {
*/ */
@GET @GET
@Path("{" + TYPE_PATH_PARAM + "}") @Path("{" + TYPE_PATH_PARAM + "}")
@Consumes({MediaType.TEXT_PLAIN, ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8})
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8) @Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String read(@PathParam(TYPE_PATH_PARAM) String type, 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 { throws SchemaNotFoundException, ResourceRegistryException {
logger.info("Requested Schema for type {}", type); logger.info("Requested Schema for type {}", type);
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();