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

Public Member Functions

Set< CategorygetChildren ()
 
void setChildren (Set< Category > children)
 
String getDescription ()
 
void setDescription (String description)
 
Long getId ()
 
void setId (Long id)
 
Category getParent ()
 
void setParent (Category parent)
 
Set< CategoryParticipantgetParticipants ()
 
void setParticipants (Set< CategoryParticipant > participants)
 
String getFullDescription ()
 
void setFullDescription (String fullDescription)
 
String getUniquePath ()
 
void setUniquePath (String uniquePath)
 
boolean isKnowledgeBase ()
 
void setKnowledgeBase (boolean knowledgeBase)
 
boolean isOwnsProjects ()
 
void setOwnsProjects (boolean ownsProjects)
 
Set< DescriptorDefinitiongetDescriptors ()
 
void setDescriptors (Set< DescriptorDefinition > descriptors)
 
Set< WorthDefinitiongetWorths ()
 
void setWorths (Set< WorthDefinition > worths)
 
Object entityId ()
 
boolean isEmpty ()
 
void prepareSave ()
 
CategoryParticipant addOwner (IContact contact)
 
CategoryParticipant addAssistant (IContact contact)
 
boolean isDirectOwner (IContact contact)
 
boolean isBranchAdmin (IContact contact)
 
List< IDossierParticipantgetDirectOwners ()
 
String getPath ()
 
ParticipantSet< IDossierParticipantgetFullParticipants ()
 
IContact getDefaultResponsible (ParticipantRole role)
 
List< DossiergetDossiers ()
 
- Public Member Functions inherited from org.turro.jpa.entity.IDaoEntity
default boolean isNew ()
 
default void prepareDelete ()
 
default void removeEmpties ()
 
default Collection< Collection > collections ()
 

Static Public Member Functions

static String getPathToFullDescription (String path)
 

Detailed Description

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

Definition at line 54 of file Category.java.

Member Function Documentation

◆ addAssistant()

CategoryParticipant org.turro.dossier.entity.Category.addAssistant ( IContact  contact)

Definition at line 213 of file Category.java.

213  {
214  if(contact == null) return null;
215  CategoryParticipant p = new CategoryParticipant();
216  p.setCategory(this);
217  p.setIdContact(contact.getId());
218  p.setName(contact.getName());
219  p.setRole(ParticipantRole.PARTICIPANT_ASSISTANT);
220  getParticipants().add(p);
221  return p;
222  }
Set< CategoryParticipant > getParticipants()
Definition: Category.java:116
Here is the call graph for this function:

◆ addOwner()

CategoryParticipant org.turro.dossier.entity.Category.addOwner ( IContact  contact)

Definition at line 202 of file Category.java.

202  {
203  if(contact == null) return null;
204  CategoryParticipant p = new CategoryParticipant();
205  p.setCategory(this);
206  p.setIdContact(contact.getId());
207  p.setName(contact.getName());
208  p.setRole(ParticipantRole.PARTICIPANT_OWNER);
209  getParticipants().add(p);
210  return p;
211  }
Here is the call graph for this function:

◆ entityId()

Object org.turro.dossier.entity.Category.entityId ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 179 of file Category.java.

179  {
180  return id;
181  }

◆ getChildren()

Set<Category> org.turro.dossier.entity.Category.getChildren ( )

Definition at line 84 of file Category.java.

84  {
85  return children;
86  }
Here is the caller graph for this function:

◆ getDefaultResponsible()

IContact org.turro.dossier.entity.Category.getDefaultResponsible ( ParticipantRole  role)

Definition at line 280 of file Category.java.

280  {
281  for(CategoryParticipant p : getParticipants()) {
282  if(p.getRole().equals(role)) {
283  return Contacts.getContactById(p.getIdContact());
284  }
285  }
286  if(getParent() != null) {
287  return getParent().getDefaultResponsible(role);
288  }
289  return null;
290  }
IContact getDefaultResponsible(ParticipantRole role)
Definition: Category.java:280
Here is the call graph for this function:

◆ getDescription()

String org.turro.dossier.entity.Category.getDescription ( )

Definition at line 92 of file Category.java.

