Example usage for java.text MessageFormat MessageFormat

List of usage examples for java.text MessageFormat MessageFormat

Introduction

In this page you can find the example usage for java.text MessageFormat MessageFormat.

Prototype

public MessageFormat(String pattern) 

Source Link

Document

Constructs a MessageFormat for the default java.util.Locale.Category#FORMAT FORMAT locale and the specified pattern.

Usage

From source file:org.pegadi.server.article.ArticleServerImpl.java

/**
 * Returns the template for the given article. This method will return
 * <code>null</code> if the template isn't found or an exception is thrown.
 * TODO: This method does not consider the encoding of the template XML.
 * The proper way to fix this is to parse as XML, and then serialize.
 *
 * @param articleID The ID of the article.
 * @return The template.// w  w w. j av a 2 s.com
 */
public String getTemplate(int articleID) {
    Map parameters = template.queryForMap(
            "SELECT Article.refJournalist, Article.refPhotographer, ArticleType.template FROM Article, ArticleType WHERE Article.ID=:id AND ArticleType.ID=Article.refArticleType",
            Collections.singletonMap("id", articleID));
    String templName = (String) parameters.get("template");
    String journalistID = (String) parameters.get("refJournalist");
    String photographerID = (String) parameters.get("refPhotographer");
    log.info("getTemplate: Retrieving template '{}/{}'.", xmlLocation, templName);

    String template;
    try {
        StringWriter temp = new StringWriter();
        TransformerFactory fac = TransformerFactory.newInstance();
        Transformer trans = fac.newTransformer();
        trans.transform(new StreamSource(new FileInputStream(xmlLocation + "/" + templName)),
                new StreamResult(temp));

        template = temp.toString();
    } catch (Exception e) {
        log.error("getTemplate: Exception reading template file", e);
        return null;
    }

    // Format the template
    MessageFormat mf = new MessageFormat(template);
    Object[] args = new Object[10];
    log.debug("setting webxml to {}", webXml);
    args[0] = webXml;
    args[9] = articleID;

    // Set journalist info for template
    Person j = null;
    try {
        if (isNotBlank(journalistID)) {
            j = userServer.getUserByUsername(journalistID);
        }
    } catch (Exception e) {
        log.error("getTemplate: Error getting journalist info", e);
    }
    if (j != null) {
        args[1] = j.getUsername();
        args[2] = j.getName();
        args[3] = j.getEmailAddress();
        args[4] = getInitials(j);
    } else {
        args[1] = 0;
        args[2] = "";
        args[3] = "";
        args[4] = "";
    }

    // Set photographer info for template
    Person p = null;
    try {
        if (isNotBlank(photographerID)) {
            p = userServer.getUserByUsername(photographerID);
        }
    } catch (Exception e) {
        log.error("getTemplate: Error getting photographer info", e);
    }
    if (p != null) {
        args[5] = p.getUsername();
        args[6] = p.getName();
        args[7] = p.getEmailAddress();
        args[8] = getInitials(p);
    } else {
        args[5] = 0;
        args[6] = "";
        args[7] = "";
        args[8] = "";
    }

    try {
        return mf.format(args);
    } catch (Exception e) {
        log.error("getTemplate: Error formatting template", e);
        return null;
    }
}

From source file:org.pentaho.reporting.libraries.base.util.ResourceBundleSupport.java

/**
 * Formats the message stored in the resource bundle (using a MessageFormat).
 *
 * @param key        the resourcebundle key
 * @param parameters the parameter collection for the message
 * @return the formated string/*from   w  ww  . j  a  v a2s  .  com*/
 */
public String formatMessage(final String key, final Object[] parameters) {
    final MessageFormat format = new MessageFormat(strictString(key));
    format.setLocale(getLocale());
    return format.format(parameters);
}

From source file:org.deegree.enterprise.servlet.OGCServletController.java

/**
 * Formats the provided string and the args array into a String using MessageFormat.
 *
 * @param pattern/*from   w w  w  .j a  v  a2 s  .com*/
 * @param args
 * @return the message to present the client.
 */
private String produceMessage(String pattern, Object[] args) {
    return new MessageFormat(pattern).format(args);
}

From source file:freemind.controller.Controller.java

/** Creates a new mode (controller), activates the toolbars, title and deactivates all
 * actions./*from ww w  .  j  a  v  a2s. c o m*/
 * Does nothing, if the mode is identical to the current mode.
 *
 * @return false if the change was not successful.
 */
