1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.actionitem;
17
18 import org.kuali.rice.core.api.delegation.DelegationType;
19
20 import javax.persistence.Entity;
21 import javax.persistence.NamedQueries;
22 import javax.persistence.NamedQuery;
23 import javax.persistence.Table;
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.List;
27 import java.util.Map;
28
29
30
31
32
33
34
35
36
37
38 @Entity
39 @Table(name = "KREW_ACTN_ITM_T")
40 @NamedQueries({@NamedQuery(name = "ActionItem.DistinctDocumentsForPrincipalId", query =
41 "SELECT COUNT(DISTINCT(ai.documentId)) FROM ActionItem ai"
42 + " WHERE ai.principalId = :principalId AND (ai.delegationType IS NULL OR ai.delegationType = 'P')"),
43 @NamedQuery(name = "ActionItem.GetMaxDateAndCountForPrincipalId", query =
44 "SELECT MAX(ai.dateAssigned) AS max_date, COUNT(DISTINCT(ai.documentId)) AS total_records FROM ActionItem ai"
45 + " WHERE ai.principalId = :principalId"),
46 @NamedQuery(name = "ActionItem.GetQuickLinksDocumentTypeNameAndCount", query =
47 "select ai.docName, COUNT(ai) from ActionItem ai where ai.principalId = :principalId " +
48 "and (ai.delegationType is null or ai.delegationType != :delegationType)"
49 + " group by ai.docName")})
50 public class ActionItem extends ActionItemBase {
51
52 private static final long serialVersionUID = -1079562205125660151L;
53
54 public ActionItem deepCopy(Map<Object, Object> visited) {
55 return super.deepCopy(visited, ActionItem.class);
56 }
57
58 public static org.kuali.rice.kew.api.action.ActionItem to(ActionItem bo) {
59 if (bo == null) {
60 return null;
61 }
62 return org.kuali.rice.kew.api.action.ActionItem.Builder.create(bo).build();
63 }
64
65 public static List<org.kuali.rice.kew.api.action.ActionItem> to(Collection<ActionItem> bos) {
66 if (bos == null) {
67 return null;
68 }
69 if (bos.isEmpty()) {
70 return new ArrayList<org.kuali.rice.kew.api.action.ActionItem>();
71 }
72
73 List<org.kuali.rice.kew.api.action.ActionItem> dtos = new ArrayList<org.kuali.rice.kew.api.action.ActionItem>(
74 bos.size());
75 for (ActionItem bo : bos) {
76 dtos.add(ActionItem.to(bo));
77 }
78 return dtos;
79 }
80 }