18 package org.turro.dossier.issue;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
23 import org.turro.action.Contacts;
24 import org.turro.string.ObjectString;
25 import org.turro.string.Strings;
26 import org.turro.auth.Authentication;
27 import org.turro.dossier.db.DossierPU;
28 import org.turro.dossier.dossier.DossierData;
29 import org.turro.dossier.dossier.DossierValues;
30 import org.turro.dossier.dossier.DossierWrapper;
31 import org.turro.dossier.dw.DossierDWReport;
32 import org.turro.dossier.entity.*;
33 import org.turro.dossier.util.WorksheetUtil;
34 import org.turro.elephant.context.Application;
35 import org.turro.elephant.context.ElephantContext;
36 import org.turro.elephant.db.WhereClause;
37 import org.turro.i18n.I_;
38 import org.turro.jpa.Dao;
39 import org.turro.jpa.entity.DaoEntity;
40 import org.turro.plugin.contacts.IContact;
41 import org.turro.related.Relateds;
50 private List<IssueParticipantRole> role;
51 private boolean hasIssueQA;
61 this.contact = contact;
69 return I_.
get(
"Issue");
74 return entity.getFullDescription();
75 }
catch(Exception ex) {
81 this.contact = contact;
88 if(dp.getIdContact().equals(contact.
getId()) && dp.isShowAllIssues()) {
96 return !getRole().isEmpty();
122 entity.getDossier() !=
null &&
140 return "/_zul/images/date_surpassed.png";
143 return "/_zul/images/value_surpassed.png";
149 int p =
entity.getPriority().getPriority();
151 return "/_zul/images/priority" + p +
".png";
157 return Math.min(getRelevanceByReporter(), Math.min(getRelevanceByResponsible(), getRelevanceByQA()));
161 StringBuilder result =
new StringBuilder();
181 result.append(
entity.getPriority().getPriority());
182 result.append(
entity.getType().getPriority());
183 result.append(reverse(ObjectString.formatObject(
entity.getModification(), ObjectString.COMPRESSED_DATE_PATTERN,
false)));
184 result.append(
entity.getId());
187 }
catch(Exception ex) {
191 return result.toString();
195 if(reality ==
null) {
199 reality.
expenses += icomment.getExpenses();
200 reality.hours += icomment.getHours();
201 reality.price += icomment.getPrice();
210 prevision.hours =
entity.getHours();
211 prevision.price =
entity.getPrice();
230 !Strings.isBlank(ip.getIdContact())) {
240 !Strings.isBlank(ip.getIdContact())) {
250 !Strings.isBlank(ip.getIdContact())) {
258 Date now =
new Date();
259 return entity.getStartDate() ==
null || now.after(
entity.getStartDate());
263 Date now =
new Date();
264 return (
entity.getControlDate() !=
null && now.after(
entity.getControlDate())) ||
265 (
entity.getDelivery() !=
null && now.after(
entity.getDelivery()));
280 return entity.getSources();
285 return entity.getTargets();
292 result += (Strings.isEmpty(result) ?
"" :
", ") + ip.getName();
302 result += (Strings.isEmpty(result) ?
"" :
", ") + ip.getName();
312 result += (Strings.isEmpty(result) ?
"" :
", ") + ip.getName();
322 result += (Strings.isEmpty(result) ?
"" :
", ") + ip.getName();
340 List<String> l =
new ArrayList<String>();
341 Date now =
new Date();
342 if(
entity.getStartDate() !=
null) {
343 if(now.before(
entity.getStartDate())) {
347 StringBuffer sb =
new StringBuffer();
349 Issue source = ip.getSource();
372 private String reverse(String
string) {
373 StringBuffer sb =
new StringBuffer(
string);
374 for(
int i = 0; i < sb.length(); i++) {
375 sb.setCharAt(i, (
char)(
'9' - sb.charAt(i) +
'0'));
377 return sb.toString();
380 private List<IssueParticipantRole> getRole() {
381 if(!contact.
isValid())
return Collections.EMPTY_LIST;
383 role =
new ArrayList<>();
385 if(!Strings.isBlank(ip.getIdContact())) {
386 if(ip.getIdContact().equals(contact.
getId())) {
387 role.add(ip.getRole());
398 private int getRelevanceByReporter() {
419 private int getRelevanceByResponsible() {
440 private int getRelevanceByQA() {
460 Iterator<IssueParticipant> iip =
entity.getParticipants().iterator();
461 while(iip.hasNext()) {
462 if(Strings.isBlank(iip.next().getIdContact())) {
469 return entity.getStartDate();
473 return entity.getDelivery();
477 return entity.getControlDate();
490 public boolean delete() {
493 return super.delete();
503 (
entity.getStatus().isFinished() ?
" " +
I_.
byKey(
entity.getResolution().toString()) :
"");
569 wc.
addClause(
"update IssueParticipant ip");
570 wc.
addClause(
"set pendingRevision = true");
580 wc.
addClause(
"update IssueParticipant ip");
581 wc.
addClause(
"set pendingRevision = false");
static IContact getIContact()
static String getObjectPath(Object object)
void setReportValues(Dossier dossier)
Set< IssueComment > getComments()
Set< IssueParticipant > getParticipants()
IssueWrapper(Issue issue, IContact contact)
IssueDetailSet getDetail()
void setContact(IContact contact)
boolean getCanShowDossier()
DossierValues getReality()
String getOrderingValue()
String getReporterString()
Set< IssuePredecessor > getSources()
int getRelevanceOrderByContact()
String getResponsibleString()
String getPriorityImage()
IssueWrapper(Issue issue)
Set< IssuePredecessor > getTargets()
List< String > getWaitingReason()
String getAssistantString()
boolean isFullParticipant()
void setIssue(Issue issue)
boolean hasPassedStartDate()
DossierData getDossierData()
static void checkPendingRevision(Issue issue)
boolean canStartBySources()
boolean hasPassedValues()
boolean getCanCheckClose()
boolean getCanMarkAsIncomplete()
static void removeWorksheet(String idContact)
boolean isInRole(String role)
static Application getApplication()
static String logMsg(String msg)
void addClause(String clause)
void addNamedValue(String name, Object value)
static String format(String msg, Object... arguments)
static String byKey(String key)
static String get(String msg)
int executeUpdate(String query)