public boolean createNewMode(String mode) {
    if (getMode() != null && mode.equals(getMode().toString())) {
        return true;
    }

    //Check if the mode is available and create ModeController.
    Mode newMode = mModescreator.getMode(mode);
    if (newMode == null) {
        errorMessage(getResourceString("mode_na") + ": " + mode);
        return false;
    }

    // change the map module to get changed toolbars etc.:
    getMapModuleManager().setMapModule(null, newMode);

    setTitle();
    getMode().activate();

    Object[] messageArguments = { getMode().toLocalizedString() };
    MessageFormat formatter = new MessageFormat(getResourceString("mode_status"));
    getFrame().out(formatter.format(messageArguments));

    return true;
}

From source file:canreg.client.gui.analysis.FrequenciesByYearInternalFrame.java

/**
 *
 *///from w ww  .j  av  a2 s .c  o m
@Action
public void printTableAction() {
    try {
        if (!resultTable.print(JTable.PrintMode.NORMAL,
                new MessageFormat(java.util.ResourceBundle
                        .getBundle("canreg/client/gui/analysis/resources/FrequenciesByYearInternalFrame")
                        .getString("CANREG_FREQUENCIES_BY_YEAR") + " - " + rangeFilterPanel.getFilter()),
                null)) {
            System.err.println(java.util.ResourceBundle
                    .getBundle("canreg/client/gui/analysis/resources/FrequenciesByYearInternalFrame")
                    .getString("USER CANCELLED PRINTING"));
        }
    } catch (java.awt.print.PrinterException e) {
        System.err.format(java.util.ResourceBundle
                .getBundle("canreg/client/gui/analysis/resources/FrequenciesByYearInternalFrame")
                .getString("CANNOT PRINT %S%N"), e.getMessage());
    }
}

From source file:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java

/**
 *
 *///w  ww .  ja va2 s  .  co  m
