Class BaseRequestInfo
java.lang.Object
org.gcube.informationsystem.resourceregistry.api.request.BaseRequestInfo
- All Implemented Interfaces:
RequestInfo
The Class BaseRequestInfo.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanTrack if the request requested to includeMetadatain allIdentifiableElementor just in the root instanceprotected booleanTrack if hierarchicalMode has been requestedprotected booleanTrack if the request requested to include contextsprotected booleanTrack if the request requested to includeMetadataprotected IntegerTo get unlimited results the limit query parameters must be set to -1.protected IntegerThe offset parameter indicates the starting position of the result.Fields inherited from interface org.gcube.informationsystem.resourceregistry.api.request.RequestInfo
DEFAULT_LIMIT, DEFAULT_OFFSET, UNBOUNDED_LIMIT -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new base request info.BaseRequestInfo(Integer offset, Integer limit) Instantiates a new base request info. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallMeta()Checks whether to include metadata for all nested instances in the response.getLimit()Gets the maximum number of instances to return in a single response.Gets the number of instances to skip from the beginning of the result set.booleanChecks whether to include the list of contexts where instances and their nested elements are available.booleanChecks whether to include metadata in the response instance.booleanChecks whether to include instances from child contexts of the current context.voidsetAllMeta(boolean allMeta) Sets whether to include metadata for all nested instances (ConsistsOf relations, Facets, etc.) in the response.voidsetHierarchicalMode(boolean hierarchicalMode) Sets whether to include instances from child contexts of the current context.voidsetIncludeContexts(boolean includeContexts) Sets whether to include the list of contexts where the instance and its nested elements are available in the response.voidsetIncludeMeta(boolean includeMeta) Sets whether to include metadata in the response instance.voidSets the maximum number of instances to return in a single response.voidSets the number of instances to skip from the beginning of the result set.
-
Field Details
-
offset
The offset parameter indicates the starting position of the result. -
limit
To get unlimited results the limit query parameters must be set to -1. If the results are too much the operation could have a timeout. -
includeMeta
protected boolean includeMetaTrack if the request requested to includeMetadata -
allMeta
protected boolean allMetaTrack if the request requested to includeMetadatain allIdentifiableElementor just in the root instance -
hierarchicalMode
protected boolean hierarchicalModeTrack if hierarchicalMode has been requested -
includeContexts
protected boolean includeContextsTrack if the request requested to include contexts
-
-
Constructor Details
-
BaseRequestInfo
public BaseRequestInfo()Instantiates a new base request info. -
BaseRequestInfo
Instantiates a new base request info.- Parameters:
offset- the offsetlimit- the limit
-
-
Method Details
-
getLimit
Gets the maximum number of instances to return in a single response.- Specified by:
getLimitin interfaceRequestInfo- Returns:
- the limit value for pagination, or null if not set (uses server default)
-
setLimit
Sets the maximum number of instances to return in a single response. Used for pagination to control response size and manage memory usage.- Default value: Server configuration dependent
- Example: Set to 50 to get at most 50 instances per request
- Unlimited results: Set to
RequestInfo.UNBOUNDED_LIMIT(-1) for unlimited results (may cause timeout if results are too many) - Query parameter: limit
- Specified by:
setLimitin interfaceRequestInfo- Parameters:
limit- Maximum number of instances to return, orRequestInfo.UNBOUNDED_LIMITfor unlimited results
-
getOffset
Gets the number of instances to skip from the beginning of the result set.- Specified by:
getOffsetin interfaceRequestInfo- Returns:
- the offset value for pagination, or null if not set (defaults to 0)
-
setOffset
Sets the number of instances to skip from the beginning of the result set. Used for pagination to navigate through large result sets.- Default value: 0
- Example: Set to 10 to skip the first 10 instances (useful for pagination)
- Query parameter:
offset
- Specified by:
setOffsetin interfaceRequestInfo- Parameters:
offset- Number of instances to skip from the beginning
-
includeMeta
public boolean includeMeta()Checks whether to include metadata in the response instance.- Specified by:
includeMetain interfaceRequestInfo- Returns:
- true if metadata should be included, false for basic information only
-
setIncludeMeta
public void setIncludeMeta(boolean includeMeta) Sets whether to include metadata in the response instance. Controls whether to includeMetadatain the response.- Default value: false (basic information only)
- Values:
- true: includes metadata with role-based filtering
- false: basic information only
- Query parameter: includeMeta
- IS-Manager, Infrastructure-Manager, and Context-Manager: See complete metadata including sensitive information (createdBy, lastUpdatedBy)
- Other users: See filtered metadata with sensitive fields obfuscated
- Specified by:
setIncludeMetain interfaceRequestInfo- Parameters:
includeMeta- Whether to include metadata in the response instance
-
allMeta
public boolean allMeta()Checks whether to include metadata for all nested instances in the response.- Specified by:
allMetain interfaceRequestInfo- Returns:
- true if metadata should be included for all nested elements, false for main instance only
-
setAllMeta
public void setAllMeta(boolean allMeta) Sets whether to include metadata for all nested instances (ConsistsOf relations, Facets, etc.) in the response. Controls whether to includeMetadatain allIdentifiableElementor just in the root instance. Must be used in conjunction with includeMeta=true.- Default value: false (metadata only for main instance, more human-readable)
- Values:
- true: complete metadata for all nested IdentifiableElement instances
- false: metadata only in the root instance, more readable
- Purpose: When false, produces more human-readable responses with less JSON to process
- Query parameter: allMeta
- Specified by:
setAllMetain interfaceRequestInfo- Parameters:
allMeta- Whether to include metadata for all nested instances in the response
-
isHierarchicalMode
public boolean isHierarchicalMode()Checks whether to include instances from child contexts of the current context. This is an admin-only feature.- Specified by:
isHierarchicalModein interfaceRequestInfo- Returns:
- true if hierarchical mode is enabled, false for current context only
-
setHierarchicalMode
public void setHierarchicalMode(boolean hierarchicalMode) Sets whether to include instances from child contexts of the current context.- Default value: false (child contexts not included)
- Values:
- true: includes child contexts
- false: current context only
- Query parameter:
hierarchical
- IS-Manager and Infrastructure-Manager: Global roles, can use hierarchical mode in any context
- Context-Manager: Context-specific role, can use hierarchical mode only in contexts where they have this role
- Other users: Not available
- Specified by:
setHierarchicalModein interfaceRequestInfo- Parameters:
hierarchicalMode- Whether to include instances from child contexts of the current context
-
includeContexts
public boolean includeContexts()Checks whether to include the list of contexts where instances and their nested elements are available.- Specified by:
includeContextsin interfaceRequestInfo- Returns:
- true if context information should be included, false if context information is not included
-
setIncludeContexts
public void setIncludeContexts(boolean includeContexts) Sets 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: shows context availability
- false: no context information
- Query parameter:
includeContexts
- Resources: Present in all contexts that form the union of contexts of all their Facets
- ConsistsOf relations: Present in all contexts where their target Facets are present
- Facets: Context availability depends on the Resources that include them via ConsistsOf relations
- Specified by:
setIncludeContextsin interfaceRequestInfo- Parameters:
includeContexts- Whether to include the list of contexts where instances and their nested elements are available
-