Create SMS message.

@param alert {@link net.anotheria.moskito.core.threshold.alerts.ThresholdAlert}
@param template {@link net.anotheria.moskito.extensions.notificationproviders.BulkSMSNotificationProvider#smsTemplate}
@return SMS
491478
private static String createMessage(final ThresholdAlert alert, final String template) {
        // TODO: message should be encoded to apropriate encoding
        //return alert.getThreshold().getName() + ": " + alert.getOldStatus() + "->" + alert.getNewStatus();
        String message;
        if(!StringUtils.isEmpty(template)) {
            ThresholdAlertTemplate thresholdAlertTemplate = new ThresholdAlertTemplate(alert);
            message = thresholdAlertTemplate.process(template);
        } else {
            message = ThresholdAlertConverter.toPlainText(alert);
        }
        return message;
    }
45488
public static <T extends Comparable<?>> DateTemplate<T> dateTemplate(Class<? extends T> cl, Template template, List<?> args) {
        return new DateTemplate<T>(cl, template, ImmutableList.copyOf(args));
    }
8104
public final void setTemplate() {
        template = new HashMap();
        if (isEventExist()) {
            template.putAll(events.get(next));
        }
        template.put("event", eventType);
    }
584730
@Override
  public NlsMessage create(NlsTemplate template, String key1, Object argument1, String key2, Object argument2, String key3, Object argument3, String key4,
      Object argument4) {

    // CHECKSTYLE:ON

    Map<String, Object> arguments = new HashMap<>();
    arguments.put(key1, argument1);
    arguments.put(key2, argument2);
    arguments.put(key3, argument3);
    arguments.put(key4, argument4);
    return create(template, arguments);
  }
518536
public JsonResponse getTemplate(String template) throws IOException {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(Template.PARAM_TEMPLATE, template);
        return apiGet(ApiAction.template, data);
    }
875515
private ProcTemplate createTemplate(Template template) {
        if (!template.isEmpty()) {
            return new ProcTemplate(templateElementFactory.createTemplateList(template.getElements()));
        } else {
            return ProcTemplate.EMPTY;
        }
    }
707607
function(template) {

		var i = 0,
			count = template.length,
			result = [];

		for (; i < count; i++) {

			if (typeof(template[i]) == 'string') {

				if (!Lava.EMPTY_REGEX.test(template[i])) Lava.t("Text between tags is not allowed in this context. You may want to use a lava-style comment ({* ... *})");

			} else {

				result.push(template[i]);

			}

		}

		return result;

	}
1102647
public static <T extends Comparable<?>> TimeTemplate<T> timeTemplate(Class<? extends T> cl, String template, List<?> args) {
        return timeTemplate(cl, createTemplate(template), args);
    }
1110853
public static <T extends Number & Comparable<?>> NumberTemplate<T> numberTemplate(Class<? extends T> cl, Template template, List<?> args) {
        return new NumberTemplate<T>(cl, template, ImmutableList.copyOf(args));
    }
1012517
protected function createMessageContent(Twig_Template $template, array $context): MessageContent
    {
        $mimeType = $this->renderBlock($template, 'content_type', $context);
        $content = $mimeType === 'text/html'
            ? new HtmlMessageContent
            : new GenericMessageContent($mimeType);

        $context['_content'] = $content;
        $content->modify(
            $this->renderBlock($template, 'content', $context),
            $this->renderBlock($template, 'text_content', $context) ?: null
        );

        $attachments = array_filter(preg_split('/\s*[,;]\s*/', trim($this->renderBlock($template, 'attachments', $context))));
        foreach ($attachments as $path) {
            $content->attach($path);
        }

        return $content;
    }
229836
public static void showAlert(String title, String message, final Runnable callback) {

        final Window window = new Window();
        window.setModal(true);
        Panel panel = new Panel();
        panel.setCaption(title);
        panel.setWidth("500px");
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        panel.setContent(layout);
        layout.addComponent(new Label(message));
        Button okButton = new Button();
        okButton.addClickListener(new ClickListener() {

            /** The serial version id. */
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {

                window.close();
                if (callback != null) {
                    callback.run();
                }
            }
        });
        layout.addComponent(okButton);
        layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
        okButton.setCaption(
            org.opencms.workplace.Messages.get().getBundle(A_CmsUI.get().getLocale()).key(
                org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_OK_0));
        window.setContent(panel);
        window.setClosable(false);
        window.setResizable(false);
        A_CmsUI.get().addWindow(window);

    }
704282
public static PredicateTemplate predicateTemplate(Template template, List<?> args) {
        return new PredicateTemplate(template, ImmutableList.copyOf(args));
    }
1650
function createDomElementFromTemplate(html) {
    //match container markers like <@element/>
    let containerTags = html.match(rContainerGlobal) || [];

    for (let containerTag of containerTags) {
        let [, containerName, attrs = ''] = rContainer.exec(containerTag);
        let template = `<script type="x" ${ATTR}="${containerName}">${attrs.trim()}</script>`;

        html = html.split(containerTag).join(template);
    }

    //match attribute markers like <span @element></span>
    let allTags = html.match(rTags) || [];

    for (let tag of allTags) {
        let result = rAttr.exec(tag);

        if (result) {
            let elName = result[1];
            html = html.split(tag).join(tag.replace(`@${elName}`, `${ATTR}="${elName}"`));
        }
    }

    return $.create(html.trim());
}
806065
public void updateErrorTemplate(int statusCode, String template) throws SecurityException {
	checkWriteAccess();
	boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_DEBUGGING);
	if (!hasAccess) throw new SecurityException("no access to change error settings");

	Element error = _getRootElement("error");
	// if(template.trim().length()>0)
	error.setAttribute("template-" + statusCode, template);
    }
1052912
function createCustomNotification(notification) {
    if (!notification) {
        return Promise.resolve();
    }

    return Promise.each(notification.messages, function (message) {
        let toAdd = {
            // @NOTE: the update check service returns "0" or "1" (https://github.com/TryGhost/UpdateCheck/issues/43)
            custom: !!notification.custom,
            createdAt: moment(notification.created_at).toDate(),
            status: message.status || 'alert',
            type: message.type || 'info',
            id: message.id,
            dismissible: message.hasOwnProperty('dismissible') ? message.dismissible : true,
            top: !!message.top,
            message: message.content
        };

        debug('Add Custom Notification', toAdd);
        return api.notifications.add({notifications: [toAdd]}, {context: {internal: true}});
    });
}
538596
public static <T> TemplateExpression<T> template(Class<? extends T> cl, String template, List<?> args) {
        return template(cl, TemplateFactory.DEFAULT.create(template), args);
    }
1039544
@SafeVarargs
    public static <S, E extends Event> InputMapTemplate<S, E> sequence(InputMapTemplate<S, ? extends E>... templates) {
        return new TemplateChain<>(templates);
    }