protected JFreeChart createMeterChart() throws JRException {
    // Start by creating the plot that will hold the meter
    MeterPlot chartPlot = new MeterPlot((ValueDataset) getDataset());
    JRMeterPlot jrPlot = (JRMeterPlot) getPlot();

    // Set the shape
    MeterShapeEnum shape = jrPlot.getShapeValue() == null ? MeterShapeEnum.DIAL : jrPlot.getShapeValue();

    switch (shape) {
    case CHORD:
        chartPlot.setDialShape(DialShape.CHORD);
        break;
    case PIE:
        chartPlot.setDialShape(DialShape.PIE);
        break;
    case CIRCLE:
        chartPlot.setDialShape(DialShape.CIRCLE);
        break;
    case DIAL:
    default:
        return createDialChart();
    }

    chartPlot.setDialOutlinePaint(Color.BLACK);
    int meterAngle = jrPlot.getMeterAngleInteger() == null ? 180 : jrPlot.getMeterAngleInteger().intValue();
    // Set the size of the meter
    chartPlot.setMeterAngle(meterAngle);

    // Set the spacing between ticks.  I hate the name "tickSize" since to me it
    // implies I am changing the size of the tick, not the spacing between them.
    double tickInterval = jrPlot.getTickIntervalDouble() == null ? 10.0
            : jrPlot.getTickIntervalDouble().doubleValue();
    chartPlot.setTickSize(tickInterval);

    JRFont tickLabelFont = jrPlot.getTickLabelFont();
    Integer defaultBaseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.BASEFONT_SIZE);
    Font themeTickLabelFont = getFont(
            (JRFont) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_TICK_LABEL_FONT),
            tickLabelFont, defaultBaseFontSize);
    chartPlot.setTickLabelFont(themeTickLabelFont);

    Color tickColor = jrPlot.getTickColor() == null ? Color.BLACK : jrPlot.getTickColor();
    chartPlot.setTickPaint(tickColor);
    int dialUnitScale = 1;

    Range range = convertRange(jrPlot.getDataRange());
    // Set the meter's range
    if (range != null) {
        chartPlot.setRange(range);
        double bound = Math.max(Math.abs(range.getUpperBound()), Math.abs(range.getLowerBound()));
        dialUnitScale = ChartThemesUtilities.getScale(bound);
        if ((range.getLowerBound() == (int) range.getLowerBound()
                && range.getUpperBound() == (int) range.getUpperBound() && tickInterval == (int) tickInterval)
                || dialUnitScale > 1) {
            chartPlot.setTickLabelFormat(new DecimalFormat("#,##0"));
        } else if (dialUnitScale == 1) {
            chartPlot.setTickLabelFormat(new DecimalFormat("#,##0.0"));
        } else if (dialUnitScale <= 0) {
            chartPlot.setTickLabelFormat(new DecimalFormat("#,##0.00"));
        }
    }
    chartPlot.setTickLabelsVisible(true);

    // Set all the colors we support
    Paint backgroundPaint = jrPlot.getOwnBackcolor() == null ? ChartThemesConstants.TRANSPARENT_PAINT
            : jrPlot.getOwnBackcolor();
    chartPlot.setBackgroundPaint(backgroundPaint);

    GradientPaint gp = new GradientPaint(new Point(), Color.LIGHT_GRAY, new Point(), Color.BLACK, false);

    if (jrPlot.getMeterBackgroundColor() != null) {
        chartPlot.setDialBackgroundPaint(jrPlot.getMeterBackgroundColor());
    } else {
        chartPlot.setDialBackgroundPaint(gp);
    }
    //chartPlot.setForegroundAlpha(1f);
    Paint needlePaint = jrPlot.getNeedleColor() == null ? new Color(191, 48, 0) : jrPlot.getNeedleColor();
    chartPlot.setNeedlePaint(needlePaint);

    JRValueDisplay display = jrPlot.getValueDisplay();
    if (display != null) {
        Color valueColor = display.getColor() == null ? Color.BLACK : display.getColor();
        chartPlot.setValuePaint(valueColor);
        String pattern = display.getMask() != null ? display.getMask() : "#,##0.####";
        if (pattern != null)
            chartPlot.setTickLabelFormat(new DecimalFormat(pattern));
        JRFont displayFont = display.getFont();
        Font themeDisplayFont = getFont(
                (JRFont) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_DISPLAY_FONT),
                displayFont, defaultBaseFontSize);

        if (themeDisplayFont != null) {
            chartPlot.setValueFont(themeDisplayFont);
        }
    }
    String label = getChart().hasProperties()
            ? getChart().getPropertiesMap().getProperty(DefaultChartTheme.PROPERTY_DIAL_LABEL)
            : null;

    if (label != null) {
        if (dialUnitScale < 0)
            label = new MessageFormat(label)
                    .format(new Object[] { String.valueOf(Math.pow(10, dialUnitScale)) });
        else if (dialUnitScale < 3)
            label = new MessageFormat(label).format(new Object[] { "1" });
        else
            label = new MessageFormat(label)
                    .format(new Object[] { String.valueOf((int) Math.pow(10, dialUnitScale - 2)) });

    }

    // Set the units - this is just a string that will be shown next to the
    // value
    String units = jrPlot.getUnits() == null ? label : jrPlot.getUnits();
    if (units != null && units.length() > 0)
        chartPlot.setUnits(units);

    chartPlot.setTickPaint(Color.BLACK);

    // Now define all of the intervals, setting their range and color
    List intervals = jrPlot.getIntervals();
    if (intervals != null && intervals.size() > 0) {
        int size = Math.min(3, intervals.size());

        int colorStep = 0;
        if (size > 3)
            colorStep = 255 / (size - 3);

        for (int i = 0; i < size; i++) {
            JRMeterInterval interval = (JRMeterInterval) intervals.get(i);
            Color color = i < 3 ? (Color) ChartThemesConstants.AEGEAN_INTERVAL_COLORS.get(i)
                    : new Color(255 - colorStep * (i - 3), 0 + colorStep * (i - 3), 0);

            interval.setBackgroundColor(color);
            interval.setAlpha(new Double(1.0));
            chartPlot.addInterval(convertInterval(interval));
        }
    }

    // Actually create the chart around the plot
    JFreeChart jfreeChart = new JFreeChart((String) evaluateExpression(getChart().getTitleExpression()), null,
            chartPlot, getChart().getShowLegend() == null ? false : getChart().getShowLegend().booleanValue());

    // Set all the generic options
    configureChart(jfreeChart, getPlot());

    return jfreeChart;

}

From source file:org.acmsl.commons.BundleI14able.java

/**
 * Builds an internationalized message for given key, parameters and
 * locale./* w  w  w  .  j av a  2 s.c om*/
 * @param message the message.
 * @param params the message parameters.
 * @return the customized message.
 */