92  {
93  return description;
94  }
Here is the caller graph for this function:

◆ getDescriptors()

Set<DescriptorDefinition> org.turro.dossier.entity.Category.getDescriptors ( )

Definition at line 160 of file Category.java.

160  {
161  return descriptors;
162  }
Here is the caller graph for this function:

◆ getDirectOwners()

List<IDossierParticipant> org.turro.dossier.entity.Category.getDirectOwners ( )

Definition at line 246 of file Category.java.

246  {
247  List<IDossierParticipant> list = new ArrayList<>();
248  for(CategoryParticipant p : getParticipants()) {
249  if(p.getRole().equals(ParticipantRole.PARTICIPANT_OWNER)) {
250  list.add(p);
251  }
252  }
253  return list;
254  }

◆ getDossiers()

List<Dossier> org.turro.dossier.entity.Category.getDossiers ( )

Definition at line 292 of file Category.java.

292  {
293  WhereClause wc = new WhereClause();
294  wc.addClause("select d from Dossier d");
295  wc.addClause("where d.category = :category");
296  wc.addNamedValue("category", this);
297  Dao dao = new DossierPU();
298  return dao.getResultList(Dossier.class, wc);
299  }
Here is the call graph for this function:

◆ getFullDescription()

String org.turro.dossier.entity.Category.getFullDescription ( )

Definition at line 128 of file Category.java.

128  {
129  return fullDescription;
130  }
Here is the caller graph for this function:

◆ getFullParticipants()

ParticipantSet<IDossierParticipant> org.turro.dossier.entity.Category.getFullParticipants ( )

Definition at line 270 of file Category.java.

