Class MailUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic final String
buildSubject
(IProcessingContext p_ctx, String p_strStaticPart, IValueHolder<?> p_vhDynamicPart) Deprecated.static final String
buildSubject
(IProcessingContext p_ctx, String p_strStaticPart, IValueHolder<?> p_vhDynamicPart, String p_strLanguage) Note: Do not use this method in scripts.static String
checkLevelOfTargetPage
(IBusinessLogicProcessingContext p_ctx, String p_strAppGuid, String p_strSrcPageGuid, String p_strTargetGuid, String p_strRecIdForMail) Checks if the level of the targetpage and the level of the sourcepage is different.getAddressesFromField
(IBusinessLogicProcessingContext p_ctx, de.uplanet.lucy.server.businesslogic.util.IDataRecord p_record, String p_strAppGuid, String p_strDgGuid, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) Get a set of non-empty mail addresses from the given field.getAddressesFromField
(IBusinessLogicProcessingContext p_ctx, de.uplanet.lucy.server.businesslogic.util.IDataRecord p_record, String p_strAppGuid, String p_strDgGuid, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz, boolean p_bIncludeDeactivatedUsers) Get a set of non-empty mail addresses from the given field.static de.uplanet.lucy.server.businesslogic.util.ICloseableDataRangeDataService
getAddressListCloseableDataRange
(IBusinessLogicProcessingContext p_ctx, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) Note: Do not use this method in scripts.static de.uplanet.lucy.server.businesslogic.util.IDataRangeDataService
getAddressListDataRange
(IBusinessLogicProcessingContext p_ctx, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) Note: Do not use this method in scripts.static String
getApplicationResponsibleAddress
(de.uplanet.jdbc.JdbcConnection p_conn, String p_strAppGuid) getBossAddresses
(de.uplanet.jdbc.JdbcConnection p_conn, de.uplanet.lucy.server.usermanager.IUser p_user) static String
Deprecated.static javax.mail.internet.InternetAddress
Get the email address of the default sender configured for the portal.static String
getDeputyAddress
(de.uplanet.jdbc.JdbcConnection p_conn, de.uplanet.lucy.server.usermanager.IUser p_user) Get the mail address of the given user's deputy.static de.uplanet.lucy.server.businesslogic.util.IDataRangeDataService
getDistinctDataRangeList
(IBusinessLogicProcessingContext p_ctx, de.uplanet.lucy.server.mail.MailRecipientInfo p_mailRcp, TimeZone p_tz) Deprecated.static de.uplanet.lucy.server.businesslogic.util.IDataRangeDataService
getDistinctDataRangeList
(IBusinessLogicProcessingContext p_ctx, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) Deprecated.static de.uplanet.lucy.server.businesslogic.util.IDataRangeDataService
getDistinctDataRangeList
(IBusinessLogicProcessingContext p_ctx, String p_strAppGuid, String p_strDgGuid, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) Deprecated.static de.uplanet.lucy.server.mail.MailInfo
getMailInfoFromDatabase
(IProcessingContext p_ctx, String p_strGuid) Read a mail info object from the database.static de.uplanet.lucy.server.mail.MailRecipientInfo
getRecipientsFromDatabase
(de.uplanet.jdbc.JdbcConnection p_conn, de.uplanet.lucy.server.usermanager.IUser p_user, String p_strGuid, String p_strType) Note: Do not use this method in scripts.static String
getRenderedValue
(IProcessingContext p_ctx, IValueHolder<?> p_vh) Note: Do not use this method in scripts.getUserMailBizFromDistributionList
(de.uplanet.jdbc.JdbcConnection p_conn, String p_strList) Parse a pipe-separated list of org structure GUIDs and get the user mail addresses determined by it.getUserMailBizFromDistributionList
(de.uplanet.jdbc.JdbcConnection p_conn, String p_strList, boolean p_bIncludeDeactivatedUsers) Parse a pipe-separated list of org structure GUIDs and get the user mail addresses determined by it.static IValueHolder<?>
getValueHolderFromField
(IBusinessLogicProcessingContext p_ctx, String p_strAppGuid, String p_strDgGuid, String p_strFieldGuid, String p_strRecId) Note: Do not use this method in scripts.static boolean
isDistributionList
(String p_strList) Check if the given string represents a ||-separated distribution list.static boolean
Test if the mail service is enabled.parseSemicolonOrLinefeedSeparatedAddresses
(String p_strAddresses) Deprecated.UseMailAddressUtil.parseSeparatedAddresses(String)
instead.
-
Method Details
-
isMailServiceEnabled
public static boolean isMailServiceEnabled()Test if the mail service is enabled.- Returns:
true
if the mail service is enabled, orfalse
otherwise.
-
getDefaultSenderAddress
@Deprecated public static String getDefaultSenderAddress() throws de.uplanet.lucy.mail.SendMailConfigurationExceptionDeprecated.UsegetDefaultSenderInternetAddress()
instead.Get the email address of the default sender configured for the portal.- Returns:
- The default sender address.
- Throws:
de.uplanet.lucy.server.mail.MailServiceNotAvailableException
- If the mail service is not available.de.uplanet.lucy.mail.SendMailConfigurationException
- If the mail configuration could not be loaded.
-
getDefaultSenderInternetAddress
public static javax.mail.internet.InternetAddress getDefaultSenderInternetAddress() throws de.uplanet.lucy.mail.SendMailConfigurationException, javax.mail.internet.AddressExceptionGet the email address of the default sender configured for the portal.- Returns:
- The default sender address, or
null
if none is configured. - Throws:
de.uplanet.lucy.server.mail.MailServiceNotAvailableException
- If the mail service is not available.de.uplanet.lucy.mail.SendMailConfigurationException
- If the mail configuration could not be loaded.javax.mail.internet.AddressException
- If the configured email address is invalid.
-
parseSemicolonOrLinefeedSeparatedAddresses
@Deprecated public static List<String> parseSemicolonOrLinefeedSeparatedAddresses(String p_strAddresses) Deprecated.UseMailAddressUtil.parseSeparatedAddresses(String)
instead.Note: This method also parses comma separators. -
isDistributionList
Check if the given string represents a ||-separated distribution list.- Parameters:
p_strList
- The string to be checked.- Returns:
true
if the given string represents a ||-separated distribution list, orfalse
otherwise.
-
getUserMailBizFromDistributionList
public static List<String> getUserMailBizFromDistributionList(de.uplanet.jdbc.JdbcConnection p_conn, String p_strList) throws SQLException Parse a pipe-separated list of org structure GUIDs and get the user mail addresses determined by it.Deactivated users are excluded from the result.
- Parameters:
p_conn
- The database connection to be used.p_strList
- A list of org structure GUIDs.- Throws:
SQLException
- If a database error occurred.- See Also:
-
getUserMailBizFromDistributionList
public static List<String> getUserMailBizFromDistributionList(de.uplanet.jdbc.JdbcConnection p_conn, String p_strList, boolean p_bIncludeDeactivatedUsers) throws SQLException Parse a pipe-separated list of org structure GUIDs and get the user mail addresses determined by it.- Parameters:
p_conn
- The database connection to be used.p_strList
- A list of org structure GUIDs.p_bIncludeDeactivatedUsers
-false
if deactivated users should be ignored, ortrue
otherwise.- Returns:
- A list that contains the (non-empty) addresses.
- Throws:
SQLException
- If a database error occurred.- Since:
- Intrexx 6.0.
-
buildSubject
@Deprecated public static final String buildSubject(IProcessingContext p_ctx, String p_strStaticPart, IValueHolder<?> p_vhDynamicPart) throws de.uplanet.lucy.server.renderer.RendererException, de.uplanet.lucy.server.renderer.RendererFactoryException, de.uplanet.util.InvalidPropertyException Deprecated.Note: Do not use this method in scripts. It will be changed in the future
- Throws:
de.uplanet.lucy.server.renderer.RendererException
de.uplanet.lucy.server.renderer.RendererFactoryException
de.uplanet.util.InvalidPropertyException
-
buildSubject
public static final String buildSubject(IProcessingContext p_ctx, String p_strStaticPart, IValueHolder<?> p_vhDynamicPart, String p_strLanguage) throws de.uplanet.lucy.server.renderer.RendererException, de.uplanet.lucy.server.renderer.RendererFactoryException, de.uplanet.util.InvalidPropertyException Note: Do not use this method in scripts. It will be changed in the future
If the static part of the subject is not
null
and it contains the special variable${1}
this special variable will be replaced with the dynamic part or the empty string if the dynamic part isnull
.If the static part of the subject is not
null
and it does not contain the special variable${1}
then an existing dynamic part will be appended with a space character prepended.If the given language is
null
thedefault language
will be used.- Parameters:
p_ctx
- The current processing context.p_strStaticPart
- The static part of the subject, ornull
.p_vhDynamicPart
- The dynamic part of the subject, ornull
.p_strLanguage
- The language, ornull
.- Returns:
- The build subject.
- Throws:
de.uplanet.lucy.server.renderer.RendererException
- If an error occurred.de.uplanet.lucy.server.renderer.RendererFactoryException
- If an error occurred.de.uplanet.util.InvalidPropertyException
- If an error occurred.
-
getMailInfoFromDatabase
public static de.uplanet.lucy.server.mail.MailInfo getMailInfoFromDatabase(IProcessingContext p_ctx, String p_strGuid) throws SQLException, de.uplanet.lucy.usermanager.NotFoundException Read a mail info object from the database.Note: Do not use this method in scripts.
- Parameters:
p_ctx
- The processing context.p_strGuid
- The GUID of the requested mail info.- Returns:
- A mail inf object.
- Throws:
SQLException
- If a database error occurred.de.uplanet.lucy.usermanager.NotFoundException
- If the deputy of the user in the context was not found in the database.
-
getRecipientsFromDatabase
public static de.uplanet.lucy.server.mail.MailRecipientInfo getRecipientsFromDatabase(de.uplanet.jdbc.JdbcConnection p_conn, de.uplanet.lucy.server.usermanager.IUser p_user, String p_strGuid, String p_strType) throws SQLException, de.uplanet.lucy.usermanager.NotFoundException Note: Do not use this method in scripts.
- Parameters:
p_conn
- The database connection to be used.p_user
- A user, if boss or deputy mails should be sent. If this parameter isnull
, and boss or deputy are configured as recipients, anIllegalProcessingContextException
will be thrown.p_strGuid
- The unique identifier of the recipient configuration.p_strType
- The recipient type, i.e. eitherTo
, orCc
, orBcc
.- Returns:
- The recipient configuration from the database, or
null
if none was found. - Throws:
SQLException
- If a database error occurred.de.uplanet.lucy.usermanager.NotFoundException
- If the deputy of the given user was not found in the database.
-
getBossAddresses
public static SortedSet<String> getBossAddresses(de.uplanet.jdbc.JdbcConnection p_conn, de.uplanet.lucy.server.usermanager.IUser p_user) throws SQLException - Parameters:
p_conn
- The database connection to be used.p_user
- The user.- Returns:
- A possibly empty list of boss e-mail addresses.
- Throws:
SQLException
- If a database error occurred.
-
getDeputyAddress
public static String getDeputyAddress(de.uplanet.jdbc.JdbcConnection p_conn, de.uplanet.lucy.server.usermanager.IUser p_user) throws SQLException, de.uplanet.lucy.usermanager.NotFoundException Get the mail address of the given user's deputy.- Parameters:
p_conn
- The database connection to be used.p_user
- The user.- Returns:
- The given user's deputy, or
null
if there is none. - Throws:
SQLException
- If a database error occurred.de.uplanet.lucy.usermanager.NotFoundException
- If the deputy was not found in the database.
-
getApplicationResponsibleAddress
public static String getApplicationResponsibleAddress(de.uplanet.jdbc.JdbcConnection p_conn, String p_strAppGuid) throws SQLException - Throws:
SQLException
-
getAddressListDataRange
public static de.uplanet.lucy.server.businesslogic.util.IDataRangeDataService getAddressListDataRange(IBusinessLogicProcessingContext p_ctx, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) throws de.uplanet.lucy.server.businesslogic.BlException Note: Do not use this method in scripts.
- Parameters:
p_ctx
- The processing context.p_strFieldGuid
- The field GUID.p_filter
- A filter to be applied, ornull
.p_tz
- The current user's time zone.- Returns:
- An object that gives access to the requested data.
- Throws:
de.uplanet.lucy.server.businesslogic.BlException
- If an error occurred.
-
getAddressListCloseableDataRange
public static de.uplanet.lucy.server.businesslogic.util.ICloseableDataRangeDataService getAddressListCloseableDataRange(IBusinessLogicProcessingContext p_ctx, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) throws de.uplanet.lucy.server.businesslogic.BlException Note: Do not use this method in scripts.
- Parameters:
p_ctx
- The processing context.p_strFieldGuid
- The field GUID.p_filter
- A filter to be applied, ornull
.p_tz
- The current user's time zone.- Returns:
- An object that gives access to the requested data (must be closed after use).
- Throws:
de.uplanet.lucy.server.businesslogic.BlException
- If an error occurred.
-
getDistinctDataRangeList
@Deprecated public static de.uplanet.lucy.server.businesslogic.util.IDataRangeDataService getDistinctDataRangeList(IBusinessLogicProcessingContext p_ctx, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) throws de.uplanet.lucy.server.businesslogic.BlException Deprecated.- Throws:
de.uplanet.lucy.server.businesslogic.BlException
-
getDistinctDataRangeList
@Deprecated public static de.uplanet.lucy.server.businesslogic.util.IDataRangeDataService getDistinctDataRangeList(IBusinessLogicProcessingContext p_ctx, de.uplanet.lucy.server.mail.MailRecipientInfo p_mailRcp, TimeZone p_tz) throws de.uplanet.lucy.server.businesslogic.BlException Deprecated.- Throws:
de.uplanet.lucy.server.businesslogic.BlException
-
getDistinctDataRangeList
@Deprecated public static de.uplanet.lucy.server.businesslogic.util.IDataRangeDataService getDistinctDataRangeList(IBusinessLogicProcessingContext p_ctx, String p_strAppGuid, String p_strDgGuid, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) throws de.uplanet.lucy.server.businesslogic.BlException Deprecated.- Throws:
de.uplanet.lucy.server.businesslogic.BlException
-
getAddressesFromField
public static Set<String> getAddressesFromField(IBusinessLogicProcessingContext p_ctx, de.uplanet.lucy.server.businesslogic.util.IDataRecord p_record, String p_strAppGuid, String p_strDgGuid, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz) throws Exception Get a set of non-empty mail addresses from the given field.The addresses are parsed as a case insensitive semicolon, or line-feed separated list of strings, or as a ||-delimited list of org structure GUIDs.
Deactivated users are excluded from the result.
- Parameters:
p_ctx
- The processing context.p_strAppGuid
- The GUID of the application.p_strDgGuid
- The GUID of the data group.p_strFieldGuid
- The field GUID.p_filter
- A filter to be applied, ornull
.p_tz
- The current user's time zone.- Returns:
- A set that contains non-empty mail adresses.
- Throws:
Exception
- If an error occurred.- See Also:
-
getAddressesFromField
public static Set<String> getAddressesFromField(IBusinessLogicProcessingContext p_ctx, de.uplanet.lucy.server.businesslogic.util.IDataRecord p_record, String p_strAppGuid, String p_strDgGuid, String p_strFieldGuid, de.uplanet.lucy.server.businesslogic.rtdata.jdbc.filter.IFilterElement p_filter, TimeZone p_tz, boolean p_bIncludeDeactivatedUsers) throws de.uplanet.lucy.server.businesslogic.BlException, SQLException Get a set of non-empty mail addresses from the given field.The addresses are parsed as a case insensitive semicolon, or line-feed separated list of strings, or as a ||-delimited list of org structure GUIDs.
- Parameters:
p_ctx
- The processing context.p_strAppGuid
- The GUID of the application.p_strDgGuid
- The GUID of the data group.p_strFieldGuid
- The field GUID.p_filter
- A filter to be applied, ornull
.p_tz
- The current user's time zone.p_bIncludeDeactivatedUsers
-false
if deactivated users should be ignored, ortrue
otherwise.- Returns:
- A set that contains non-empty mail adresses.
- Throws:
de.uplanet.lucy.server.businesslogic.BlException
- If an error occurred.SQLException
- If an error occurred.- Since:
- Intrexx 6.0.
-
getRenderedValue
public static String getRenderedValue(IProcessingContext p_ctx, IValueHolder<?> p_vh) throws de.uplanet.lucy.server.renderer.RendererException, de.uplanet.lucy.server.renderer.RendererFactoryException Note: Do not use this method in scripts.
- Throws:
de.uplanet.lucy.server.renderer.RendererFactoryException
de.uplanet.lucy.server.renderer.RendererException
-
getValueHolderFromField
public static IValueHolder<?> getValueHolderFromField(IBusinessLogicProcessingContext p_ctx, String p_strAppGuid, String p_strDgGuid, String p_strFieldGuid, String p_strRecId) throws de.uplanet.lucy.server.businesslogic.BlException Note: Do not use this method in scripts.
- Parameters:
p_ctx
- The current processing context.p_strAppGuid
- The application that contains the data group identified byp_strDgGuid
.p_strDgGuid
- The data group that contains the record identified byp_strRecId
.p_strFieldGuid
- The field that contains the subject (may belong to the parent data group).p_strRecId
- The primary key of the record inp_strDgGuid
.- Returns:
- The value.
- Throws:
de.uplanet.lucy.server.businesslogic.BlException
- If an error occurred.
-
checkLevelOfTargetPage
public static String checkLevelOfTargetPage(IBusinessLogicProcessingContext p_ctx, String p_strAppGuid, String p_strSrcPageGuid, String p_strTargetGuid, String p_strRecIdForMail) throws de.uplanet.lucy.server.businesslogic.BlException Checks if the level of the targetpage and the level of the sourcepage is different. If so it gets the recid of the parentfield of that level of the targetpage for the given recordid.Note: Do not use this method in scripts.
- Parameters:
p_strSrcPageGuid
- Database GUID of the sourcepagep_strRecIdForMail
- current Recid of the record of the mail.- Returns:
null
, if the level is teh same otherwise the value of the parentid for the level of the targetpage.- Throws:
de.uplanet.lucy.server.businesslogic.BlException
- If an error occurred.
-
getDefaultSenderInternetAddress()
instead.