@NotNull
protected String buildMessage(@NotNull final String message, @NotNull final Object[] params) {
    return new MessageFormat(message).format(params);
}

From source file:net.sf.jasperreports.chartthemes.spring.EyeCandySixtiesChartTheme.java

@Override
protected JFreeChart createMeterChart() throws JRException {
    // Start by creating the plot that will hold the meter
    MeterPlot chartPlot = new MeterPlot((ValueDataset) getDataset());
    JRMeterPlot jrPlot = (JRMeterPlot) getPlot();

    // Set the shape
    MeterShapeEnum shape = jrPlot.getShapeValue() == null ? MeterShapeEnum.DIAL : jrPlot.getShapeValue();

    switch (shape) {
    case CHORD:/*ww w.  j a  va 2s. co m*/
        chartPlot.setDialShape(DialShape.CHORD);
        break;
    case PIE:
        chartPlot.setDialShape(DialShape.PIE);
        break;
    case CIRCLE:
        chartPlot.setDialShape(DialShape.CIRCLE);
        break;
    case DIAL:
    default:
        return createDialChart();
    }

    chartPlot.setDialOutlinePaint(Color.BLACK);
    int meterAngle = jrPlot.getMeterAngleInteger() == null ? 180 : jrPlot.getMeterAngleInteger();
    // Set the size of the meter
    chartPlot.setMeterAngle(meterAngle);

    // Set the spacing between ticks.  I hate the name "tickSize" since to me it
    // implies I am changing the size of the tick, not the spacing between them.
    double tickInterval = jrPlot.getTickIntervalDouble() == null ? 10.0 : jrPlot.getTickIntervalDouble();
    chartPlot.setTickSize(tickInterval);

    JRFont tickLabelFont = jrPlot.getTickLabelFont();
    Integer defaultBaseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.BASEFONT_SIZE);
    Font themeTickLabelFont = getFont(
            (JRFont) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_TICK_LABEL_FONT),
            tickLabelFont, defaultBaseFontSize);
    chartPlot.setTickLabelFont(themeTickLabelFont);

    // localizing the default format, can be overridden by display.getMask()
    chartPlot.setTickLabelFormat(NumberFormat.getInstance(getLocale()));

    Color tickColor = jrPlot.getTickColor() == null ? Color.BLACK : jrPlot.getTickColor();
    chartPlot.setTickPaint(tickColor);
    int dialUnitScale = 1;

    Range range = convertRange(jrPlot.getDataRange());
    // Set the meter's range
    if (range != null) {
        chartPlot.setRange(range);
        double bound = Math.max(Math.abs(range.getUpperBound()), Math.abs(range.getLowerBound()));
        dialUnitScale = ChartThemesUtilities.getScale(bound);
        if ((range.getLowerBound() == (int) range.getLowerBound()
                && range.getUpperBound() == (int) range.getUpperBound() && tickInterval == (int) tickInterval)
                || dialUnitScale > 1) {
            chartPlot.setTickLabelFormat(
                    new DecimalFormat("#,##0", DecimalFormatSymbols.getInstance(getLocale())));
        } else if (dialUnitScale == 1) {
            chartPlot.setTickLabelFormat(
                    new DecimalFormat("#,##0.0", DecimalFormatSymbols.getInstance(getLocale())));
        } else if (dialUnitScale <= 0) {
            chartPlot.setTickLabelFormat(
                    new DecimalFormat("#,##0.00", DecimalFormatSymbols.getInstance(getLocale())));
        }
    }
    chartPlot.setTickLabelsVisible(true);

    // Set all the colors we support
    Paint backgroundPaint = jrPlot.getOwnBackcolor() == null ? ChartThemesConstants.TRANSPARENT_PAINT
            : jrPlot.getOwnBackcolor();
    chartPlot.setBackgroundPaint(backgroundPaint);

    GradientPaint gp = new GradientPaint(new Point(), Color.LIGHT_GRAY, new Point(), Color.BLACK, false);

    if (jrPlot.getMeterBackgroundColor() != null) {
        chartPlot.setDialBackgroundPaint(jrPlot.getMeterBackgroundColor());
    } else {
        chartPlot.setDialBackgroundPaint(gp);
    }
    //chartPlot.setForegroundAlpha(1f);
    Paint needlePaint = jrPlot.getNeedleColor() == null ? new Color(191, 48, 0) : jrPlot.getNeedleColor();
    chartPlot.setNeedlePaint(needlePaint);

    JRValueDisplay display = jrPlot.getValueDisplay();
    if (display != null) {
        Color valueColor = display.getColor() == null ? Color.BLACK : display.getColor();
        chartPlot.setValuePaint(valueColor);
        String pattern = display.getMask() != null ? display.getMask() : "#,##0.####";
        if (pattern != null)
            chartPlot.setTickLabelFormat(
                    new DecimalFormat(pattern, DecimalFormatSymbols.getInstance(getLocale())));
        JRFont displayFont = display.getFont();
        Font themeDisplayFont = getFont(
                (JRFont) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_DISPLAY_FONT),
                displayFont, defaultBaseFontSize);

        if (themeDisplayFont != null) {
            chartPlot.setValueFont(themeDisplayFont);
        }
    }
    String label = getChart().hasProperties()
            ? getChart().getPropertiesMap().getProperty(DefaultChartTheme.PROPERTY_DIAL_LABEL)
            : null;

    if (label != null) {
        if (dialUnitScale < 0)
            label = new MessageFormat(label)
                    .format(new Object[] { String.valueOf(Math.pow(10, dialUnitScale)) });
        else if (dialUnitScale < 3)
            label = new MessageFormat(label).format(new Object[] { "1" });
        else
            label = new MessageFormat(label)
                    .format(new Object[] { String.valueOf((int) Math.pow(10, dialUnitScale - 2)) });

    }

    // Set the units - this is just a string that will be shown next to the
    // value
    String units = jrPlot.getUnits() == null ? label : jrPlot.getUnits();
    if (units != null && units.length() > 0)
        chartPlot.setUnits(units);

    chartPlot.setTickPaint(Color.BLACK);

    // Now define all of the intervals, setting their range and color
    List<JRMeterInterval> intervals = jrPlot.getIntervals();
    if (intervals != null && intervals.size() > 0) {
        int size = Math.min(3, intervals.size());

        int colorStep = 0;
        if (size > 3)
            colorStep = 255 / (size - 3);

        for (int i = 0; i < size; i++) {
            JRMeterInterval interval = intervals.get(i);
            Color color = i < 3 ? (Color) ChartThemesConstants.AEGEAN_INTERVAL_COLORS.get(i)
                    : new Color(255 - colorStep * (i - 3), 0 + colorStep * (i - 3), 0);

            interval.setBackgroundColor(color);
            interval.setAlpha(1.0d);
            chartPlot.addInterval(convertInterval(interval));
        }
    }

    // Actually create the chart around the plot
    JFreeChart jfreeChart = new JFreeChart(evaluateTextExpression(getChart().getTitleExpression()), null,
            chartPlot, getChart().getShowLegend() == null ? false : getChart().getShowLegend());

    // Set all the generic options
    configureChart(jfreeChart, getPlot());

    return jfreeChart;

}

