Class LaunchUtils


  • public class LaunchUtils
    extends java.lang.Object
    Utilities for WCM launches.
    • Constructor Detail

      • LaunchUtils

        public LaunchUtils()
    • 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)
        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 that resource is part of. If target is null, the production version of the resource is returned.
        Parameters:
        resource - a launch-based resource
        target - a parent launch or null to 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 to getTargetResource(Resource, Launch). The returned path might not resolve (if the target resource does not exist).
        Parameters:
        resource - a launch-based resource
        target - a parent launch or null to 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) launch
        resource - 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 to getLaunchResource(Launch,Resource). The returned path might not resolve (if the resource does not exist in the launch).
        Parameters:
        launch - a (possibly nested) launch
        resource - 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)
        Returns true if the provided path is a launch-based path
        Parameters:
        path - The path to check
        Returns:
        true if the provided path is a launch-based path
      • isLaunchResourcePath

        public static boolean isLaunchResourcePath​(java.lang.String path)
        Returns true if the provided path is a launch resource path
        Parameters:
        path - Path to check
        Returns:
        true if the provided path is a launch resource path
      • getLaunchPath

        public static java.lang.String getLaunchPath​(java.lang.String path)
        Deprecated.
        since 6.0.0 - use getLaunchResource(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 null if provided path does not belong to a launch
      • getLaunchPathFromName

        public static java.lang.String getLaunchPathFromName​(java.lang.String launchName)
        Deprecated.
        since 6.0.0
        Warning: 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.0
        Returns 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.0
        Returns the launch resource path corresponding to a provided path and a launch name
        Parameters:
        path - The path to build the launch resource path from
        launchName - Launch name
        Returns:
        Returns the resource path within the provided launch or null if 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