psdi.common.emailstner

Class EmailListnerTask

  • java.lang.Object
    • psdi.common.emailstner.EmailListnerTask


  • public class EmailListnerTask
    extends java.lang.Object
    Class for processing email starting from reading mailserver to creating inboundcomm
    • Constructor Detail

      • EmailListnerTask

        public EmailListnerTask()
    • Method Detail

      • performTask

        public void performTask(java.lang.String taskName,
                                java.lang.String instanceName)
      • getLogger

        public static MXLogger getLogger()
        Returns the logger to be used to log messages.
        Returns:
        the logger to be used to log messages.
      • setLogger

        public void setLogger(MXLogger logger)
        Set the logger to be used to log messages.
        Parameters:
        logger - the logger to be used to log messages.
      • getRunAsUserInfo

        public UserInfo getRunAsUserInfo()
        Returns the user information to be used to retrieve the business objects.
        Returns:
        the user information to be used to retrieve the business objects.
      • setRunAsUserInfo

        public void setRunAsUserInfo(UserInfo userInfo)
        Sets the the user information to be used to retrieve the business objects. This must be associated with an administrative user.
        Parameters:
        userInfo - the user information to be used to retrieve the business objects.
      • readMessagesFromMailServer

        public void readMessagesFromMailServer(InboundCommCfgData cfgData,
                                               MboRemote inboundCommCfgMbo)
        Read mails from the mail Server and process it
        Parameters:
        cfgData -
        inboundCommCfgMbo -
      • processNEWStatusFromInboundComm

        public void processNEWStatusFromInboundComm(MboRemote inboundCommCfgMbo)
        Process NEW Status mail from staging table
        Parameters:
        inboundcommcfg - mbo
      • processNewStatusMail

        public MboRemote processNewStatusMail(MboRemote inboundComm)
                                       throws java.lang.Exception
        Process inboundcomm record of status NEW.
        Parameters:
        inboundComm -
        inboundCommCfgMbo -
        Returns:
        staging mbo
        Throws:
        java.lang.Exception
      • getAppFromInbCommSecurity

        public java.lang.String getAppFromInbCommSecurity(MboRemote inboundComm,
                                                          java.lang.String objectName)
                                                   throws java.lang.Exception
        Get the app name for the objectname for the inboundcomm record.
        Parameters:
        inboundComm -
        objectName -
        Returns:
        app Name
        Throws:
        java.lang.Exception
      • appExistForSecurityCheck

        public void appExistForSecurityCheck(MboRemote inboundComm,
                                             int formatMode)
                                      throws java.lang.Exception
        Check if app name exist to perform security check
        Parameters:
        inboundComm -
        formatMode -
        Throws:
        java.lang.Exception
      • getAppFromMaxApps

        public java.lang.String getAppFromMaxApps(java.lang.String objectName)
                                           throws java.lang.Exception
        Return the app name from maxapps table
        Parameters:
        objectName -
        Returns:
        app name
        Throws:
        java.lang.Exception
      • parseFormattedMessage

        public void parseFormattedMessage(MboRemote inboundComm,
                                          LSNRParser parser,
                                          int mode)
                                   throws java.lang.Exception
        Parse the formatted message body to get object,action,where clause and result columns
        Parameters:
        inboundComm -
        parser -
        mode -
        Throws:
        java.lang.Exception
      • processMailForFreeformMode

        public MboRemote processMailForFreeformMode(MboRemote inboundComm)
                                             throws java.lang.Exception
        Process email for freeform mode. Check preprocessor class for new or old mail.
        Parameters:
        inboundComm -
        Returns:
        mbo
        Throws:
        java.lang.Exception
      • getObjectActionForFormattedMode

        public MboRemote getObjectActionForFormattedMode(MboRemote inboundComm,
                                                         LSNRParser parser,
                                                         int mode)
                                                  throws java.lang.Exception
        Process email to get Object and action for XML or Attribute-value mode.
        Parameters:
        inboundComm -
        parser -
        mode -
        adminEmail -
        Returns:
        staging record
        Throws:
        java.lang.Exception
      • getMultipartPart

        public MailData getMultipartPart(javax.mail.internet.MimeMultipart mp,
                                         MailData md,
                                         java.util.Vector vector)
                                  throws java.lang.Exception
        Read each part of multipart message and retrieve all parts
        Parameters:
        mp -
        md -
        cfgData -
        Returns:
        MailData object
        Throws:
        java.lang.Exception
      • getTextPart

        public java.lang.String getTextPart(javax.mail.internet.MimeBodyPart mbp,
                                            java.lang.String text)
                                     throws java.lang.Exception
        Read each part of multipart message and retrieve only the text part
        Parameters:
        m -
        md -
        cfgData -
        Returns:
        String containing text part
        Throws:
        java.lang.Exception
      • writeIntoInboundComm

        public MboRemote writeIntoInboundComm(MailData md,
                                              InboundCommCfgData cfgData,
                                              MboRemote inboundCommCfgMbo)
                                       throws java.lang.Exception
        Deprecated. 
        Parameters:
        md -
        cfgData -
        inboundCommCfgMbo -
        Returns:
        Throws:
        java.lang.Exception
      • writeIntoInboundComm

        public MboRemote writeIntoInboundComm(MailData md,
                                              InboundCommCfgData cfgData,
                                              MboRemote inboundCommCfgMbo,
                                              javax.mail.Message m)
                                       throws java.lang.Exception
        Writes data to the INBOUNDCOMM table
        Parameters:
        md -
        cfgData -
        inboundCommCfgMbo -
        Returns:
        staging record
        Throws:
        java.lang.Exception
      • writeToDocInfoAndDocLinks

        public void writeToDocInfoAndDocLinks(MailData md,
                                              java.lang.String inbCommUser,
                                              MboRemote inboundComm,
                                              java.lang.String attFileName,
                                              java.lang.String doclinkName,
                                              boolean msgFirstLevel,
                                              int msgLevel)
                                       throws java.lang.Exception
        Write attatchments to docinfo and doclinks
        Parameters:
        md -
        inbCommUser -
        inboundComm -
        attFileName -
        doclinkName -
        msgFirstLevel -
        msgLevel -
        Throws:
        java.lang.Exception
      • getContentTypeFrom

        public static java.lang.String getContentTypeFrom(java.lang.String fileName)
                                                   throws java.rmi.RemoteException,
                                                          MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • isNewMail

        public boolean isNewMail(java.lang.String mailId,
                                 java.lang.String emailAddress,
                                 UserInfo ui)
                          throws java.lang.Exception
        Check if a mail is a new mail or not.Pop3 doesn't return new mail count in getNewMessageCount()
        Parameters:
        mailId -
        emalAddress -
        userinfo -
        Returns:
        true if mail is New, else false
        Throws:
        java.lang.Exception
      • isNewMail

        public boolean isNewMail(java.lang.String mailId,
                                 java.lang.String emailAddress)
                          throws java.lang.Exception
        Deprecated. in 7.5 Check if a mail is a new mail or not.Pop3 doesn't return new mail count in getNewMessageCount()
        Parameters:
        mailId -
        emalAddress -
        Returns:
        true if mail is New, else false
        Throws:
        java.lang.Exception
      • deleteMailAfterAgeThreshold

        public void deleteMailAfterAgeThreshold(javax.mail.Message m,
                                                int age,
                                                java.lang.String ageUOM,
                                                java.lang.String emailAddress)
                                         throws java.lang.Exception
        Delete the mail after the age threshold
        Parameters:
        m -
        age -
        ageUOM -
        Throws:
        java.lang.Exception
      • getAccessToken

        public java.util.HashMap getAccessToken(java.lang.String tokenUrl,
                                                java.lang.String clientId,
                                                java.lang.String clientSecret,
                                                java.lang.String refreshToken,
                                                java.lang.String grantType)