Class RawRequest
Represents the specific Requestable keys a developer has explicitly
included or excluded for a given request, along with the phases they should be loaded in.
The class is "raw" because it is unaware of the inter-relationships between
Requestable items, such as whether or where they are included in a graph.
No processing is done, nor should be done, on the inputs.
Other classes may perform analysis and optimisations on the raw request.
To keep the data in this class "raw", it must only ever reference "entry points"
in to a data structure (e.g., a complete DependencyGraph).
Any operations that need to work with a complete, resolved list of Requestable items
(e.g., resolved excluded dependencies) should use a more appropriate class to
represent the result of that operation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all the resources from the excluded list.booleanexclude(Requestable requestableToExclude) Adds aRequestableto the exclusion list of resources.voidexclude(Collection<Requestable> resources) Returns allRequestableitems whose content should not be served to the client in this request.Deprecated.Get a flat set with all the resources for each type.getIncluded(ResourcePhase phaseType) Retrieve all the resources to be included by phase type.Deprecated.In the future the only method to be used will begetIncluded().LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> getIncludedData(ResourcePhase phaseType) booleanhasAny(ResourcePhase phase) Check if anything has been requested in a given phase.booleaninclude(Requestable resource) booleaninclude(ResourcePhase resourcePhase, RawRequest requestToInclude) Adds aRequestableto the inclusion list of resources for a specific type.booleaninclude(ResourcePhase resourcePhase, Requestable resource) voidinclude(ResourcePhase resourcePhase, Collection<Requestable> resources) voidincludeFirst(ResourcePhase resourcePhase, Requestable resource) Adds aRequestableto the inclusion list of resources for a specific type as the top of the priority.voidsetPhaseCompleted(ResourcePhase resourcePhase) Removes all resources and data requested inResourcePhaseand adds them to the excluded list.toString()
-
Constructor Details
-
RawRequest
public RawRequest()
-
-
Method Details
-
hasAny
Check if anything has been requested in a given phase.- Parameters:
phase- the phase to check for presence of requestables.- Returns:
- true if any requestables exist in the given resource phase, false if it is empty.
-
clearExcluded
public void clearExcluded()Clear all the resources from the excluded list. -
setPhaseCompleted
Removes all resources and data requested in
ResourcePhaseand adds them to the excluded list.API note: this method mutates the object state in a non-recoverable way. if you need to know what the request was at a particular point in time, the object would need to be cloned at that point in time.
Implementation note: since phases are sequential, this method need not exist; it could be replaced with a `getExcluded(ResourcePhase)` method, which would return all developer-excluded resources along with all included resources from all previous phases. This would allow us to make this class immutable.
-
deepClone
-
exclude
Adds aRequestableto the exclusion list of resources.- Parameters:
requestableToExclude- The requestable resource to be excluded.- Returns:
true: The requestable was added to the exclusion set.false: The requestable was not added to the exclusion set.
-
exclude
- See Also:
-
include
- See Also:
-
include
public void include(@Nonnull ResourcePhase resourcePhase, @Nullable Collection<Requestable> resources) - See Also:
-
include
- See Also:
-
include
Adds aRequestableto the inclusion list of resources for a specific type.- Parameters:
resourcePhase- The resource resourcePhase type for the resource.requestToInclude- The requestable resource to be included.- Returns:
true: The requestable was added to the inclusion set.false: The requestable was not added to the inclusion set.
-
includeFirst
Adds aRequestableto the inclusion list of resources for a specific type as the top of the priority.- Parameters:
resourcePhase- The resource resourcePhase type for the resource.resource- The requestable resource to be included.
-
getIncluded
Get a flat set with all the resources for each type. The order is not meant to be significant. However, some products depend on it.- Returns:
- A flatted set with all the resources to be included.
- See Also:
-
- PLUGWEB-640 for patch to satisfy Confluence.
- PLUGWEB-495 for long-term solution.
-
getIncludedAsLooseType
Deprecated.In the future the only method to be used will begetIncluded().Returns the includedRequestableas their string representation for retro-compatibility. The order is not meant to be significant. However, some products depend on it.- Returns:
- A flattened set with all the resources to be included.
- See Also:
-
- PLUGWEB-640 for patch to satisfy Confluence.
- PLUGWEB-495 for long-term solution.
-
getIncluded
Retrieve all the resources to be included by phase type. The order is not meant to be significant. However, some products depend on it.- Parameters:
phaseType- The phase type to be used for the filtering.- Returns:
- The filtered set with the resources or empty if there is not any for the type.
- Throws:
NullPointerException- If the resource phase type is not defined.- See Also:
-
- PLUGWEB-640 for patch to satisfy Confluence.
- PLUGWEB-495 for long-term solution.
-
getIncludedData
@Nonnull public LinkedHashMap<String,com.atlassian.json.marshal.Jsonable> getIncludedData(@Nonnull ResourcePhase phaseType) -
getIncludedData
-
getExcluded
Returns allRequestableitems whose content should not be served to the client in this request.- Returns:
- A copy of the current excluded resources keys.
-
getExcludedAsLooseType
Deprecated.In the future the only method to be used will begetExcluded().Returns the excludedRequestableas their string representation for retro-compatibility.- Returns:
- A copy of the current excluded resources keys.
-
getExcludedData
-
toString
-
getExcluded().