Class TrackerSoapUtil


  • public class TrackerSoapUtil
    extends Object
    Class used for aggregating convenience methods for tracker soap calls.
    • Constructor Summary

      Constructors 
      Constructor Description
      TrackerSoapUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String[] convUserIdToUserName​(com.vasoftware.sf.server.types.UserSessionKey sessionKey, com.vasoftware.sf.server.types.UserKey[] userkeys)
      Convert an array of user keys to usernames.
      static com.vasoftware.sf.server.types.UserKey[] convUsernameToUserId​(com.vasoftware.sf.server.types.UserSessionKey sessionKey, String[] usernames)
      Convert an array of usernames to user keys.
      static com.vasoftware.sf.server.services.field.UserValueDO[] convUserNameToUserValueDoArray​(com.vasoftware.sf.server.types.UserSessionKey sessionKey, String[] usernames)  
      static Date getDateFromValue​(Object value)
      For some reason date/time objects unmarshalled from axis are sometimes being returned as java.util.Date objects and sometimes returned as java.util.Calendar objects.
      protected static com.vasoftware.sf.server.services.user.UserList getUserList​(com.vasoftware.sf.server.types.UserSessionKey sessionKey, String[] usernames)  
      static void isRoleList​(String srcTrackerId, com.vasoftware.sf.server.types.ProjectPath destProjectPath, com.vasoftware.sf.server.types.UserSessionKey sessionKey)
      checks if the roles are mapped between the trackers.
      static Date removeTime​(Date date)
      Used to remove the time portion of the given date.
      static String replaceDescriptionForCRLFInCreate​(String description)
      Check for changes wrt CRLF in multi-line description field.
      static void replaceDescriptionForCRLFInUpdate​(com.vasoftware.sf.server.services.tracker.ArtifactDO originalDO, com.vasoftware.sf.server.services.tracker.ArtifactDO updArtifactDO)
      Check for changes wrt CRLF in multi-line description field.
      static void replaceTxtFlexValueForCRLFInCreate​(SoapFieldValues flexFields)
      Check for changes wrt CRLF in multi-line text flex field(s).
      static void replaceTxtFlexValueForCRLFInUpdate​(com.vasoftware.sf.server.services.tracker.ArtifactDO originalDO, com.vasoftware.sf.server.services.tracker.ArtifactDO updArtifactDO)
      Check for changes wrt CRLF in multi-line text flex field(s).
    • Constructor Detail

      • TrackerSoapUtil

        public TrackerSoapUtil()
    • Method Detail

      • convUsernameToUserId

        public static com.vasoftware.sf.server.types.UserKey[] convUsernameToUserId​(com.vasoftware.sf.server.types.UserSessionKey sessionKey,
                                                                                    String[] usernames)
                                                                             throws NoSuchObjectFault
        Convert an array of usernames to user keys.
        Parameters:
        usernames - an array of usernames to convert
        Returns:
        an array of userKeys.
        Throws:
        NoSuchObjectFault - thrown if one or more of the usernames specified is invalid
      • convUserNameToUserValueDoArray

        public static com.vasoftware.sf.server.services.field.UserValueDO[] convUserNameToUserValueDoArray​(com.vasoftware.sf.server.types.UserSessionKey sessionKey,
                                                                                                           String[] usernames)
                                                                                                    throws NoSuchObjectFault
        Parameters:
        sessionKey -
        usernames - an array of usernames to convert
        Returns:
        an array of userValues
        Throws:
        NoSuchObjectFault
      • getUserList

        protected static com.vasoftware.sf.server.services.user.UserList getUserList​(com.vasoftware.sf.server.types.UserSessionKey sessionKey,
                                                                                     String[] usernames)
                                                                              throws NoSuchObjectFault
        Parameters:
        sessionKey -
        usernames - an array of usernames
        Returns:
        userList
        Throws:
        NoSuchObjectFault
      • convUserIdToUserName

        public static String[] convUserIdToUserName​(com.vasoftware.sf.server.types.UserSessionKey sessionKey,
                                                    com.vasoftware.sf.server.types.UserKey[] userkeys)
                                             throws NoSuchObjectFault
        Convert an array of user keys to usernames.
        Parameters:
        userkeys - an array of userkeys to convert
        Returns:
        an array of usernames.
        Throws:
        NoSuchObjectFault - thrown if one or more of the userkeys specified is invalid
      • getDateFromValue

        public static Date getDateFromValue​(Object value)
        For some reason date/time objects unmarshalled from axis are sometimes being returned as java.util.Date objects and sometimes returned as java.util.Calendar objects. This method returns the proper Date object(without time portion) for whatever the value passed in happens to be.

        On null, it returns null. If value is an object other than java.util.Date or java.util.Calendar, it returns a null.

        Parameters:
        value - the value to convert to a Date
        Returns:
        the date value with just the date portion alone
      • isRoleList

        public static void isRoleList​(String srcTrackerId,
                                      com.vasoftware.sf.server.types.ProjectPath destProjectPath,
                                      com.vasoftware.sf.server.types.UserSessionKey sessionKey)
                               throws WorkflowViolationFault,
                                      NoSuchObjectFault
        checks if the roles are mapped between the trackers.
        Parameters:
        srcTrackerId - SourceTrackerId.
        destProjectPath - Destination projectpath.
        sessionKey - user session key.
        Throws:
        WorkflowViolationFault - If roles are not matching in source tracker and in destination project.
        NoSuchObjectFault - throws If object not found.
      • removeTime

        public static Date removeTime​(Date date)
        Used to remove the time portion of the given date.
        Parameters:
        date - the date
        Returns:
        the date without the time portion
      • replaceTxtFlexValueForCRLFInUpdate

        public static void replaceTxtFlexValueForCRLFInUpdate​(com.vasoftware.sf.server.services.tracker.ArtifactDO originalDO,
                                                              com.vasoftware.sf.server.services.tracker.ArtifactDO updArtifactDO)
        Check for changes wrt CRLF in multi-line text flex field(s). (Axis / Xerces removes \r hence though the user does not change anything sees the flex field as changed during update of any other field. Hence reset to original if changes are only due to CRLF) Strip \r from original and updated flex value and make a comparison. If original equals updated then replace updated with original. If not equals then replace all occurrences of \n with \r\n. If user has not modified anything in the text flex then the equals is satisfied, but as axis removes \r replace updated with original. If the user has modified the flex value then the same needs to be preserved hence replace all \n with \r\n to maintain consistency with UI.
        Parameters:
        originalDO - the original artifact DO
        updArtifactDO - the updated artifact DO
      • replaceTxtFlexValueForCRLFInCreate

        public static void replaceTxtFlexValueForCRLFInCreate​(SoapFieldValues flexFields)
        Check for changes wrt CRLF in multi-line text flex field(s). If the originalDO has \n then replace all occurences of \n with \r\n. Any multi-line UI update sends \r\n, where as in Axis its stored as \n to maintain consistency in db storing the value with \r\n.
        Parameters:
        flexFields - the flex fields for artifact
      • replaceDescriptionForCRLFInUpdate

        public static void replaceDescriptionForCRLFInUpdate​(com.vasoftware.sf.server.services.tracker.ArtifactDO originalDO,
                                                             com.vasoftware.sf.server.services.tracker.ArtifactDO updArtifactDO)
        Check for changes wrt CRLF in multi-line description field. To maintain consistency between CLI / Soap update for description and UI update this is used. This is similar to the update made in flex-fields in replaceTxtFlexValueForCRLFInUpdate(). Please refer the above method for the details.
        Parameters:
        originalDO - the original artifact DO
        updArtifactDO - the updated artifact DO
      • replaceDescriptionForCRLFInCreate

        public static String replaceDescriptionForCRLFInCreate​(String description)
        Check for changes wrt CRLF in multi-line description field. If the originalDO has \n then replace all occurrences of \n with \r\n. Any multi-line UI update sends \r\n, where as in Axis its stored as \n to maintain consistency in db storing the value with \r\n.
        Parameters:
        description - the description text for artifact
        Returns:
        The description content where \n is replaced with \r\n