View Javadoc
1   /*
2    * Copyright 2008 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.module.purap.util.cxml;
17  
18  import org.apache.commons.lang.builder.ToStringBuilder;
19  import org.apache.log4j.Logger;
20  import org.kuali.ole.module.purap.businessobject.B2BShoppingCartItem;
21  
22  import java.util.ArrayList;
23  import java.util.List;
24  
25  public class B2BShoppingCart extends B2BShoppingCartBase {
26  
27      private final static Logger log = Logger.getLogger(B2BShoppingCart.class);
28  
29      private String messageStatusCode;
30      private String messageStatusText;
31      private String buyerCookieText;
32      private String totalAmount;
33      //Not used
34      private CxmlHeader cxmlHeader;
35      private List<B2BShoppingCartItem> itemsList;
36  
37  
38      public void addShoppingCartItem(B2BShoppingCartItem item) {
39          if (itemsList == null) {
40              itemsList = new ArrayList<B2BShoppingCartItem>();
41          }
42          itemsList.add(item);
43      }
44  
45      public B2BShoppingCartItem[] getShoppingCartItems() {
46          if (itemsList != null) {
47              B2BShoppingCartItem[] tempItems = new B2BShoppingCartItem[itemsList.size()];
48              return itemsList.toArray(tempItems);
49          }
50          return null;
51      }
52  
53      public List getItems() {
54          return itemsList;
55      }
56  
57      public CxmlHeader getCxmlHeader() {
58          return cxmlHeader;
59      }
60  
61      public void setCxmlHeader(CxmlHeader cxmlHeader) {
62          this.cxmlHeader = cxmlHeader;
63      }
64  
65      public String getBuyerCookieText() {
66          return buyerCookieText;
67      }
68  
69      public void setBuyerCookieText(String buyerCookieText) {
70          this.buyerCookieText = buyerCookieText;
71      }
72  
73      public String getTotal() {
74          return totalAmount;
75      }
76  
77      public void setTotal(String totalAmount) {
78          this.totalAmount = totalAmount;
79      }
80  
81      public String getMessageStatusCode() {
82          return messageStatusCode;
83      }
84  
85      public void setMessageStatusCode(String messageStatusCode) {
86          this.messageStatusCode = messageStatusCode;
87      }
88  
89      public String getMessageStatusText() {
90          return messageStatusText;
91      }
92  
93      public void setMessageStatusText(String messageStatusText) {
94          this.messageStatusText = messageStatusText;
95      }
96  
97      public String toString() {
98  
99          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 }