001/*
002 * jPOS Project [http://jpos.org]
003 * Copyright (C) 2000-2026 jPOS Software SRL
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jpos.iso;
020
021/**
022 * Base validation-error class. Contains a reference to error details.
023 * Error description, Error reject code: optional code used in some
024 * financial systems to specifya field reject code. It refer to error.
025 * Error Id: A string of " " separated ids. The ids are the fields,
026 * subfields, ... ids for the component with error.
027 * For example: id="48 0 1" indicates the error was in field 48,
028 * subfield 0, subfield 1.
029 * <p>Title: jPOS</p>
030 * <p>Description: Java Framework for Financial Systems</p>
031 * <p>Copyright: Copyright (c) 2000 jPOS.org.  All rights reserved.</p>
032 * <p>Company: www.jPOS.org</p>
033 * @author Jose Eduardo Leon
034 * @version 1.0
035 */
036public class ISOVError {
037
038    /** Constructs an error with the given description.
039     * @param Description the error description
040     */
041    public ISOVError( String Description ) {
042        this.description = Description;
043    }
044
045    /** Constructs an error with description and reject code.
046     * @param Description the error description
047     * @param RejectCode  the rejection code
048     */
049    public ISOVError( String Description, String RejectCode ) {
050        this.description = Description;
051        this.rejectCode = RejectCode;
052    }
053
054    /** Returns the rejection code.
055     * @return the reject code
056     */
057    public String getRejectCode(){
058        return rejectCode;
059    }
060
061    /** Returns the error ID.
062     * @return the error ID string
063     */
064    public String getId(){
065        return id;
066    }
067
068    /**
069     * Replaces the error identifier.
070     *
071     * @param ID error identifier
072     */
073    public void setId ( String ID ){
074        id = ID;
075    }
076
077    /** Returns the error description.
078     * @return the description
079     */
080    public String getDescription() {
081        return description;
082    }
083
084    /** Used by error parsers to set field tree path **/
085    protected String id;
086    /** The error description. */
087    protected String description = "";
088    /** The rejection code. */
089    protected String rejectCode;
090    /** default error types **/
091    public static final int ERR_INVALID_LENGTH = 1;
092    /** Error code for invalid value. */
093    public static final int ERR_INVALID_VALUE = 2;
094}