Class SystemMessagesMailHelper


  • @Scriptable
    public final class SystemMessagesMailHelper
    extends Object
    • Constructor Detail

      • SystemMessagesMailHelper

        public SystemMessagesMailHelper​(IBusinessLogicProcessingContext p_ctx,
                                        ApplicationInfo p_appInfo)
                                 throws de.uplanet.lucy.server.businesslogic.BlException
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
    • Method Detail

      • loadMessagesForCurrentUser

        public void loadMessagesForCurrentUser​(String p_strFrequenz)
                                        throws Exception
        Loads the new message for the given interval and the current user.
        Parameters:
        p_strFrequenz -
        Throws:
        Exception
      • getMessageAndLoadImmediatelyRecipients

        public SystemMessage getMessageAndLoadImmediatelyRecipients​(String p_strRecId,
                                                                    IValueHolder<?> p_vhProfileId,
                                                                    IValueHolder<?> p_vhKey,
                                                                    IValueHolder<?> p_vhMessageText,
                                                                    IValueHolder<?> p_vhObjectId,
                                                                    IValueHolder<?> p_vhFeedRecId,
                                                                    IValueHolder<?> p_vhPluginGuid,
                                                                    IValueHolder<?> p_vhCount)
                                                             throws Exception
        Get the system message and loads the immediately recipients. If there are no recipients for the message it returns null.
        Parameters:
        p_strRecId - The system message RecId.
        p_vhProfileId - The ProfileId.
        p_vhKey - The key.
        p_vhMessageText - The text.
        p_vhObjectId - The object RecId.
        p_vhFeedRecId - The FeedRecId.
        p_vhPluginGuid - The PluginGuid.
        p_vhCount - The count.
        Returns:
        the map with the language as key, and a list of recipient email addresses as value.
        Throws:
        Exception
      • getMessageAndLoadImmediatelyRecipients

        public SystemMessage getMessageAndLoadImmediatelyRecipients​(String p_strRecId,
                                                                    boolean p_bReference)
                                                             throws Exception
        Get the system message and loads the immediately recipients. If there are no recipients for the message it returns null.
        Parameters:
        p_strRecId - The system message RecId.
        p_bReference - True if a new reference was added to a existing system message.
        Returns:
        the map with the language as key, and a list of recipient email addresses as value.
        Throws:
        Exception
      • hasNewMessages

        public boolean hasNewMessages()
        Are there messages to sent as email.
        Returns:
        true if there are messages to sent, otherwise false.
      • getLanguageToRecipientMailMap

        public Map<String,​List<String>> getLanguageToRecipientMailMap()
        Get the recipients for the languages.
        Returns:
        A map with the language as key and the mail addresses as value.
      • getLanguageToTimeZoneIdToRecipientMailMap

        public Map<String,​Map<String,​List<String>>> getLanguageToTimeZoneIdToRecipientMailMap()
        Get the recipients for the languages and time zones.
        Returns:
        A map with the language as key and as value a second map with the time zone as key and the mail addresses as value.
      • getMessageText

        public String getMessageText​(SystemMessage p_message)
                              throws de.uplanet.lucy.server.businesslogic.BlException
        Get the rendered text for the given message.
        Parameters:
        p_message - The system message to render.
        Returns:
        The rendered text.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getMessagesText

        public String getMessagesText​(String p_strType,
                                      String p_strSeparator)
                               throws de.uplanet.lucy.server.businesslogic.BlException
        Get the rendered text of all system messages for the given type.
        Parameters:
        p_strType - The type.
        p_strSeparator - The separator between two messages.
        Returns:
        the text of the system messages.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getObjectIds

        public Set<String> getObjectIds​(String p_strType)
                                 throws de.uplanet.lucy.server.businesslogic.BlException
        Get the object RecIds of all messages for the given type.
        Parameters:
        p_strType - The type.
        Returns:
        the list of object RecIds.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getPluginGuids

        public Set<String> getPluginGuids​(String p_strType)
                                   throws de.uplanet.lucy.server.businesslogic.BlException
        Get the plugin Guids of all messages for the given type.
        Parameters:
        p_strType - The type.
        Returns:
        the list of plugin Guids.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getProfileIds

        public Set<de.uplanet.lucy.server.share.businesslogic.profile.ProfileId> getProfileIds​(String p_strType)
                                                                                        throws de.uplanet.lucy.server.businesslogic.BlException
        Get the ProfileIds of all messages for the given type.
        Parameters:
        p_strType - The type.
        Returns:
        the list of ProfileIds.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getEventImage

        public File getEventImage​(String p_strEventId,
                                  int p_iWidth,
                                  int p_iHeight)
                           throws de.uplanet.lucy.server.businesslogic.BlException
        Get the image for the given event.
        Parameters:
        p_strEventId - The event id.
        p_iWidth - The scaled image width.
        p_iHeight - The scaled image height.
        Returns:
        the image or null, if no image is defined.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getGroupImage

        public File getGroupImage​(String p_strGroupId,
                                  int p_iWidth,
                                  int p_iHeight)
                           throws de.uplanet.lucy.server.businesslogic.BlException
        Get the image for the given group.
        Parameters:
        p_strGroupId - The group id.
        p_iWidth - The scaled image width.
        p_iHeight - The scaled image height.
        Returns:
        the image or null, if no image is defined.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getMessageImage

        public File getMessageImage​(String p_strMessageId,
                                    int p_iWidth,
                                    int p_iHeight)
                             throws de.uplanet.lucy.server.businesslogic.BlException
        Get the image for the given message.
        Parameters:
        p_strMessageId - The message id.
        p_iWidth - The scaled image width.
        p_iHeight - The scaled image height.
        Returns:
        the image or null, if no image is defined.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getPluginImage

        public File getPluginImage​(String p_strPluginGuid)
                            throws de.uplanet.lucy.server.businesslogic.BlException
        Get the image for the given plugin.
        Parameters:
        p_strPluginGuid - The plugin Guid.
        Returns:
        the image or null, if no image is defined.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getProfileImage

        public File getProfileImage​(de.uplanet.lucy.server.share.businesslogic.profile.ProfileId p_profileId,
                                    int p_iWidth,
                                    int p_iHeight)
                             throws de.uplanet.lucy.server.businesslogic.BlException
        Get the image for the given profile.
        Parameters:
        p_profileId - The ProfileId as ProfileId.
        p_iWidth - The scaled image width.
        p_iHeight - The scaled image height.
        Returns:
        the image or null, if no image is defined.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getProfileImage

        public File getProfileImage​(String p_strProfileId,
                                    int p_iWidth,
                                    int p_iHeight)
                             throws de.uplanet.lucy.server.businesslogic.BlException
        Get the image for the given profile.
        Parameters:
        p_strProfileId - The ProfileId as String.
        p_iWidth - The scaled image width.
        p_iHeight - The scaled image height.
        Returns:
        the image or null, if no image is defined.
        Throws:
        de.uplanet.lucy.server.businesslogic.BlException
      • getEventLinkTag

        public String getEventLinkTag​(String p_strEventId,
                                      String p_strStyleClass)
                               throws de.uplanet.lucy.server.share.text.RenderingException
        Get the open tag for the link to the given event.
        Parameters:
        p_strEventId - The event id.
        p_strStyleClass - The link style class.
        Returns:
        the link open tag.
        Throws:
        de.uplanet.lucy.server.share.text.RenderingException
      • getGroupLinkTag

        public String getGroupLinkTag​(String p_strGroupId,
                                      String p_strStyleClass)
                               throws de.uplanet.lucy.server.share.text.RenderingException
        Get the open tag for the link to the given group.
        Parameters:
        p_strGroupId - The group id.
        p_strStyleClass - The link style class.
        Returns:
        the link open tag.
        Throws:
        de.uplanet.lucy.server.share.text.RenderingException
      • getMessageLinkTag

        public String getMessageLinkTag​(String p_strMessageId,
                                        String p_strStyleClass)
                                 throws de.uplanet.lucy.server.share.text.RenderingException
        Get the open tag for the link to the given message.
        Parameters:
        p_strMessageId - The message id.
        p_strStyleClass - The link style class.
        Returns:
        the link open tag.
        Throws:
        de.uplanet.lucy.server.share.text.RenderingException
      • getProfileLinkTag

        public String getProfileLinkTag​(de.uplanet.lucy.server.share.businesslogic.profile.ProfileId p_profileId,
                                        String p_strStyleClass)
                                 throws de.uplanet.lucy.server.share.text.RenderingException
        Get the open tag for the link to the ProfileId.
        Parameters:
        p_profileId - The profile ID.
        p_strStyleClass - The link style class.
        Returns:
        the link open tag.
        Throws:
        de.uplanet.lucy.server.share.text.RenderingException
      • getAdministrationLinkTag

        public String getAdministrationLinkTag​(String p_strStyleClass)
                                        throws de.uplanet.lucy.server.share.text.RenderingException
        Get the open tag for the link to the ProfileId.
        Parameters:
        p_strStyleClass - The link style class.
        Returns:
        the link open tag.
        Throws:
        de.uplanet.lucy.server.share.text.RenderingException
      • getShareLinkTag

        public String getShareLinkTag()
                               throws de.uplanet.lucy.server.share.text.RenderingException
        Get the link to share start page.
        Returns:
        the link.
        Throws:
        de.uplanet.lucy.server.share.text.RenderingException
      • getSystemMessagesOverviewLink

        public String getSystemMessagesOverviewLink​(String p_strLinkStyleClass)
                                             throws de.uplanet.lucy.server.share.text.RenderingException
        Get the link to all system messages.
        Parameters:
        p_strLinkStyleClass - The link style class.
        Returns:
        the link.
        Throws:
        de.uplanet.lucy.server.share.text.RenderingException
      • getMailTitle

        public String getMailTitle()
                            throws de.uplanet.lucy.server.share.text.RenderingException
        Get the mail title.
        Returns:
        The title of the mail.
        Throws:
        de.uplanet.lucy.server.share.text.RenderingException
      • setLanguage

        public void setLanguage​(String p_strLanguage)
        Set the language for rendering the mail.
        Parameters:
        p_strLanguage - The language to set.
      • setLanguageAndTimeZone

        public void setLanguageAndTimeZone​(String p_strLanguage,
                                           String p_strTimeZoneId)
        Set the language for rendering the mail.
        Parameters:
        p_strLanguage - The language to set.
        p_strTimeZoneId - The timozone id.
      • isAdministrationMessage

        public boolean isAdministrationMessage​(SystemMessage p_message)
      • getColor

        public static String getColor​(IBusinessLogicProcessingContext p_ctx,
                                      String p_strType,
                                      String p_strDefault)
        Get defined colors.
        Parameters:
        p_ctx - The BusinessLogicProcessingContext.
        p_strType - The key to access the system data group.
        p_strDefault - The default value.
        Returns:
        The color if defined, otherwise the given default value.