Coverage Report - org.kuali.rice.kew.useroptions.dao.impl.UserOptionsDAOOjbImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
UserOptionsDAOOjbImpl
0%
0/30
0%
0/4
1.182
UserOptionsDAOOjbImpl$1
0%
0/2
N/A
1.182
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  *
 4  
  *
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.kew.useroptions.dao.impl;
 18  
 
 19  
 import org.apache.ojb.broker.PersistenceBroker;
 20  
 import org.apache.ojb.broker.query.Criteria;
 21  
 import org.apache.ojb.broker.query.QueryByCriteria;
 22  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 23  
 import org.kuali.rice.core.api.util.RiceConstants;
 24  
 import org.kuali.rice.core.framework.persistence.platform.DatabasePlatform;
 25  
 import org.kuali.rice.kew.useroptions.UserOptions;
 26  
 import org.kuali.rice.kew.useroptions.dao.UserOptionsDAO;
 27  
 import org.springmodules.orm.ojb.PersistenceBrokerCallback;
 28  
 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
 29  
 
 30  
 import java.util.ArrayList;
 31  
 import java.util.Collection;
 32  
 import java.util.List;
 33  
 
 34  
 
 35  0
 public class UserOptionsDAOOjbImpl extends PersistenceBrokerDaoSupport implements UserOptionsDAO {
 36  
 
 37  
         public Long getNewOptionIdForActionList() {
 38  0
         return (Long)this.getPersistenceBrokerTemplate().execute(new PersistenceBrokerCallback() {
 39  
             public Object doInPersistenceBroker(PersistenceBroker broker) {
 40  0
                     return getPlatform().getNextValSQL("KREW_ACTN_LIST_OPTN_S", broker);
 41  
             }
 42  
         });
 43  
     }
 44  
 
 45  
         protected DatabasePlatform getPlatform() {
 46  0
             return (DatabasePlatform)GlobalResourceLoader.getService(RiceConstants.DB_PLATFORM);
 47  
     }
 48  
 
 49  
     public List<UserOptions> findByUserQualified(String principalId, String likeString) {
 50  0
         Criteria criteria = new Criteria();
 51  0
         criteria.addEqualTo("workflowId", principalId);
 52  0
         criteria.addLike("optionId", likeString);
 53  0
         return new ArrayList<UserOptions>(this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(UserOptions.class, criteria)));
 54  
     }
 55  
 
 56  
     public void deleteByUserQualified(String principalId, String likeString) {
 57  0
         Criteria criteria = new Criteria();
 58  0
         criteria.addEqualTo("workflowId", principalId);
 59  0
         criteria.addLike("optionId", likeString);
 60  0
         this.getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(UserOptions.class, criteria));
 61  0
     }
 62  
 
 63  
     public Collection<UserOptions> findByWorkflowUser(String principalId) {
 64  0
         UserOptions userOptions = new UserOptions();
 65  0
         userOptions.setWorkflowId(principalId);
 66  0
         return this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(userOptions));
 67  
     }
 68  
 
 69  
     public void save(UserOptions userOptions) {
 70  0
             this.getPersistenceBrokerTemplate().store(userOptions);
 71  0
     }
 72  
     
 73  
     public void save(Collection<UserOptions> userOptions) {
 74  0
             if (userOptions != null) for (UserOptions option : userOptions) {
 75  0
                     this.getPersistenceBrokerTemplate().store(option);
 76  
             }
 77  0
     }
 78  
     
 79  
     public void deleteUserOptions(UserOptions userOptions) {
 80  0
             this.getPersistenceBrokerTemplate().delete(userOptions);
 81  0
     }
 82  
 
 83  
     public UserOptions findByOptionId(String optionId, String principalId) {
 84  0
         UserOptions userOptions = new UserOptions();
 85  0
         userOptions.setOptionId(optionId);
 86  0
         userOptions.setWorkflowId(principalId);
 87  0
         return (UserOptions) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(userOptions));
 88  
     }
 89  
 
 90  
     public Collection<UserOptions> findByOptionValue(String optionId, String optionValue) {
 91  0
         UserOptions userOptions = new UserOptions();
 92  0
         userOptions.setOptionId(optionId);
 93  0
         userOptions.setOptionVal(optionValue);
 94  0
         return this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(userOptions));
 95  
     }
 96  
 }