001/*
002 * Copyright 2006-2008 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 * http://www.opensource.org/licenses/ecl2.php
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.module.purap.util.cxml;
017
018import org.apache.commons.lang.StringUtils;
019import org.apache.commons.lang.builder.ToStringBuilder;
020
021import java.util.ArrayList;
022import java.util.List;
023
024public class PurchaseOrderResponse extends B2BShoppingCartBase {
025
026    private List errors = new ArrayList();
027
028    public void addPOResponseErrorMessage(String errorText) {
029        if (StringUtils.isNotEmpty(errorText)) {
030            errors.add(errorText);
031        }
032    }
033
034    public List getPOResponseErrorMessages() {
035
036        if (!isSuccess()) {
037            return errors;
038        } else {
039            return null;
040        }
041    }
042
043    public String toString() {
044
045        ToStringBuilder toString = new ToStringBuilder(this);
046        toString.append("StatusCode", getStatusCode());
047        toString.append("StatusText", getStatusText());
048        toString.append("isSuccess", isSuccess());
049        toString.append("Errors", getPOResponseErrorMessages());
050
051        return toString.toString();
052    }
053}