Header contains context property only when requested

This commit is contained in:
Luca Frosini 2021-09-02 15:06:40 +02:00
parent fa47217afd
commit 93855856b7
6 changed files with 30 additions and 0 deletions

View File

@ -49,6 +49,10 @@ import com.orientechnologies.orient.core.record.ODirection;
@Path(AccessPath.ACCESS_PATH_PART)
public class Access extends BaseRest {
public Access() {
super();
}
/*
* e.g. GET /access/contexts
*/

View File

@ -17,6 +17,11 @@ public class BaseRest {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
public BaseRest() {
ContextUtility.getHierarchicalMode().set(false);
ContextUtility.getIncludeInstanceContexts().set(false);
}
@Context
protected UriInfo uriInfo;

View File

@ -36,6 +36,11 @@ public class ContextManager {
*/
private static Logger logger = LoggerFactory.getLogger(ContextManager.class);
public ContextManager() {
ContextUtility.getHierarchicalMode().set(false);
ContextUtility.getIncludeInstanceContexts().set(false);
}
/*
* GET /contexts
*

View File

@ -35,6 +35,10 @@ import org.gcube.informationsystem.resourceregistry.instances.base.ElementManage
@Path(InstancePath.INSTANCES_PATH_PART)
public class InstancesManager extends BaseRest {
public InstancesManager() {
super();
}
/*
* GET /instances/{TYPE_NAME}[?polymorphic=true]
* e.g. GET /instances/ContactFacet?polymorphic=true

View File

@ -28,6 +28,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation;
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.model.ERManagement;
@ -42,6 +43,11 @@ public class SharingManager {
private static Logger logger = LoggerFactory.getLogger(SharingManager.class);
public SharingManager() {
ContextUtility.getHierarchicalMode().set(false);
ContextUtility.getIncludeInstanceContexts().set(false);
}
protected String serializeAffectedInstaces(ObjectMapper objectMapper, Map<UUID,JsonNode> affectedInstances) throws ResourceRegistryException {
ArrayNode arrayNode = objectMapper.createArrayNode();
for(JsonNode jsonNode : affectedInstances.values()) {

View File

@ -21,6 +21,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.api.rest.TypePath;
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
import org.gcube.informationsystem.resourceregistry.types.SchemaManagement;
import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type;
@ -35,6 +36,11 @@ public class TypeManager {
private static Logger logger = LoggerFactory.getLogger(TypeManager.class);
public TypeManager() {
ContextUtility.getHierarchicalMode().set(false);
ContextUtility.getIncludeInstanceContexts().set(false);
}
/*
* PUT /types/{TYPE_NAME}
* e.g. PUT /types/ContactFacet