001 /*
002 * Copyright 2011 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 */
016 package org.kuali.kfs.module.purap.util.cxml;
017
018 import java.util.ArrayList;
019 import java.util.List;
020
021 import org.apache.commons.lang.builder.ToStringBuilder;
022 import org.apache.log4j.Logger;
023 import org.kuali.kfs.module.purap.businessobject.B2BShoppingCartItem;
024
025 public class B2BShoppingCart extends B2BShoppingCartBase {
026
027 private final static Logger log = Logger.getLogger(B2BShoppingCart.class);
028
029 private String messageStatusCode;
030 private String messageStatusText;
031 private String buyerCookieText;
032 private String totalAmount;
033 //Not used
034 private CxmlHeader cxmlHeader;
035 private List<B2BShoppingCartItem> itemsList;
036
037
038 public void addShoppingCartItem(B2BShoppingCartItem item){
039 if (itemsList == null){
040 itemsList = new ArrayList<B2BShoppingCartItem>();
041 }
042 itemsList.add(item);
043 }
044
045 public B2BShoppingCartItem[] getShoppingCartItems(){
046 if (itemsList != null){
047 B2BShoppingCartItem[] tempItems = new B2BShoppingCartItem[itemsList.size()];
048 return itemsList.toArray(tempItems);
049 }
050 return null;
051 }
052
053 public List getItems(){
054 return itemsList;
055 }
056
057 public CxmlHeader getCxmlHeader() {
058 return cxmlHeader;
059 }
060
061 public void setCxmlHeader(CxmlHeader cxmlHeader) {
062 this.cxmlHeader = cxmlHeader;
063 }
064
065 public String getBuyerCookieText() {
066 return buyerCookieText;
067 }
068
069 public void setBuyerCookieText(String buyerCookieText) {
070 this.buyerCookieText = buyerCookieText;
071 }
072
073 public String getTotal() {
074 return totalAmount;
075 }
076
077 public void setTotal(String totalAmount) {
078 this.totalAmount = totalAmount;
079 }
080
081 public String getMessageStatusCode() {
082 return messageStatusCode;
083 }
084
085 public void setMessageStatusCode(String messageStatusCode) {
086 this.messageStatusCode = messageStatusCode;
087 }
088
089 public String getMessageStatusText() {
090 return messageStatusText;
091 }
092
093 public void setMessageStatusText(String messageStatusText) {
094 this.messageStatusText = messageStatusText;
095 }
096
097 public String toString(){
098
099 ToStringBuilder toString = new ToStringBuilder(this);
100
101 toString.append("messageStatusCode",getMessageStatusCode());
102 toString.append("messageStatusText",getMessageStatusText());
103 toString.append("statusCode",getStatusCode());
104 toString.append("statusText",getStatusText());
105 toString.append("buyerCookieText",getBuyerCookieText());
106 toString.append("totalAmount",getTotal());
107 toString.append("CXMLHeader",getCxmlHeader());
108 toString.append("Items",itemsList);
109
110 return toString.toString();
111 }
112
113 }