Coverage Report - org.kuali.rice.core.framework.persistence.ojb.SuffixedSqlSelectStatement
 
Classes in this File Line Coverage Branch Coverage Complexity
SuffixedSqlSelectStatement
0%
0/9
0%
0/2
1.333
 
 1  
 /*
 2  
  * Copyright 2007-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.rice.core.framework.persistence.ojb;
 17  
 
 18  
 import org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement;
 19  
 import org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement;
 20  
 import org.apache.ojb.broker.metadata.ClassDescriptor;
 21  
 import org.apache.ojb.broker.platforms.Platform;
 22  
 import org.apache.ojb.broker.query.Query;
 23  
 import org.apache.ojb.broker.util.logging.Logger;
 24  
 
 25  
 /**
 26  
  * A SqlSelectStatement sublclass that is aware of a special {@link SuffixableQueryByCriteria} Criteria
 27  
  * class and will append a suffix specified by that class of criteria to the generated SQL statement.
 28  
  * This is a hack to introduce select-for-update functionality into OJB so the same ORM/Criteria abstractions
 29  
  * can be retained for select-for-update queries.  Select for update appears to have been added in the OJB
 30  
  * source repository, so maybe a forthcoming release will include this functionality and these kludges can be
 31  
  * removed.
 32  
  * @see SqlGeneratorSuffixableImpl
 33  
  * @see SuffixableQueryByCriteria
 34  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 35  
  */
 36  
 public class SuffixedSqlSelectStatement extends SqlSelectStatement {
 37  
 
 38  
     public SuffixedSqlSelectStatement(Platform pf, ClassDescriptor cld, Query query, Logger logger) {
 39  0
         super(pf, cld, query, logger);
 40  0
     }
 41  
 
 42  
     public SuffixedSqlSelectStatement(SqlQueryStatement parent, Platform pf, ClassDescriptor cld, Query query,
 43  
             Logger logger) {
 44  0
         super(parent, pf, cld, query, logger);
 45  0
     }
 46  
 
 47  
     @Override
 48  
     protected String buildStatement() {
 49  0
         String stmt = super.buildStatement();
 50  0
         Query query = this.getQuery();
 51  0
         if (query instanceof SuffixableQueryByCriteria) {
 52  0
             stmt += " " + ((SuffixableQueryByCriteria) query).getQuerySuffix();
 53  
         }
 54  0
         return stmt;
 55  
     }
 56  
 }