001/* 002 * Copyright 2007 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.dataaccess.impl; 017 018import org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao; 019import org.kuali.rice.core.framework.persistence.jdbc.dao.PlatformAwareDaoBaseJdbc; 020import org.springframework.dao.DataAccessException; 021import org.springframework.jdbc.support.rowset.SqlRowSet; 022 023import java.util.HashMap; 024import java.util.Map; 025 026/** 027 * A class to do the database queries needed to prepare documents status codes and descriptions. 028 */ 029public class StatusCodeAndDescriptionForPurapDocumentsDaoJdbc extends PlatformAwareDaoBaseJdbc implements StatusCodeAndDescriptionForPurapDocumentsDao { 030 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(StatusCodeAndDescriptionForPurapDocumentsDaoJdbc.class); 031 032 /** 033 * @see org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao#getRequisitionDocumentStatuses() 034 */ 035 public Map<String, String> getRequisitionDocumentStatuses() { 036 LOG.debug("getRequisitionDocumentStatuses() started"); 037 038 Map<String, String> requistionStatuses = new HashMap<String, String>(); 039 040 try { 041 SqlRowSet statusesRowSet = getJdbcTemplate().queryForRowSet("SELECT * FROM PUR_REQS_STAT_T ORDER BY REQS_STAT_CD"); 042 043 while (statusesRowSet.next()) { 044 requistionStatuses.put(statusesRowSet.getString("REQS_STAT_CD"), statusesRowSet.getString("REQS_STAT_DESC")); 045 } 046 047 LOG.debug("getRequisitionDocumentStatuses() exited"); 048 049 return requistionStatuses; 050 } catch (DataAccessException dae) { 051 return requistionStatuses; 052 } 053 } 054 055 /** 056 * @see org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao#getPurchaseOrderDocumentStatuses() 057 */ 058 public Map<String, String> getPurchaseOrderDocumentStatuses() { 059 LOG.debug("getPurchaseOrderDocumentStatuses() started"); 060 061 Map<String, String> purchaseOrderStatuses = new HashMap<String, String>(); 062 try { 063 SqlRowSet statusesRowSet = getJdbcTemplate().queryForRowSet("SELECT * FROM PUR_PO_STAT_T ORDER BY PO_STAT_CD"); 064 065 while (statusesRowSet.next()) { 066 purchaseOrderStatuses.put(statusesRowSet.getString("PO_STAT_CD"), statusesRowSet.getString("PO_STAT_DESC")); 067 } 068 069 LOG.debug("getPurchaseOrderDocumentStatuses() exited"); 070 071 return purchaseOrderStatuses; 072 } catch (DataAccessException dae) { 073 return purchaseOrderStatuses; 074 } 075 } 076 077 /** 078 * @see org.kuali.ole.module.purap.dataaccess.StatusCodeAndDescriptionForPurapDocumentsDao#getPaymentRequestDocumentStatuses() 079 */ 080 public Map<String, String> getPaymentRequestDocumentStatuses() { 081 LOG.debug("getPaymentRequestDocumentStatuses() started"); 082 083 Map<String, String> paymentRequestStatuses = new HashMap<String, String>(); 084 085 try { 086 SqlRowSet statusesRowSet = getJdbcTemplate().queryForRowSet("SELECT * FROM AP_PMT_RQST_STAT_T ORDER BY PMT_RQST_STAT_CD"); 087 088 while (statusesRowSet.next()) { 089 paymentRequestStatuses.put(statusesRowSet.getString("PMT_RQST_STAT_CD"), statusesRowSet.getString("PMT_RQST_STAT_DESC")); 090 } 091 092 LOG.debug("getPaymentRequestDocumentStatuses() exited"); 093 094 return paymentRequestStatuses; 095 } catch (DataAccessException dae) { 096 return paymentRequestStatuses; 097 } 098 } 099 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}