Class ReleaserUtils

java.lang.Object
fr.paris.lutece.plugins.releaser.util.ReleaserUtils

public class ReleaserUtils extends Object
The Class ReleaserUtils.
Author:
merlinfe
  • Field Details

  • Constructor Details

    • ReleaserUtils

      public ReleaserUtils()
  • Method Details

    • getWorklowContextDataKey

      public static String getWorklowContextDataKey(String strArtifactId, int nContextId)
      Gets the worklow context data key.
      Parameters:
      strArtifactId - the str artifact id
      nContextId - the n context id
      Returns:
      the worklow context data key
    • getLocalPath

      public static String getLocalPath(WorkflowReleaseContext context)
      Gets the local path.
      Parameters:
      context - the context
      Returns:
      the local path
    • getLocalPomPath

      public static String getLocalPomPath(WorkflowReleaseContext context)
      Gets the local pom path.
      Parameters:
      context - the context
      Returns:
      the local pom path
    • getLocalEffectivePomPath

      public static String getLocalEffectivePomPath(WorkflowReleaseContext context)
      Gets the local pom path.
      Parameters:
      context - the context
      Returns:
      the local pom path
    • getLocalSitePath

      public static String getLocalSitePath(Site site)
      Gets the local site path.
      Parameters:
      site - the site
      Returns:
      the local site path
    • getLocalPathUnderBase

      public static String getLocalPathUnderBase(String strName)
      Returns a local directory under the site base path, refusing any name that would leave it : the directory is deleted and recreated at each clone.
      Parameters:
      strName - the directory name, an artifactId
      Returns:
      the path
    • getLocalPathUnder

      public static String getLocalPathUnder(String strBase, String strName)
      Returns a local directory under a base path, refusing any name that would leave it.
      Parameters:
      strBase - the base path
      strName - the directory name
      Returns:
      the path
    • getLocalSitePomPath

      public static String getLocalSitePomPath(Site site)
      Gets the local site pom path.
      Parameters:
      site - the site
      Returns:
      the local site pom path
    • getComponentName

      public static String getComponentName(String strScmDeveloperConnection, String strArtifactId)
      Gets the component name.
      Parameters:
      strScmDeveloperConnection - the str scm developer connection
      strArtifactId - the str artifact id
      Returns:
      the component name
    • getSiteTagName

      public static String getSiteTagName(Site site)
      Gets the site tag name.
      Parameters:
      site - the site
      Returns:
      the site tag name
    • addInfoError

      public static void addInfoError(CommandResult commandResult, String strError, Exception e)
      Adds the info error.
      Parameters:
      commandResult - the command result
      strError - the str error
      e - the e
    • addInfoError

      public static void addInfoError(CommandResult commandResult, String strError, String strShortError, Exception e)
      Adds the info error, with a short variant shown in the release info column.
      Parameters:
      commandResult - the command result
      strError - the full error, appended to the release log
      strShortError - the short error, shown in the release info column
      e - the e
    • addTechnicalError

      public static void addTechnicalError(CommandResult commandResult, String strError, Exception e) throws fr.paris.lutece.portal.service.util.AppException
      Adds the technical error.
      Parameters:
      commandResult - the command result
      strError - the str error
      e - the e
      Throws:
      fr.paris.lutece.portal.service.util.AppException - the app exception
    • addTechnicalError

      public static void addTechnicalError(CommandResult commandResult, String strError) throws fr.paris.lutece.portal.service.util.AppException
      Adds the technical error.
      Parameters:
      commandResult - the command result
      strError - the str error
      Throws:
      fr.paris.lutece.portal.service.util.AppException - the app exception
    • startCommandResult

      public static void startCommandResult(WorkflowReleaseContext context)
      Start command result.
      Parameters:
      context - the context
    • logStartAction

      public static void logStartAction(WorkflowReleaseContext context, String strActionName)
      Log start action.
      Parameters:
      context - the context
      strActionName - the str action name
    • logEndAction

      public static void logEndAction(WorkflowReleaseContext context, String strActionName)
      Log end action.
      Parameters:
      context - the context
      strActionName - the str action name
    • stopCommandResult

      public static void stopCommandResult(WorkflowReleaseContext context)
      Stop command result.
      Parameters:
      context - the context
    • convertStringToInt

      public static int convertStringToInt(String strParameter)
      convert a string to int.
      Parameters:
      strParameter - the string parameter to convert
      Returns:
      the conversion
    • getReleaserUser

      public static ReleaserUser getReleaserUser(javax.servlet.http.HttpServletRequest request, Locale locale)
      Gets the releaser user.
      Parameters:
      request - the request
      locale - the locale
      Returns:
      the releaser user
    • populateReleaserUser

      public static void populateReleaserUser(javax.servlet.http.HttpServletRequest request, ReleaserUser user)
      Populate releaser user.
      Parameters:
      request - the request
      user - the user
    • setReleaserUser

      public static void setReleaserUser(javax.servlet.http.HttpServletRequest request, ReleaserUser releaserUser)
      Sets the releaser user.
      Parameters:
      request - the request
      releaserUser - the releaser user
    • isApplicationAccountEnable

      public static boolean isApplicationAccountEnable()
      Checks if is application account enable.
      Returns:
      true, if is application account enable
    • compareVersion

      public static int compareVersion(String strVersion1, String strVersion2)
      Compare version.
      Parameters:
      strVersion1 - the str version 1
      strVersion2 - the str version 2
      Returns:
      the int
    • cleanPWDInLog

      public static String cleanPWDInLog(String strLog)
    • getBranchReleaseFrom

      public static String getBranchReleaseFrom(WorkflowReleaseContext context)
    • checkGithubWritePermission

      public static String checkGithubWritePermission(IReleaserResource resource, ReleaserUser user)
      Checks that the user credentials grant the GitHub write (push) permission required to release a resource. Only applies to GitHub resources : returns null for the other repository types.
      Parameters:
      resource - the resource to release (site or component)
      user - the releaser user holding the session credentials
      Returns:
      an error message to send back to the user, or null if the release can proceed
    • IsVersionInRightFormat

      public static boolean IsVersionInRightFormat(String strVersion)