Search in sources :

Example 16 with MapAccessor

use of org.springframework.context.expression.MapAccessor in project spring-boot-admin by codecentric.

the class OpsGenieNotifier method getMessage.

@Nullable
protected String getMessage(InstanceEvent event, Instance instance) {
    Map<String, Object> root = new HashMap<>();
    root.put("event", event);
    root.put("instance", instance);
    root.put("lastStatus", getLastStatus(event.getInstance()));
    StandardEvaluationContext context = new StandardEvaluationContext(root);
    context.addPropertyAccessor(new MapAccessor());
    return description.getValue(context, String.class);
}
Also used : StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) HashMap(java.util.HashMap) MapAccessor(org.springframework.context.expression.MapAccessor) Nullable(javax.annotation.Nullable)

Example 17 with MapAccessor

use of org.springframework.context.expression.MapAccessor in project spring-boot-admin by codecentric.

the class HipchatNotifier method getMessage.

@Nullable
protected String getMessage(InstanceEvent event, Instance instance) {
    Map<String, Object> root = new HashMap<>();
    root.put("event", event);
    root.put("instance", instance);
    root.put("lastStatus", getLastStatus(event.getInstance()));
    StandardEvaluationContext context = new StandardEvaluationContext(root);
    context.addPropertyAccessor(new MapAccessor());
    return description.getValue(context, String.class);
}
Also used : StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) HashMap(java.util.HashMap) MapAccessor(org.springframework.context.expression.MapAccessor) Nullable(javax.annotation.Nullable)

Example 18 with MapAccessor

use of org.springframework.context.expression.MapAccessor in project spring-boot-admin by codecentric.

the class MicrosoftTeamsNotifier method createEvaluationContext.

protected StandardEvaluationContext createEvaluationContext(InstanceEvent event, Instance instance) {
    Map<String, Object> root = new HashMap<>();
    root.put("event", event);
    root.put("instance", instance);
    root.put("lastStatus", getLastStatus(event.getInstance()));
    StandardEvaluationContext context = new StandardEvaluationContext(root);
    context.addPropertyAccessor(new MapAccessor());
    return context;
}
Also used : StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) HashMap(java.util.HashMap) MapAccessor(org.springframework.context.expression.MapAccessor)

Example 19 with MapAccessor

use of org.springframework.context.expression.MapAccessor in project spring-boot-admin by codecentric.

the class PagerdutyNotifier method getDescription.

@Nullable
protected String getDescription(InstanceEvent event, Instance instance) {
    Map<String, Object> root = new HashMap<>();
    root.put("event", event);
    root.put("instance", instance);
    root.put("lastStatus", getLastStatus(event.getInstance()));
    StandardEvaluationContext context = new StandardEvaluationContext(root);
    context.addPropertyAccessor(new MapAccessor());
    return description.getValue(context, String.class);
}
Also used : StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) HashMap(java.util.HashMap) MapAccessor(org.springframework.context.expression.MapAccessor) Nullable(javax.annotation.Nullable)

Example 20 with MapAccessor

use of org.springframework.context.expression.MapAccessor in project cas by apereo.

the class AbstractCasWebflowConfigurer method getSpringExpressionParser.

/**
 * Gets spring expression parser.
 *
 * @return the spring expression parser
 */
public SpringELExpressionParser getSpringExpressionParser() {
    val configuration = new SpelParserConfiguration();
    val spelExpressionParser = new SpelExpressionParser(configuration);
    val parser = new SpringELExpressionParser(spelExpressionParser, this.flowBuilderServices.getConversionService());
    parser.addPropertyAccessor(new ActionPropertyAccessor());
    parser.addPropertyAccessor(new BeanFactoryPropertyAccessor());
    parser.addPropertyAccessor(new FlowVariablePropertyAccessor());
    parser.addPropertyAccessor(new MapAdaptablePropertyAccessor());
    parser.addPropertyAccessor(new MessageSourcePropertyAccessor());
    parser.addPropertyAccessor(new ScopeSearchingPropertyAccessor());
    parser.addPropertyAccessor(new BeanExpressionContextAccessor());
    parser.addPropertyAccessor(new MapAccessor());
    parser.addPropertyAccessor(new MapAdaptablePropertyAccessor());
    parser.addPropertyAccessor(new EnvironmentAccessor());
    parser.addPropertyAccessor(new ReflectivePropertyAccessor());
    return parser;
}
Also used : lombok.val(lombok.val) ActionPropertyAccessor(org.springframework.webflow.expression.spel.ActionPropertyAccessor) MessageSourcePropertyAccessor(org.springframework.webflow.expression.spel.MessageSourcePropertyAccessor) BeanFactoryPropertyAccessor(org.springframework.webflow.expression.spel.BeanFactoryPropertyAccessor) ScopeSearchingPropertyAccessor(org.springframework.webflow.expression.spel.ScopeSearchingPropertyAccessor) FlowVariablePropertyAccessor(org.springframework.webflow.expression.spel.FlowVariablePropertyAccessor) SpringELExpressionParser(org.springframework.binding.expression.spel.SpringELExpressionParser) ReflectivePropertyAccessor(org.springframework.expression.spel.support.ReflectivePropertyAccessor) BeanExpressionContextAccessor(org.springframework.context.expression.BeanExpressionContextAccessor) SpelExpressionParser(org.springframework.expression.spel.standard.SpelExpressionParser) MapAccessor(org.springframework.context.expression.MapAccessor) EnvironmentAccessor(org.springframework.context.expression.EnvironmentAccessor) MapAdaptablePropertyAccessor(org.springframework.webflow.expression.spel.MapAdaptablePropertyAccessor) SpelParserConfiguration(org.springframework.expression.spel.SpelParserConfiguration)

Aggregations

MapAccessor (org.springframework.context.expression.MapAccessor)20 StandardEvaluationContext (org.springframework.expression.spel.support.StandardEvaluationContext)17 HashMap (java.util.HashMap)11 Nullable (javax.annotation.Nullable)7 SpelExpressionParser (org.springframework.expression.spel.standard.SpelExpressionParser)6 Test (org.junit.Test)4 Expression (org.springframework.expression.Expression)4 Map (java.util.Map)3 BeanFactoryResolver (org.springframework.context.expression.BeanFactoryResolver)3 EnvironmentAccessor (org.springframework.context.expression.EnvironmentAccessor)3 Method (java.lang.reflect.Method)2 SpringELExpressionParser (org.springframework.binding.expression.spel.SpringELExpressionParser)2 BeanExpressionContextAccessor (org.springframework.context.expression.BeanExpressionContextAccessor)2 ExpressionParser (org.springframework.expression.ExpressionParser)2 PropertyAccessor (org.springframework.expression.PropertyAccessor)2 SpelParserConfiguration (org.springframework.expression.spel.SpelParserConfiguration)2 ReflectivePropertyAccessor (org.springframework.expression.spel.support.ReflectivePropertyAccessor)2 StandardTypeConverter (org.springframework.expression.spel.support.StandardTypeConverter)2 ActionPropertyAccessor (org.springframework.webflow.expression.spel.ActionPropertyAccessor)2 BeanFactoryPropertyAccessor (org.springframework.webflow.expression.spel.BeanFactoryPropertyAccessor)2