Package ru.bgcrm.dao.message

# Class MessageType

java.lang.Object
org.bgerp.model.base.Id
org.bgerp.model.base.IdTitle
ru.bgcrm.dao.message.MessageType

All Implemented Interfaces:
  `Serializable`, `Id<Integer>`, `IdTitle<Integer>`, `Title`

Direct Known Subclasses:
  `MessageTypeCall`, `MessageTypeEmail`, `MessageTypeHelpDesk`, `MessageTypeNote`

public abstract class MessageType extends IdTitle

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final ConfigMap`
  `configMap`
  `protected final Setup`
  `setup`
  `protected Integer`
  `unprocessedMessagesCount`

  ### Fields inherited from class org.bgerp.model.base.IdTitle

  `title`

  ### Fields inherited from class org.bgerp.model.base.Id

  `id`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `MessageType(Setup setup, int id, String title, ConfigMap config)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String`
  `answerText(String text)`
  `Message`
  `getAnswerMessage(Message original)`
  `ConfigMap`
  `getConfigMap()`
  `MessageTypeContactSaver`
  `getContactSaver()`
  `String`
  `getEditorJsp()`
  Plugin's endpoint for process message editor.
  `String`
  `getHeaderJsp()`
  `String`
  `getMessageDescription(String lang, Message message)`
  Generates short message description.
  `String`
  `getProcessMessageHeaderColor(Message message)`
  `Map<Integer,MessageTypeSearch>`
  `getSearchMap()`
  `Integer`
  `getUnprocessedMessagesCount()`
  Count of unprocessed messages.
  `String`
  `getViewerJsp()`
  `boolean`
  `isAnswerSupport()`
  `boolean`
  `isCheckEmptySubject()`
  `boolean`
  `isEditable(Message message)`
  Can a message be edited
  `boolean`
  `isProcessChangeSupport()`
  `boolean`
  `isReadable()`
  `boolean`
  `isReading()`
  Message type is currently running `newMessageList(ConnectionSet)`.
  `boolean`
  `isRemovable(Message message)`
  `void`
  `messageDelete(ConnectionSet conSet, String... messageIds)`
  Deletes both processed and unprocessed messages.
  `Message`
  `messageLinkedToProcess(Message message)`
  `Message`
  `newMessageGet(ConnectionSet conSet, String messageId)`
  Gets unprocessed message from storage.
  `List<Message>`
  `newMessageList(ConnectionSet conSet)`
  List of unprocessed messages from storage, for example - E-Mails from IMAP folder.
  `Message`
  `newMessageLoad(Connection con, String messageId)`
  Gets unprocessed message from storage and persists it in DB.
  `void`
  `process()`
  Sends and reads message list.
  `protected Map<Integer,FileInfo>`
  `processMessageAttaches(Connection con, DynActionForm form, Message message)`
  `List<CommonObjectLink>`
  `searchObjectsForLink(Message message)`
  `abstract void`
  `updateMessage(Connection con, DynActionForm form, Message message)`

  ### Methods inherited from class org.bgerp.model.base.IdTitle

  `getTitle, setTitle, toString, unknown`

  ### Methods inherited from class org.bgerp.model.base.Id

  `equals, getId, hashCode, setId`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.bgerp.model.base.iface.Id

  `getId`

- ## Field Details

  - ### setup

    protected final Setup setup

  - ### configMap

    protected final ConfigMap configMap

  - ### unprocessedMessagesCount

    protected volatile Integer unprocessedMessagesCount

- ## Constructor Details

  - ### MessageType

    protected MessageType(Setup setup, int id, String title, ConfigMap config)

- ## Method Details

  - ### getConfigMap

    public ConfigMap getConfigMap()

  - ### getSearchMap

    public Map<Integer,MessageTypeSearch> getSearchMap()

  - ### getContactSaver

    public MessageTypeContactSaver getContactSaver()

  - ### isCheckEmptySubject

    public boolean isCheckEmptySubject()

  - ### isReading

    public boolean isReading()
    Message type is currently running `newMessageList(ConnectionSet)`.
    Returns:

  - ### getUnprocessedMessagesCount

    public Integer getUnprocessedMessagesCount()
    Count of unprocessed messages.
    Returns:
      value or null if unknown.

  - ### isAnswerSupport

    public boolean isAnswerSupport()

  - ### getAnswerMessage

    public Message getAnswerMessage(Message original)

  - ### answerText

    protected String answerText(String text)

  - ### isEditable

    public boolean isEditable(Message message)
    Can a message be edited
    Parameters:
      `message` - the message, `null` for adding a message of the type
    Returns:

  - ### isRemovable

    public boolean isRemovable(Message message)

  - ### isReadable

    public boolean isReadable()
    Returns:
      possibility to mark message as read/unread using kernel logic

  - ### isProcessChangeSupport

    public boolean isProcessChangeSupport()

  - ### getViewerJsp

    public String getViewerJsp()
    Returns:
      Plugin's endpoint for unprocessed message viewing.

  - ### getProcessMessageHeaderColor

    public String getProcessMessageHeaderColor(Message message)

  - ### getHeaderJsp

    public String getHeaderJsp()
    Returns:
      Plugin's endpoint for process message header.

  - ### getMessageDescription

    public String getMessageDescription(String lang, Message message)
    Generates short message description.
    Parameters:
      `lang` - language.
      `message` - message with the type.
    Returns:

  - ### getEditorJsp

    public String getEditorJsp()
    Plugin's endpoint for process message editor.
    Returns:

  - ### process

    public void process()
    Sends and reads message list.

  - ### newMessageList

    public List<Message> newMessageList(ConnectionSet conSet) throws Exception
    List of unprocessed messages from storage, for example - E-Mails from IMAP folder.
    Parameters:
      `conSet` -
    Returns:
    Throws:
      `Exception`

  - ### newMessageGet

    public Message newMessageGet(ConnectionSet conSet, String messageId) throws Exception
    Gets unprocessed message from storage.
    Parameters:
      `conSet` -
      `messageId` - unique ID.
    Returns:
    Throws:
      `Exception`

  - ### messageDelete

    public void messageDelete(ConnectionSet conSet, String... messageIds) throws Exception
    Deletes both processed and unprocessed messages.
    Parameters:
      `conSet` -
      `messageIds` - set with int DB IDs or type related string IDs.
    Throws:
      `Exception`

  - ### newMessageLoad

    public Message newMessageLoad(Connection con, String messageId) throws Exception
    Gets unprocessed message from storage and persists it in DB.
    Parameters:
      `con` -
      `messageId` -
    Returns:
    Throws:
      `Exception`

  - ### updateMessage

    public abstract void updateMessage(Connection con, DynActionForm form, Message message) throws Exception
    Throws:
      `Exception`

  - ### searchObjectsForLink

    public List<CommonObjectLink> searchObjectsForLink(Message message)

  - ### messageLinkedToProcess

    public Message messageLinkedToProcess(Message message) throws Exception
    Throws:
      `Exception`

  - ### processMessageAttaches

    protected Map<Integer,FileInfo> processMessageAttaches(Connection con, DynActionForm form, Message message) throws Exception
    Throws:
      `Exception`