Search in sources :

Example 1 with SMailLabelStrategy

use of org.dbflute.mail.send.supplement.label.SMailLabelStrategy in project fess by codelibs.

the class FessMailDeliveryDepartmentCreator method createDogmaticPostalPersonnel.

protected SMailDogmaticPostalPersonnel createDogmaticPostalPersonnel() {
    // #ext_point e.g. locale, database
    final String testPrefix = fessConfig.getMailSubjectTestPrefix();
    final AsyncManager asyncManager = getAsyncManager();
    final MessageManager messageManager = getMessageManager();
    return new SMailDogmaticPostalPersonnel() {

        // *if you need user locale switching or templates from database,
        // override createConventionReceptionist() (see the method for the details)
        @Override
        protected SMailConventionReceptionist createConventionReceptionist() {
            return super.createConventionReceptionist().asReceiverLocale(postcard -> {
                return OptionalThing.empty();
            });
        }

        @Override
        protected OptionalThing<SMailSubjectFilter> createSubjectFilter() {
            return OptionalThing.of((view, subject) -> testPrefix + subject);
        }

        @Override
        protected OptionalThing<SMailAsyncStrategy> createAsyncStrategy() {
            return OptionalThing.of((view, runnable) -> async(asyncManager, runnable));
        }

        @Override
        protected OptionalThing<SMailLabelStrategy> createLabelStrategy() {
            return OptionalThing.of((view, locale, label) -> resolveLabelIfNeeds(messageManager, locale, label));
        }
    };
}
Also used : SMailLabelStrategy(org.dbflute.mail.send.supplement.label.SMailLabelStrategy) MessageManager(org.lastaflute.core.message.MessageManager) SMailSubjectFilter(org.dbflute.mail.send.supplement.filter.SMailSubjectFilter) SMailDogmaticPostalPersonnel(org.dbflute.mail.send.embedded.personnel.SMailDogmaticPostalPersonnel) SMailAsyncStrategy(org.dbflute.mail.send.supplement.async.SMailAsyncStrategy) AsyncManager(org.lastaflute.core.magic.async.AsyncManager)

Aggregations

SMailDogmaticPostalPersonnel (org.dbflute.mail.send.embedded.personnel.SMailDogmaticPostalPersonnel)1 SMailAsyncStrategy (org.dbflute.mail.send.supplement.async.SMailAsyncStrategy)1 SMailSubjectFilter (org.dbflute.mail.send.supplement.filter.SMailSubjectFilter)1 SMailLabelStrategy (org.dbflute.mail.send.supplement.label.SMailLabelStrategy)1 AsyncManager (org.lastaflute.core.magic.async.AsyncManager)1 MessageManager (org.lastaflute.core.message.MessageManager)1