Package com.adobe.cq.wcm.launches.utils
Class LaunchUtils
java.lang.Object
com.adobe.cq.wcm.launches.utils.LaunchUtils
Utilities for WCM launches.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildLaunchResourcePath(String path, String launchName) Deprecated.since 6.0.0static LaunchSourcefindNearestLaunchSource(Resource inputResource, List<LaunchSource> launchSourceList) static StringgetLaunchPath(String path) Deprecated.since 6.0.0 - usegetLaunchResource(Resource)instead.static StringgetLaunchPathFromName(String launchName) Deprecated.since 6.0.0static ResourcegetLaunchResource(Launch launch, Resource resource) Given a resource, which can be production or launch-based, returns the corresponding resource in the specified (and possibly nested) launch.static ResourcegetLaunchResource(Resource resource) Returns the resource of the launch the provided resource belongs tostatic StringgetLaunchResourcePath(Launch launch, Resource resource) Constructs the path of a resource in the specified launch according togetLaunchResource(Launch,Resource).static ResourcegetProductionResource(Resource resource) Deprecated.static StringDeprecated.since 6.0.0static ResourcegetTargetResource(Resource resource, Launch target) Given a launch-based resource, this method returns the corresponding resource in the specified target launch.static StringgetTargetResourcePath(Resource resource, Launch target) Constructs the target path of a launch-based resource according togetTargetResource(Resource, Launch).static booleanisApprovedLaunchResource(Resource resource) returns true if the given launch resource is approvedstatic booleanisLaunchBasedPath(String path) Returnstrueif the provided path is a launch-based pathstatic booleanisLaunchResourcePath(String path) Returnstrueif the provided path is a launch resource path
-
Constructor Details
-
LaunchUtils
public LaunchUtils()
-
-
Method Details
-
getLaunchResource
Returns the resource of the launch the provided resource belongs to- Parameters:
resource- Resource to check- Returns:
- Resource of the launch the provided resource belongs to
-
getProductionResource
Deprecated.Given a launch-based resource, this method returns the corresponding resource in the source of the launch. For nested launches, the returned resource is launch-based. For first-level launches, the returned resource is the production version.- Parameters:
resource- A launch-based resource- Returns:
- the source version of the resource
-
getTargetResource
Given a launch-based resource, this method returns the corresponding resource in the specified target launch. The target launch must be a parent launch of the launch thatresourceis part of. Iftargetisnull, the production version of the resource is returned.- Parameters:
resource- a launch-based resourcetarget- a parent launch ornullto get the production version- Returns:
- the resource at the specified target
- Throws:
LaunchException- if the specified target is not a parent launch
-
getTargetResourcePath
Constructs the target path of a launch-based resource according togetTargetResource(Resource, Launch). The returned path might not resolve (if the target resource does not exist).- Parameters:
resource- a launch-based resourcetarget- a parent launch ornullto get the production version- Returns:
- the path of the resource at the specified target
- Throws:
LaunchException- if the specified target is not a parent launch
-
getLaunchResource
Given a resource, which can be production or launch-based, returns the corresponding resource in the specified (and possibly nested) launch.- Parameters:
launch- a (possibly nested) launchresource- a (source) resource- Returns:
- the corresponding resource in the launch
- Throws:
LaunchException- if the resource is launch-based and the specified launch is not a child launch
-
getLaunchResourcePath
Constructs the path of a resource in the specified launch according togetLaunchResource(Launch,Resource). The returned path might not resolve (if the resource does not exist in the launch).- Parameters:
launch- a (possibly nested) launchresource- a (source) resource- Returns:
- the path of the resource in the launch
- Throws:
LaunchException- if the resource is launch-based and the specified launch is not a child launch, or if the specified launch has an invalid parent launch in the launch hierarchy
-
isLaunchBasedPath
Returnstrueif the provided path is a launch-based path- Parameters:
path- The path to check- Returns:
trueif the provided path is a launch-based path
-
isLaunchResourcePath
Returnstrueif the provided path is a launch resource path- Parameters:
path- Path to check- Returns:
trueif the provided path is a launch resource path
-
getLaunchPath
Deprecated.since 6.0.0 - usegetLaunchResource(Resource)instead.Warning: this method is deprecated. It will not work with the new launches structure. Returns the launch resource path corresponding to the provided launch-based path- Parameters:
path- The launch-based path- Returns:
- Launch resource path corresponding to the provided launch-based path
or
nullif provided path does not belong to a launch
-
getLaunchPathFromName
Deprecated.since 6.0.0Warning: this method is deprecated. It will not work with the new launches structure. Returns the launch resource path from the provided launch name- Parameters:
launchName- The launch name- Returns:
- Launch resource path from the provided launch name
-
getProductionResourcePath
Deprecated.since 6.0.0Returns the production resource path corresponding to the provided launch-based resource path- Parameters:
path- The launch-based resource path- Returns:
- Production resource path corresponding to the provided launch-based resource path or the provided path if it isn't a launch-based resource path
-
buildLaunchResourcePath
Deprecated.since 6.0.0Returns the launch resource path corresponding to a provided path and a launch name- Parameters:
path- The path to build the launch resource path fromlaunchName- Launch name- Returns:
- Returns the resource path within the provided launch or
nullif the provided path is already a launch-based resource path from a different launch than the provided one
-
isApprovedLaunchResource
returns true if the given launch resource is approved- Parameters:
resource- launch based resource- Returns:
- returns the boolean
-
findNearestLaunchSource
public static LaunchSource findNearestLaunchSource(Resource inputResource, List<LaunchSource> launchSourceList)
-