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

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

    • TYPE_PATH_PARAMETER

      public static final String TYPE_PATH_PARAMETER
      Constant representing the type name path parameter.
      See Also:
  • Constructor Details

    • TypeManager

      public TypeManager()
  • Method Details

    • cleanCache

      public jakarta.ws.rs.core.Response cleanCache()
      Clean the types cache
      Returns:
    • create

      @PUT @Path("{type-name}") @Consumes({"text/plain","application/json;charset=UTF-8"}) @Produces("application/json;charset=UTF-8") public jakarta.ws.rs.core.Response create(@PathParam("type-name") String typeName, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Creates a new type definition in the Information System. Only the highest level administrative users can perform this operation due to its system-wide impact. REST Endpoint: PUT /types/{type-name} Request Examples:
      • PUT /types/ContactFacet (creates a new ContactFacet type definition)
      • PUT /types/MyCustomResource (creates a new custom resource type).
      Path Parameters:
      • type-name: The name of the type to create (e.g., "ContactFacet", "MyCustomResource").
      Request Body:
      • JSON representation of the type definition
      • Must conform to the Information System type schema.
      Authorization Requirements: IS-Manager:
      • Can create any type definition without restrictions
      • Has full administrative privileges across the entire Information System.
      Infrastructure-Manager:
      • Can create any type definition without restrictions
      • Has full administrative privileges across the entire Information System.
      All Other Users (including Context-Manager):
      • Cannot create type definitions
      • Will receive authorization errors if attempting these operations
      • Type creation is restricted to prevent system-wide compatibility issues.
      Operation Behavior: Type Update Policy: No REST Update Method Exposed:
      • Although the underlying code supports type updates, the update functionality is intentionally NOT exposed via REST API
      • Type modifications can break compatibility across the entire Information System
      • Examples of breaking changes:
      • Making a previously optional facet property mandatory; • Changing property types or constraints; • Modifying validation rules that could invalidate existing instances. Offline Update Process:
      • Type updates must be performed offline after careful impact assessment
      • Changes require evaluation of all existing instances and dependent systems
      • Updates are applied through controlled maintenance procedures
      • This ensures system stability and prevents breaking existing client applications.
      Response Codes:
      • 201 Created: Type successfully created
      • 409 Conflict: Type already exists with the given name
      • 400 Bad Request: Invalid JSON schema or malformed request
      • 403 Forbidden: User lacks authorization to create types.
      Response Format:
      • Content-Type: application/json
      • Body: Complete type definition including metadata and schema information.
      Parameters:
      typeName - the name of the type to create (must be unique in the system)
      json - the JSON schema definition of the type to create
      Returns:
      HTTP 201 Created response with the complete type definition
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the provided schema is invalid or malformed
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - for creation errors or authorization failures
    • read

      @GET @Path("{type-name}") @Produces("application/json;charset=UTF-8") public String read(@PathParam("type-name") String type, @QueryParam("polymorphic") @DefaultValue("false") Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Retrieves the schema definition(s) for the specified type. The response can include subtypes and metadata based on query parameters and user authorization. REST Endpoint: GET /types/{type-name}[?polymorphic={true|false}&includeMeta={true|false}] Request Examples:
      • GET /types/ContactFacet (returns basic ContactFacet type definition only)
      • GET /types/ContactFacet?polymorphic=true (returns ContactFacet and all its subtypes)
      • GET /types/ContactFacet?includeMeta=true (returns ContactFacet with metadata for authorized users)
      • GET /types/ContactFacet?polymorphic=true&includeMeta=true (returns ContactFacet, subtypes, and metadata).
      Path Parameters:
      • type-name: The name of the type to retrieve (case-sensitive).
      Query Parameters: polymorphic (optional):
      • Whether to include subtypes in the response
      • Default value: false (returns only the specified type)
      • When true: returns the specified type AND all its existing subtypes
      • When false: returns only the specified type definition
      • Note: No pagination is applied - ALL subtypes are returned when polymorphic=true
      • Example: ?polymorphic=true (includes all subtypes of the requested type).
      includeMeta (optional):
      • Whether to include metadata in the response
      • Default value: false (basic type information only)
      • Values: true|false
      • Example: ?includeMeta=true (includes metadata based on user authorization).
      Authorization Requirements: IS-Manager:
      • Receive basic type information by default
      • Can explicitly request metadata via includeMeta=true query parameter
      • When metadata is requested, receive complete type definitions with full metadata
      • All metadata fields are included when includeMeta=true
      • No obfuscation or filtering of sensitive information.
      Infrastructure-Manager:
      • Receive basic type information by default
      • Can explicitly request metadata via includeMeta=true query parameter
      • When metadata is requested, receive complete type definitions with full metadata
      • All metadata fields are included when includeMeta=true
      • No obfuscation or filtering of sensitive information.
      All Other Users:
      • Receive basic type information by default
      • Can explicitly request metadata via includeMeta=true query parameter
      • When metadata is requested, receive metadata with sensitive information filtered:
      • Date fields (creation, modification) are visible; • User identifiers (createdBy, lastUpdateBy) are obfuscated or hidden; • Other administrative details may be filtered. Response Codes:
      • 200 OK: Type successfully retrieved
      • 404 Not Found: Type with the specified name does not exist
      • 403 Forbidden: User lacks authorization to access type information.
      Response Format:
      • Content-Type: application/json
      • Body: Type schema definition(s) with authorization-appropriate detail level
      • When polymorphic=false: single type definition object
      • When polymorphic=true: array of type definitions (parent + all subtypes).
      Parameters:
      type - the name of the type to retrieve (case-sensitive)
      polymorphic - whether to include subtypes in the response (default: false)
      Returns:
      JSON containing type schema definition(s) with authorization-appropriate detail level
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the specified type is not found in the system
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - for retrieval errors or other system failures