Class InstancesManager

java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.BaseRest
org.gcube.informationsystem.resourceregistry.rest.InstancesManager

@Path("instances") public class InstancesManager extends BaseRest
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

  • Constructor Details

    • InstancesManager

      public InstancesManager()
  • Method Details

    • readAll

      @GET @Path("/{type-name}") @Consumes({"text/plain","application/json;charset=UTF-8"}) @Produces("application/json;charset=UTF-8") public String readAll(@PathParam("type-name") String type, @QueryParam("polymorphic") @DefaultValue("true") Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Retrieves all instances of a specified type from the Resource Registry. REST Endpoint: GET /instances/{type-name} Request Examples:
      • Basic query: GET /instances/EService
      • With pagination: GET /instances/EService?limit=20&offset=40
      • With subtypes and metadata: GET /instances/EService?polymorphic=true&includeMeta=true
      • Full metadata context: GET /instances/EService?includeMeta=true&allMeta=true
      • With context information: GET /instances/EService?includeContexts=true
      • Hierarchical (admin only): GET /instances/EService?hierarchical=true
      • Hierarchical with contexts (admin only): GET /instances/EService?hierarchical=true&includeContexts=true.
      Path Parameters:
      • type-name: The name of the Information System type whose instances should be retrieved (e.g., "EService", "ContactFacet").
      Query Parameters: polymorphic (optional):
      • Whether to include instances of subtypes in the response
      • Default value: true (includes all subtypes)
      • Values: true|false
      • Example: ?polymorphic=false (returns only exact type instances).
      limit (optional):
      • Maximum number of instances to return in a single response
      • Default value: 10
      • Example: ?limit=50 (returns at most 50 instances).
      offset (optional):
      • Number of instances to skip from the beginning of the result set
      • Default value: 0 (starts from the first instance)
      • Example: ?offset=100 (skips the first 100 instances).
      includeMeta (optional):
      • Whether to include metadata in the response instances
      • Default value: false (basic information only)
      • Values: true|false
      • Example: ?includeMeta=true (includes metadata with appropriate filtering based on user role)
      • Metadata includes only the requested type and subtypes (if polymorphic=true)
      • Restriction: IS-Manager, Infrastructure-Manager, and Context-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
      allMeta (optional):
      • Whether to include metadata for all nested instances (ConsistsOf relations, Facets, etc.)
      • Must be used in conjunction with includeMeta=true
      • Default value: false (metadata only for main instances, more human-readable)
      • Values: true|false
      • Example: ?includeMeta=true&allMeta=true (includes metadata for all nested elements)
      • Purpose: When false, produces more human-readable responses with less JSON to process.
      hierarchical (optional, admin-only):
      • Whether to include instances from child contexts of the current context
      • Default value: false (current context only)
      • Values: true|false
      • Restriction: Only available to IS-Manager, Infrastructure-Manager, and Context-Manager roles (Context-Manager must be of the current context derived from the authorization token)
      • Example: ?hierarchical=true (includes instances from current and child contexts)
      • Current context is determined from the authorization token.
      includeContexts (optional):
      • Whether to include the list of contexts where each instance is available
      • Default value: false (context information not included)
      • Values: true|false
      • Example: ?includeContexts=true (shows context availability for each instance)
      • Note: A Resource is present in all contexts that form the union of contexts of all its Facets
      • Note: ConsistsOf relations are present in all contexts where their target Facets are present.
      Authorization Requirements: IS-Manager:
      • Full access to all metadata and hierarchical querying capabilities
      • Can access instances across all contexts
      • Receives complete, unfiltered metadata including all administrative fields.
      Infrastructure-Manager:
      • Full access to all metadata and hierarchical querying capabilities
      • Can access instances across all contexts
      • Receives complete, unfiltered metadata including all administrative fields.
      Context-Manager:
      • Full access to all metadata and hierarchical querying capabilities
      • Must be Context-Manager of the current context derived from the authorization token
      • Can access hierarchical querying capabilities
      • Receives complete, unfiltered metadata including all administrative fields.
      Other Users:
      • Basic access with metadata filtering and no hierarchical querying
      • Cannot use hierarchical querying (hierarchical parameter ignored)
      • Receive metadata with sensitive information filtered when includeMeta=true.
      Response Codes:
      • 200 OK: Instances successfully retrieved
      • 400 Bad Request: Invalid query parameters (e.g., invalid limit/offset values)
      • 404 Not Found: The specified type does not exist
      • 403 Forbidden: Insufficient permissions to access instances in the current context.
      Response Format:
      • Returns a JSON array containing the requested instances
      • Each instance includes its properties, relations, and metadata (if requested)
      • Empty array is returned if no instances of the specified type exist in the accessible contexts.
      Example Metadata (filtered for non-admin users): ``json "metadata": { "type": "Metadata", "creationTime": "2025-03-18 17:13:40.952 +0100", "createdBy": "HIDDEN_FOR_PRIVACY", "lastUpdateBy": "HIDDEN_FOR_PRIVACY", "lastUpdateTime": "2025-03-19 16:21:16.805 +0100" } ``
      Parameters:
      type - The name of the Information System type whose instances to retrieve
      polymorphic - Whether to include instances of subtypes (default: true)
      Returns:
      JSON array containing the requested instances with their properties and relations
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - If the specified type does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during instance retrieval
    • exists

      @HEAD @Path("/{type-name}/{instance-uuid}") @Consumes({"text/plain","application/json;charset=UTF-8"}) @Produces("application/json;charset=UTF-8") public jakarta.ws.rs.core.Response exists(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Checks if an instance with the specified type and UUID exists in the Resource Registry. REST Endpoint: HEAD /instances/{type-name}/{instance-uuid} Request Examples:
      • Basic check: HEAD /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f
      • Hierarchical check (admin only): HEAD /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?hierarchical=true.
      Path Parameters:
      • type-name: The name of the Information System type (e.g., "EService", "ContactFacet")
      • instance-uuid: The unique identifier of the instance to check.
      Query Parameters: hierarchical (optional, admin-only):
      • Whether to check for instance existence in child contexts of the current context
      • Default value: false (current context only)
      • Values: true|false
      • Restriction: Only available to IS-Manager, Infrastructure-Manager, and Context-Manager roles (Context-Manager must be of the current context derived from the authorization token)
      • Example: ?hierarchical=true (checks current context and all child contexts)
      • Current context is determined from the authorization token.
      Authorization Requirements: IS-Manager:
      • Can check existence of any instance type in any context
      • Can use hierarchical querying to check across context hierarchies
      • Has full administrative access to existence checking.
      Infrastructure-Manager:
      • Can check existence of any instance type in any context
      • Can use hierarchical querying to check across context hierarchies
      • Has full administrative access to existence checking.
      Context-Manager:
      • Can check existence of instances in the current context
      • Can use hierarchical querying within their managed context hierarchy
      • Must be Context-Manager of the current context (derived from the authorization token)
      • Cannot check instances in contexts where they don't have Context-Manager role.
      Other Users:
      • Can check existence of instances in the current context only
      • Cannot use hierarchical querying (parameter is ignored)
      • Only within contexts where they have authorized access through their token.
      Response Codes:
      • 204 No Content: Instance exists and is accessible in the current context
      • 404 Not Found: Instance does not exist
      • 403 Forbidden: Instance exists but is available in another context (not accessible in current context).
      Parameters:
      type - The name of the Information System type
      instanceId - The unique identifier of the instance to check
      Returns:
      HTTP response with appropriate status code (204, 404, or 403)
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - If the specified type or instance does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during the existence check
    • read

      @GET @Path("/{type-name}/{instance-uuid}") @Consumes({"text/plain","application/json;charset=UTF-8"}) @Produces("application/json;charset=UTF-8") public String read(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Retrieves a single instance with the specified type and UUID. REST Endpoint: GET /instances/{type-name}/{instance-uuid} Request Examples:
      • Basic query: GET /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f
      • With metadata: GET /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?includeMeta=true
      • Full metadata context: GET /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?includeMeta=true&allMeta=true
      • With context information: GET /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?includeContexts=true
      • Hierarchical (admin only): GET /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?hierarchical=true
      • Hierarchical with contexts (admin only): GET /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?hierarchical=true&includeContexts=true.
      Path Parameters:
      • type-name: The name of the Information System type (e.g., "EService", "ContactFacet")
      • instance-uuid: The unique identifier of the instance to retrieve (e.g., "48af15ad-7e56-4157-b624-71c98cea4f8f").
      Query Parameters: includeMeta (optional):
      • Whether to include metadata in the response instance
      • Default value: false (basic information only)
      • Values: true|false
      • Example: ?includeMeta=true (includes metadata with appropriate filtering based on user role)
      • Metadata includes the requested instance and nested elements based on polymorphic setting
      • Restriction: IS-Manager, Infrastructure-Manager, and Context-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
      allMeta (optional):
      • Whether to include metadata for all nested instances (ConsistsOf relations, Facets, etc.)
      • Must be used in conjunction with includeMeta=true
      • Default value: false (metadata only for main instance, more human-readable)
      • Values: true|false
      • Example: ?includeMeta=true&allMeta=true (includes metadata for all nested elements)
      • Purpose: When false, produces more human-readable responses with less JSON to process.
      hierarchical (optional, admin-only):
      • Whether to retrieve the instance from child contexts of the current context
      • Default value: false (current context only)
      • Values: true|false
      • Restriction: Only available to IS-Manager, Infrastructure-Manager, and Context-Manager roles (Context-Manager must be of the current context derived from the authorization token)
      • Example: ?hierarchical=true (searches current and child contexts for the instance)
      • Current context is determined from the authorization token.
      includeContexts (optional):
      • Whether to include the list of contexts where the instance and its nested elements are available
      • Default value: false (context information not included)
      • Values: true|false
      • Example: ?includeContexts=true (shows context availability for the instance and nested elements)
      • Note: A Resource is present in all contexts that form the union of contexts of all its Facets
      • Note: ConsistsOf relations are present in all contexts where their target Facets are present.
      Authorization Requirements: IS-Manager:
      • Full access to retrieve any instance in any context
      • Can use hierarchical querying to search across context hierarchies
      • Receive complete, unfiltered metadata for the instance and all nested elements
      • Metadata includes all administrative fields without obfuscation.
      Infrastructure-Manager:
      • Full access to retrieve any instance in any context
      • Can use hierarchical querying to search across context hierarchies
      • Receive complete, unfiltered metadata for the instance and all nested elements
      • Metadata includes all administrative fields without obfuscation.
      Context-Manager:
      • Can retrieve instances in the current context and child contexts
      • Can use hierarchical querying within their managed context hierarchy
      • Must be Context-Manager of the current context (derived from the authorization token)
      • Receive complete, unfiltered metadata for the instance and all nested elements
      • Metadata includes all administrative fields without obfuscation.
      Other Users:
      • Can retrieve instances in the current context only
      • Cannot use hierarchical querying (hierarchical parameter ignored)
      • Receive metadata with sensitive information filtered when includeMeta=true:
      • Date fields (creation, modification) are visible; • User identifiers (createdBy, lastUpdateBy) are obfuscated or hidden; • Other administrative details may be filtered. Response Codes:
      • 200 OK: Instance successfully retrieved
      • 404 Not Found: Instance does not exist
      • 403 Forbidden: Instance exists but is available in another context (not accessible in current context).
      Response Format:
      • Returns a JSON object containing the requested instance
      • Includes its properties, relations, and metadata (if requested)
      • Nested elements are included based on polymorphic and metadata settings.
      Example Metadata (filtered for non-admin users): ``json "metadata": { "type": "Metadata", "creationTime": "2025-03-18 17:13:40.952 +0100", "createdBy": "HIDDEN_FOR_PRIVACY", "lastUpdateBy": "HIDDEN_FOR_PRIVACY", "lastUpdateTime": "2025-03-19 16:21:16.805 +0100" } ``
      Parameters:
      type - The name of the Information System type
      instanceId - The unique identifier of the instance to retrieve
      Returns:
      JSON object containing the requested instance with its properties and relations
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - If the specified type or instance does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during instance retrieval
    • updateOrCreate

      @PUT @Path("/{type-name}/{instance-uuid}") @Consumes({"text/plain","application/json;charset=UTF-8"}) @Produces("application/json;charset=UTF-8") public String updateOrCreate(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Creates a new instance or updates an existing instance with the specified type and UUID in the Resource Registry. REST Endpoint: PUT /instances/{type-name}/{instance-uuid} Request Examples:
      • Basic create/update: PUT /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f
      • With metadata in response: PUT /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?includeMeta=true
      • Full metadata context: PUT /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?includeMeta=true&allMeta=true
      • With context information: PUT /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f?includeContexts=true.
      Path Parameters:
      • type-name: The name of the Information System type (e.g., "EService", "ContactFacet")
      • instance-uuid: The unique identifier of the instance to create or update.
      Request Body:
      • JSON representation of the instance to create or update
      • Must conform to the specified type schema.
      Query Parameters: includeMeta (optional):
      • Whether to include metadata in the response instance
      • Default value: false (basic information only)
      • Values: true|false
      • Example: ?includeMeta=true (includes metadata with appropriate filtering based on user role)
      • Metadata includes the created/updated instance and nested elements based on polymorphic setting
      • Restriction: IS-Manager, Infrastructure-Manager, and Context-Manager see complete metadata including sensitive information (createdBy, lastUpdatedBy); other users see filtered metadata with sensitive fields obfuscated.
      allMeta (optional):
      • Whether to include metadata for all nested instances (ConsistsOf relations, Facets, etc.) in the response
      • Must be used in conjunction with includeMeta=true
      • Default value: false (metadata only for main instance, more human-readable)
      • Values: true|false
      • Example: ?includeMeta=true&allMeta=true (includes metadata for all nested elements)
      • Purpose: When false, produces more human-readable responses with less JSON to process.
      includeContexts (optional):
      • Whether to include the list of contexts where the instance and its nested elements are available in the response
      • Default value: false (context information not included)
      • Values: true|false
      • Example: ?includeContexts=true (shows context availability for the instance and nested elements)
      • Note: A Resource is present in all contexts that form the union of contexts of all its Facets
      • Note: ConsistsOf relations are present in all contexts where their target Facets are present
      • Note: Unlike read operations, this parameter does not require hierarchical=true.
      Authorization Requirements: IS-Manager:
      • Full access to create/update instances in any context
      • Can create/update instances across all contexts within the infrastructure
      • Receive complete, unfiltered metadata for the instance and all nested elements in the response
      • Metadata includes all administrative fields without obfuscation.
      Infrastructure-Manager:
      • Full access to create/update instances in any context
      • Can create/update instances across all contexts within the infrastructure
      • Receive complete, unfiltered metadata for the instance and all nested elements in the response
      • Metadata includes all administrative fields without obfuscation.
      Context-Manager:
      • Can create/update instances in the current context
      • Must be Context-Manager of the current context (derived from the authorization token)
      • Cannot create/update instances in contexts where they don't have Context-Manager role
      • Receive complete, unfiltered metadata for the instance and all nested elements in the response
      • Metadata includes all administrative fields without obfuscation.
      Other Users:
      • Limited create/update permissions based on instance ownership and context access
      • Only within contexts where they have authorized access through their token
      • Receive metadata with sensitive information filtered when includeMeta=true:
      • Date fields (creation, modification) are visible; • User identifiers (createdBy, lastUpdateBy) are obfuscated or hidden; • Other administrative details may be filtered. Operation Behavior:
      • Create: If the instance with the specified UUID does not exist, creates a new instance
      • Update: If the instance with the specified UUID exists, updates the existing instance
      • The operation is idempotent and atomic.
      Response Codes:
      • 200 OK: Instance successfully updated (existing instance modified)
      • 201 Created: Instance successfully created (new instance)
      • 400 Bad Request: Invalid request body, malformed JSON, or schema validation failed
      • 403 Forbidden: Insufficient permissions to create/update the instance
      • 404 Not Found: The specified type does not exist.
      Response Format:
      • Returns a JSON object containing the created or updated instance
      • Includes its properties, relations, and metadata (if requested)
      • Response structure depends on includeMeta, allMeta, and includeContexts parameters.
      Example Metadata (filtered for non-admin users): ``json "metadata": { "type": "Metadata", "creationTime": "2025-03-18 17:13:40.952 +0100", "createdBy": "HIDDEN_FOR_PRIVACY", "lastUpdateBy": "HIDDEN_FOR_PRIVACY", "lastUpdateTime": "2025-03-19 16:21:16.805 +0100" } ``
      Parameters:
      type - The name of the Information System type
      instanceId - The unique identifier of the instance to create or update
      json - JSON representation of the instance to create or update
      Returns:
      JSON object containing the created or updated instance with its properties and relations
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during instance creation or update
    • delete

      @DELETE @Path("/{type-name}/{instance-uuid}") public jakarta.ws.rs.core.Response delete(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Deletes an instance with the specified type and UUID from the Resource Registry. REST Endpoint: DELETE /instances/{type-name}/{instance-uuid} Request Examples:
      • Delete resource (e.g., EService): DELETE /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f
      • Delete facet (e.g., ContactFacet): DELETE /instances/ContactFacet/4023d5b2-8601-47a5-83ef-49ffcbfc7d86.
      Path Parameters:
      • type-name: The name of the Information System type (e.g., "EService", "ContactFacet")
      • instance-uuid: The unique identifier of the instance to delete.
      Query Parameters:
      • This endpoint does not accept any query parameters
      • The deletion operates only in the current context (derived from the authorization token)
      • No hierarchical or metadata options are available for delete operations.
      Authorization Requirements: IS-Manager:
      • Can delete any instance from any context
      • Full administrative access to deletion operations across all contexts.
      Infrastructure-Manager:
      • Can delete any instance from any context
      • Full administrative access to deletion operations across all contexts.
      Context-Manager:
      • Can delete instances if the request is made from a context where they have Context-Manager role
      • Must be Context-Manager of the current context (derived from the authorization token)
      • The current context must be one of the contexts where the instance exists.
      Other Users:
      • Can delete instances if the request is made from a context where the instance is present
      • The current context (derived from the authorization token) must be one of the contexts where the instance exists
      • Only within contexts where they have authorized access through their token.
      Operation Behavior:
      • Global Deletion: The instance is deleted from all contexts where it exists, not just the current context
      • IsRelatedTo Relations Cleanup: All IsRelatedTo relations involving the deleted instance (both as source and target) are deleted from all contexts to prevent broken relations and maintain referential integrity
      • Cascading Effects for IsRelatedTo: Connected Resources are deleted only if propagation constraints require it and only for relations where the deleted instance is the source (relations are followed in their direction) and only within the current context
      • Complete ConsistsOf Deletion: All ConsistsOf relations and their target Facets are deleted regardless of context
      • Facet/ConsistsOf Deletion Behavior: When deleting a Facet or ConsistsOf relation, both the ConsistsOf relation and the Facet must be present in the current context. The source Resource is revalidated against its type schema after deletion - if the Resource becomes invalid, the deletion operation fails with a 400 Bad Request error (SchemaViolationException)
      • Schema Validation: When deleting Facets or ConsistsOf relations, the source Resource is validated against its type schema after deletion to ensure consistency - validation failures result in a 400 Bad Request error (SchemaViolationException)
      • Permission Validation: User permissions are validated against the current context
      • Atomicity: The operation is atomic - either the instance and all cascaded deletions succeed, or the entire operation fails.
      Response Codes:
      • 204 No Content: Instance successfully deleted
      • 400 Bad Request: Schema validation failed after deletion (SchemaViolationException) - occurs when deleting a Facet or ConsistsOf relation would leave the source Resource in an invalid state according to its type schema
      • 404 Not Found: Instance does not exist
      • 403 Forbidden: Instance exists but is available in another context (not accessible in current context).
      Parameters:
      type - The name of the Information System type
      instanceId - The unique identifier of the instance to delete
      Returns:
      HTTP response with status 204 (No Content) on successful deletion
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during instance deletion, including permission or constraint violations
    • getInstanceContexts

      @GET @Path("{type-name}/{instance-uuid}/contexts") @Produces("application/json;charset=UTF-8") public String getInstanceContexts(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.entities.resource.ResourceNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Retrieves the list of contexts where a specific instance is present in the Resource Registry. REST Endpoint: GET /instances/{type-name}/{instance-uuid}/contexts Request Examples:
      • Get contexts for a resource: GET /instances/EService/48af15ad-7e56-4157-b624-71c98cea4f8f/contexts
      • Get contexts for a facet: GET /instances/ContactFacet/4023d5b2-8601-47a5-83ef-49ffcbfc7d86/contexts.
      Path Parameters:
      • type-name: The name of the Information System type (e.g., "EService", "ContactFacet")
      • instance-uuid: The unique identifier of the instance whose contexts to retrieve.
      Query Parameters:
      • This endpoint does not accept any query parameters
      • No filtering, pagination, or metadata options are available.
      Authorization Requirements: IS-Manager:
      • Can retrieve context information for any instance
      • Full access to view contexts across the entire infrastructure.
      Infrastructure-Manager:
      • Can retrieve context information for any instance
      • Full access to view contexts across the entire infrastructure.
      Context-Manager:
      • Can retrieve context information for any accessible instance
      • Access depends on their Context-Manager role in relevant contexts.
      Other Users:
      • Can retrieve context information for any accessible instance
      • Access depends on their permissions and context availability through their token.
      Response Codes:
      • 200 OK: Context list successfully retrieved
      • 404 Not Found: Instance does not exist
      • 403 Forbidden: Instance exists but is available in another context (not accessible for context listing).
      Response Format:
      • Returns a JSON object containing the contexts where the instance is present
      • Each key is a context UUID and each value is the current full context path
      • Empty object is returned if the instance exists but is not present in any contexts.
      Example Response: ``json { "3d846e2f-3582-4344-b03a-629d4cd34d53": "/gcube/devsec/devVRE", "4eb849d5-efbb-4430-9eb6-1968123921b4": "/gcube", "a7bc333f-84df-498d-ae9d-748b358267b5": "/gcube/devsec" } ``
      Parameters:
      type - The name of the Information System type
      instanceId - The unique identifier of the instance
      Returns:
      JSON object containing context UUID to context path mappings where the instance is present
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.entities.resource.ResourceNotFoundException - If the instance does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException - If context-related errors occur
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during context retrieval