Coverage Report - org.kuali.rice.kew.notes.dao.impl.NoteDAOOjbImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
NoteDAOOjbImpl
0%
0/22
N/A
1
 
 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.notes.dao.impl;
 18  
 
 19  
 import java.util.List;
 20  
 
 21  
 import org.apache.ojb.broker.query.Criteria;
 22  
 import org.apache.ojb.broker.query.QueryByCriteria;
 23  
 import org.kuali.rice.kew.notes.Attachment;
 24  
 import org.kuali.rice.kew.notes.Note;
 25  
 import org.kuali.rice.kew.notes.dao.NoteDAO;
 26  
 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
 27  
 
 28  
 
 29  0
 public class NoteDAOOjbImpl extends PersistenceBrokerDaoSupport implements NoteDAO {
 30  
 
 31  
     public Note getNoteByNoteId(String noteId) {
 32  0
         Criteria crit = new Criteria();
 33  0
         crit.addEqualTo("noteId", noteId);
 34  0
         return (Note) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(Note.class, crit));          
 35  
     }
 36  
 
 37  
     public List getNotesByDocumentId(String documentId) {
 38  0
         Criteria crit = new Criteria();
 39  0
         crit.addEqualTo("documentId", documentId);
 40  0
         QueryByCriteria query = new QueryByCriteria(Note.class, crit);
 41  0
         query.addOrderByAscending("noteId");
 42  0
         return (List) this.getPersistenceBrokerTemplate().getCollectionByQuery(query);        
 43  
     }
 44  
     
 45  
     public void saveNote(Note note) {
 46  0
             this.getPersistenceBrokerTemplate().store(note);    
 47  0
     }
 48  
 
 49  
     public void deleteNote(Note note) {
 50  0
         Criteria crit = new Criteria();
 51  0
         crit.addEqualTo("noteId", note.getNoteId());
 52  0
         this.getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(Note.class, crit));
 53  0
     }
 54  
    
 55  
     public void deleteAttachment(Attachment attachment) {
 56  0
             Criteria crit = new Criteria();
 57  0
             crit.addEqualTo("attachmentId", attachment.getAttachmentId());
 58  0
             this.getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(Attachment.class, crit));
 59  0
     }
 60  
 
 61  
         
 62  
     public Attachment findAttachment(String attachmentId) {
 63  0
             Criteria crit = new Criteria();
 64  0
             crit.addEqualTo("attachmentId", attachmentId);
 65  0
             return (Attachment)this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(Attachment.class, crit));
 66  
     }
 67  
 
 68  
 }