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.apache.ojb.broker.query.Criteria;
19  import org.apache.ojb.broker.query.QueryByCriteria;
20  import org.apache.ojb.broker.query.QueryFactory;
21  import org.kuali.ole.module.purap.businessobject.PurchaseOrderVendorQuote;
22  import org.kuali.ole.module.purap.document.*;
23  import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
24  
25  import java.util.List;
26  
27  /**
28   * A class to do the database queries needed to fetch requisitions, po, preq etc., for
29   * migration of status code from purap documents to the document header's workflowdocument.
30   */
31  public class PurapDocumentsStatusCodeMigrationDaoOjb extends PlatformAwareDaoBaseOjb {
32      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PurapDocumentsStatusCodeMigrationDaoOjb.class);
33  
34      public List<RequisitionDocument> getRequisitionDocumentsForStatusCodeMigration() {
35          LOG.debug("getRequisitionDocumentsForStatusCodeMigration() started");
36  
37          Criteria criteria = new Criteria();
38          criteria.addNotNull("REQS_STAT_CD");
39  
40          QueryByCriteria query = QueryFactory.newQuery(RequisitionDocument.class, criteria);
41          return (List<RequisitionDocument>) getPersistenceBrokerTemplate().getCollectionByQuery(query);
42      }
43  
44      /**
45       * @see org.kuali.ole.module.purap.dataaccess.PurapDocumentsStatusCodeMigrationDao#getPurchaseOrderDocumentsForStatusCodeMigration()
46       */
47      public List<PurchaseOrderDocument> getPurchaseOrderDocumentsForStatusCodeMigration() {
48          LOG.debug("getPurchaseOrderDocumentsForStatusCodeMigration() started");
49  
50          Criteria criteria = new Criteria();
51          criteria.addNotNull("PO_STAT_CD");
52  
53          QueryByCriteria query = QueryFactory.newQuery(PurchaseOrderDocument.class, criteria);
54          return (List<PurchaseOrderDocument>) getPersistenceBrokerTemplate().getCollectionByQuery(query);
55      }
56  
57      /**
58       * @see org.kuali.ole.module.purap.dataaccess.PurapDocumentsStatusCodeMigrationDao#getPurchaseOrderVendorQuoteDocumentsForStatusCodeMigration()
59       */
60      public List<PurchaseOrderVendorQuote> getPurchaseOrderVendorQuoteDocumentsForStatusCodeMigration() {
61          LOG.debug("getPurchaseOrderVendorQuoteDocumentsForStatusCodeMigration() started");
62  
63          Criteria criteria = new Criteria();
64          criteria.addNotNull("PO_QT_STAT_CD");
65  
66          QueryByCriteria query = QueryFactory.newQuery(PurchaseOrderVendorQuote.class, criteria);
67          return (List<PurchaseOrderVendorQuote>) getPersistenceBrokerTemplate().getCollectionByQuery(query);
68      }
69  
70      /**
71       * @see org.kuali.ole.module.purap.dataaccess.PurapDocumentsStatusCodeMigrationDao#getPaymentRequestDocumentsForStatusCodeMigration()
72       */
73      public List<PaymentRequestDocument> getPaymentRequestDocumentsForStatusCodeMigration() {
74          LOG.debug("getPaymentRequestDocumentsForStatusCodeMigration() started");
75  
76          Criteria criteria = new Criteria();
77          criteria.addNotNull("PMT_RQST_STAT_CD");
78  
79          QueryByCriteria query = QueryFactory.newQuery(PaymentRequestDocument.class, criteria);
80          return (List<PaymentRequestDocument>) getPersistenceBrokerTemplate().getCollectionByQuery(query);
81      }
82  
83      /**
84       * @see org.kuali.ole.module.purap.dataaccess.PurapDocumentsStatusCodeMigrationDao#getVendorCreditMemoDocumentsForStatusCodeMigration()
85       */
86      public List<VendorCreditMemoDocument> getVendorCreditMemoDocumentsForStatusCodeMigration() {
87          LOG.debug("getVendorCreditMemoDocumentsForStatusCodeMigration() started");
88  
89          Criteria criteria = new Criteria();
90          criteria.addNotNull("CRDT_MEMO_STAT_CD");
91  
92          QueryByCriteria query = QueryFactory.newQuery(VendorCreditMemoDocument.class, criteria);
93          return (List<VendorCreditMemoDocument>) getPersistenceBrokerTemplate().getCollectionByQuery(query);
94      }
95  
96      /**
97       * @see org.kuali.ole.module.purap.dataaccess.PurapDocumentsStatusCodeMigrationDao#getLineItemReceivingDocumentDocumentsForStatusCodeMigration()
98       */
99      public List<LineItemReceivingDocument> getLineItemReceivingDocumentDocumentsForStatusCodeMigration() {
100         LOG.debug("getLineItemReceivingDocumentDocumentsForStatusCodeMigration() started");
101 
102         Criteria criteria = new Criteria();
103         criteria.addNotNull("RCVNG_LN_STAT_CD");
104 
105         QueryByCriteria query = QueryFactory.newQuery(LineItemReceivingDocument.class, criteria);
106         return (List<LineItemReceivingDocument>) getPersistenceBrokerTemplate().getCollectionByQuery(query);
107     }
108 }