com.ibm.tivoli.maximo.mfmail

Class MfMailUtility

  • java.lang.Object
    • com.ibm.tivoli.maximo.mfmail.MfMailUtility


  • public class MfMailUtility
    extends java.lang.Object
    • Method Detail

      • checkActionArgForInbound

        protected static void checkActionArgForInbound(MboRemote arg,
                                                       MXLogger logger)
                                                throws java.rmi.RemoteException,
                                                       MXException
        Check fatal configuration errors If error is detected in this method, either the system itself or configuration is critically wrong. We simply write log and throw exception without changing status of Inboundcomm entry.
        Parameters:
        arg -
        logger -
        Throws:
        java.rmi.RemoteException
        MXException
      • createStatusList

        protected java.lang.String createStatusList(MboRemote mbo,
                                                    java.lang.String status,
                                                    UserInfo ui,
                                                    java.lang.String prefix,
                                                    int deviceClass)
                                             throws java.rmi.RemoteException,
                                                    MXException
        Parameters:
        mbo -
        status - : Status to be used as base. List will include status that can be changed from this status
        ui -
        prefix - : Prefix string to be used in the status list. Can be null or nullstring
        deviceClass - : Device class for which list to be created
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • getStatusLinkList

        protected java.lang.String getStatusLinkList(MboRemote targetMbo,
                                                     java.lang.String status,
                                                     java.lang.String subj,
                                                     java.lang.String sender,
                                                     java.lang.String secStr,
                                                     MfMailSTCtrlInfo ci,
                                                     UserInfo ui,
                                                     MfMailGlobalInfo gi)
                                              throws java.rmi.RemoteException,
                                                     MXException
        Create list of status as mailto: URLs in anchor tag. No CC can be used with this method
        Parameters:
        targetMbo -
        status - : Status to be used as base. List will include status that can be changed from this status
        subj - : Original subject of incoming mail
        sender - : Sender of the mail. Used as TO in the mailto
        secStr -
        ci -
        ui -
        gi -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • createValueList

        protected java.lang.String createValueList(MboRemote targetMbo,
                                                   java.lang.String attribute,
                                                   UserInfo ui,
                                                   MfMailGlobalInfo gi)
                                            throws java.rmi.RemoteException,
                                                   MXException
        This method creates list of values, if the list from MboValue returns the MboSet with the attribute and description.
        Parameters:
        targetMbo - : MBO from which attribute is retrieved
        attribute - : The name of attribute
        ui -
        gi -
        Returns:
        lookup list string or null
        Throws:
        java.rmi.RemoteException
        MXException
      • getStatusDescription

        protected java.lang.String getStatusDescription(MboRemote targetMbo,
                                                        java.lang.String status,
                                                        UserInfo ui)
                                                 throws java.rmi.RemoteException,
                                                        MXException
        Get description of status for a particular status on target Mbo in the language of user.
        Parameters:
        targetMbo -
        status -
        ui -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • getSupplementInfo

        protected java.lang.String getSupplementInfo(MboRemote targetMbo,
                                                     java.lang.String attr,
                                                     java.util.HashSet keySet,
                                                     MfMailGlobalInfo gi,
                                                     UserInfo ui)
                                              throws MXException,
                                                     java.rmi.RemoteException
        Provide supplemental information, such as read only, list of values, etc. for the specified attribute
        Parameters:
        targetMbo -
        attr - : Attribute to generate supplemental information
        keySet -
        gi -
        ui -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • getSystemLineMarker

        protected java.lang.String getSystemLineMarker(MfMailGlobalInfo gi,
                                                       UserInfo ui)
                                                throws java.rmi.RemoteException,
                                                       MXException
        Retrieve marker for system line
        Parameters:
        gi -
        ui -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • getSecurityString

        protected java.lang.String getSecurityString(MboRemote targetMbo,
                                                     MboRemote trackEntry,
                                                     java.lang.String to)
                                              throws java.rmi.RemoteException,
                                                     MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • getSecurityString

        protected java.lang.String getSecurityString(MboRemote targetMbo,
                                                     MboRemote trackEntry,
                                                     java.lang.String[] to)
                                              throws java.rmi.RemoteException,
                                                     MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • sendSTReplyMailVerySmall

        public void sendSTReplyMailVerySmall(MboRemote inboundComm,
                                             MboRemote commTemplate,
                                             MboRemote targetMbo,
                                             MboRemote trackEntry,
                                             UserInfo ui,
                                             java.lang.String valueList,
                                             int deviceClass)
                                      throws java.rmi.RemoteException,
                                             MXException
        Send reply mail for status scenario with very small device
        Parameters:
        inboundComm -
        commTemplate -
        targetMbo -
        trackEntry -
        ui -
        valueList -
        objKeys -
        deviceClass -
        Throws:
        java.rmi.RemoteException
        MXException
      • sendWFNotifyMail

        public void sendWFNotifyMail(MboRemote track,
                                     MboRemote tempTargetMbo,
                                     MfMailWFCtrlInfo wc)
                              throws java.rmi.RemoteException,
                                     MXException
        This method send notification mail when work flow assignment has completed by different user by mail.
        Parameters:
        track -
        tempTargetMbo -
        wc -
        Throws:
        java.rmi.RemoteException
        MXException
      • sendErrorMail

        public void sendErrorMail(MboRemote inboundComm,
                                  java.lang.String template)
                           throws java.rmi.RemoteException,
                                  MXException
        Method to Send Error notification mail This method is used from MfMailSendErrorReply class
        Parameters:
        inboundComm -
        template -
        Throws:
        java.rmi.RemoteException
        MXException
      • createKeyValString

        protected java.lang.String createKeyValString(MboRemote targetMbo)
                                               throws java.rmi.RemoteException,
                                                      MXException
        Create string with all key attributes and value of each attribute for better message
        Parameters:
        targetMbo -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • createMailIdentificationString

        protected static java.lang.String createMailIdentificationString(MboRemote inboundComm)
        Create string to point the inbound mail for logging
        Parameters:
        inboundComm -
        Returns:
      • logMailInfo

        public void logMailInfo(MboRemote inboundComm)
                         throws java.rmi.RemoteException,
                                MXException
        Log information about the inboundcomm to identify the mail caused the error.
        Parameters:
        inboundComm -
        Throws:
        java.rmi.RemoteException
        MXException
      • sendErrorMailToAdmin

        public void sendErrorMailToAdmin(java.lang.String errMsg,
                                         java.lang.String template)
                                  throws java.rmi.RemoteException,
                                         MXException
        Send Mail to administrator to notify admin action is needed. In case the object passed to send action is not valid, we have no owner. This method is written to send mail directly using MXServer so that mail can be sent where we do not have any owner object.
        Parameters:
        errMsg - : message text
        template - : communication template
        Throws:
        java.rmi.RemoteException
        MXException
      • insertTaskList

        protected java.lang.String insertTaskList(java.lang.String message,
                                                  MboRemote targetMbo,
                                                  UserInfo ui)
                                           throws java.rmi.RemoteException,
                                                  MXException
        Insert list of tasks for WORKORDER, if special variable is used in the body
        Parameters:
        message -
        targetMbo - , this must be instance of WORKORDER
        Returns:
        the modified message, in which the variable is replaced with task list
        Throws:
        java.rmi.RemoteException
        MXException
      • insertGuidanceST

        protected java.lang.String insertGuidanceST(java.lang.String message,
                                                    int deviceClass,
                                                    UserInfo ui,
                                                    MfMailGlobalInfo gi)
                                             throws java.rmi.RemoteException,
                                                    MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • insertGuidanceWF

        protected java.lang.String insertGuidanceWF(java.lang.String message,
                                                    int deviceClass,
                                                    UserInfo ui,
                                                    MfMailGlobalInfo gi)
                                             throws java.rmi.RemoteException,
                                                    MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • exFormatFromDevice

        protected int exFormatFromDevice(int deviceClass,
                                         boolean bHtml)
      • deviceClassFromExFormat

        protected int deviceClassFromExFormat(int exFormat)
      • htmlFromExFormat

        protected boolean htmlFromExFormat(int exFormat)
      • createInboundCommLog

        public void createInboundCommLog(MboRemote inboundComm,
                                         MboRemote targetMbo,
                                         java.util.Date cDate)
                                  throws MXException,
                                         java.rmi.RemoteException
        creats a commlog entry for inbound mail
        Parameters:
        inboundComm -
        targetMbo -
        templateName -
        Throws:
        MXException
        java.rmi.RemoteException
      • getUserInfoForPerson

        protected UserInfo getUserInfoForPerson(java.lang.String personId)
                                         throws java.rmi.RemoteException,
                                                MXException
        Return UserInfo for specified PERSONID, if there is a MAXUSER for that person
        Parameters:
        personId -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
        java.lang.Exception
      • getUserFromMail

        protected UserInfo getUserFromMail(java.lang.String mailAddr)
                                    throws java.rmi.RemoteException,
                                           MXException
        Get UserInfo of maximo user from mail address
        Parameters:
        mailAddr -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • recordErrorInTrackEntry

        protected void recordErrorInTrackEntry(MboRemote trackEntry)
                                        throws java.rmi.RemoteException,
                                               MXException
        Record error status in Maximo for Email Tracking Table
        Parameters:
        trackEntry -
        Throws:
        java.rmi.RemoteException
        MXException
      • isActiveAssignment

        protected boolean isActiveAssignment(WFAssignment assign)
                                      throws java.rmi.RemoteException,
                                             MXException
        Check if WFAssignment is active or not
        Parameters:
        assign -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • isKeyAttribute

        public boolean isKeyAttribute(java.lang.String[] keys,
                                      java.lang.String attribute)
      • getNVPairListST

        protected java.lang.String getNVPairListST(MboRemote targetMbo,
                                                   UserInfo ui,
                                                   MfMailSTCtrlInfo ci,
                                                   MfMailGlobalInfo gi,
                                                   java.lang.String secStr,
                                                   boolean bMedium)
                                            throws java.rmi.RemoteException,
                                                   MXException
        This method creates the value list for STATUS change scenario
        Parameters:
        targetMbo - : MBO from which attribute values are retrieved
        ui - : User Info to get description and values in this user's language
        ci -
        gi -
        Returns:
        Value List to be used to replace variable in the mail body
        Throws:
        java.rmi.RemoteException
        MXException
      • copyFromTemplate

        protected void copyFromTemplate(MboRemote commLog,
                                        MboRemote commTemplate,
                                        MboRemote preResolve1,
                                        MboRemote preResolve2,
                                        MboRemote postResolve1,
                                        MboRemote postResolve2)
                                 throws MXException,
                                        java.rmi.RemoteException
        Copy commTemplate to CommLog with resolving variable against multiple Mbo
        Parameters:
        commLog -
        commTemplate -
        preResolve1 -
        preResolve2 -
        postResolve1 -
        postResolve2 -
        Throws:
        MXException
        java.rmi.RemoteException
      • getAppName

        protected boolean getAppName(InboundCommRemote inboundComm,
                                     java.lang.String mboName)
                              throws java.rmi.RemoteException,
                                     MXException
        Find application name for authorization check so that we can conduct authorization checking
        Parameters:
        inboundComm -
        mboName -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • getBodyForParser

        protected java.lang.String getBodyForParser(MfMailGlobalInfo gi,
                                                    java.lang.String originalMsgBody)
                                             throws java.rmi.RemoteException,
                                                    MXException
        Extract name value pair from message body so that the returned string can be parsed as standard E-mail listener mail
        Parameters:
        gi -
        originalMsgBody -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException
      • getFirstLine

        protected java.lang.String getFirstLine(java.lang.String messageBody)
      • getFirstNum

        protected java.lang.String getFirstNum(java.lang.String firstLine)
      • getSecondNum

        protected java.lang.String getSecondNum(java.lang.String firstLine)
      • getSecondToken

        protected java.lang.String getSecondToken(java.lang.String firstLine)
      • getThirdToken

        protected java.lang.String getThirdToken(java.lang.String firstLine)
      • mergeAddr

        protected java.lang.String mergeAddr(java.lang.String list1,
                                             java.lang.String list2,
                                             java.lang.String list3)
        Merge three address lists into one
        Parameters:
        list1 -
        list2 -
        list3 -
        Returns:
        merged list
      • mergeAddr

        protected java.lang.String mergeAddr(java.lang.String list1,
                                             java.lang.String list2)
        Merge two address lists into one. The list may be just e-mail address, or e-mail address with name.
        Parameters:
        list1 -
        list2 -
        Returns:
      • mergeAddr

        protected java.lang.String mergeAddr(java.lang.String[] list1,
                                             java.lang.String list2)
      • belongsTo

        protected boolean belongsTo(java.lang.String fromStr,
                                    java.lang.String listStr)
                             throws MXApplicationException
        Checks whether the e-mail address of fromStr belongs to e-mail address list of listStr
        Parameters:
        fromStr -
        listStr -
        Returns:
        Throws:
        MXApplicationException
      • encodeAddresses

        protected java.lang.String encodeAddresses(java.lang.String source)
                                            throws MXException
        Encode name part of recipient list, when mxe.emai.charset is specified
        Parameters:
        source -
        Returns:
        Throws:
        MXException
      • getHashSet

        public java.util.HashSet getHashSet(java.lang.String commaSeparatedList)
      • convert2Hash

        protected java.util.HashSet convert2Hash(java.lang.String[] array)
      • multiAdd

        protected void multiAdd(java.lang.StringBuffer result,
                                java.lang.String src,
                                java.lang.String assist,
                                java.lang.String lineSeparator,
                                MfMailGlobalInfo gi)
      • trimLine

        protected java.lang.String trimLine(java.lang.String src,
                                            MfMailGlobalInfo gi)
      • getSplitPos

        protected static int getSplitPos(java.lang.String src,
                                         int lenBytes)
        Returns character position to split for the given string and byte length
        Parameters:
        src - : source string
        lenBytes - : limit length in bytes
        Returns:
        : split position in char
      • getSenderFromTemplate

        public java.lang.String getSenderFromTemplate(MboRemote commTemplate)
                                               throws java.rmi.RemoteException,
                                                      MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • encodeForMailTo

        protected java.lang.String encodeForMailTo(java.lang.String src)
                                            throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
      • getLogger

        public MXLogger getLogger()
      • setLogger

        public void setLogger(MXLogger logger)
      • isMailHTML

        public boolean isMailHTML()
                           throws java.rmi.RemoteException
        Returns:
        true, if all mail is to be sent as html
        Throws:
        java.rmi.RemoteException