Browse Source

Restrict the interface to ERElement refs #21973

feature/21973
Luca Frosini 5 months ago
parent
commit
edc51232a5
  1. 5
      CHANGELOG.md
  2. 2
      pom.xml
  3. 6
      src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClient.java
  4. 6
      src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientImpl.java

5
CHANGELOG.md

@ -2,8 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for Resource Registry Schema Client
## [v4.1.0-SNAPSHOT]
## [v4.0.0] [r5.0.0] -
- Restrict the interface to accept ERElement classes and not all the Element classes [#21973]
## [v4.0.0] [r5.0.0]
- Switched JSON management to gcube-jackson [#19116]

2
pom.xml

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-schema-client</artifactId>
<version>4.0.0</version>
<version>4.1.0-SNAPSHOT</version>
<name>Resource Registry Schema Client</name>
<description>Contains Non Idempotent API to manage Schemas in Resource Registry</description>

6
src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClient.java

@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.schema;
import java.util.List;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.model.reference.ERElement;
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;
@ -13,13 +13,13 @@ import org.gcube.informationsystem.types.reference.Type;
*/
public interface ResourceRegistrySchemaClient {
public <E extends Element> Type create(Class<E> clz)
public <ERElem extends ERElement> Type create(Class<ERElem> clz)
throws SchemaException, ResourceRegistryException;
public String create(String typeDefinitition)
throws SchemaException, ResourceRegistryException;
public <E extends Element> List<Type> read(Class<E> clz, Boolean polymorphic)
public <ERElem extends ERElement> List<Type> read(Class<ERElem> clz, Boolean polymorphic)
throws SchemaNotFoundException, ResourceRegistryException;
public String read(String typeName, Boolean polymorphic)

6
src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientImpl.java

@ -7,7 +7,7 @@ import java.util.Map;
import org.gcube.common.gxhttp.reference.GXConnection;
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.model.reference.ERElement;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextAlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
@ -36,7 +36,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
}
@Override
public <E extends Element> Type create(Class<E> clz)
public <ERElem extends ERElement> Type create(Class<ERElem> clz)
throws SchemaException, ResourceRegistryException {
try {
String typeDefinition = TypeMapper.serializeType(clz);
@ -78,7 +78,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
@Override
public <ISM extends Element> List<Type> read(Class<ISM> clz, Boolean polymorphic)
public <ERElem extends ERElement> List<Type> read(Class<ERElem> clz, Boolean polymorphic)
throws SchemaNotFoundException, ResourceRegistryException {
try {
String typeName = Utility.getTypeName(clz);

Loading…
Cancel
Save