Aligned APIs with IS model refactoring
This commit is contained in:
parent
c0517db9b8
commit
2c4950a6fb
|
@ -13,14 +13,13 @@ import org.gcube.informationsystem.types.reference.TypeDefinition;
|
|||
*/
|
||||
public interface ResourceRegistrySchemaClient {
|
||||
|
||||
public <ISM extends ISManageable> TypeDefinition<ISM> create(Class<ISM> clz)
|
||||
public <ISM extends ISManageable> TypeDefinition create(Class<ISM> clz)
|
||||
throws SchemaException, ResourceRegistryException;
|
||||
|
||||
public String create(String baseType, String typeDefinitition)
|
||||
throws SchemaException, ResourceRegistryException;
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public <ISM extends ISManageable> List<TypeDefinition> read(Class<ISM> clz, Boolean polymorphic)
|
||||
throws SchemaNotFoundException, ResourceRegistryException;
|
||||
|
||||
|
|
|
@ -36,9 +36,8 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <ISM extends ISManageable> TypeDefinition<ISM> create(Class<ISM> clz)
|
||||
public <ISM extends ISManageable> TypeDefinition create(Class<ISM> clz)
|
||||
throws SchemaException, ResourceRegistryException {
|
||||
try {
|
||||
String typeDefinition = TypeBinder.serializeType(clz);
|
||||
|
@ -56,8 +55,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
|||
public String create(String baseType, String typeDefinitition) throws ContextAlreadyPresentException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to create: {}", typeDefinitition);
|
||||
@SuppressWarnings("unchecked")
|
||||
TypeDefinition<? extends ISManageable> typeDefinitionObj = TypeBinder.deserializeTypeDefinition(typeDefinitition);
|
||||
TypeDefinition typeDefinitionObj = TypeBinder.deserializeTypeDefinition(typeDefinitition);
|
||||
|
||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
||||
|
@ -80,7 +78,6 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public <ISM extends ISManageable> List<TypeDefinition> read(Class<ISM> clz, Boolean polymorphic)
|
||||
throws SchemaNotFoundException, ResourceRegistryException {
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.informationsystem.resourceregistry.schema;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
|
@ -26,11 +25,10 @@ public class ResourceRegistrySchemaClientTest extends ContextTest {
|
|||
// @Test
|
||||
public void testCreate() throws Exception {
|
||||
ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create();
|
||||
TypeDefinition<? extends ISManageable> td = resourceRegistrySchemaClient.create(AuxFacet.class);
|
||||
TypeDefinition td = resourceRegistrySchemaClient.create(AuxFacet.class);
|
||||
logger.debug("{}", td);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Test
|
||||
public void testRead() throws Exception {
|
||||
ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create();
|
||||
|
@ -42,8 +40,8 @@ public class ResourceRegistrySchemaClientTest extends ContextTest {
|
|||
|
||||
types = resourceRegistrySchemaClient.read(Facet.class, false);
|
||||
Assert.assertTrue(types.size()==1);
|
||||
TypeDefinition<Facet> gotFacetDefinition = types.get(0);
|
||||
TypeDefinition<Facet> facetDefinition = TypeBinder.createTypeDefinition(Facet.class);
|
||||
TypeDefinition gotFacetDefinition = types.get(0);
|
||||
TypeDefinition facetDefinition = TypeBinder.createTypeDefinition(Facet.class);
|
||||
|
||||
|
||||
Assert.assertTrue(gotFacetDefinition.getName().compareTo(facetDefinition.getName())==0);
|
||||
|
|
Loading…
Reference in New Issue