Examples of ValidationResult


Examples of org.graylog2.plugin.database.validators.ValidationResult

        this.maxLength = maxLength;
    }

    @Override
    public ValidationResult validate(Object value) {
        final ValidationResult superResult = super.validate(value);

        if (superResult instanceof ValidationResult.ValidationPassed) {
            final String sValue = (String) value;
            if (sValue == null || sValue.length() <= maxLength) {
                new ValidationResult.ValidationPassed();
View Full Code Here

Examples of org.gwtoolbox.widget.client.form.validation.ValidationResult

    public FormValidationResult validate() {
        DefaultFormValidationResult result = new DefaultFormValidationResult();
        for (Map.Entry<String, FormField> entry : formFields.fieldByKey.entrySet()) {
            FormField field = entry.getValue();
            if (field.isEnabled()) {
                ValidationResult fieldResult = entry.getValue().validate();
                result.merge(field.getKey(), fieldResult);
            }
        }
        if (formValidator != null) {
            ValidationResult generalValidationResult = formValidator.validate(this);
            if (!generalValidationResult.isValid()) {
                result.setGeneralValidationResult(generalValidationResult);
            }
        }
        return result;
    }
View Full Code Here

Examples of org.hdiv.dataValidator.ValidationResult

    return application;
  }

  @Bean
  public ValidationResult validationResult() {
    ValidationResult result = new ValidationResult();
    return result;
  }
View Full Code Here

Examples of org.infinispan.schematic.internal.schema.ValidationResult

    }

    @Override
    public Results validate( Document document,
                             String schemaUri ) {
        ValidationResult result = new ValidationResult();
        SchemaDocument schema = schemaDocuments.get(schemaUri, result);
        if (schema != null) {
            schema.getValidator().validate(null, null, document, Paths.rootPath(), result, schemaDocuments);
        }
        return result;
View Full Code Here

Examples of org.jboss.as.console.client.shared.general.validation.ValidationResult

        toolstrip.providesDeleteOp(false);
        toolstrip.setPreValidation(new FormToolStrip.PreValidation() {
            @Override
            public boolean isValid() {
                ValidationResult validation = presenter.validateInterfaceConstraints(
                        form.getUpdatedEntity(),
                        form.getChangedValues()
                );


                errorMessages.setHTML("");

                if(!validation.isValid())
                {
                    SafeHtmlBuilder html = new SafeHtmlBuilder();
                    int i=0;
                    for(String detail : validation.getMessages())
                    {
                        if(i==0) html.appendHtmlConstant("<b>");
                        html.appendEscaped(detail).appendHtmlConstant("<br/>");
                        if(i==0) html.appendHtmlConstant("</b>");

                        i++;
                    }

                    //Feedback.alert("Invalid Interface Constraints", html.toSafeHtml());
                    errorMessages.setHTML(html.toSafeHtml());
                }
                return validation.isValid();


            }
        });
        form.bind(table);
View Full Code Here

Examples of org.jboss.forge.addon.parser.java.utils.ValidationResult

   public void validate(UIValidationContext context)
   {
      String className = component().getValue();
      if (!Strings.isNullOrEmpty(className))
      {
         ValidationResult result = JLSValidator.validateClassName(className);
         if (!result.getType().equals(ResultType.INFO))
         {
            context.addValidationError(component(), result.getMessage());
         }
      }
   }
View Full Code Here

Examples of org.jitterbit.integration.data.validation.ValidationResult

        public boolean equals(Object obj) {
            if (obj == this) {
                return true;
            }
            if (obj instanceof ValidationResult) {
                ValidationResult that = (ValidationResult) obj;
                return Sets.newHashSet(allMessages()).equals(Sets.newHashSet(that.allMessages()));
            }
            return false;
        }
View Full Code Here

Examples of org.milyn.validation.ValidationResult

*/
public class OrderTest extends TestCase {

    public void test_01() throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config.xml"));
        ValidationResult result = new ValidationResult();

        try {
            smooks.filterSource(new StreamSource(getClass().getResourceAsStream("order-message-01.xml")), result);

            assertEquals(4, result.getNumFailures());

            List<OnFailResult> errors = result.getErrors();
            List<OnFailResult> warnings = result.getWarnings();

            assertEquals(3, errors.size());
            assertEquals(1, warnings.size());

            assertEquals("Invalid customer number '123123' at 'order/header/customer/@number'.  Customer number must match pattern '[A-Z]-[0-9]{5}'.", errors.get(0).getMessage());
View Full Code Here

Examples of org.netbeans.modules.php.api.validation.ValidationResult

    @Override
    public String getErrorMessage() {
        if (getPanel().isSupportEnabled()) {
            // validate
            ValidationResult validationResult = new CustomizerValidator(phpModule)
                    .validate(getPanel().getAppDirectory())
                    .getResult();

            if (validationResult.hasErrors()) {
                return validationResult.getErrors().get(0).getMessage();
            }
        }

        return null;
    }
View Full Code Here

Examples of org.olat.core.gui.render.ValidationResult

                //validation does a voting about where the GUIMsg is rendered
                if(!validForDispatching){
                  // not valid: fire oldtimestamp event and later rerender
                  fireEvent(ureq, OLDTIMESTAMPCALL);
                }
                ValidationResult vr = vv.getValidationResult();
   
                boolean newJsCssAdded= vr.getJsAndCSSAdder().finishAndCheckChange();
                String newModUri = vr.getNewModuleURI();
                // !validForDispatching ||
                if (newJsCssAdded || newModUri != null) {
                  // send 302 redirect so the ajax-iframe's parent window gets reloaded to either include new js/css or to prepare the address bar
                  // url for asynchronous requests when delivering inline-contentpackaging.
                  // set window id to cur id, timestamp to current timestamp,
                  // component id to -1 -> indicates rerender
                  String uri = buildURIForRedirect(newModUri); // newModUri == null in case "just" new css or js libs have been added
                  // set this only for the first request (the .html request), but clear it afterwards for asyncmedia
                  validatingCausedRerendering = true;
                  Command rmrcom = CommandFactory.createParentRedirectTo(uri);
                  wbackofficeImpl.sendCommandTo(rmrcom);
                  //OLAT-4563: so the timestamp is not incremented, we do only a redirect
                  setDirty(false);
                } else {
                  // inline rendering by selectively replacing the dirty components in the dom tree of the browser
                  wbackofficeImpl.fireCycleEvent(Window.BEFORE_INLINE_RENDERING);
         
                  // Start by preparing the client: must be called prior to the
                  // other commands to not overwrite the form o2c dirty flag
                  // wich might be set by later commands
                  if (!this.isDirty()) {
                    wbackofficeImpl.sendCommandTo(CommandFactory.createPrepareClientCommand(wbackofficeImpl.getBusinessControlPath()));
                  }
                 
                  // Add the js and css files and related pre init commands
                  Command jscsscom = jsAndCssAdder.extractJSCSSCommand();
                  wbackofficeImpl.sendCommandTo(jscsscom);
                 
                  // Add the DOM replacement commands. Must be called after the
                  // js and css commands. Inline JS scripts might have
                  // dependencies to previously loaded js libs
                  if (this.isDirty()) {
                    // special case: when the window itself is dirty we require
                    // a full page refresh in any case
                    String reRenderUri = buildURIFor(this, timestampID, null);
                    Command rmrcom = CommandFactory.createParentRedirectTo(reRenderUri);
                    wbackofficeImpl.sendCommandTo(rmrcom);
                    this.setDirty(false);
                  } else {
                    // check for dirty child components in the component tree
                    Command co = handleDirties();
                   
                    //DUMP FOR EACH CLICK THE CURRENT JumpInPath -> for later usage and debugging.
                    //System.err.println("V^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^V");
                    WindowControl current = (WindowControl)wbackofficeImpl.getWindow().getAttribute("BUSPATH");
                    //System.err.println(current != null ? JumpInManager.getRestJumpInUri(current.getBusinessControl()) : "NONE");
                    //System.err.println("T^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^T");
                    wbackofficeImpl.fireCycleEvent(AFTER_INLINE_RENDERING);
                    if (co != null) { // see method handleDirties for the rare case of co == null even if there are dirty components;
                      wbackofficeImpl.sendCommandTo(co);
                    }
                  }
                }
              } else { // not inline
                if(!validForDispatching){
                  // not valid: fire oldtimestamp event
                  fireEvent(ureq, OLDTIMESTAMPCALL);
                }
                // not inline, new mediaresource
                // send it to the parent window (e.g. an excel download, but could also be a 302 redirect)
                // if the browser has e.g. pdf configured to be displayed inline, we want it to fill the whole area (self window), not the hidden iframe.
                // the same for 302.
                // -> send a command which offers a new location for the main window.
                // create a mapper which maps this mediaresource, and serves it once only
                MediaResourceMapper extMRM = new MediaResourceMapper();
                extMRM.setMediaResource(mmr);
                //FIXME:fj:b deregister old mapper, or reuse current one
                String res = MapperRegistry.getInstanceFor(ureq.getUserSession()).register(extMRM)+"/";
                // e.g. res = /olat/m/10001/
                Command rmrcom = CommandFactory.createParentRedirectForExternalResource(res);
                wbackofficeImpl.sendCommandTo(rmrcom);
              }
            } else { // not dispatched
              Tracing.logDebug("Found a valid timestamp but could not dispatch to component: ureq.compid:"+ureq.getComponentID()+" ureq.win-ts:"+ureq.getTimestampID()+" ureq.comp-ts:"+ureq.getComponentTimestamp() + " target.timestamp:" + target.getTimestamp() + " target=" + target, this.getClass());
              String reRenderUri = buildURIFor(this, timestampID, null);
              Command rmrcom = CommandFactory.createParentRedirectTo(reRenderUri);
              wbackofficeImpl.sendCommandTo(rmrcom);
            }
            MediaResource jsonmr = wbackofficeImpl.extractCommands(true);
            ServletUtil.serveResource(request, response, jsonmr);
          } catch (Throwable th) {
            // in any case, try to inform the user appropriately.
            // a) error while dispatching (e.g. db problem, npe, ...)
            // b) for inline: error while validating or json-rendering dirty components.
           
            // since an error has occured for a request which is targeted in the background iframe, we need to redirect to the error window.
            // create the error window
            try {
              Tracing.logDebug("Error in Window, rollback", getClass());
              DBFactory.getInstance().rollback();
           
              ChiefController msgcc = MsgFactory.createMessageChiefController(ureq, th);
              Window errWindow = msgcc.getWindow();
              // register window
              Windows.getWindows(ureq).registerWindow(errWindow);
              // redirect to the error window
              String newWinUri = buildRenderOnlyURIFor(errWindow);
              Command rmrcom = CommandFactory.createParentRedirectTo(newWinUri);
              wbackofficeImpl.sendCommandTo(rmrcom);
              MediaResource jsonmr = wbackofficeImpl.extractCommands(true);
              ServletUtil.serveResource(request, response, jsonmr);
            } catch (Throwable anotherTh) {
              Tracing.logError("Exception while handling exception!!!!", anotherTh, this.getClass());
            }
          }
          return;
        }
      }
     
      // -------------------------
      // ----- standard mode -----
      // -------------------------
      if (renderOnly || timestampID == null) {
        inline = true;
        validate = true;
      } else if (validatingCausedRerendering && timestampID.equals("-1")) {
        // the first request after the 302 redirect cause by a component validation
        // -> just rerender, but clear the flag for further async media requests
        validatingCausedRerendering = false;
        inline = true;
        validate = false; // no need to revalidate right now
        checkNewWindow = false;
        dispatch = false;
      else {
        // [POST: !renderOnly && timestampID != null]
        // if we had a inline rendering at least once (latestTimestamp is
        // set), then check for an old timestamp
        //System.out.println("dispatch normal: compid:"+ureq.getComponentID()+" win-ts:"+ureq.getTimestampID()+" comp-ts:"+ureq.getComponentTimestamp());
        if (latestTimestamp != null && !timestampID.equals(latestTimestamp)) {
          // this is not a link from the latest rendering, but from a previous
          // one, since it has a wrong timestamp parameter -> check for
          // asynchronous media
          if (asyncMediaResponsible == null) { // no async resp.
            // assume it to be a link from an old window (using browser back or
            // "open in new
            // window/tab" in the browser).
            if ((componentID != null && componentID.equals("-1")) || (ureq.getParameter("o_winrndo") != null)) {
              // just rerender
            else {
              // not a valid timestamp -> most likely a browser back or forward event (or a copy/paste of a url) ->

              // fire event to listening chiefcontroller
              fireEvent(ureq, OLDTIMESTAMPCALL);
              /*
               *
               * REVIEW:PB: this will be the code allowing back forward navigation
               * ---->
              // look at the timestamps more thoroughly.
              if (!timestampID.equals("-1")) {
                int diff = findInHistory(ureq);
                // diff == 0 -> reload (->ignore, so it will cause a simple rerendering)
                // diff < 0  -> browser-back
                // diff > 0  -> browser-forward
                //System.out.println("!!!!(normal) back: diff "+diff);
                wbackofficeImpl.browserBackOrForward(ureq, diff);
              } // else a 302 redirect of the main window -> simply rerender
              if (ureq.getComponentID() != null) {
                //System.out.println("normal: compid:"+ureq.getComponentID()+" win-ts:"+ureq.getTimestampID()+" comp-ts:"+ureq.getComponentTimestamp());
              } else {
                //System.out.println("special url - no component part (e.g. 302 redirect because of new req. js / css) compid:"+ureq.getComponentID()+" win-ts:"+ureq.getTimestampID()+" comp-ts:"+ureq.getComponentTimestamp());
              }
              validate = true;
              <------------- */
            }
            // just rerender current window
            inline = true;
            // do not increment timestamp so that e.g. url in a iframe remain valid
            incTimestamp = false;
          } else {
            // some component will take care of it for the moment, so be it
            mr = asyncMediaResponsible.getAsyncMediaResource(ureq);
            if (mr == null) { // indicates inline rendering
              inline = true;
              checkNewWindow = true; // an inline rendered async link should be
              // able to produce a new window
              validate = true;
            } else { // serve the resource.
              // all flags remain at their default value
            }
          }
        } else {
          // latestTimestamp == null || timestampID.equals(latestTimestamp)
         
          dispatch = true;
          checkNewWindow = true;
          validate = true;       
        }
      }
      // end of simple flagging.
      long dstart = 0;
      if (isDebugLog) {
        dstart = System.currentTimeMillis();
        long syncIntroDiff = dstart - debug_start;
        debugMsg.append("sync_bdisp:").append(syncIntroDiff).append(LOG_SEPARATOR);
      }
     
      if (dispatch) {
        boolean didDispatch = doDispatchToComponent(ureq, debugMsg);
        if (isDebugLog) {
          long dstop = System.currentTimeMillis();
          long diff = dstop - dstart;
          debugMsg.append("disp_comp:").append(diff).append(LOG_SEPARATOR);
          //Tracing.logDebug("componentdispatchtime: " + (dstop - dstart), Window.class);
        }
        if (didDispatch) { // the component with the given id was found
          mr = ureq.getDispatchResult().getResultingMediaResource();
          if (mr == null) {
            inline = true;
          } else {
            inline = false;
          }
        } else {
          // component with id was not found -> probably asynchronous thread changed flow ->
          // just rerender
          inline = true;
          dispatch = false;
          checkNewWindow = false;
          validate = true;
        }

      }

      if (checkNewWindow) {
        Window resWindow = ureq.getDispatchResult().getResultingWindow();
        if (resWindow != null) {
          // register it first, if not done before
          Windows ws = Windows.getWindows(ureq);
          if (!ws.isRegistered(resWindow)) {
            resWindow.setUriPrefix(uriPrefix);
            ws.registerWindow(resWindow);
          }
          // render initial state of new window by redirecting (302) to the new
          // window id. needed for asyncronous data like images loaded
         
          // todo maybe better delegate window registry to the windowbackoffice?
          URLBuilder ubu = new URLBuilder(uriPrefix, resWindow.getInstanceId(), String.valueOf(resWindow.timestamp), resWindow.wbackofficeImpl);
          StringOutput sout = new StringOutput(30);
          ubu.buildURI(sout, null, null);
          mr = new RedirectMediaResource(sout.toString());
          ServletUtil.serveResource(request, response, mr);
          if (isDebugLog) {
            long diff = System.currentTimeMillis() - debug_start;
            debugMsg.append("rdirnw:").append(diff).append(LOG_SEPARATOR);
            Tracing.logDebug(debugMsg.toString(), Window.class);
          }
          return;
        }
      }

      if (inline) {
          // do inline rendering.
         
          Container top = getContentPane();
          // validate prior to rendering, but only if the timestamp was not null
          // /
          // the component just got dispatched
          if (validate) { // do not validate if a previous validate lead to a
            // redirect; validating makes no sense here
            //long t1 = System.currentTimeMillis();
            ValidatingVisitor vv = new ValidatingVisitor(gsettings, jsAndCssAdder);
            ComponentTraverser ct = new ComponentTraverser(vv, top, false);
            ct.visitAll(ureq);
            wbackofficeImpl.fireCycleEvent(Window.AFTER_VALIDATING);
            ValidationResult vr = vv.getValidationResult();
            String newModUri = vr.getNewModuleURI();

            vr.getJsAndCSSAdder().finishAndCheckChange(); // ignore the return value since we are just about rendering anyway
         
            if (newModUri != null) {
              // send 302 redirect without dispatching, but just rerender
              // inline.
              // set window id to cur id, timestamp to current timestamp,
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.