View Javadoc
1   /*
2    * Copyright 2007 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.dataaccess.impl;
17  
18  import org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao;
19  import org.kuali.rice.core.framework.persistence.jdbc.dao.PlatformAwareDaoBaseJdbc;
20  import org.springframework.dao.DataAccessException;
21  import org.springframework.jdbc.support.rowset.SqlRowSet;
22  
23  import java.util.HashMap;
24  import java.util.Map;
25  
26  /**
27   * A class to do the database queries needed to prepare documents status codes and descriptions.
28   */
29  public class StatusCodeAndDescriptionForPurapDocumentsDaoJdbc extends PlatformAwareDaoBaseJdbc implements StatusCodeAndDescriptionForPurapDocumentsDao {
30      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(StatusCodeAndDescriptionForPurapDocumentsDaoJdbc.class);
31  
32      /**
33       * @see org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao#getRequisitionDocumentStatuses()
34       */
35      public Map<String, String> getRequisitionDocumentStatuses() {
36          LOG.debug("getRequisitionDocumentStatuses() started");
37  
38          Map<String, String> requistionStatuses = new HashMap<String, String>();
39  
40          try {
41              SqlRowSet statusesRowSet = getJdbcTemplate().queryForRowSet("SELECT * FROM PUR_REQS_STAT_T ORDER BY REQS_STAT_CD");
42  
43              while (statusesRowSet.next()) {
44                  requistionStatuses.put(statusesRowSet.getString("REQS_STAT_CD"), statusesRowSet.getString("REQS_STAT_DESC"));
45              }
46  
47              LOG.debug("getRequisitionDocumentStatuses() exited");
48  
49              return requistionStatuses;
50          } catch (DataAccessException dae) {
51              return requistionStatuses;
52          }
53      }
54  
55      /**
56       * @see org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao#getPurchaseOrderDocumentStatuses()
57       */
58      public Map<String, String> getPurchaseOrderDocumentStatuses() {
59          LOG.debug("getPurchaseOrderDocumentStatuses() started");
60  
61          Map<String, String> purchaseOrderStatuses = new HashMap<String, String>();
62          try {
63              SqlRowSet statusesRowSet = getJdbcTemplate().queryForRowSet("SELECT * FROM PUR_PO_STAT_T ORDER BY PO_STAT_CD");
64  
65              while (statusesRowSet.next()) {
66                  purchaseOrderStatuses.put(statusesRowSet.getString("PO_STAT_CD"), statusesRowSet.getString("PO_STAT_DESC"));
67              }
68  
69              LOG.debug("getPurchaseOrderDocumentStatuses() exited");
70  
71              return purchaseOrderStatuses;
72          } catch (DataAccessException dae) {
73              return purchaseOrderStatuses;
74          }
75      }
76  
77      /**
78       * @see org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao#getPaymentRequestDocumentStatuses()
79       */
80      public Map<String, String> getPaymentRequestDocumentStatuses() {
81          LOG.debug("getPaymentRequestDocumentStatuses() started");
82  
83          Map<String, String> paymentRequestStatuses = new HashMap<String, String>();
84  
85          try {
86              SqlRowSet statusesRowSet = getJdbcTemplate().queryForRowSet("SELECT * FROM AP_PMT_RQST_STAT_T ORDER BY PMT_RQST_STAT_CD");
87  
88              while (statusesRowSet.next()) {
89                  paymentRequestStatuses.put(statusesRowSet.getString("PMT_RQST_STAT_CD"), statusesRowSet.getString("PMT_RQST_STAT_DESC"));
90              }
91  
92              LOG.debug("getPaymentRequestDocumentStatuses() exited");
93  
94              return paymentRequestStatuses;
95          } catch (DataAccessException dae) {
96              return paymentRequestStatuses;
97          }
98      }
99  
100     /**
101      * @see org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao#getVendorCreditMemoDocumentStatuses()
102      */
103     public Map<String, String> getVendorCreditMemoDocumentStatuses() {
104         LOG.debug("getVendorCreditMemoDocumentStatuses() started");
105 
106         Map<String, String> vendorCreditMemoStatuses = new HashMap<String, String>();
107 
108         try {
109             SqlRowSet statusesRowSet = getJdbcTemplate().queryForRowSet("SELECT * FROM AP_CRDT_MEMO_STAT_T ORDER BY CRDT_MEMO_STAT_CD");
110 
111             while (statusesRowSet.next()) {
112                 vendorCreditMemoStatuses.put(statusesRowSet.getString("CRDT_MEMO_STAT_CD"), statusesRowSet.getString("CRDT_MEMO_STAT_DESC"));
113             }
114 
115             LOG.debug("getVendorCreditMemoDocumentStatuses() exited");
116 
117             return vendorCreditMemoStatuses;
118         } catch (DataAccessException dae) {
119             return vendorCreditMemoStatuses;
120         }
121     }
122 
123     /**
124      * @see org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao#getLineItemReceivingDocumentStatuses()
125      */
126     public Map<String, String> getLineItemReceivingDocumentStatuses() {
127         LOG.debug("getLineItemReceivingDocumentStatuses() started");
128 
129         Map<String, String> lineItemReceivingStatuses = new HashMap<String, String>();
130 
131         try {
132             SqlRowSet statusesRowSet = getJdbcTemplate().queryForRowSet("SELECT * FROM PUR_RCVNG_LN_STAT_T ORDER BY RCVNG_LN_STAT_CD");
133 
134             while (statusesRowSet.next()) {
135                 lineItemReceivingStatuses.put(statusesRowSet.getString("RCVNG_LN_STAT_CD"), statusesRowSet.getString("RCVNG_LN_STAT_DESC"));
136             }
137 
138             LOG.debug("getLineItemReceivingDocumentStatuses() exited");
139 
140             return lineItemReceivingStatuses;
141         } catch (DataAccessException dae) {
142             return lineItemReceivingStatuses;
143         }
144     }
145 }