Examples of Constraint


Examples of org.drools.core.spi.Constraint

        }

        String expression = expressionBuilder.toString();
        MVELCompilationUnit compilationUnit = getConstraintBuilder( context ).buildCompilationUnit(context, pattern, expression, mvelCtx.getAliases());

        Constraint combinedConstraint = getConstraintBuilder( context ).buildMvelConstraint( packageNames,
                                                                                             expression,
                                                                                             declarations.toArray(new Declaration[declarations.size()]),
                                                                                             compilationUnit,
                                                                                             IndexUtil.ConstraintType.UNKNOWN,
                                                                                             null, null, false );
View Full Code Here

Examples of org.drools.factconstraints.server.Constraint

        conf.setFieldName("age");
    }

    @Test
    public void testValidConstraint() {
      Constraint cons = new IntegerConstraint();
     
        ValidationResult result = cons.validate(12, conf);
        assertTrue(result.isSuccess());

        result = cons.validate(new Integer("12"), conf);
        assertTrue(result.isSuccess());

        result = cons.validate("12", conf);
        assertTrue(result.isSuccess());

    }
View Full Code Here

Examples of org.drools.ide.common.server.factconstraints.Constraint

        conf.setFieldName("age");
    }

    @Test
    public void testValidConstraint() {
        Constraint cons = new IntegerConstraint();

        ValidationResult result = cons.validate(12, conf);
        assertTrue(result.isSuccess());

        result = cons.validate(new Integer("12"), conf);
        assertTrue(result.isSuccess());

        result = cons.validate("12", conf);
        assertTrue(result.isSuccess());

    }
View Full Code Here

Examples of org.drools.ruleflow.core.Constraint

                        ruleSet3,
                        Connection.TYPE_NORMAL );
        new ConnectionImpl( ruleSet3,
                        end,
                        Connection.TYPE_NORMAL );
        Constraint constraint1 = new org.drools.ruleflow.core.impl.ConstraintImpl();
        constraint1.setPriority(1);
        split.setConstraint(out1, constraint1);
        Constraint constraint2 = new org.drools.ruleflow.core.impl.ConstraintImpl();
        constraint2.setPriority(2);
        split.setConstraint(out2, constraint2);

        // process
        final RuleFlowProcess process = new RuleFlowProcessImpl();
        process.setId( "1" );
View Full Code Here

Examples of org.drools.spi.Constraint

                addedDeclaration.setBindingName( decl.getBindingName() );
            }
        }

        for ( Constraint oldConstr : this.constraints ) {
            Constraint clonedConstr = oldConstr.clone();

            // we must update pattern references in cloned declarations
            Declaration[] oldDecl = oldConstr.getRequiredDeclarations();
            Declaration[] newDecl = clonedConstr.getRequiredDeclarations();
            for ( int i = 0; i < newDecl.length; i++ ) {
                if ( newDecl[i].getPattern() == this ) {
                    newDecl[i].setPattern( clone );
                    // we still need to call replace because there might be nested declarations to replace
                    clonedConstr.replaceDeclaration( oldDecl[i],
                                                     newDecl[i] );
                }
            }

            clone.addConstraint(clonedConstr);
View Full Code Here

Examples of org.drools.verifier.components.Constraint

            field = ObjectTypeFactory.createField( descr.getFieldName(),
                                                   objectType );
            data.add( field );
        }

        constraint = new Constraint( pattern );

        constraint.setFieldPath( field.getPath() );
        constraint.setFieldName( field.getName() );
        constraint.setPatternIsNot( pattern.isPatternNot() );
        constraint.setFieldPath( field.getPath() );
View Full Code Here

Examples of org.drools.workflow.core.Constraint

        } else {
            xmlDump.append(">" + EOL);
            xmlDump.append("      <constraints>" + EOL);
            for (Map.Entry<ConnectionRef, Constraint> entry: splitNode.getConstraints().entrySet()) {
                ConnectionRef connection = entry.getKey();
                Constraint constraint = entry.getValue();
                xmlDump.append("        <constraint "
                    + "toNodeId=\"" + connection.getNodeId() + "\" "
                    + "toType=\"" + connection.getToType() + "\" ");
                String name = constraint.getName();
                if (name != null && !"".equals(name)) {
                    xmlDump.append("name=\"" + XmlDumper.replaceIllegalChars(constraint.getName()) + "\" ");
                }
                int priority = constraint.getPriority();
                if (priority != 0) {
                    xmlDump.append("priority=\"" + constraint.getPriority() + "\" ");
                }
                xmlDump.append("type=\"" + constraint.getType() + "\" ");
                String dialect = constraint.getDialect();
                if (dialect != null && !"".equals(dialect)) {
                    xmlDump.append("dialect=\"" + dialect + "\" ");
                }
                String constraintString = constraint.getConstraint();
                if (constraintString != null) {
                    xmlDump.append(">" + XmlDumper.replaceIllegalChars(constraintString) + "</constraint>" + EOL);
                } else {
                    xmlDump.append("/>" + EOL);
                }
View Full Code Here

Examples of org.eclipse.jetty.http.security.Constraint

        jndi.bind("myAuthHandler", getSecurityHandler());
        return jndi;
    }

    private SecurityHandler getSecurityHandler() throws IOException {
        Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, "user");
        constraint.setAuthenticate(true);

        ConstraintMapping cm = new ConstraintMapping();
        cm.setPathSpec("/*");
        cm.setConstraint(constraint);

View Full Code Here

Examples of org.eclipse.jetty.util.security.Constraint

    conn.setHost("127.0.0.1");
    return conn;
  }

  private SecurityHandler makeSecurityHandler(String password) {
    Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, "user");
    constraint.setAuthenticate(true);
    constraint.setRoles(new String[]{"user"});
    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");
    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new BasicAuthenticator());
View Full Code Here

Examples of org.eclipse.ocl.ecore.Constraint

    String expession = permission.getConstraint().getExpession();
    OCL<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, Constraint, EClass, EObject> ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);
    OCLHelper<EClassifier, ?, ?, Constraint> helper = ocl.createOCLHelper();
    helper.setContext(permission);
    try {
      Constraint constraint = helper.createInvariant(expession);
      Query<EClassifier, EClass, EObject> constraintEval = ocl.createQuery(constraint);
      return constraintEval.check(permissionInstance);
    } catch (ParserException e) {
      e.printStackTrace();
      throw new UamClientException(MessageFormat.format("Incorrect expression: {0}. {1}", expession, e.getLocalizedMessage()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.