BrightSide Workbench Full Report + Source Code
org.turro.dossier.dossier.DossierWrapper Class Reference
Inheritance diagram for org.turro.dossier.dossier.DossierWrapper:
Collaboration diagram for org.turro.dossier.dossier.DossierWrapper:

Public Member Functions

 DossierWrapper (Dossier entity)
 
Dossier save ()
 
boolean delete ()
 
String getTabLabel ()
 
String getSelfLabel ()
 
String getTooltiptext ()
 
void setContact (IContact contact)
 
boolean isParticipant ()
 
boolean isOwner ()
 
boolean isSubject ()
 
boolean isAssistant ()
 
boolean getCanShowParticipants ()
 
boolean getCanShowAllAttachments ()
 
boolean getCanShowAllIssues ()
 
boolean getReceiveAllEmails ()
 
String getIssueParticipantName ()
 
String getIssueParticipant ()
 
void setIssueParticipant (String issueParticipant)
 
List getIssueAlarms ()
 
IssueResults getIssueSearch ()
 
DossierDWReport getReport ()
 
List< DossierWrappergetResponsibles ()
 
long getIssueCount ()
 
Date getIssueLastModification ()
 
boolean isEmptyDescriptors (String grouping, boolean required)
 
- Public Member Functions inherited from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >
 DaoEntity ()
 
 DaoEntity (Class< T > persistentClass)
 
 DaoEntity (T entity)
 
Dao getDao ()
 
getEntity ()
 
IElephantEntity getIee ()
 
find (ID id)
 
ID getId ()
 
List< String > getMessages ()
 
boolean canDelete ()
 
boolean canSave ()
 
boolean equals (Object obj)
 
int hashCode ()
 

Protected Member Functions

Dao createDao ()
 
boolean shouldLog ()
 
- Protected Member Functions inherited from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >
void logEntity (SystemLogType logType, Object entity, String action, String data)
 
String dataEntity (Object entity)
 
void initOperation ()
 
void addMessage (String message)
 

Additional Inherited Members

- Static Public Member Functions inherited from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >
static Object getEntityId (Object entity)
 
static boolean isNewId (Object id)
 
- Protected Attributes inherited from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >
entity
 
ID id
 
List< String > messages = new ArrayList<>()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 58 of file DossierWrapper.java.

Constructor & Destructor Documentation

◆ DossierWrapper()

org.turro.dossier.dossier.DossierWrapper.DossierWrapper ( Dossier  entity)

Definition at line 66 of file DossierWrapper.java.

66  {
67  super(entity);
68  }
Here is the caller graph for this function:

Member Function Documentation

◆ createDao()

Dao org.turro.dossier.dossier.DossierWrapper.createDao ( )
protected

Reimplemented from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >.

Definition at line 71 of file DossierWrapper.java.

71  {
72  return new DossierPU();
73  }

◆ delete()

boolean org.turro.dossier.dossier.DossierWrapper.delete ( )

Reimplemented from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >.

Definition at line 126 of file DossierWrapper.java.

126  {
127  EntityCollections.entities(entity.getParticipants()).removeEmpties();
128  Relateds.empty().removeAny(DossierPU.getObjectPath(entity));
129  return super.delete();
130  }
Here is the call graph for this function:

◆ getCanShowAllAttachments()

boolean org.turro.dossier.dossier.DossierWrapper.getCanShowAllAttachments ( )

Definition at line 197 of file DossierWrapper.java.

