Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

package com.erggroup.buildtool.smtp;

/**
 * This package provides utility functions to assist in the creation of URLs into 
 * the Release Manager Web Server
 * These are used in emails to assist the user in navigating to a Package or Release
 */
public class CreateUrls
{
    /**
     * 
     * @return Return the Base http reference to the Release Manager Web Server
     *         If one cannot be found create a dummy one.
     */
    public static String getRmBaseUrl()
    {
        String rmRef = System.getenv("GBE_RM_URL");
        if (rmRef == null) {
            rmRef = "http://GBE_RM_URL";
        }
        return rmRef;
    }
    
    
    /**
     * Create a URL to a Release Manager Web entry for a given Release and optioanl package
     * 
     * @param rtag_id Identify the Release via numeric tag
     * @param pv_id   Identify the package by pv_id - May be null
     * 
     * @return A URL to the package within Release Manager (Web Server)
     */
    
    public static String generateRmUrl(String rtag_id, String pv_id)
    {
        //  Create a Release Manager Reference
        String rmRef = getRmBaseUrl();
        
        rmRef += "/fixed_issues.asp?"
              + "rtag_id=" + rtag_id;
        if (pv_id != null )
        {
              rmRef += "&pv_id=" + pv_id; 
        }
             
        return rmRef;
    }
    
    /**
     * @param rtag_id
     * @param pv_id
     * @return A URL to the package within Release Manager (Web Server)
     */
    public static String generateRmUrl(int rtag_id, int pv_id)
    {
        return generateRmUrl(String.valueOf(rtag_id), String.valueOf(pv_id)); 
    }
    

    /**
     * @param rtag_id Identify the Release via numeric tag
     * 
     * @return  A URL to a Release entry within Release Manager (Web Server)
     */
    public static String generateReleaseUrl(int rtag_id)
    {
        return getRmBaseUrl() + "/dependencies.asp?rtag_id=" + rtag_id;
    }
    
    /**
     * 
     * @return Create an http ref to the error logfile
     */
    public static String generateUncBaseUrl()
    {
        String unc = System.getenv("GBE_UNC");
        if ( unc == null )
        {
            // Should not happen
            // GBE_UNC is checked in BuildDaemon at startup
            unc = "http://GBE_UNC";
        }
        return unc;
    }
}