Package org.megatome.frame2.errors

Examples of org.megatome.frame2.errors.Errors


    *
    * @throws JspException
    */
   @Override
   public int doStartTag() throws JspException {
      Errors errors = getErrors(this.pageContext);

      if ((errors == null) || errors.isEmpty()) {
         return EVAL_BODY_INCLUDE;
      }

      StringBuffer buffer = new StringBuffer();

      Locale locale = HTMLHelpers.getLocale(this.pageContext,this.localeKey);
      ResourceBundle bundle = ResourceLocator.getBundle(locale);

      addElement(bundle, locale, buffer, Globals.ERRORS_HEADER, true);

      for (Error errs : errors.get(this.errorKey)) {
         addElement(bundle, locale, buffer, Globals.ERRORS_PREFIX, false);                 
         buffer.append(errs.getMessage(locale));
         addElement(bundle, locale, buffer, Globals.ERRORS_SUFFIX, false);
         buffer.append("\n"); //$NON-NLS-1$
      }
View Full Code Here


    item.setPartNum("AAAAA"); //$NON-NLS-1$

    assertFalse(this.processor.validateEvent(this.po));

    Errors errors = this.processor.getContextWrapper().getRequestErrors();

    assertEquals(2, errors.size());

    for (Error error : errors.get()) {
      assertEquals("org.megatome.frame2.jaxbgen.Items", error.getKey()); //$NON-NLS-1$
      // assertEquals(
      // "the value does not match the regular expression
      // \"\\d{3}-[A-Z]{2}\".", //$NON-NLS-1$
      // error.getValue1());
View Full Code Here

    item.setQuantity(101);

    assertFalse(this.processor.validateEvent(this.po));

    Errors errors = this.processor.getContextWrapper().getRequestErrors();

    assertEquals(2, errors.size());

    for (Error error : errors.get()) {
      assertEquals("org.megatome.frame2.jaxbgen.Items", error.getKey()); //$NON-NLS-1$
      // assertEquals(
      // "the value is out of the range (maxExclusive specifies 100).",
      // //$NON-NLS-1$
      // error.getValue1());
View Full Code Here

    this.po.setBillTo(null);

    assertFalse(this.processor.validateEvent(this.po));

    Errors errors = this.processor.getContextWrapper().getRequestErrors();

    assertEquals(1, errors.size());

    for (Error error : errors.get()) {
      assertEquals(
          "org.megatome.frame2.jaxbgen.PurchaseOrderType", error.getKey()); //$NON-NLS-1$
      assertTrue(error.getValue1().toString().contains("'{billTo}'")); //$NON-NLS-1$
      assertNull(error.getValue2());
    }
View Full Code Here

     * @return Error object
     * @see org.megatome.frame2.errors.Error
     */
    public final static org.megatome.frame2.errors.Error createError(final String key, final Object value1,
            final Object value2, final Object value3) {
        return new ErrorImpl(key, value1, value2, value3);
    }
View Full Code Here

   * @throws ConfigException
   *             DOCUMENT ME!
   */
  public EventProxy getEventProxy(String eventName) throws ConfigException {
    EventDef eventDef = this.events.get(eventName);
    Event event = null;

    if (eventDef == null) {
      throw new ConfigException("Invalid Event Name: " + eventName); //$NON-NLS-1$
    }

    try {
      String type = eventDef.getType();

      if (type != null) {
        // event = (Event) getClass().forName(type).newInstance();
        event = (Event) Class.forName(type).newInstance();
        event.setEventName(eventName);
      }
    } catch (Exception e) {
      throw new ConfigException("Invalid Event ", e); //$NON-NLS-1$
    }

View Full Code Here

     * @return The event that is associated with the request in the
     *         configuration.
     */
    public Event getEvent() throws ConfigException {
        String eventName = getEventName(this.request.getServletPath());
        Event event = getConfig().getEventProxy(eventName).getEvent();
        if (event != null) {
            event.setEventName(eventName);
        }
        return event;

    }
View Full Code Here

        //String view = null;
        //ForwardProxy result = null;
        ViewProxy proxy = null;
        try {
            String eventName = getEventName(this.request.getServletPath());
            Event event = getEvent();

            if (this.requestParams == null) {
                Frame2Exception e = null;
                if (this.fileUploadException != null) {
                    e = new Frame2Exception(this.fileUploadException);
View Full Code Here

    private ViewProxy callAndMapHandlers(ForwardProxy proxy) throws Exception {
      boolean valid = true;
      ForwardProxy result = proxy;
        while (result.isEventType()) {
          // Map URI params into event, then callHandlers again
          Event next = getConfig().getEventProxy(result.getPath()).getEvent();
          if (getContextWrapper().hasResponseURIAttributes()) {
            valid = mapAttributesToEvent(getContextWrapper().getResponseURIAttributes(), next, getConfig().validateFor(next.getEventName()));
          }
          if (valid) {
            result = callHandlers(result.getPath(), next, ViewType.HTML);
          } else {
            return new ViewProxy(result, getValidationFailedView(next, next.getEventName()).getPath());
          }
        }
      getContextWrapper().clearResponseURIAttributes();
      return new ViewProxy(result, result.getPath());
    }
View Full Code Here

          }

          // EventHandler handler = (EventHandler)
          // getClass().forName(handlerDef.getType())
          // .newInstance();
          EventHandler handler = (EventHandler) Class.forName(
              handlerDef.getType()).newInstance();

          result.add(new EventHandlerProxy(handlerName, handler,
              handlerDef));
        }
View Full Code Here

TOP

Related Classes of org.megatome.frame2.errors.Errors

Copyright © 2018 www.massapicom. 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.