1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.rice.kns.dao.impl; |
17 |
|
|
18 |
|
import java.util.ArrayList; |
19 |
|
import java.util.Collection; |
20 |
|
import java.util.List; |
21 |
|
|
22 |
|
import org.apache.log4j.Logger; |
23 |
|
import org.apache.ojb.broker.query.Criteria; |
24 |
|
import org.apache.ojb.broker.query.Query; |
25 |
|
import org.apache.ojb.broker.query.QueryByCriteria; |
26 |
|
import org.apache.ojb.broker.query.QueryFactory; |
27 |
|
import org.kuali.rice.kns.bo.Attachment; |
28 |
|
import org.kuali.rice.kns.bo.Note; |
29 |
|
import org.kuali.rice.kns.dao.NoteDao; |
30 |
|
import org.springframework.dao.DataAccessException; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@author |
36 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 10 |
Complexity Density: 0.45 |
|
37 |
|
public class NoteDaoOjb extends PlatformAwareDaoBaseOjb implements NoteDao { |
38 |
|
private static Logger LOG = Logger.getLogger(NoteDaoOjb.class); |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
0
|
public NoteDaoOjb() {... |
44 |
0
|
super(); |
45 |
|
} |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
@param |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0.57 |
|
52 |
0
|
public void save(Note note) throws DataAccessException {... |
53 |
|
|
54 |
0
|
if(note!=null&¬e.getNoteIdentifier()==null&¬e.getAttachment()!=null) { |
55 |
0
|
Attachment attachment = note.getAttachment(); |
56 |
0
|
note.setAttachment(null); |
57 |
|
|
58 |
0
|
getPersistenceBrokerTemplate().store(note); |
59 |
0
|
attachment.setNoteIdentifier(note.getNoteIdentifier()); |
60 |
|
|
61 |
0
|
note.setAttachment(attachment); |
62 |
|
} |
63 |
0
|
getPersistenceBrokerTemplate().store(note); |
64 |
|
} |
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
69 |
0
|
public void deleteNote(Note note) throws DataAccessException {... |
70 |
0
|
getPersistenceBrokerTemplate().delete(note.getAttachment()); |
71 |
0
|
note.setAttachment(null); |
72 |
0
|
getPersistenceBrokerTemplate().delete(note); |
73 |
|
|
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
@return |
81 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
82 |
0
|
public List<Note> findByremoteObjectId(String remoteObjectId) {... |
83 |
0
|
Criteria criteria = new Criteria(); |
84 |
|
|
85 |
0
|
criteria.addEqualTo("RMT_OBJ_ID", remoteObjectId); |
86 |
|
|
87 |
0
|
QueryByCriteria query = QueryFactory.newQuery(Note.class, criteria); |
88 |
|
|
89 |
|
|
90 |
0
|
defaultOrderBy(query); |
91 |
0
|
Collection<Note> notes = findCollection(query); |
92 |
|
|
93 |
0
|
return new ArrayList<Note>(notes); |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
96 |
0
|
public Note getNoteByNoteId(Long noteId) {... |
97 |
0
|
Criteria crit = new Criteria(); |
98 |
0
|
crit.addEqualTo("noteIdentifier", noteId); |
99 |
0
|
return (Note) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(Note.class, crit)); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
@param |
105 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
0
|
private void defaultOrderBy(QueryByCriteria query) {... |
107 |
|
|
108 |
0
|
query.addOrderBy("notePostedTimestamp", true); |
109 |
|
} |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
@return |
117 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
0
|
@SuppressWarnings("unchecked")... |
119 |
|
private Collection<Note> findCollection(Query query) throws DataAccessException { |
120 |
0
|
return getPersistenceBrokerTemplate().getCollectionByQuery(query); |
121 |
|
} |
122 |
|
} |