| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 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(Long 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(Long 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 | |
} |