Examples of Validator


Examples of org.apache.pivot.wtk.validation.Validator

        textinputDateRegex.setValidator(new RegexTextValidator(
            "(19|20)\\d\\d[- /.](0[1-9]|1[012])[-/.](0[1-9]|[12][0-9]|3[01])"));

        // creating a custom model that only accepts "true" or "false"
        textinputCustomBoolean.setText("true");
        textinputCustomBoolean.setValidator(new Validator() {
            @Override
            public boolean isValid(String s) {
                return "true".equals(s) || "false".equals(s);
            }
        });

Examples of org.apache.sling.validation.api.Validator

            Map<String, String>> validators) {
        if (!propertyType.isValid(value)) {
            result.addFailureMessage(property, "Property was expected to be of type " + propertyType.getName());
        }
        for (Map.Entry<Validator, Map<String, String>> validatorEntry : validators.entrySet()) {
            Validator validator = validatorEntry.getKey();
            Map<String, String> arguments = validatorEntry.getValue();
            try {
                String validatorMessage = validator.validate(value, arguments);
                if (validatorMessage != null) {
                    if (validatorMessage.isEmpty()) {
                        validatorMessage = "Property does not contain a valid value for the " + validator
                                .getClass().getName() + " validator";
                    }
                    result.addFailureMessage(property, validatorMessage);
                }
            } catch (SlingValidationException e) {
                // wrap in another SlingValidationException to include information about the property
                throw new SlingValidationException("Could not call validator " + validator
                        .getClass().getName() + " for resourceProperty " + property, e);
            }
        }
    }

Examples of org.apache.sqoop.validation.Validator

    try {
      SqoopConnector connector =
        ConnectorManager.getInstance().getConnector(newConnector
          .getUniqueName());

      Validator validator = connector.getValidator();

      boolean upgradeSuccessful = true;

      MetadataUpgrader upgrader = connector.getMetadataUpgrader();
      List<MConnection> connections = findConnectionsForConnector(
        connectorID);
      List<MJob> jobs = findJobsForConnector(connectorID);
      // -- BEGIN TXN --
      tx = getTransaction();
      tx.begin();
      deleteConnectionsAndJobs(connections, jobs, tx);
      updateConnector(newConnector, tx);
      for (MConnection connection : connections) {
        long connectionID = connection.getPersistenceId();
        // Make a new copy of the forms from the connector,
        // else the values will get set in the forms in the connector for
        // each connection.
        List<MForm> forms = newConnector.getConnectionForms().clone(false).getForms();
        MConnectionForms newConnectionForms = new MConnectionForms(forms);
        upgrader.upgrade(connection.getConnectorPart(), newConnectionForms);
        MConnection newConnection = new MConnection(connectorID,
          newConnectionForms, connection.getFrameworkPart());
        newConnection.setPersistenceId(connectionID);

        // Transform form structures to objects for validations
        Object newConfigurationObject = ClassUtils.instantiate(connector.getConnectionConfigurationClass());
        FormUtils.fromForms(newConnection.getConnectorPart().getForms(), newConfigurationObject);

        Validation validation = validator.validateConnection(newConfigurationObject);
        if (validation.getStatus().canProceed()) {
          updateConnection(newConnection, tx);
        } else {
          logInvalidModelObject("connection", newConnection, validation);
          upgradeSuccessful = false;
        }
      }
      for (MJob job : jobs) {
        // Make a new copy of the forms from the connector,
        // else the values will get set in the forms in the connector for
        // each connection.
        List<MForm> forms = newConnector.getJobForms(job.getType()).clone(false).getForms();
        MJobForms newJobForms = new MJobForms(job.getType(), forms);
        upgrader.upgrade(job.getConnectorPart(), newJobForms);
        MJob newJob = new MJob(connectorID, job.getConnectionId(),
          job.getType(), newJobForms, job.getFrameworkPart());
        newJob.setPersistenceId(job.getPersistenceId());

        // Transform form structures to objects for validations
        Object newConfigurationObject = ClassUtils.instantiate(connector.getJobConfigurationClass(job.getType()));
        FormUtils.fromForms(newJob.getConnectorPart().getForms(), newConfigurationObject);

        Validation validation = validator.validateJob(newJob.getType(), newConfigurationObject);
        if (validation.getStatus().canProceed()) {
          updateJob(newJob, tx);
        } else {
          logInvalidModelObject("job", newJob, validation);
          upgradeSuccessful = false;

Examples of org.apache.tapestry.form.validator.Validator

       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle(field);
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        field.getForm();
        fieldControl.setReturnValue(form);

        form.isClientValidationEnabled();
        formControl.setReturnValue(true);

        field.getForm();
        fieldControl.setReturnValue(form);

        form.getName();
        formControl.setReturnValue("myform");

        field.getName();
        fieldControl.setReturnValue("myfield");

        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());
       
        FormComponentContributorContext context = new FormComponentContributorContextImpl(field);
       
        validator.renderContribution(writer, cycle, context, field);
        validatorControl.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
        { new EqualsMatcher(), new EqualsMatcher(), new TypeMatcher(), new EqualsMatcher() }));       
       
        replayControls();

