use of de.metas.letters.model.MADBoilerPlate in project metasfresh-webui-api by metasfresh.
the class LetterRestController method applyTemplate.
private void applyTemplate(final WebuiLetter letter, final WebuiLetterBuilder newLetterBuilder, final LookupValue templateLookupValue) {
final Properties ctx = Env.getCtx();
final int textTemplateId = templateLookupValue.getIdAsInt();
final MADBoilerPlate boilerPlate = MADBoilerPlate.get(ctx, textTemplateId);
//
// Attributes
final BoilerPlateContext context = documentCollection.createBoilerPlateContext(letter.getContextDocumentPath());
//
// Content and subject
newLetterBuilder.textTemplateId(textTemplateId);
newLetterBuilder.content(boilerPlate.getTextSnippetParsed(context));
newLetterBuilder.subject(boilerPlate.getSubject());
}
use of de.metas.letters.model.MADBoilerPlate in project metasfresh-webui-api by metasfresh.
the class MailRestController method applyTemplate.
private void applyTemplate(final WebuiEmail email, final WebuiEmailBuilder newEmailBuilder, final LookupValue templateId) {
final Properties ctx = Env.getCtx();
final MADBoilerPlate boilerPlate = MADBoilerPlate.get(ctx, templateId.getIdAsInt());
//
// Attributes
final BoilerPlateContext attributes = documentCollection.createBoilerPlateContext(email.getContextDocumentPath());
//
// Subject
final String subject = MADBoilerPlate.parseText(ctx, boilerPlate.getSubject(), true, attributes, ITrx.TRXNAME_None);
newEmailBuilder.subject(subject);
// Message
newEmailBuilder.message(boilerPlate.getTextSnippetParsed(attributes));
}
Aggregations