From source file:com.okta.tools.awscli.java

private static String setAWSCredentials(AssumeRoleWithSAMLResult assumeResult, String credentialsProfileName)
        throws FileNotFoundException, UnsupportedEncodingException, IOException {
    BasicSessionCredentials temporaryCredentials = new BasicSessionCredentials(
            assumeResult.getCredentials().getAccessKeyId(), assumeResult.getCredentials().getSecretAccessKey(),
            assumeResult.getCredentials().getSessionToken());

    String awsAccessKey = temporaryCredentials.getAWSAccessKeyId();
    String awsSecretKey = temporaryCredentials.getAWSSecretKey();
    String awsSessionToken = temporaryCredentials.getSessionToken();

    if (credentialsProfileName.startsWith("arn:aws:sts::")) {
        credentialsProfileName = credentialsProfileName.substring(13);
    }/*from   w w  w. j av  a 2 s  .c om*/
    if (credentialsProfileName.contains(":assumed-role")) {
        credentialsProfileName = credentialsProfileName.replaceAll(":assumed-role", "");
    }

    Object[] args = { new String(credentialsProfileName), selectedPolicyRank };
    MessageFormat profileNameFormat = new MessageFormat("{0}/{1}");
    credentialsProfileName = profileNameFormat.format(args);

    //update the credentials file with the unique profile name
    UpdateCredentialsFile(credentialsProfileName, awsAccessKey, awsSecretKey, awsSessionToken);
    //also override the default profile
    UpdateCredentialsFile(DefaultProfileName, awsAccessKey, awsSecretKey, awsSessionToken);

    return credentialsProfileName;
}

