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

Public Member Functions

boolean isActive ()
 
void setActive (boolean active)
 
boolean isCash ()
 
void setCash (boolean cash)
 
ContractDefinition getContractDefinition ()
 
void setContractDefinition (ContractDefinition contractDefinition)
 
Set< ContractFlowgetContractFlows ()
 
void setContractFlows (Set< ContractFlow > contractFlows)
 
Set< ContractPreferencegetContractPreferences ()
 
void setContractPreferences (Set< ContractPreference > contractPreferences)
 
String getContractor ()
 
void setContractor (String contractor)
 
Currency getCurrency ()
 
void setCurrency (Currency currency)
 
Department getDepartment ()
 
void setDepartment (Department department)
 
Date getEndDate ()
 
void setEndDate (Date endDate)
 
boolean isEquivalenceSurcharge ()
 
void setEquivalenceSurcharge (boolean equivalenceSurcharge)
 
String getGlobalId ()
 
void setGlobalId (String globalId)
 
long getId ()
 
void setId (long id)
 
String getName ()
 
void setName (String name)
 
String getNotes ()
 
void setNotes (String notes)
 
OperatingModifier getOperatingModifier ()
 
void setOperatingModifier (OperatingModifier operatingModifier)
 
String getGrouping ()
 
void setGrouping (String grouping)
 
double getFee ()
 
void setFee (double fee)
 
Periodicity getPeriodicity ()
 
void setPeriodicity (Periodicity periodicity)
 
Set< ContractParticipantgetParticipants ()
 
void setParticipants (Set< ContractParticipant > participants)
 
Set< RelatedContractStoregetRelatedContractStores ()
 
void setRelatedContractStores (Set< RelatedContractStore > relatedContractStores)
 
Service getService ()
 
void setService (Service service)
 
Date getStartDate ()
 
void setStartDate (Date startDate)
 
boolean isStock ()
 
void setStock (boolean stock)
 
Set< TaxgetTaxes ()
 
void setTaxes (Set< Tax > taxes)
 
Set< ContractedgetContracted ()
 
void setContracted (Set< Contracted > contracted)
 
boolean isUseContractorCode ()
 
void setUseContractorCode (boolean useContractorCode)
 
ContractHandshake getContractHandshake ()
 
void setContractHandshake (ContractHandshake contractHandshake)
 
Object entityId ()
 
boolean isEmpty ()
 
void prepareSave ()
 
Collection< Collection > collections ()
 
IContact getIContractor ()
 
String getPartialDescription ()
 
String getFullDescription ()
 
Collection< ContractFlowgetFlowFor (Document document)
 
List< DocumentgetDocuments ()
 
Collection< IContactgetIParticipants ()
 
Collection< IContactgetIParticipantsEmail ()
 
String getUsualPath (DocumentDefinition documentDefinition)
 
MappingSet getSerializerMappings ()
 
- Public Member Functions inherited from org.turro.jpa.entity.IDaoEntity
default boolean isNew ()
 
default void prepareDelete ()
 
default void removeEmpties ()
 

Static Public Member Functions

static void checkNames ()
 

Detailed Description

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

Definition at line 40 of file Contract.java.

Member Function Documentation

◆ checkNames()

static void org.turro.financials.entity.Contract.checkNames ( )
static

Definition at line 448 of file Contract.java.

448  {
449  Dao dao = new FinancialsPU();
450  List<Contract> list = dao.getResultList(
451  "select contract from Contract as contract");
452  for(Contract c : list) {
453  c.prepareSave();
454  dao.saveObject(c);
455  }
456  }

◆ collections()

Collection<Collection> org.turro.financials.entity.Contract.collections ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 365 of file Contract.java.

365  {
366  return List.of(
367  getParticipants(),
370  getTaxes(),
371  getContracted());
372  }
Set< ContractParticipant > getParticipants()
Definition: Contract.java:260
Set< RelatedContractStore > getRelatedContractStores()
Definition: Contract.java:268
Set< ContractFlow > getContractFlows()
Definition: Contract.java:137
Set< Contracted > getContracted()
Definition: Contract.java:312
Here is the call graph for this function:

