Package com.adobe.cq.wcm.launches.utils
Class LaunchUtils
- java.lang.Object
-
- com.adobe.cq.wcm.launches.utils.LaunchUtils
-
public class LaunchUtils extends Object
Utilities for WCM launches.
-
-
Constructor Summary
Constructors Constructor Description LaunchUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StringbuildLaunchResourcePath(String path, String launchName)Deprecated.since 6.0.0static 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 StringgetProductionResourcePath(String path)Deprecated.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
-
-
-
Method Detail
-
getLaunchResource
public static Resource getLaunchResource(Resource resource)
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
public static Resource getProductionResource(Resource resource)
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
public static Resource getTargetResource(Resource resource, Launch target) throws LaunchException
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
public static String getTargetResourcePath(Resource resource, Launch target) throws LaunchException
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
public static Resource getLaunchResource(Launch launch, Resource resource) throws LaunchException
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
public static String getLaunchResourcePath(Launch launch, Resource resource) throws LaunchException
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
public static boolean isLaunchBasedPath(String path)
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
public static boolean isLaunchResourcePath(String path)
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
public static String getLaunchPath(String path)
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
public static String getLaunchPathFromName(String launchName)
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
public static String getProductionResourcePath(String path)
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
public static String buildLaunchResourcePath(String path, String launchName)
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
public static boolean isApprovedLaunchResource(Resource resource)
returns true if the given launch resource is approved- Parameters:
resource- launch based resource- Returns:
- returns the boolean
-
-