From source file:org.kuali.rice.kew.mail.service.impl.ActionListEmailServiceImpl.java

public String buildImmediateReminderBody(Person person, org.kuali.rice.kew.api.action.ActionItem actionItem,
        DocumentType documentType) {
    String docHandlerUrl = documentType.getResolvedDocumentHandlerUrl();
    if (StringUtils.isNotBlank(docHandlerUrl)) {
        if (!docHandlerUrl.contains("?")) {
            docHandlerUrl += "?";
        } else {/*from  ww w. j a  v  a  2 s  . c o  m*/
            docHandlerUrl += "&";
        }
        docHandlerUrl += KewApiConstants.DOCUMENT_ID_PARAMETER + "=" + actionItem.getDocumentId();
        docHandlerUrl += "&" + KewApiConstants.COMMAND_PARAMETER + "=" + KewApiConstants.ACTIONLIST_COMMAND;
    }
    StringBuffer sf = new StringBuffer();

    /*sf
      .append("Your Action List has an eDoc(electronic document) that needs your attention: \n\n");
    sf.append("Document ID:\t" + actionItem.getDocumentId() + "\n");
    sf.append("Initiator:\t\t");
    try {
       sf.append(actionItem.getRouteHeader().getInitiatorUser()
         .getDisplayName()
         + "\n");
    } catch (Exception e) {
       LOG.error("Error retrieving initiator for action item "
         + actionItem.getDocumentId());
       sf.append("\n");
    }
    sf.append("Type:\t\t" + "Add/Modify "
      + actionItem.getRouteHeader().getDocumentType().getName()
      + "\n");
    sf.append("Title:\t\t" + actionItem.getDocTitle() + "\n");
    sf.append("\n\n");
    sf.append("To respond to this eDoc: \n");
    sf.append("\tGo to " + docHandlerUrl + "\n\n");
    sf.append("\tOr you may access the eDoc from your Action List: \n");
    sf.append("\tGo to " + getActionListUrl()
      + ", and then click on the numeric Document ID: "
      + actionItem.getDocumentId()
      + " in the first column of the List. \n");
    sf.append("\n\n\n");
    sf
      .append("To change how these email notifications are sent(daily, weekly or none): \n");
    sf.append("\tGo to " + getPreferencesUrl() + "\n");
    sf.append("\n\n\n");
    sf.append(getHelpLink(documentType) + "\n\n\n");*/

    MessageFormat messageFormat = null;
    String stringMessageFormat = ConfigContext.getCurrentContextConfig()
            .getProperty(IMMEDIATE_REMINDER_EMAIL_MESSAGE_KEY);
    LOG.debug("Immediate reminder email message from configuration (" + IMMEDIATE_REMINDER_EMAIL_MESSAGE_KEY
            + "): " + stringMessageFormat);
    if (stringMessageFormat == null) {
        messageFormat = DEFAULT_IMMEDIATE_REMINDER;
    } else {
        messageFormat = new MessageFormat(stringMessageFormat);
    }
    String initiatorUser = (person == null ? "" : person.getName());

    if (StringUtils.isNotBlank(docHandlerUrl)) {
        Object[] args = { actionItem.getDocumentId(), initiatorUser, documentType.getName(),
                actionItem.getDocTitle(), docHandlerUrl, getActionListUrl(), getPreferencesUrl(),
                getHelpLink(documentType) };

        messageFormat.format(args, sf, new FieldPosition(0));

        LOG.debug("default immediate reminder: " + DEFAULT_IMMEDIATE_REMINDER.format(args));
    } else {
        Object[] args = { actionItem.getDocumentId(), initiatorUser, documentType.getName(),
                actionItem.getDocTitle(), getActionListUrl(), getPreferencesUrl(), getHelpLink(documentType) };

        messageFormat.format(args, sf, new FieldPosition(0));

        LOG.debug("default immediate reminder: " + DEFAULT_IMMEDIATE_REMINDER_NO_DOC_HANDLER.format(args));
    }
    LOG.debug("immediate reminder: " + sf);

    // for debugging purposes on the immediate reminder only
    if (!isProduction()) {
        try {
            sf.append("Action Item sent to " + actionItem.getPrincipalId());
            if (actionItem.getDelegationType() != null) {
                sf.append(" for delegation type " + actionItem.getDelegationType());
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    return sf.toString();
}