Package pt.opensoft.msg

Examples of pt.opensoft.msg.InvalidRequest


        String field = request.getString(name);
        if (field == null) {
            if (optional) {
                return null;
            } else {
                return new InvalidRequest(name, designation + " tem que estar preenchido");
            }
        }

        if (optional && field.length() == 0) {
            return new InvalidRequest(name, designation + " n�o pode ser vazio");
        }

        if (minLength > 0 && (field.length() < minLength)) {
            return new InvalidRequest(name, designation + " deve ter pelo menos " + minLength + "caracteres");
        }

        if (maxLength > 0 && (field.length() > maxLength)) {
            return new InvalidRequest(name, designation + " n�o pode exceder o tamanho " + maxLength);
        }

        return null;
    }
View Full Code Here


    public NumericFormField(String name, String designation, int minLength, int maxLength, boolean mandatory) {
        super(name, designation, minLength, maxLength, mandatory);
    }

    public InvalidRequest validateRequest(Request request) {
        InvalidRequest invalid = super.validateRequest(request);
        String field = request.getString(name);
        if (invalid == null) {
            if ((field == null || field.trim().equals("")) && optional) {
                return null;
            }
             if (!StringUtil.isNumeric(field)) {
                return new InvalidRequest(name, designation + " dever� ser num�rico");
            }
        }

        return invalid;
    }
View Full Code Here

        String oldName = name;
        name = _prefixName + name;
        String oldDesignation = designation;
        designation = _prefixDesignation + designation;

        InvalidRequest invalid = null;
        try {
            invalid = super.validateRequest(request);
        } finally {
            name = oldName;
            designation = oldDesignation;
View Full Code Here

    public NumericPrefixFormField(String name, String designation, int minLength, int maxLength, boolean mandatory) {
        super(name, designation, minLength, maxLength, mandatory);
    }

    public InvalidRequest validateRequest(Request request) {
        InvalidRequest invalid = super.validateRequest(request);
        String field = request.getString(_prefixName + name);
        if (invalid == null) {
            if ((field == null || field.trim().equals("")) && optional) {
                return null;
            }
            if (!_signed && !StringUtil.isNumeric(field)) {
                return new InvalidRequest(_prefixName + name, _prefixDesignation + designation + " dever� ser num�rico");
            }
            if (_signed && !StringUtil.isSignedNumeric(field)) {
                return new InvalidRequest(_prefixName + name, _prefixDesignation + designation + " dever� ser num�rico");
            }
        }

        return invalid;
    }
View Full Code Here

    public int getErrorCode() {
    return errorCode;
  }

  public InvalidRequest convertToInvalidRequest() {
        return new InvalidRequest(getInputId(), getErrorMsg(), getErrorCode());
    }
View Full Code Here

    public FloatPrefixFormField(String name, String designation, int minLength, int maxLength, boolean mandatory) {
        super(name, designation, minLength, maxLength, mandatory);
    }

    public InvalidRequest validateRequest(Request request) {
        InvalidRequest invalid = super.validateRequest(request);
        String field = request.getString(_prefixName + name);
        if (invalid == null) {
            if ((field == null || field.trim().equals("")) && optional) {
                return null;
            }
            try {
                NumberFormat.getNumberInstance().parse(field);
                if (field.indexOf('.') != -1) {
                    throw new ParseException("Encontrei um . num float", 0);   
                }
            } catch (ParseException e) {
                return new InvalidRequest(_prefixName + name, _prefixDesignation + designation + " dever� ser num�rico (eventualmente com parte decimal, separada por v�rgula)");
            }
        }

        return invalid;
    }
View Full Code Here

  public static InvalidRequest renderInvalidRequest(Element root) {
    Element input = root.getChild("input");
    Element message = root.getChild("message");
    Element responseCode = root.getChild("responseCode");

    return new InvalidRequest(input != null ? input.getTextTrim() : null, message != null ? message.getTextTrim() : null, Integer.parseInt(responseCode.getTextTrim()));
  }
View Full Code Here

        return fieldNames;
    }

    public InvalidRequest validateRequest(Request request) {
        InvalidRequest invalid = null;
        for (Iterator iterator = _fields.iterator(); iterator.hasNext() && (invalid == null);) {
            FormField formField = (FormField) iterator.next();
            invalid = formField.validateRequest(request);
        }
View Full Code Here

                    trxBeingMonitored = TrxMonitor.getInstance().startTrx(this.application, this.name, userId, Thread.currentThread());
                }
            }

            // se chegou aqui � pq tem permiss�es...
            InvalidRequest invalid = validate(request);
            if (invalid != null) {
                if (this.sessionManager != null) this.sessionManager.warning(logger, application, getTransactionName(), request);
                processTimer.stop();
                if (threshold > 0 && processTimer.ellapsed() > threshold) logger.push("too long");
                if (logtrx) logger.info(processTimer.ellapsed(), invalid);
View Full Code Here

TOP

Related Classes of pt.opensoft.msg.InvalidRequest

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.