/** * Set the {@link Condition} of this {@link Rule} instance. */ public RuleBuilder when(final Condition condition) { if (this.condition == null) this.condition = condition; else if (condition instanceof ConditionBuilder) this.condition = ((ConditionBuilder) this.condition).and(condition); else this.condition = Conditions.wrap(this.condition).and(condition); return this; }
if (SourceMode.isDisabled().evaluate(event, context))
@Override public Configuration getConfiguration(RuleLoaderContext ruleLoaderContext) { String ruleIDPrefix = getClass().getSimpleName(); return ConfigurationBuilder.begin().addRule() .when(JavaClass .references("javax.persistence.Entity").at(TypeReferenceLocation.ANNOTATION).as(ENTITY_ANNOTATIONS) .or(JavaClass.references("javax.persistence.Table").at(TypeReferenceLocation.ANNOTATION).as(TABLE_ANNOTATIONS_LIST)) .or(JavaClass.references("javax.persistence.NamedQuery").at(TypeReferenceLocation.ANNOTATION).as(NAMED_QUERY_LIST)) .or(JavaClass.references("javax.persistence.NamedQueries").at(TypeReferenceLocation.ANNOTATION).as(NAMED_QUERIES_LIST)) .or(JavaClass.references("javax.persistence.DiscriminatorValue").at(TypeReferenceLocation.ANNOTATION).as(DISCRIMINATOR_VALUE_LIST)) ) .perform(Iteration.over(ENTITY_ANNOTATIONS).perform(new AbstractIterationOperation<JavaTypeReferenceModel>() { @Override public void perform(GraphRewrite event, EvaluationContext context, JavaTypeReferenceModel payload) { extractEntityBeanMetadata(event, payload); } }).endIteration()) .withId(ruleIDPrefix + "_JPAEntityBeanRule"); }
if (SourceMode.isDisabled().evaluate(event, context))
@Override public Configuration getConfiguration(RuleLoaderContext ruleLoaderContext) { String ruleIDPrefix = getClass().getSimpleName(); return ConfigurationBuilder.begin().addRule() .when(JavaClass .references("javax.persistence.Entity").at(TypeReferenceLocation.ANNOTATION).as(ENTITY_ANNOTATIONS) .or(JavaClass.references("javax.persistence.Table").at(TypeReferenceLocation.ANNOTATION).as(TABLE_ANNOTATIONS_LIST)) .or(JavaClass.references("javax.persistence.NamedQuery").at(TypeReferenceLocation.ANNOTATION).as(NAMED_QUERY_LIST)) .or(JavaClass.references("javax.persistence.NamedQueries").at(TypeReferenceLocation.ANNOTATION).as(NAMED_QUERIES_LIST)) .or(JavaClass.references("javax.persistence.DiscriminatorValue").at(TypeReferenceLocation.ANNOTATION).as(DISCRIMINATOR_VALUE_LIST)) ) .perform(Iteration.over(ENTITY_ANNOTATIONS).perform(new AbstractIterationOperation<JavaTypeReferenceModel>() { @Override public void perform(GraphRewrite event, EvaluationContext context, JavaTypeReferenceModel payload) { extractEntityBeanMetadata(event, payload); } }).endIteration()) .withId(ruleIDPrefix + "_JPAEntityBeanRule"); }
/** * Set the {@link Condition} of this {@link Rule} instance. */ public RuleBuilder when(final Condition condition) { if (this.condition == null) this.condition = condition; else if (condition instanceof ConditionBuilder) this.condition = ((ConditionBuilder) this.condition).and(condition); else this.condition = Conditions.wrap(this.condition).and(condition); return this; }
.addRule() .when(JavaClass.references("javax.persistence.Entity").at(TypeReferenceLocation.ANNOTATION).as(ENTITY_ANNOTATIONS) .or(JavaClass.references("javax.persistence.Table").at(TypeReferenceLocation.ANNOTATION).as(TABLE_ANNOTATIONS_LIST))) .perform(Iteration.over(ENTITY_ANNOTATIONS).perform(new AbstractIterationOperation<JavaTypeReferenceModel>()
@Override public Join to(final String resource) { if (this.resourcePattern != null) { throw new IllegalStateException("Cannot set resource path more than once."); } this.resourcePattern = resource; this.resourcePath = Path.matches(resource); Set<String> parameters = getPathRequestParameters(); if (outboundConditionCache == null) { this.outboundConditionCache = resourcePath; for (String name : parameters) { Query parameter = Query.parameterExists(name); outboundConditionCache = outboundConditionCache.and(parameter); } } return this; }
@Override public Join to(final String resource) { if (this.resourcePattern != null) { throw new IllegalStateException("Cannot set resource path more than once."); } this.resourcePattern = resource; this.resourcePath = Path.matches(resource); Set<String> parameters = getPathRequestParameters(); if (outboundConditionCache == null) { this.outboundConditionCache = resourcePath; for (String name : parameters) { Query parameter = Query.parameterExists(name); outboundConditionCache = outboundConditionCache.and(parameter); } } return this; }
@Override public Join to(final String resource) { if (this.resourcePattern != null) { throw new IllegalStateException("Cannot set resource path more than once."); } this.resourcePattern = resource; this.resourcePath = Path.matches(resource); Set<String> parameters = getPathRequestParameters(); if (outboundConditionCache == null) { this.outboundConditionCache = resourcePath; for (String name : parameters) { Query parameter = Query.parameterExists(name); outboundConditionCache = outboundConditionCache.and(parameter); } } return this; }
piped.as(initialQueryID).evaluate(event,context);
@Override protected Configuration narrow(ExampleConfiguration appConfiguration) { if (appConfiguration != null && !Collections.isEmpty(appConfiguration.angularjsRoutes) ) { Set<String> paths = new HashSet<>(appConfiguration.angularjsRoutes); return ConfigurationBuilder.begin() .addRule() .when( Direction.isInbound() .and(Path.matches("/{path}")) .and(matchesAnyOfPaths(paths)) ) .perform( Log.message(Logger.Level.DEBUG, "Forwarding to index.html from {path}") .and(Forward.to("/index.html")) ); } return null; }
piped.as(initialQueryID).evaluate(event,context);