Package com.adobe.cq.wcm.launches.utils
Class LaunchUtils
- java.lang.Object
-
- com.adobe.cq.wcm.launches.utils.LaunchUtils
-
public class LaunchUtils extends java.lang.ObjectUtilities 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 java.lang.StringbuildLaunchResourcePath(java.lang.String path, java.lang.String launchName)Deprecated.since 6.0.0static LaunchSourcefindNearestLaunchSource(Resource inputResource, java.util.List<LaunchSource> launchSourceList)static java.lang.StringgetLaunchPath(java.lang.String path)Deprecated.since 6.0.0 - usegetLaunchResource(Resource)instead.static java.lang.StringgetLaunchPathFromName(java.lang.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 java.lang.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 java.lang.StringgetProductionResourcePath(java.lang.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 java.lang.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(java.lang.String path)Returnstrueif the provided path is a launch-based pathstatic booleanisLaunchResourcePath(java.lang.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 java.lang.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 java.lang.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(java.lang.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(java.lang.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 java.lang.String getLaunchPath(java.lang.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 java.lang.String getLaunchPathFromName(java.lang.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 java.lang.String getProductionResourcePath(java.lang.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 java.lang.String buildLaunchResourcePath(java.lang.String path, java.lang.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
-
findNearestLaunchSource
public static LaunchSource findNearestLaunchSource(Resource inputResource, java.util.List<LaunchSource> launchSourceList)
-
-