270  {
271  ParticipantSet<IDossierParticipant> set = new ParticipantSet<>(getParticipants());
272  Category c = getParent();
273  while(c != null) {
274  set.addAll(c.getParticipants());
275  c = c.getParent();
276  }
277  return set;
278  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getId()

Long org.turro.dossier.entity.Category.getId ( )

Definition at line 100 of file Category.java.

100  {
101  return id;
102  }
Here is the caller graph for this function:

◆ getParent()

Category org.turro.dossier.entity.Category.getParent ( )

Definition at line 108 of file Category.java.

108  {
109  return parent;
110  }
Here is the caller graph for this function:

◆ getParticipants()

Set<CategoryParticipant> org.turro.dossier.entity.Category.getParticipants ( )

Definition at line 116 of file Category.java.

116  {
117  Dao dao = new DossierPU();
118  if(id != null && id > 0 && dao.isNotLoaded(participants)) {
119  participants = dao.lazyLoader(Category.class, this, "participants").participants;
120  }
121  return participants;
122  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPath()

String org.turro.dossier.entity.Category.getPath ( )

Definition at line 256 of file Category.java.

256  {
257  if(!Strings.isBlank(fullDescription)) {
258  return "/" + fullDescription.replaceAll("\\s*\\" + Chars.backward() + "\\s*", "\\/");
259  }
260  return null;
261  }
Here is the caller graph for this function:

◆ getPathToFullDescription()

static String org.turro.dossier.entity.Category.getPathToFullDescription ( String  path)
static

Definition at line 263 of file Category.java.

263  {
264  if(!Strings.isBlank(path)) {
265  return path.substring(1).replaceAll("\\/", " \\" + Chars.backward() + " ");
266  }
267  return null;
268  }
Here is the caller graph for this function:

◆ getUniquePath()

String org.turro.dossier.entity.Category.getUniquePath ( )

Definition at line 136 of file Category.java.

136  {
137  return uniquePath;
138  }
Here is the caller graph for this function:

◆ getWorths()

Set<WorthDefinition> org.turro.dossier.entity.Category.getWorths ( )

Definition at line 168 of file Category.java.

168  {
169  return worths;
170  }
Here is the caller graph for this function:

◆ isBranchAdmin()

boolean org.turro.dossier.entity.Category.isBranchAdmin ( IContact  contact)

Definition at line 235 of file Category.java.

235  {
236  for(CategoryParticipant p : getParticipants()) {
237  if(p.getRole().equals(ParticipantRole.PARTICIPANT_OWNER) &&
238  contact.getId().equals(p.getIdContact()) &&
239  p.isAdmin()) {
240  return true;
241  }
242  }
243  return false;
244  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDirectOwner()

boolean org.turro.dossier.entity.Category.isDirectOwner ( IContact  contact)

Definition at line 224 of file Category.java.

224  {
225  for(CategoryParticipant p : getParticipants()) {
226  if(p.getRole().equals(ParticipantRole.PARTICIPANT_OWNER)) {
227  if(contact.getId().equals(p.getIdContact())) {
228  return true;
229  }
230  }
231  }
232  return false;
233  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.dossier.entity.Category.isEmpty ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 184 of file Category.java.

184  {
185  return Strings.isBlank(description);
186  }
Here is the caller graph for this function:

◆ isKnowledgeBase()

boolean org.turro.dossier.entity.Category.isKnowledgeBase ( )

Definition at line 144 of file Category.java.

144  {
145  return knowledgeBase;
146  }
Here is the caller graph for this function:

◆ isOwnsProjects()

boolean org.turro.dossier.entity.Category.isOwnsProjects ( )

Definition at line 152 of file Category.java.

152  {
153  return ownsProjects;
154  }
Here is the caller graph for this function:

◆ prepareSave()

void org.turro.dossier.entity.Category.prepareSave ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 189 of file Category.java.

189  {
190  IDaoEntity.super.prepareSave();
191  if(id == null || id == 0) {
192  id = IdUtils.getNewLongIdFromLong(new DossierPU(), "Category", "id");
193  } else {
194  if(Hierarchy.checkLoop(this, (c) -> c.id, (c) -> c.parent)) {
195  parent = null;
196  }
197  }
198  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChildren()

void org.turro.dossier.entity.Category.setChildren ( Set< Category children)

Definition at line 88 of file Category.java.

88  {
89  this.children = children;
90  }

◆ setDescription()

void org.turro.dossier.entity.Category.setDescription ( String  description)

Definition at line 96 of file Category.java.

96  {
97  this.description = description;
98  }
Here is the caller graph for this function:

◆ setDescriptors()

void org.turro.dossier.entity.Category.setDescriptors ( Set< DescriptorDefinition descriptors)

Definition at line 164 of file Category.java.

164  {
165  this.descriptors = descriptors;
166  }
Here is the caller graph for this function:

◆ setFullDescription()

void org.turro.dossier.entity.Category.setFullDescription ( String  fullDescription)

Definition at line 132 of file Category.java.

132  {
133  this.fullDescription = fullDescription;
134  }

◆ setId()

void org.turro.dossier.entity.Category.setId ( Long  id)

Definition at line 104 of file Category.java.

104  {
105  this.id = id;
106  }

◆ setKnowledgeBase()

void org.turro.dossier.entity.Category.setKnowledgeBase ( boolean  knowledgeBase)

Definition at line 148 of file Category.java.

148  {
149  this.knowledgeBase = knowledgeBase;
150  }
Here is the caller graph for this function:

◆ setOwnsProjects()

void org.turro.dossier.entity.Category.setOwnsProjects ( boolean  ownsProjects)

Definition at line 156 of file Category.java.

156  {
157  this.ownsProjects = ownsProjects;
158  }
Here is the caller graph for this function:

◆ setParent()

void org.turro.dossier.entity.Category.setParent ( Category  parent)

Definition at line 112 of file Category.java.

112  {
113  this.parent = parent;
114  }
Here is the caller graph for this function:

◆ setParticipants()

void org.turro.dossier.entity.Category.setParticipants ( Set< CategoryParticipant participants)

Definition at line 124 of file Category.java.

124  {
125  this.participants = participants;
126  }
Here is the caller graph for this function:

◆ setUniquePath()

void org.turro.dossier.entity.Category.setUniquePath ( String  uniquePath)

Definition at line 140 of file Category.java.

140  {
141  this.uniquePath = uniquePath;
142  }

◆ setWorths()

void org.turro.dossier.entity.Category.setWorths ( Set< WorthDefinition worths)

Definition at line 172 of file Category.java.

172  {
173  this.worths = worths;
174  }
Here is the caller graph for this function:

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