Class MMailText

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_Persistent, I_R_MailText, Evaluatee

public class MMailText extends X_R_MailText
Mail Template Model. Cannot be cached as it holds PO/BPartner/User to parse.
Version:
$Id: MMailText.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Field Details

    • m_user

      protected MUser m_user
      Parse User
    • m_bpartner

      protected MBPartner m_bpartner
      Parse BPartner
    • m_po

      protected PO m_po
      Parse PO
    • m_MailHeader

      protected String m_MailHeader
      Translated Header
    • m_MailText

      protected String m_MailText
      Translated Text
    • m_MailText2

      protected String m_MailText2
      Translated Text 2
    • m_MailText3

      protected String m_MailText3
      Translated Text 3
    • s_cacheTrl

      protected static CCache<String,org.compiere.model.MMailText.MMailTextTrl> s_cacheTrl
      Translation Cache
    • m_language

      protected String m_language
  • Constructor Details

    • MMailText

      public MMailText(Properties ctx, String R_MailText_UU, String trxName)
      UUID based Constructor
      Parameters:
      ctx - Context
      R_MailText_UU - UUID key
      trxName - Transaction
    • MMailText

      public MMailText(Properties ctx, int R_MailText_ID, String trxName)
      Standard Constructor
      Parameters:
      ctx - context
      R_MailText_ID - id
      trxName - transaction
    • MMailText

      public MMailText(Properties ctx, ResultSet rs, String trxName)
      Load Constructor
      Parameters:
      ctx - context
      rs - result set
      trxName - transaction
  • Method Details

    • getMailText

      public String getMailText(boolean all)
      Get translated and parsed Mail Text
      Parameters:
      all - true to concatenate mailtext, mailtext2 and mailtext3
      Returns:
      translated and parsed text
    • getMailText

      public String getMailText(boolean all, boolean parsed)
      Get translated and parsed (if parsed argument is true) Mail Text
      Parameters:
      all - true to concatenate mailtext, mailtext2 and mailtext3
      parsed - true to parsed variables in text
      Returns:
      translated and parsed (if parsed argument is true) text
    • getMailText

      public String getMailText(boolean all, boolean parsed, boolean keepEscapeSequence)
      Get translated and parsed (if parsed argument is true) Mail Text
      Parameters:
      all - true to concatenate mailtext, mailtext2 and mailtext3
      parsed - true to parsed variables in text
      keepEscapeSequence - if true, keeps the escape sequence '@@' in the parsed string. Otherwise, the '@@' escape sequence is used to keep '@' character in the string.
      Returns:
      translated and parsed (if parsed argument is true) text
    • getMailText

      public String getMailText()
      Get translated and parsed Mail Text
      Specified by:
      getMailText in interface I_R_MailText
      Overrides:
      getMailText in class X_R_MailText
      Returns:
      translated and parsed text
    • getMailText2

      public String getMailText2()
      Get translated and parsed Mail Text 2
      Specified by:
      getMailText2 in interface I_R_MailText
      Overrides:
      getMailText2 in class X_R_MailText
      Returns:
      translated and parsed text
    • getMailText3

      public String getMailText3()
      Get translated and parsed Mail Text 3
      Specified by:
      getMailText3 in interface I_R_MailText
      Overrides:
      getMailText3 in class X_R_MailText
      Returns:
      translated and parsed text
    • getMailHeader

      public String getMailHeader()
      Get translated and parsed Mail Header
      Specified by:
      getMailHeader in interface I_R_MailText
      Overrides:
      getMailHeader in class X_R_MailText
      Returns:
      translated and parsed text
    • getMailHeader

      public String getMailHeader(boolean parsed)
      Get translated and parsed (if parsed argument is true) Header
      Parameters:
      parsed - true to parse variable in text
      Returns:
      translated and parsed (if parsed argument is true) text
    • parse

      protected String parse(String text)
      Parse variables in text (@variable expression@)
      Parameters:
      text - text
      Returns:
      parsed text
    • parse

      protected String parse(String text, boolean keepEscapeSequence)
      Parse variables in text (@variable expression@)
      Parameters:
      text - text
      keepEscapeSequence - if true, keeps the escape sequence '@@' in the parsed string. Otherwise, the '@@' escape sequence is used to keep '@' character in the string.
      Returns:
      parsed text
    • parse

      protected String parse(String text, PO po, boolean keepEscapeSequence)
      Parse variables in text (@variable expression@)
      Parameters:
      text - text
      po - PO instance
      keepEscapeSequence - if true, keeps the escape sequence '@@' in the parsed string. Otherwise, the '@@' escape sequence is used to keep '@' character in the string.
      Returns:
      parsed text
    • parseVariable

      protected String parseVariable(String variable, PO po, boolean keepEscapeSequence)
      Get value for a variable expression
      Parameters:
      variable - variable expression
      po - po
      keepEscapeSequence - if true, keeps the escape sequence '@@' in the parsed string. Otherwise, the '@@' escape sequence is used to keep '@' character in the string.
      Returns:
      value for variable or if not found the original variable expression
    • setUser

      public void setUser(int AD_User_ID)
      Set User for parsing of text
      Parameters:
      AD_User_ID - user
    • setUser

      public void setUser(MUser user)
      Set User for parsing of text
      Parameters:
      user - MUser instance
    • setBPartner

      public void setBPartner(int C_BPartner_ID)
      Set BPartner for parsing of text
      Parameters:
      C_BPartner_ID - bp
    • setBPartner

      public void setBPartner(MBPartner bpartner)
      Set BPartner for parsing of text
      Parameters:
      bpartner - MBPartner instance
    • setPO

      public void setPO(PO po)
      Set PO for parsing of text
      Parameters:
      po - PO instance
    • setPO

      public void setPO(PO po, boolean analyse)
      Set PO for parsing of text
      Parameters:
      po - PO instance
      analyse - true to search for BPartner/User from po
    • translate

      protected void translate()
      Translate to BPartner Language or language from setLanguage(String) call.
    • getTranslation

      protected org.compiere.model.MMailText.MMailTextTrl getTranslation(String AD_Language)
      Get Translation
      Parameters:
      AD_Language - language
      Returns:
      MMailTextTrl
    • setLanguage

      public void setLanguage(String language)
      Set language for translation of text
      Parameters:
      language -
    • getPO

      public PO getPO()
      Returns:
      PO instance
    • getBPartner

      public MBPartner getBPartner()
      Returns:
      MBPartner instance
    • getLanguage

      public String getLanguage()
      Returns:
      language for translation of text
    • getUser

      public MUser getUser()
      Returns:
      MUser instance