◆ entityId()

Object org.turro.financials.entity.Contract.entityId ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 339 of file Contract.java.

339  {
340  return id;
341  }

◆ getContractDefinition()

ContractDefinition org.turro.financials.entity.Contract.getContractDefinition ( )

Definition at line 125 of file Contract.java.

125  {
126  Dao dao = new FinancialsPU();
127  if(id > 0 && dao.isNotLoaded(contractDefinition)) {
128  contractDefinition = dao.lazyLoader(Contract.class, this, "contractDefinition").contractDefinition;
129  }
130  return contractDefinition;
131  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContracted()

Set<Contracted> org.turro.financials.entity.Contract.getContracted ( )

Definition at line 312 of file Contract.java.

312  {
313  return contracted;
314  }
Here is the caller graph for this function:

◆ getContractFlows()

Set<ContractFlow> org.turro.financials.entity.Contract.getContractFlows ( )

Definition at line 137 of file Contract.java.

137  {
138  return contractFlows;
139  }
Here is the caller graph for this function:

◆ getContractHandshake()

ContractHandshake org.turro.financials.entity.Contract.getContractHandshake ( )

Definition at line 328 of file Contract.java.

328  {
329  return contractHandshake;
330  }
Here is the caller graph for this function:

◆ getContractor()

String org.turro.financials.entity.Contract.getContractor ( )

Definition at line 153 of file Contract.java.

153  {
154  return contractor;
155  }
Here is the caller graph for this function:

◆ getContractPreferences()

Set<ContractPreference> org.turro.financials.entity.Contract.getContractPreferences ( )

Definition at line 145 of file Contract.java.

145  {
146  return contractPreferences;
147  }
Here is the caller graph for this function:

◆ getCurrency()

Currency org.turro.financials.entity.Contract.getCurrency ( )

Definition at line 161 of file Contract.java.

161  {
162  if(currency == null) {
163  currency = Currency.getInstance("EUR");
164  }
165  return currency;
166  }
Here is the caller graph for this function:

◆ getDepartment()

Department org.turro.financials.entity.Contract.getDepartment ( )

Definition at line 172 of file Contract.java.

172  {
173  return department;
174  }
Here is the caller graph for this function:

◆ getDocuments()

List<Document> org.turro.financials.entity.Contract.getDocuments ( )

Definition at line 439 of file Contract.java.

439  {
440  WhereClause wc = new WhereClause();
441  wc.addClause("select d from Document d");
442  wc.addClause("where d.contract = :contract");
443  wc.addNamedValue("contract", this);
444  Dao dao = new FinancialsPU();
445  return dao.getResultList(Document.class, wc);
446  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEndDate()

Date org.turro.financials.entity.Contract.getEndDate ( )

Definition at line 180 of file Contract.java.

180  {
181  return endDate;
182  }
Here is the caller graph for this function:

◆ getFee()

double org.turro.financials.entity.Contract.getFee ( )

Definition at line 244 of file Contract.java.

244  {
245  return fee;
246  }

◆ getFlowFor()

Collection<ContractFlow> org.turro.financials.entity.Contract.getFlowFor ( Document  document)

Definition at line 427 of file Contract.java.

427  {
428  ArrayList<ContractFlow> flows = new ArrayList<>();
429  if(document != null && document.getDocumentDefinition() != null) {
430  for(ContractFlow cf : contractFlows) {
431  if(cf.getDocumentDefinition().getId() == document.getDocumentDefinition().getId()) {
432  flows.add(cf);
433  }
434  }
435  }
436  return flows;
437  }
Here is the call graph for this function:

◆ getFullDescription()

String org.turro.financials.entity.Contract.getFullDescription ( )

Definition at line 391 of file Contract.java.

391  {
392  StringBuilder sb = new StringBuilder();
393  if(department != null) {
394  sb.append(department.getFullName());
395  service = null;
396  } else if(service != null) {
397  sb.append(service.getFullName());
398  department = null;
399  } else {
400  IContact ic = getIContractor();
401  if(ic != null) {
402  sb.append(ic.getName());
403  }
404  }
405  if(getContractDefinition() != null) {
406  PhraseBuilder pb = new PhraseBuilder();
407  pb.addWord(contractDefinition.getName());
408  pb.addPendingSeparator(": ");
409  for(ContractPreference cp : getContractPreferences()) {
410  pb.addWord(cp.getName());
411  pb.addPendingSeparator(",");
412  }
413  if(!pb.isBlank()) {
414  pb.enclose("()");
415  sb.append(" " + pb.toString());
416  }
417  }
418  if(!OperatingModifier.OPMOD_NORMAL.equals(getOperatingModifier())) {
419  sb.append(" [" + getOperatingModifier().toString().substring(6, 12) + "]");
420  }
421  if(globalId != null) {
422  sb.append(" " + globalId);
423  }
424  return sb.toString();
425  }
ContractDefinition getContractDefinition()
Definition: Contract.java:125
OperatingModifier getOperatingModifier()
Definition: Contract.java:228
Set< ContractPreference > getContractPreferences()
Definition: Contract.java:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGlobalId()

String org.turro.financials.entity.Contract.getGlobalId ( )

Definition at line 196 of file Contract.java.

196  {
197  return globalId;
198  }
Here is the caller graph for this function:

◆ getGrouping()

String org.turro.financials.entity.Contract.getGrouping ( )

Definition at line 236 of file Contract.java.

236  {
237  return grouping;
238  }

◆ getIContractor()

IContact org.turro.financials.entity.Contract.getIContractor ( )

Definition at line 376 of file Contract.java.

376  {
377  if(!Strings.isBlank(contractor)) {
378  return Contacts.getContactById(contractor);
379  }
380  return null;
381  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getId()

long org.turro.financials.entity.Contract.getId ( )

Definition at line 204 of file Contract.java.

204  {
205  return id;
206  }
Here is the caller graph for this function:

◆ getIParticipants()

Collection<IContact> org.turro.financials.entity.Contract.getIParticipants ( )

Definition at line 462 of file Contract.java.

462  {
463  if(_participants == null) {
464  _participants = new ContactList();
465  for(ContractParticipant cp : getParticipants()) {
466  _participants.add(Contacts.getContactById(cp.getIdContact()));
467  }
468  _participants.add(getIContractor());
469  }
470  return _participants;
471  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIParticipantsEmail()

Collection<IContact> org.turro.financials.entity.Contract.getIParticipantsEmail ( )

Definition at line 473 of file Contract.java.

473  {
474  if(_docParticipants == null) {
475  _docParticipants = new ContactList();
476  for(ContractParticipant cp : getParticipants()) {
477  if(cp.getInterventionType().isSendDocuments()) {
478  _docParticipants.add(Contacts.getContactById(cp.getIdContact()));
479  }
480  }
481  _docParticipants.add(getIContractor());
482  }
483  return _docParticipants;
484  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getName()

String org.turro.financials.entity.Contract.getName ( )

Definition at line 212 of file Contract.java.

212  {
213  return name;
214  }
Here is the caller graph for this function:

◆ getNotes()

String org.turro.financials.entity.Contract.getNotes ( )

Definition at line 220 of file Contract.java.

220  {
221  return notes;
222  }

◆ getOperatingModifier()

OperatingModifier org.turro.financials.entity.Contract.getOperatingModifier ( )

Definition at line 228 of file Contract.java.

228  {
229  return operatingModifier;
230  }
Here is the caller graph for this function:

◆ getPartialDescription()

String org.turro.financials.entity.Contract.getPartialDescription ( )

Definition at line 383 of file Contract.java.

383  {
384  StringBuilder sb = new StringBuilder();
385  if(!Strings.isBlank(globalId)) {
386  sb.append(globalId);
387  }
388  return sb.length() > 0 ? sb.toString() : getFullDescription();
389  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParticipants()

Set<ContractParticipant> org.turro.financials.entity.Contract.getParticipants ( )

Definition at line 260 of file Contract.java.

260  {
261  return participants;
262  }
Here is the caller graph for this function:

◆ getPeriodicity()

Periodicity org.turro.financials.entity.Contract.getPeriodicity ( )

Definition at line 252 of file Contract.java.

252  {
253  return periodicity;
254  }

◆ getRelatedContractStores()

Set<RelatedContractStore> org.turro.financials.entity.Contract.getRelatedContractStores ( )

Definition at line 268 of file Contract.java.

268  {
269  Dao dao = new FinancialsPU();
270  if(id > 0 && dao.isNotLoaded(relatedContractStores)) {
271  relatedContractStores = dao.lazyLoader(Contract.class, this, "relatedContractStores").relatedContractStores;
272  }
273  return relatedContractStores;
274  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSerializerMappings()

MappingSet org.turro.financials.entity.Contract.getSerializerMappings ( )

Definition at line 499 of file Contract.java.

499  {
500  MappingSet set = new MappingSet();
501  set.addMapping(Contract.class, 1,
502  new String[] { "id", "globalId", "contractor", "name" },
503  new String[] { "stock", "cash", "active", "useContractorCode", "operatingModifier",
504  "startDate", "endDate", "notes", "department", "service", "contractDefinition",
505  "contractPreferences", "relatedContractStores", "participants", "currency",
506  "taxes", "equivalenceSurcharge", "contractFlows", "contractHandshake",
507  "grouping", "fee", "periodicity", "contracted" });
508  set.addMapping(Department.class, 2,
509  new String[] { "id", "name" },
510  null);
511  set.addMapping(Service.class, 2,
512  new String[] { "id", "name" },
513  null);
514  set.addMapping(ContractDefinition.class, 2,
515  new String[] { "id", "name" },
516  null);
517  set.addMapping(ContractPreference.class, 2,
518  new String[] { "id", "name" },
519  null);
520  set.addMapping(RelatedContractStore.class, 2,
521  new String[] { "allowed" },
522  new String[] { "documentDefinition", "store" });
523  set.addMapping(DocumentDefinition.class, 3,
524  new String[] { "id", "name" },
525  null);
526  set.addMapping(Contract.class, 3,
527  new String[] { "id", "name" },
528  null);
529  set.addMapping(ContractParticipant.class, 2,
530  new String[] { "name", "interventionType" },
531  null);
532  set.addMapping(Currency.class, 2,
533  new String[] { "currencyCode" },
534  null);
535  set.addMapping(Tax.class, 2,
536  new String[] { "taxType", "tax", "equivalenceSurcharge" },
537  null);
538  set.addMapping(ContractFlow.class, 2,
539  new String[] { "description" },
540  new String[] { "documentDefinition", "contractExpiries" });
541  set.addMapping(ContractExpiry.class, 3,
542  new String[] { "concept", "daysToAdd", "dayOfWeek", "percentValue", "amountValue" },
543  new String[] { "documentDefinition", "lineType", "daysOfMonth", "excludedMonths" });
544  set.addMapping(DocumentDefinition.class, 4,
545  new String[] { "id", "name" },
546  null);
547  set.addMapping(LineType.class, 4,
548  new String[] { "name" },
549  null);
550  set.addMapping(Integer.class, 4,
551  new String[] { "this" },
552  null);
553  set.addMapping(ContractHandshake.class, 2,
554  new String[] { "remoteId", "remoteName", "remoteServer" },
555  null);
556  set.addMapping(Contracted.class, 2,
557  new String[] { "concept", "price", "quantity" },
558  new String[] { "product" });
559  set.addMapping(Product.class, 3,
560  new String[] { "id", "productCode" },
561  new String[] { "description" });
562  return set;
563  }

◆ getService()

Service org.turro.financials.entity.Contract.getService ( )

Definition at line 280 of file Contract.java.

280  {
281  return service;
282  }
Here is the caller graph for this function:

◆ getStartDate()

Date org.turro.financials.entity.Contract.getStartDate ( )

Definition at line 288 of file Contract.java.

288  {
289  return startDate;
290  }
Here is the caller graph for this function:

◆ getTaxes()

Set<Tax> org.turro.financials.entity.Contract.getTaxes ( )

Definition at line 304 of file Contract.java.

304  {
305  return taxes;
306  }
Here is the caller graph for this function:

◆ getUsualPath()

String org.turro.financials.entity.Contract.getUsualPath ( DocumentDefinition  documentDefinition)

Definition at line 488 of file Contract.java.

488  {
489  if(documentDefinition != null) {
490  return "dc-" +
491  getId() + "-" +
492  documentDefinition.getId() + "-";
493  }
494  return "";
495  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isActive()

boolean org.turro.financials.entity.Contract.isActive ( )

Definition at line 109 of file Contract.java.

109  {
110  return active;
111  }
Here is the caller graph for this function:

◆ isCash()

boolean org.turro.financials.entity.Contract.isCash ( )

Definition at line 117 of file Contract.java.

117  {
118  return cash;
119  }

◆ isEmpty()

boolean org.turro.financials.entity.Contract.isEmpty ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 344 of file Contract.java.

344  {
345  return Strings.isBlank(contractor) || getContractDefinition() == null;
346  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEquivalenceSurcharge()

boolean org.turro.financials.entity.Contract.isEquivalenceSurcharge ( )

Definition at line 188 of file Contract.java.

188  {
189  return equivalenceSurcharge;
190  }
Here is the caller graph for this function:

◆ isStock()

boolean org.turro.financials.entity.Contract.isStock ( )

Definition at line 296 of file Contract.java.

296  {
297  return stock;
298  }

◆ isUseContractorCode()

boolean org.turro.financials.entity.Contract.isUseContractorCode ( )

Definition at line 320 of file Contract.java.

320  {
321  return useContractorCode;
322  }
Here is the caller graph for this function:

◆ prepareSave()

void org.turro.financials.entity.Contract.prepareSave ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 349 of file Contract.java.

349  {
350  if(!stock) {
351  department = null;
352  service = null;
353  }
354  IDaoEntity.super.prepareSave();
355  name = Strings.truncateAndWarn(getFullDescription(), 255);
356  if(operatingModifier == null) {
357  operatingModifier = OperatingModifier.OPMOD_NORMAL;
358  }
359  if(id == 0) {
360  id = IdUtils.getNewLongIdFromLong(new FinancialsPU(), "Contract", "id");
361  }
362  }
Here is the call graph for this function:

◆ setActive()

void org.turro.financials.entity.Contract.setActive ( boolean  active)

Definition at line 113 of file Contract.java.

113  {
114  this.active = active;
115  }

◆ setCash()

void org.turro.financials.entity.Contract.setCash ( boolean  cash)

Definition at line 121 of file Contract.java.

121  {
122  this.cash = cash;
123  }

◆ setContractDefinition()

void org.turro.financials.entity.Contract.setContractDefinition ( ContractDefinition  contractDefinition)

Definition at line 133 of file Contract.java.

133  {
134  this.contractDefinition = contractDefinition;
135  }

◆ setContracted()

void org.turro.financials.entity.Contract.setContracted ( Set< Contracted contracted)

Definition at line 316 of file Contract.java.

316  {
317  this.contracted = contracted;
318  }

◆ setContractFlows()

void org.turro.financials.entity.Contract.setContractFlows ( Set< ContractFlow contractFlows)

Definition at line 141 of file Contract.java.

141  {
142  this.contractFlows = contractFlows;
143  }

◆ setContractHandshake()

void org.turro.financials.entity.Contract.setContractHandshake ( ContractHandshake  contractHandshake)

Definition at line 332 of file Contract.java.

332  {
333  this.contractHandshake = contractHandshake;
334  }
Here is the caller graph for this function:

◆ setContractor()

void org.turro.financials.entity.Contract.setContractor ( String  contractor)

Definition at line 157 of file Contract.java.

157  {
158  this.contractor = contractor;
159  }

◆ setContractPreferences()

void org.turro.financials.entity.Contract.setContractPreferences ( Set< ContractPreference contractPreferences)

Definition at line 149 of file Contract.java.

149  {
150  this.contractPreferences = contractPreferences;
151  }

◆ setCurrency()

void org.turro.financials.entity.Contract.setCurrency ( Currency  currency)

Definition at line 168 of file Contract.java.

168  {
169  this.currency = currency;
170  }

◆ setDepartment()

void org.turro.financials.entity.Contract.setDepartment ( Department  department)

Definition at line 176 of file Contract.java.

176  {
177  this.department = department;
178  }

◆ setEndDate()

void org.turro.financials.entity.Contract.setEndDate ( Date  endDate)

Definition at line 184 of file Contract.java.

184  {
185  this.endDate = endDate;
186  }

◆ setEquivalenceSurcharge()

void org.turro.financials.entity.Contract.setEquivalenceSurcharge ( boolean  equivalenceSurcharge)

Definition at line 192 of file Contract.java.

192  {
193  this.equivalenceSurcharge = equivalenceSurcharge;
194  }

◆ setFee()

void org.turro.financials.entity.Contract.setFee ( double  fee)

Definition at line 248 of file Contract.java.

248  {
249  this.fee = fee;
250  }

◆ setGlobalId()

void org.turro.financials.entity.Contract.setGlobalId ( String  globalId)

Definition at line 200 of file Contract.java.

200  {
201  this.globalId = globalId;
202  }

◆ setGrouping()

void org.turro.financials.entity.Contract.setGrouping ( String  grouping)

Definition at line 240 of file Contract.java.

240  {
241  this.grouping = grouping;
242  }

◆ setId()

void org.turro.financials.entity.Contract.setId ( long  id)

Definition at line 208 of file Contract.java.

208  {
209  this.id = id;
210  }

◆ setName()

void org.turro.financials.entity.Contract.setName ( String  name)

Definition at line 216 of file Contract.java.

216  {
217  this.name = name;
218  }

◆ setNotes()

void org.turro.financials.entity.Contract.setNotes ( String  notes)

Definition at line 224 of file Contract.java.

224  {
225  this.notes = notes;
226  }

◆ setOperatingModifier()

void org.turro.financials.entity.Contract.setOperatingModifier ( OperatingModifier  operatingModifier)

Definition at line 232 of file Contract.java.

232  {
233  this.operatingModifier = operatingModifier;
234  }

◆ setParticipants()

void org.turro.financials.entity.Contract.setParticipants ( Set< ContractParticipant participants)

Definition at line 264 of file Contract.java.

264  {
265  this.participants = participants;
266  }

◆ setPeriodicity()

void org.turro.financials.entity.Contract.setPeriodicity ( Periodicity  periodicity)

Definition at line 256 of file Contract.java.

256  {
257  this.periodicity = periodicity;
258  }

◆ setRelatedContractStores()

void org.turro.financials.entity.Contract.setRelatedContractStores ( Set< RelatedContractStore relatedContractStores)

Definition at line 276 of file Contract.java.

276  {
277  this.relatedContractStores = relatedContractStores;
278  }

◆ setService()

void org.turro.financials.entity.Contract.setService ( Service  service)

Definition at line 284 of file Contract.java.

284  {
285  this.service = service;
286  }

◆ setStartDate()

void org.turro.financials.entity.Contract.setStartDate ( Date  startDate)

Definition at line 292 of file Contract.java.

292  {
293  this.startDate = startDate;
294  }

◆ setStock()

void org.turro.financials.entity.Contract.setStock ( boolean  stock)

Definition at line 300 of file Contract.java.

300  {
301  this.stock = stock;
302  }

◆ setTaxes()

void org.turro.financials.entity.Contract.setTaxes ( Set< Tax taxes)

Definition at line 308 of file Contract.java.

308  {
309  this.taxes = taxes;
310  }

◆ setUseContractorCode()

void org.turro.financials.entity.Contract.setUseContractorCode ( boolean  useContractorCode)

Definition at line 324 of file Contract.java.

324  {
325  this.useContractorCode = useContractorCode;
326  }

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