19 package org.turro.dossier.util;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Iterator;
24 import java.util.List;
25 import java.util.Objects;
26 import org.turro.string.Strings;
27 import org.turro.dossier.db.DossierPU;
28 import org.turro.dossier.entity.Issue;
29 import org.turro.dossier.entity.IssueParticipantRole;
30 import org.turro.dossier.entity.IssueStatus;
31 import org.turro.dossier.entity.Worksheet;
32 import org.turro.dossier.issue.IssueWrapper;
33 import org.turro.dossier.search.IssueResults;
34 import org.turro.jpa.Dao;
35 import org.turro.plugin.contacts.IContact;
43 public static Collection<Worksheet>
getWorksheet(String idContact) {
45 return dao.getResultList(
46 "select w from Worksheet as w " +
47 "where w.idContact = ? " +
48 "order by w.sheetOrder",
49 new Object[] { idContact });
52 public static Collection<Issue>
getIssues(String idContact, String searchValue) {
54 if(!Strings.isBlank(searchValue)) {
55 return dao.getResultList(
56 "select w.issue from Worksheet as w " +
57 "where w.idContact = ? " +
58 "and w.issue.description like ? " +
59 "order by w.sheetOrder",
60 new Object[] { idContact,
"%" + searchValue +
"%" });
62 return dao.getResultList(
63 "select w.issue from Worksheet as w " +
64 "where w.idContact = ? " +
65 "order by w.sheetOrder",
66 new Object[] { idContact });
71 ArrayList<IssueWrapper> list =
new ArrayList<>();
80 ArrayList<IssueWrapper> list =
new ArrayList<>();
88 public static Collection<IssueWrapper>
getNotIn(
IContact contact, Collection<IssueWrapper> listws) {
89 ArrayList<IssueWrapper> list =
new ArrayList<>();
95 if(iw.getRelevanceOrderByContact() == 1) {
96 boolean exists =
false;
98 if(Objects.equals(liw.getIssue().getId(), iw.getIssue().getId())) {
115 "delete from Worksheet " +
116 "where idContact = ? ",
117 new Object[] { idContact });
123 "delete from Worksheet " +
124 "where issue.id = ? ",
125 new Object[] { idIssue });
130 return dao.getResultList(
131 "select p.idContact from IssueParticipant as p " +
132 "where p.role = ? " +
133 "and p.issue.status <> ?",
139 if(isDone(worksheet, contact)) {
148 Iterator<Worksheet> it = list.iterator();
149 while(it.hasNext()) {
151 if(isDone(worksheet, contact)) {
163 private WorksheetUtil() {
int getRelevanceOrderByContact()
void setDossierId(Long dossierId)
java.util.List< IssueWrapper > getIssueList()
void setByParticipant(IContact byParticipant)
static void clearDone(List< Worksheet > list, IContact contact)
static void removeWorksheet(Long idIssue)
static Collection< Issue > getIssues(String idContact, String searchValue)
static boolean cleared(Worksheet worksheet, IContact contact)
static Collection< Worksheet > getWorksheet(String idContact)
static Collection< IssueWrapper > getNotIn(IContact contact, Collection< IssueWrapper > listws)
static List< IssueWrapper > getIssueWrappersForNow(IContact contact, String searchValue)
static void removeWorksheet(String idContact)
static Collection< String > getResponsibles()
static List< IssueWrapper > getIssueWrappers(IContact contact, String searchValue)
void deleteObject(Object obj)
int executeUpdate(String query)