Examples of org.apache.tapestry5.Validator

    @SuppressWarnings("unchecked")
    @Test
    public void validator_with_no_constraint() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        FormSupport fs = mockFormSupport();

        Map<String, Validator> map = singletonMap("required", validator);

        train_getConstraintType(validator, null);

        train_getFormValidationId(fs, "form");

        train_getComponentResources(field, resources);

        train_getId(resources, "fred");
        train_getContainerMessages(resources, containerMessages);
        train_contains(containerMessages, "form-fred-required-message", false);
        train_contains(containerMessages, "fred-required-message", false);

        train_getLocale(resources, Locale.FRENCH);

        train_getValidationMessages(messagesSource, Locale.FRENCH, messages);

        train_getMessageKey(validator, "key");
        train_getMessageFormatter(messages, "key", formatter);

        train_isRequired(validator, false);
        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, null);

Examples of org.apache.ws.security.validate.Validator

            return secEngineOverride;
        }
       
        if (!utWithCallbacks) {
            Map<QName, Object> profiles = new HashMap<QName, Object>(1);
            Validator validator = new NoOpValidator();
            profiles.put(WSSecurityEngine.USERNAME_TOKEN, validator);
            return createSecurityEngine(profiles);
        }
       
        return null;

Examples of org.apache.wss4j.dom.validate.Validator

    ) throws WSSecurityException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Found SAML Assertion element");
        }
       
        Validator validator =
            data.getValidator(new QName(elem.getNamespaceURI(), elem.getLocalName()));
        Credential credential = handleSAMLToken(elem, data, validator, wsDocInfo);
        SamlAssertionWrapper samlAssertion = credential.getSamlAssertion();
        if (LOG.isDebugEnabled()) {
            LOG.debug("SAML Assertion issuer " + samlAssertion.getIssuerString());

Examples of org.apache.wss4j.stax.validate.Validator

    }
   
    private void setTokenValidators(
        WSSSecurityProperties properties, SoapMessage message
    ) throws WSSecurityException {
        Validator validator = loadValidator(SecurityConstants.SAML1_TOKEN_VALIDATOR, message);
        if (validator != null) {
            properties.addValidator(WSSConstants.TAG_saml_Assertion, validator);
        }
        validator = loadValidator(SecurityConstants.SAML2_TOKEN_VALIDATOR, message);
        if (validator != null) {

Examples of org.apache.xmlbeans.impl.validator.Validator

            SchemaField field = schemaField();
            SchemaType type = schemaType();

            TypeStore typeStore = get_store();

            Validator validator =
                new Validator(
                    type, field, typeStore.get_schematypeloader(), options, null);

            typeStore.validate( validator );

            return validator.isValid();
        }
    }

Examples of org.codehaus.plexus.formica.validation.Validator

            {
                for ( Iterator j = validators.iterator(); j.hasNext(); )
                {
                    org.codehaus.plexus.formica.Validator v = (org.codehaus.plexus.formica.Validator) j.next();

                    Validator validator = getValidator( v.getId() );

                    String elementData = (String) data.get( element.getId() );

                    boolean valid = validator.validate( elementData );

                    if ( valid )
                    {
                        result.addElementValidationResult( element.getId(), valid, null );
                    }
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.