197  {
198  if(entity == null) return false;
199  if(isOwner()) {
200  return true;
201  } else if(isParticipant()) {
202  for(IDossierParticipant p : getEntity().getFullParticipants()) {
203  if(p.getIdContact().equals(contact.getId()) && p.isShowAllAttachments()) {
204  return true;
205  }
206  }
207  }
208  return false;
209  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCanShowAllIssues()

boolean org.turro.dossier.dossier.DossierWrapper.getCanShowAllIssues ( )

Definition at line 211 of file DossierWrapper.java.

211  {
212  if(entity == null) return false;
213  if(isOwner() || Application.getApplication().isInRole("issue:all")) {
214  return true;
215  } else if(isParticipant()) {
216  for(IDossierParticipant p : getEntity().getFullParticipants()) {
217  if(p.getIdContact().equals(contact.getId()) && p.isShowAllIssues()) {
218  return true;
219  }
220  }
221  }
222  return false;
223  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCanShowParticipants()

boolean org.turro.dossier.dossier.DossierWrapper.getCanShowParticipants ( )

Definition at line 181 of file DossierWrapper.java.

181  {
182  if(entity == null) return false;
183  if(Application.getApplication().isInRole("dossier:participants")) {
184  return true;
185  } else if(isOwner()) {
186  return true;
187  } else if(isParticipant()) {
188  for(IDossierParticipant p : getEntity().getFullParticipants()) {
189  if(p.getIdContact().equals(contact.getId()) && p.isShowParticipants()) {
190  return true;
191  }
192  }
193  }
194  return false;
195  }
Here is the call graph for this function:

◆ getIssueAlarms()

List org.turro.dossier.dossier.DossierWrapper.getIssueAlarms ( )

Definition at line 253 of file DossierWrapper.java.

253  {
254  if(issueAlarms == null) createIssueAlarms();
255  return issueAlarms;
256  }

◆ getIssueCount()

long org.turro.dossier.dossier.DossierWrapper.getIssueCount ( )

Definition at line 300 of file DossierWrapper.java.

300  {
301  Dao dao = new DossierPU();
302  WhereClause wc = new WhereClause();
303  wc.addClause("select count(issue) from Issue as issue");
304  wc.addClause("where dossier = :dossier");
305  wc.addNamedValue("dossier", entity);
306  return (Long) dao.getSingleResult(wc);
307  }
Here is the call graph for this function:

◆ getIssueLastModification()

Date org.turro.dossier.dossier.DossierWrapper.getIssueLastModification ( )

Definition at line 309 of file DossierWrapper.java.

309  {
310  Dao dao = new DossierPU();
311  WhereClause wc = new WhereClause();
312  wc.addClause("select max(issue.modification)");
313  wc.addClause("from Issue as issue");
314  wc.addClause("where dossier = :dossier");
315  wc.addNamedValue("dossier", entity);
316  return (Date) dao.getSingleResult(wc);
317  }
Here is the call graph for this function:

◆ getIssueParticipant()

String org.turro.dossier.dossier.DossierWrapper.getIssueParticipant ( )

Definition at line 245 of file DossierWrapper.java.

245  {
246  return issueParticipant;
247  }

◆ getIssueParticipantName()

String org.turro.dossier.dossier.DossierWrapper.getIssueParticipantName ( )

Definition at line 237 of file DossierWrapper.java.

237  {
238  IContact c = Contacts.getContactById(issueParticipant);
239  if(c.isValid()) {
240  return c.getName();
241  }
242  return null;
243  }
Here is the call graph for this function:

◆ getIssueSearch()

IssueResults org.turro.dossier.dossier.DossierWrapper.getIssueSearch ( )

Definition at line 258 of file DossierWrapper.java.

258  {
259  IssueResults ir = new IssueResults();
260 
261  ir.setDossierId(entity.getId());
262  ir.setIssueValue("*");
263  ir.markAll();
264  if(issueParticipant != null) {
265  ir.setByParticipantId(issueParticipant);
266  ir.setRoles(EnumSet.of(IssueParticipantRole.ISSUE_RESPONSIBLE));
267  ir.setCkOthers(false);
268  }
269 
270  return ir;
271  }
Here is the call graph for this function:

◆ getReceiveAllEmails()

boolean org.turro.dossier.dossier.DossierWrapper.getReceiveAllEmails ( )

Definition at line 225 of file DossierWrapper.java.

225  {
226  if(entity == null || !getCanShowAllIssues()) return false;
227  if(isParticipant()) {
228  for(IDossierParticipant p : getEntity().getFullParticipants()) {
229  if(p.getIdContact().equals(contact.getId()) && p.isReceiveAllEmails()) {
230  return true;
231  }
232  }
233  }
234  return false;
235  }
Here is the call graph for this function:

◆ getReport()

DossierDWReport org.turro.dossier.dossier.DossierWrapper.getReport ( )

Definition at line 273 of file DossierWrapper.java.

273  {
274  if(report == null) {
275  report = new DossierDWReport();
276  report.setReportValues(issueParticipant, IssueParticipantRole.ISSUE_RESPONSIBLE, entity.getId());
277  }
278  return report;
279  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getResponsibles()

List<DossierWrapper> org.turro.dossier.dossier.DossierWrapper.getResponsibles ( )

Definition at line 281 of file DossierWrapper.java.

281  {
282  Dao dao = new DossierPU();
283  WhereClause wc = new WhereClause();
284  wc.addClause("select distinct participant.idContact");
285  wc.addClause("from IssueParticipant as participant");
286  wc.addClause("where participant.issue.dossier = :dossier");
287  wc.addClause("and participant.role = :role");
288  wc.addClause("order by participant.name");
289  wc.addNamedValue("dossier", entity);
290  wc.addNamedValue("role", IssueParticipantRole.ISSUE_RESPONSIBLE);
291  List<DossierWrapper> l = new ArrayList<>();
292  for(String s : (List<String>) dao.getResultList(wc)) {
294  dw.setIssueParticipant(s);
295  l.add(dw);
296  }
297  return l;
298  }
Here is the call graph for this function:

◆ getSelfLabel()

String org.turro.dossier.dossier.DossierWrapper.getSelfLabel ( )

Definition at line 141 of file DossierWrapper.java.

141  {
142  if(DossierType.TYPE_PROJECT.equals(entity.getType())) {
143  return I_.get("Project");
144  } else {
145  return I_.get("Dossier");
146  }
147  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTabLabel()

String org.turro.dossier.dossier.DossierWrapper.getTabLabel ( )

Definition at line 137 of file DossierWrapper.java.

137  {
138  return getSelfLabel() + " #" + (entity.getId() == null ? "" : entity.getId());
139  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTooltiptext()

String org.turro.dossier.dossier.DossierWrapper.getTooltiptext ( )

Definition at line 149 of file DossierWrapper.java.

149  {
150  try {
151  return entity.getFullDescription();
152  } catch(Exception ex) {
153  return null;
154  }
155  }
Here is the caller graph for this function:

◆ isAssistant()

boolean org.turro.dossier.dossier.DossierWrapper.isAssistant ( )

Definition at line 176 of file DossierWrapper.java.

176  {
177  if(entity == null) return false;
178  return getRole().contains(ParticipantRole.PARTICIPANT_ASSISTANT);
179  }
Here is the caller graph for this function:

◆ isEmptyDescriptors()

boolean org.turro.dossier.dossier.DossierWrapper.isEmptyDescriptors ( String  grouping,
boolean  required 
)

Definition at line 341 of file DossierWrapper.java.

341  {
342  for(DescriptorDefinition dd : entity.getDescriptorSet()) {
343  if("all".equals(grouping) || CompareUtil.compare(grouping, dd.getGrouping()) == 0) {
344  DescriptorValue dv = dd.getValue();
345  if(required && dd.isRequired() && (dv == null || dv.isEmpty())) {
346  return true;
347  }
348  }
349  }
350  return false;
351  }
boolean equals(Object obj)
Definition: DaoEntity.java:154
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOwner()

boolean org.turro.dossier.dossier.DossierWrapper.isOwner ( )

Definition at line 166 of file DossierWrapper.java.

166  {
167  if(entity == null) return false;
168  return getRole().contains(ParticipantRole.PARTICIPANT_OWNER);
169  }
Here is the caller graph for this function:

◆ isParticipant()

boolean org.turro.dossier.dossier.DossierWrapper.isParticipant ( )

Definition at line 161 of file DossierWrapper.java.

161  {
162  if(entity == null) return false;
163  return getRole() != null && !getRole().isEmpty();
164  }
Here is the caller graph for this function:

◆ isSubject()

boolean org.turro.dossier.dossier.DossierWrapper.isSubject ( )

Definition at line 171 of file DossierWrapper.java.

171  {
172  if(entity == null) return false;
173  return getRole().contains(ParticipantRole.PARTICIPANT_SUBJECT);
174  }

◆ save()

Dossier org.turro.dossier.dossier.DossierWrapper.save ( )

Reimplemented from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >.

Definition at line 76 of file DossierWrapper.java.

76  {
77  RelatedItem rpi = entity.getRelated();
78  if(entity.getCreation() == null) {
79  entity.setCreation(new Date());
80  }
81  if(entity.getType() == null) {
82  entity.setType(DossierType.TYPE_DOSSIER);
83  }
84  EntityCollections.entities(entity.getParticipants()).removeEmpties();
85  for(Participant p : entity.getParticipants()) {
86  p.setRole(p.getRole()); //ensure properties for owner
87  }
88  EntityCollections.entities(entity.getVersions()).removeEmpties();
89  EntityCollections.entities(entity.getDescriptors()).removeEmpties();
90  if(DossierType.TYPE_PROJECT.equals(entity.getType())) {
91  Project project = entity.getProject();
92  if(project == null) {
93  project = new Project();
94  project.setPhase(0);
95  project.setProjectTitle(entity.getDescription());
96  entity.setProject(project);
97  project.setDossier(entity);
98  }
99  PhraseBuilder pb = new PhraseBuilder();
100  pb.addWord(project.getProjectCode());
101  pb.addPendingSeparator(" - ");
102  pb.addWord(project.getProjectTitle());
103  if(!pb.isBlank()) {
104  entity.setDescription(pb.toString());
105  }
106  } else {
107  entity.setProject(null);
108  }
109  entity = super.save();
110  CategoryResults.normalizeUniquePaths(entity);
111  if(!Strings.isBlank(rpi.getRelatedPath())) {
112  Relateds.from(rpi.getRelatedPath()).addDestination(
113  DossierPU.getObjectPath(entity),
114  rpi.getDescription());
115  }
116  if(entity.getId() != null) {
117  String url = Strings.unpunctuateKeepPath(entity.getCategory().getPath()).toLowerCase() +
118  "/" + entity.getId() +
119  "/" + Strings.unpunctuate(entity.getDescription()).toLowerCase();
120  EntityWebUrls.addWebUrl("/dossier/" + entity.getId(), url);
121  }
122  return entity;
123  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setContact()

void org.turro.dossier.dossier.DossierWrapper.setContact ( IContact  contact)

Definition at line 157 of file DossierWrapper.java.

157  {
158  this.contact = contact;
159  }

◆ setIssueParticipant()

void org.turro.dossier.dossier.DossierWrapper.setIssueParticipant ( String  issueParticipant)

Definition at line 249 of file DossierWrapper.java.

249  {
250  this.issueParticipant = issueParticipant;
251  }
Here is the caller graph for this function:

◆ shouldLog()

boolean org.turro.dossier.dossier.DossierWrapper.shouldLog ( )
protected

Reimplemented from org.turro.jpa.entity.DaoEntity< T extends IDaoEntity, ID extends Serializable >.

Definition at line 133 of file DossierWrapper.java.

133  {
134  return true;
135  }

The documentation for this class was generated from the following file: