Fixed Relations names
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@141322 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7c4625c2d9
commit
45e11a3806
|
@ -39,9 +39,9 @@ public class EntityRegistrationAction implements ERAction {
|
||||||
String json = TypeBinder.serializeType(r);
|
String json = TypeBinder.serializeType(r);
|
||||||
logger.trace(json);
|
logger.trace(json);
|
||||||
if (ConsistsOf.class.isAssignableFrom(r)) {
|
if (ConsistsOf.class.isAssignableFrom(r)) {
|
||||||
schemaManagement.registerConsistOfSchema(json);
|
schemaManagement.registerConsistsOfSchema(json);
|
||||||
} else if(IsRelatedTo.class.isAssignableFrom(r)){
|
} else if(IsRelatedTo.class.isAssignableFrom(r)){
|
||||||
schemaManagement.registerRelatedToSchema(json);
|
schemaManagement.registerIsRelatedToSchema(json);
|
||||||
} else {
|
} else {
|
||||||
schemaManagement.registerRelationSchema(json);
|
schemaManagement.registerRelationSchema(json);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,11 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.gcube.informationsystem.model.embedded.Embedded;
|
||||||
|
import org.gcube.informationsystem.model.entity.Facet;
|
||||||
|
import org.gcube.informationsystem.model.entity.Resource;
|
||||||
|
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||||
|
import org.gcube.informationsystem.model.relation.IsRelatedTo;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.SchemaManagement;
|
import org.gcube.informationsystem.resourceregistry.api.SchemaManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.rest.SchemaPath;
|
import org.gcube.informationsystem.resourceregistry.api.rest.SchemaPath;
|
||||||
|
@ -21,7 +26,6 @@ import org.slf4j.LoggerFactory;
|
||||||
@ApplicationPath(SchemaPath.SCHEMA_PATH_PART)
|
@ApplicationPath(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);
|
||||||
|
|
||||||
protected SchemaManagement schemaManager = new SchemaManagementImpl();
|
protected SchemaManagement schemaManager = new SchemaManagementImpl();
|
||||||
|
@ -32,16 +36,19 @@ public class SchemaManager {
|
||||||
* BODY: {...}
|
* BODY: {...}
|
||||||
*
|
*
|
||||||
* ?schema={...}
|
* ?schema={...}
|
||||||
|
*
|
||||||
* @param jsonSchema
|
* @param jsonSchema
|
||||||
* @return
|
* @return
|
||||||
* @throws SchemaException
|
* @throws SchemaException
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path(SchemaPath.EMBEDDED_PATH_PART)
|
@Path(SchemaPath.EMBEDDED_PATH_PART)
|
||||||
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
|
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String registerEmbeddedTypeSchema(String jsonSchema) throws SchemaException {
|
public String registerEmbeddedTypeSchema(String jsonSchema)
|
||||||
logger.trace("Requested Embedded registration with schema {}",jsonSchema);
|
throws SchemaException {
|
||||||
|
logger.trace("Requested {} registration with schema {}", Embedded.NAME,
|
||||||
|
jsonSchema);
|
||||||
return schemaManager.registerEmbeddedTypeSchema(jsonSchema);
|
return schemaManager.registerEmbeddedTypeSchema(jsonSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,10 +63,11 @@ public class SchemaManager {
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path(SchemaPath.FACET_PATH_PART)
|
@Path(SchemaPath.FACET_PATH_PART)
|
||||||
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
|
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String registerFacetSchema(String jsonSchema) throws SchemaException {
|
public String registerFacetSchema(String jsonSchema) throws SchemaException {
|
||||||
logger.trace("Requested Facet registration with schema {}",jsonSchema);
|
logger.trace("Requested {} registration with schema {}", Facet.NAME,
|
||||||
|
jsonSchema);
|
||||||
return schemaManager.registerFacetSchema(jsonSchema);
|
return schemaManager.registerFacetSchema(jsonSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,15 +83,17 @@ public class SchemaManager {
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path(SchemaPath.RESOURCE_PATH_PART)
|
@Path(SchemaPath.RESOURCE_PATH_PART)
|
||||||
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
|
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String registerResourceSchema(String jsonSchema) throws SchemaException {
|
public String registerResourceSchema(String jsonSchema)
|
||||||
logger.trace("Requested Resource registration with schema {}",jsonSchema);
|
throws SchemaException {
|
||||||
|
logger.trace("Requested {} registration with schema {}", Resource.NAME,
|
||||||
|
jsonSchema);
|
||||||
return schemaManager.registerResourceSchema(jsonSchema);
|
return schemaManager.registerResourceSchema(jsonSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* e.g. PUT /resource-registry/schema/consistOf
|
* e.g. PUT /resource-registry/schema/consistsOf
|
||||||
*
|
*
|
||||||
* BODY: {...}
|
* BODY: {...}
|
||||||
*
|
*
|
||||||
|
@ -92,16 +102,18 @@ public class SchemaManager {
|
||||||
* @throws SchemaException
|
* @throws SchemaException
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path(SchemaPath.CONSIST_OF_PATH_PART)
|
@Path(SchemaPath.CONSISTS_OF_PATH_PART)
|
||||||
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
|
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String registerConsistOfSchema(String jsonSchema) throws SchemaException {
|
public String registerConsistOfSchema(String jsonSchema)
|
||||||
logger.trace("Requested ConsistOf registration with schema {} ",jsonSchema);
|
throws SchemaException {
|
||||||
return schemaManager.registerConsistOfSchema(jsonSchema);
|
logger.trace("Requested {} registration with schema {} ",
|
||||||
|
ConsistsOf.NAME, jsonSchema);
|
||||||
|
return schemaManager.registerConsistsOfSchema(jsonSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* e.g. PUT /resource-registry/schema/relatedTo
|
* e.g. PUT /resource-registry/schema/isRelatedTo
|
||||||
*
|
*
|
||||||
* BODY: {...}
|
* BODY: {...}
|
||||||
*
|
*
|
||||||
|
@ -110,12 +122,14 @@ public class SchemaManager {
|
||||||
* @throws SchemaException
|
* @throws SchemaException
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path(SchemaPath.RELATED_TO_PATH_PART)
|
@Path(SchemaPath.IS_RELATED_TO_PATH_PART)
|
||||||
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
|
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String registerRelatedToSchema(String jsonSchema) throws SchemaException {
|
public String registerIsRelatedToSchema(String jsonSchema)
|
||||||
logger.trace("Requested RelatedTo registration with schema {} ",jsonSchema);
|
throws SchemaException {
|
||||||
return schemaManager.registerRelatedToSchema(jsonSchema);
|
logger.trace("Requested {} registration with schema {} ",
|
||||||
|
IsRelatedTo.NAME, jsonSchema);
|
||||||
|
return schemaManager.registerIsRelatedToSchema(jsonSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,13 @@
|
||||||
package org.gcube.informationsystem.resourceregistry.resources.impl;
|
package org.gcube.informationsystem.resourceregistry.resources.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.codehaus.jettison.json.JSONArray;
|
||||||
|
import org.codehaus.jettison.json.JSONException;
|
||||||
|
import org.codehaus.jettison.json.JSONObject;
|
||||||
import org.gcube.informationsystem.model.embedded.Embedded;
|
import org.gcube.informationsystem.model.embedded.Embedded;
|
||||||
import org.gcube.informationsystem.model.entity.Entity;
|
import org.gcube.informationsystem.model.entity.Entity;
|
||||||
import org.gcube.informationsystem.model.entity.Facet;
|
import org.gcube.informationsystem.model.entity.Facet;
|
||||||
|
@ -44,6 +48,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx;
|
||||||
* TODO Create an instance for each Registered Type in a management
|
* TODO Create an instance for each Registered Type in a management
|
||||||
* SecurityContext so that that management context can be used to see
|
* SecurityContext so that that management context can be used to see
|
||||||
* Entity and Relations as graph.
|
* Entity and Relations as graph.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class SchemaManagementImpl implements SchemaManagement {
|
public class SchemaManagementImpl implements SchemaManagement {
|
||||||
|
|
||||||
|
@ -99,8 +104,17 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String serializeOClass(OClass oClass)
|
protected static JSONObject serializeOClassAsJSON(OClass oClass)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
|
String jsonString = serializeOClass(oClass);
|
||||||
|
try {
|
||||||
|
return new JSONObject(jsonString);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
throw new SchemaException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static String serializeOClass(OClass oClass) {
|
||||||
ODocument oDocument = ((OClassImpl) oClass).toStream();
|
ODocument oDocument = ((OClassImpl) oClass).toStream();
|
||||||
return oDocument.toJSON();
|
return oDocument.toJSON();
|
||||||
}
|
}
|
||||||
|
@ -195,8 +209,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
List<OClass> oSuperclasses = getSuperclassesAndCheckCompliancy(
|
List<OClass> oSuperclasses = getSuperclassesAndCheckCompliancy(
|
||||||
orientGraphNoTx,
|
orientGraphNoTx,
|
||||||
typeDefinition,
|
typeDefinition,
|
||||||
baseType == Embedded.class ? null : baseType
|
baseType.getSimpleName());
|
||||||
.getSimpleName());
|
|
||||||
oClass.setSuperClasses(oSuperclasses);
|
oClass.setSuperClasses(oSuperclasses);
|
||||||
|
|
||||||
if (Resource.class.isAssignableFrom(baseType)) {
|
if (Resource.class.isAssignableFrom(baseType)) {
|
||||||
|
@ -267,6 +280,65 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getListOfType(String type, String baseType,
|
||||||
|
boolean includeSchema) throws SchemaNotFoundException,
|
||||||
|
SchemaException {
|
||||||
|
OrientGraphFactory orientGraphFactory = SecurityContextMapper
|
||||||
|
.getSecurityContextFactory(
|
||||||
|
SecurityContextMapper.ADMIN_SECURITY_CONTEXT_UUID,
|
||||||
|
PermissionMode.WRITER);
|
||||||
|
|
||||||
|
OrientGraphNoTx orientGraphNoTx = null;
|
||||||
|
try {
|
||||||
|
orientGraphNoTx = orientGraphFactory.getNoTx();
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
|
||||||
|
OClass baseOClass = null;
|
||||||
|
if(baseType.compareTo(Embedded.NAME)!=0){
|
||||||
|
baseOClass = getTypeSchema(orientGraphNoTx, type, baseType);
|
||||||
|
if (includeSchema) {
|
||||||
|
jsonArray.put(serializeOClassAsJSON(baseOClass));
|
||||||
|
} else {
|
||||||
|
jsonArray.put(baseOClass.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OMetadata oMetadata = orientGraphNoTx.getRawGraph().getMetadata();
|
||||||
|
OSchema oSchema = oMetadata.getSchema();
|
||||||
|
Collection<OClass> oClasses = oSchema.getClasses();
|
||||||
|
for (OClass oClass : oClasses) {
|
||||||
|
if(baseType.compareTo(Embedded.NAME)!=0){
|
||||||
|
if (oClass.isSubClassOf(baseOClass)) {
|
||||||
|
if (includeSchema) {
|
||||||
|
jsonArray.put(serializeOClassAsJSON(oClass));
|
||||||
|
} else {
|
||||||
|
jsonArray.put(oClass.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (!oClass.isSubClassOf("V") && !oClass.isSubClassOf("E")) {
|
||||||
|
if (includeSchema) {
|
||||||
|
jsonArray.put(serializeOClassAsJSON(oClass));
|
||||||
|
} else {
|
||||||
|
jsonArray.put(oClass.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return jsonArray.toString();
|
||||||
|
} catch (SchemaException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new SchemaException(e);
|
||||||
|
} finally {
|
||||||
|
if (orientGraphNoTx != null) {
|
||||||
|
orientGraphNoTx.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerEntitySchema(String jsonSchema)
|
public String registerEntitySchema(String jsonSchema)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
|
@ -291,6 +363,12 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
throw new UnsupportedOperationException("Not Yet implemented");
|
throw new UnsupportedOperationException("Not Yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEntityTypes(String baseEntityType, boolean includeSchema)
|
||||||
|
throws SchemaNotFoundException, SchemaException {
|
||||||
|
return getListOfType(baseEntityType, Entity.NAME, includeSchema);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerFacetSchema(String jsonSchema) throws SchemaException {
|
public String registerFacetSchema(String jsonSchema) throws SchemaException {
|
||||||
return registerTypeSchema(jsonSchema, Facet.class);
|
return registerTypeSchema(jsonSchema, Facet.class);
|
||||||
|
@ -314,6 +392,12 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
throw new UnsupportedOperationException("Not Yet implemented");
|
throw new UnsupportedOperationException("Not Yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFacetTypes(String baseFacetType, boolean includeSchema)
|
||||||
|
throws SchemaNotFoundException, SchemaException {
|
||||||
|
return getListOfType(baseFacetType, Facet.NAME, includeSchema);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerResourceSchema(String jsonSchema)
|
public String registerResourceSchema(String jsonSchema)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
|
@ -338,6 +422,12 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
throw new UnsupportedOperationException("Not Yet implemented");
|
throw new UnsupportedOperationException("Not Yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getResourceTypes(String baseResourceType, boolean includeSchema)
|
||||||
|
throws SchemaNotFoundException, SchemaException {
|
||||||
|
return getListOfType(baseResourceType, Resource.NAME, includeSchema);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerEmbeddedTypeSchema(String jsonSchema)
|
public String registerEmbeddedTypeSchema(String jsonSchema)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
|
@ -362,6 +452,12 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
throw new UnsupportedOperationException("Not Yet implemented");
|
throw new UnsupportedOperationException("Not Yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEmbeddedTypes(String embeddedType, boolean includeSchema)
|
||||||
|
throws SchemaNotFoundException, SchemaException {
|
||||||
|
return getListOfType(embeddedType, Embedded.NAME, includeSchema);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerRelationSchema(String jsonSchema)
|
public String registerRelationSchema(String jsonSchema)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
|
@ -387,51 +483,70 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerConsistOfSchema(String jsonSchema)
|
public String getRelationTypes(String baseRelationType, boolean includeSchema)
|
||||||
|
throws SchemaNotFoundException, SchemaException {
|
||||||
|
return getListOfType(baseRelationType, Relation.NAME, includeSchema);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String registerConsistsOfSchema(String jsonSchema)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
return registerTypeSchema(jsonSchema, ConsistsOf.class);
|
return registerTypeSchema(jsonSchema, ConsistsOf.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getConsistOfSchema(String consistOfType)
|
public String getConsistsOfSchema(String consistsOfType)
|
||||||
throws SchemaNotFoundException {
|
throws SchemaNotFoundException {
|
||||||
return getTypeSchemaAsString(consistOfType, ConsistsOf.NAME);
|
return getTypeSchemaAsString(consistsOfType, ConsistsOf.NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String updateConsistOfSchema(String consistOfType, String jsonSchema)
|
public String updateConsistsOfSchema(String consistsOfType, String jsonSchema)
|
||||||
throws SchemaNotFoundException, SchemaException {
|
throws SchemaNotFoundException, SchemaException {
|
||||||
throw new UnsupportedOperationException("Not Yet implemented");
|
throw new UnsupportedOperationException("Not Yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String deleteConsistOfSchema(String consistOfType)
|
public String deleteConsistsOfSchema(String consistsOfType)
|
||||||
throws SchemaNotFoundException {
|
throws SchemaNotFoundException {
|
||||||
throw new UnsupportedOperationException("Not Yet implemented");
|
throw new UnsupportedOperationException("Not Yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerRelatedToSchema(String jsonSchema)
|
public String getConsistsOfTypes(String consistsOfType, boolean includeSchema)
|
||||||
|
throws SchemaNotFoundException, SchemaException {
|
||||||
|
return getListOfType(consistsOfType, ConsistsOf.NAME, includeSchema);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String registerIsRelatedToSchema(String jsonSchema)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
return registerTypeSchema(jsonSchema, IsRelatedTo.class);
|
return registerTypeSchema(jsonSchema, IsRelatedTo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRelatedToSchema(String relatedToType)
|
public String getIsRelatedToSchema(String isRelatedToType)
|
||||||
throws SchemaNotFoundException {
|
throws SchemaNotFoundException {
|
||||||
return getTypeSchemaAsString(relatedToType, IsRelatedTo.NAME);
|
return getTypeSchemaAsString(isRelatedToType, IsRelatedTo.NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String updateRelatedToSchema(String relatedToType, String jsonSchema)
|
public String updateIsRelatedToSchema(String isRelatedToType,
|
||||||
throws SchemaNotFoundException, SchemaException {
|
String jsonSchema) throws SchemaNotFoundException, SchemaException {
|
||||||
throw new UnsupportedOperationException("Not Yet implemented");
|
throw new UnsupportedOperationException("Not Yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String deleteRelatedToSchema(String relatedToType)
|
public String deleteIsRelatedToSchema(String isRelatedToType)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
throw new UnsupportedOperationException("Not Yet implemented");
|
throw new UnsupportedOperationException("Not Yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIsRelatedToTypes(String isRelatedToType, boolean includeSchema)
|
||||||
|
throws SchemaNotFoundException, SchemaException {
|
||||||
|
return getListOfType(isRelatedToType, IsRelatedTo.NAME, includeSchema);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,21 +162,21 @@ public class EntityRegistrationFactory implements Factory<SchemaManagement>{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerConsistOfSchema(String jsonSchema)
|
public String registerConsistsOfSchema(String jsonSchema)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getConsistOfSchema(String consistOfType)
|
public String getConsistsOfSchema(String consistsOfType)
|
||||||
throws SchemaNotFoundException {
|
throws SchemaNotFoundException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String updateConsistOfSchema(String consistOfType,
|
public String updateConsistsOfSchema(String consistsOfType,
|
||||||
String jsonSchema) throws SchemaNotFoundException,
|
String jsonSchema) throws SchemaNotFoundException,
|
||||||
SchemaException {
|
SchemaException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -184,28 +184,28 @@ public class EntityRegistrationFactory implements Factory<SchemaManagement>{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String deleteConsistOfSchema(String consistOfType)
|
public String deleteConsistsOfSchema(String consistsOfType)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String registerRelatedToSchema(String jsonSchema)
|
public String registerIsRelatedToSchema(String jsonSchema)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRelatedToSchema(String relatedToType)
|
public String getIsRelatedToSchema(String isRelatedToType)
|
||||||
throws SchemaNotFoundException {
|
throws SchemaNotFoundException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String updateRelatedToSchema(String relatedToType,
|
public String updateIsRelatedToSchema(String isRelatedToType,
|
||||||
String jsonSchema) throws SchemaNotFoundException,
|
String jsonSchema) throws SchemaNotFoundException,
|
||||||
SchemaException {
|
SchemaException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -213,13 +213,66 @@ public class EntityRegistrationFactory implements Factory<SchemaManagement>{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String deleteRelatedToSchema(String relatedToType)
|
public String deleteIsRelatedToSchema(String isRelatedToType)
|
||||||
throws SchemaException {
|
throws SchemaException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEntityTypes(String entityType,
|
||||||
|
boolean includeSchema) throws SchemaNotFoundException,
|
||||||
|
SchemaException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFacetTypes(String facetType, boolean includeSchema)
|
||||||
|
throws SchemaNotFoundException, SchemaException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getResourceTypes(String resourceType,
|
||||||
|
boolean includeSchema) throws SchemaNotFoundException,
|
||||||
|
SchemaException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEmbeddedTypes(String embeddedType,
|
||||||
|
boolean includeSchema) throws SchemaNotFoundException,
|
||||||
|
SchemaException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelationTypes(String relationType,
|
||||||
|
boolean includeSchema) throws SchemaNotFoundException,
|
||||||
|
SchemaException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getConsistsOfTypes(String consistsOfType,
|
||||||
|
boolean includeSchema) throws SchemaNotFoundException,
|
||||||
|
SchemaException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIsRelatedToTypes(String isRelatedToType,
|
||||||
|
boolean includeSchema) throws SchemaNotFoundException,
|
||||||
|
SchemaException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,18 @@
|
||||||
package org.gcube.informationsystem.resourceregistry.resources.impl;
|
package org.gcube.informationsystem.resourceregistry.resources.impl;
|
||||||
|
|
||||||
import org.gcube.informationsystem.model.embedded.AccessPolicy;
|
import org.gcube.informationsystem.model.embedded.AccessPolicy;
|
||||||
|
import org.gcube.informationsystem.model.embedded.Embedded;
|
||||||
import org.gcube.informationsystem.model.embedded.Header;
|
import org.gcube.informationsystem.model.embedded.Header;
|
||||||
import org.gcube.informationsystem.model.entity.Entity;
|
import org.gcube.informationsystem.model.entity.Entity;
|
||||||
|
import org.gcube.informationsystem.model.entity.Facet;
|
||||||
|
import org.gcube.informationsystem.model.entity.Resource;
|
||||||
import org.gcube.informationsystem.model.entity.facet.ContactFacet;
|
import org.gcube.informationsystem.model.entity.facet.ContactFacet;
|
||||||
import org.gcube.informationsystem.model.entity.resource.Actor;
|
import org.gcube.informationsystem.model.entity.resource.Actor;
|
||||||
|
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||||
|
import org.gcube.informationsystem.model.relation.IsRelatedTo;
|
||||||
|
import org.gcube.informationsystem.model.relation.Relation;
|
||||||
import org.gcube.informationsystem.model.relation.isrelatedto.Hosts;
|
import org.gcube.informationsystem.model.relation.isrelatedto.Hosts;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.api.SchemaManagement;
|
||||||
import org.gcube.informationsystem.types.TypeBinder;
|
import org.gcube.informationsystem.types.TypeBinder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -80,4 +87,34 @@ public class SchemaManagementImplTest {
|
||||||
logger.trace(json);
|
logger.trace(json);
|
||||||
//new SchemaManagementImpl().registerFacetSchema(json);
|
//new SchemaManagementImpl().registerFacetSchema(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getList() throws Exception{
|
||||||
|
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||||
|
String list = schemaManagement.getEmbeddedTypes(Embedded.NAME, false);
|
||||||
|
logger.debug("{} list : {}", Embedded.NAME, list);
|
||||||
|
|
||||||
|
|
||||||
|
list = schemaManagement.getEntityTypes(Entity.NAME, false);
|
||||||
|
logger.debug("{} list : {}", Entity.NAME, list);
|
||||||
|
|
||||||
|
list = schemaManagement.getResourceTypes(Resource.NAME, false);
|
||||||
|
logger.debug("{} list : {}", Resource.NAME, list);
|
||||||
|
|
||||||
|
list = schemaManagement.getFacetTypes(Facet.NAME, false);
|
||||||
|
logger.debug("{} list : {}", Facet.NAME, list);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
list = schemaManagement.getRelationTypes(Relation.NAME, false);
|
||||||
|
logger.debug("{} list : {}", Relation.NAME, list);
|
||||||
|
|
||||||
|
list = schemaManagement.getConsistsOfTypes(ConsistsOf.NAME, false);
|
||||||
|
logger.debug("{} list : {}", ConsistsOf.NAME, list);
|
||||||
|
|
||||||
|
list = schemaManagement.getIsRelatedToTypes(IsRelatedTo.NAME, false);
|
||||||
|
logger.debug("{} list : {}", IsRelatedTo.NAME, list);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue