BrightSide Workbench Full Report + Source Code
org.turro.financials.document.logic.DocumentComposer Class Reference
Inheritance diagram for org.turro.financials.document.logic.DocumentComposer:
Collaboration diagram for org.turro.financials.document.logic.DocumentComposer:

Public Member Functions

void onSelectLines ()
 
void onSelectExpiries ()
 
void onSelectRelations ()
 
void onSelectBatchOf ()
 
void onSelectRegister ()
 
void onSelectFlow ()
 
void onContractChange ()
 
void onDocumentDefinitionChange ()
 
void onDocProcess ()
 
void onProperties ()
 
void onLinesChange ()
 
void onRelationsChange ()
 
void onDocumentClone ()
 
void onCopyLines ()
 
void onPasteLines ()
 
void onAppendRow ()
 
void onInsertRow ()
 
void onDeleteRow ()
 
void afterSave ()
 
void doFinally () throws Exception
 
- Public Member Functions inherited from org.turro.jpa.composer.EntityComposer< E, ID >
final void onChange (Event event)
 
final void onSave ()
 
final void onDelete ()
 
Object getEntity ()
 
Object getWrapper ()
 
void doBeforeComposeChildren (Component comp) throws Exception
 
void doAfterCompose (Component comp) throws Exception
 

Protected Member Functions

String getAttributeName ()
 
Document getEntityInstance (Long id)
 
DaoEntity getWrapperInstance (Component comp)
 
boolean beforeDelete ()
 
boolean beforeSave ()
 
void doOnDelete ()
 
void doOnSave ()
 
boolean shouldBeSaved ()
 
boolean inSaveRole ()
 
boolean inDeleteRole ()
 
void retrieveEntity ()
 
- Protected Member Functions inherited from org.turro.jpa.composer.EntityComposer< E, ID >
abstract E getEntityInstance (ID id)
 
void afterDelete ()
 
void doOnChange ()
 
boolean hasChanged ()
 
boolean canClose ()
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.jpa.composer.EntityComposer< E, ID >
entity
 
DaoEntity wrapper
 

Detailed Description

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

Definition at line 68 of file DocumentComposer.java.

Member Function Documentation

◆ afterSave()

void org.turro.financials.document.logic.DocumentComposer.afterSave ( )

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 370 of file DocumentComposer.java.

370  {
371  if(entity != null) {
372  FinancialsMenu.showDocument(entity.getId());
373  }
374  }
Here is the call graph for this function:

◆ beforeDelete()

boolean org.turro.financials.document.logic.DocumentComposer.beforeDelete ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 311 of file DocumentComposer.java.

311  {
312  DocumentWrapper w = (DocumentWrapper) getWrapper();
313  return super.beforeSave() && !acceptance.isBlocked();
314  }
Here is the call graph for this function:

◆ beforeSave()

boolean org.turro.financials.document.logic.DocumentComposer.beforeSave ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 317 of file DocumentComposer.java.

317  {
318  DocumentWrapper w = (DocumentWrapper) getWrapper();
319  w.setPriorSavingValues(lines.getValues(), (List<DocumentRelation>) expiries.getRelations());
320  return super.beforeSave() && (acceptance == null || !acceptance.isBlocked());
321  }
Here is the call graph for this function:

◆ doFinally()

void org.turro.financials.document.logic.DocumentComposer.doFinally ( ) throws Exception

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 382 of file DocumentComposer.java.

382  {
383  super.doFinally();
384  if(entity.getId() == 0) {
385  acceptance.setVisible(false);
386  entInf.setVisible(false);
387  properties.setVisible(false);
388  } else {
389  contract.setVisible(false);
390  lbCtcDef.setContractDefinition(entity.getContract().getContractDefinition());
391  lbCtcDef.setObjectValue(entity.getDocumentDefinition());
392  }
393  lbCtcDef.setDisabled(true);
394  contract.setObjectValue(entity.getContract());
395  ctcInf.setContract(entity.getContract());
396  entInf.setEntity(entity.getContract());
397  entInf.generate();
398  docProcess.setDocument(entity);
399  updateExpiriesOptions();
400  report.setGrid(lines);
401  reportnv.setGrid(lines);
402  reportsend.setGrid(lines);
403  reportsend.setImage(Images.getImage("mail_send"));
404  reportsend.setTooltiptext(I_.get("Send documents"));
405  }
void setEntity(Object entity)
void setContractDefinition(ContractDefinition contractDefinition)
Here is the call graph for this function:

◆ doOnDelete()

void org.turro.financials.document.logic.DocumentComposer.doOnDelete ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 324 of file DocumentComposer.java.

324  {
325  DocumentWrapper w = (DocumentWrapper) getWrapper();
326  PhraseBuilder pb = new PhraseBuilder();
327  boolean wrongDate = !w.checkSave(pb);
328  boolean batchs = !w.checkBatchs(pb);
329  if(wrongDate || batchs) {
330  if(batchs) {
331  Messages.info(I_.get("Can't delete")).add(pb.toString()).show();
332  // can't save
333  } else if(wrongDate && !Application.getApplication().isInRole("finan-model:edit")) {
334  // can't save
335  Messages.info(I_.get("Can't delete")).add(pb.toString()).show();
336  } else {
337  pb.addWord(I_.get("Proceed anyway"));
338  Messages.question().add(pb.toString()).show(() -> {
339  DocumentComposer.super.doOnDelete();
340  });
341  }
342  } else {
343  super.doOnDelete();
344  }
345  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doOnSave()

void org.turro.financials.document.logic.DocumentComposer.doOnSave ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 348 of file DocumentComposer.java.

348  {
349  DocumentWrapper w = (DocumentWrapper) getWrapper();
350  PhraseBuilder pb = new PhraseBuilder();
351  boolean wrongDate = !w.checkSave(pb);
352  boolean duplicates = !w.checkDuplicates(pb);
353  if(wrongDate || duplicates) {
354  if(wrongDate && !Application.getApplication().isInRole("finan-model:edit")) {
355  // can't save
356  Messages.info(I_.get("Can't delete")).add(pb.toString()).show();
357  } else {
358  pb.addWord(I_.get("Proceed anyway"));
359  Messages.question().add(pb.toString()).show(() -> {
360  DocumentComposer.super.doOnSave();
361  });
362  }
363  } else {
364  super.doOnSave();
365  }
366  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttributeName()

String org.turro.financials.document.logic.DocumentComposer.getAttributeName ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 286 of file DocumentComposer.java.

286  {
287  return "document";
288  }

◆ getEntityInstance()

Document org.turro.financials.document.logic.DocumentComposer.getEntityInstance ( Long  id)
protected

Definition at line 291 of file DocumentComposer.java.

291  {
292  if(id == null) {
293  entity = new Document();
294  entity.setDocumentDate(new java.util.Date());
295  entity.setReceiptDate(entity.getDocumentDate());
296  } else {
297  entity = new FinancialsPU().find(Document.class, id);
298  }
299  return entity;
300  }

◆ getWrapperInstance()

DaoEntity org.turro.financials.document.logic.DocumentComposer.getWrapperInstance ( Component  comp)
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 303 of file DocumentComposer.java.

303  {
304  DocumentWrapper w = new DocumentWrapper(entity);
305  Framework.getCurrent().setSelectedLabel(w.getTabLabel());
306  Framework.getCurrent().setSelectedTooltiptext(w.getTooltiptext());
307  return w;
308  }
Here is the call graph for this function:

◆ inDeleteRole()

boolean org.turro.financials.document.logic.DocumentComposer.inDeleteRole ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 413 of file DocumentComposer.java.

413  {
414  return Application.getApplication().isInRole("finan-document:delete");
415  }
Here is the call graph for this function:

◆ inSaveRole()

boolean org.turro.financials.document.logic.DocumentComposer.inSaveRole ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 408 of file DocumentComposer.java.

408  {
409  return Application.getApplication().isInRole("finan-document:edit");
410  }
Here is the call graph for this function:

◆ onAppendRow()

void org.turro.financials.document.logic.DocumentComposer.onAppendRow ( )

Definition at line 265 of file DocumentComposer.java.

265  {
266  lines.addNewRow();
267  }
Here is the call graph for this function:

◆ onContractChange()

void org.turro.financials.document.logic.DocumentComposer.onContractChange ( )

Definition at line 183 of file DocumentComposer.java.

183  {
184  if(contract.getObjectValue() != null) {
185  DocumentWrapper w = (DocumentWrapper) getWrapper();
186  ctcInf.setContract(contract.getObjectValue());
187  entInf.setEntity(contract.getObjectValue());
188  entInf.generate();
189  entity.setContract(contract.getObjectValue());
190  lbCtcDef.updateContractDefinition(contract.getObjectValue().getContractDefinition());
191  lbCtcDef.setDisabled(false);
192  lines.updateDocument(entity);
193  docProcess.setDocument(entity);
194  updateExpiriesOptions();
195  } else {
196  lbCtcDef.setDisabled(true);
197  lines.clearTable();
198  expiries.clearTable();
199  }
200  }
void updateContractDefinition(ContractDefinition contractDefinition)
Here is the call graph for this function:

◆ onCopyLines()

void org.turro.financials.document.logic.DocumentComposer.onCopyLines ( )

Definition at line 251 of file DocumentComposer.java.

251  {
252  DocumentWrapper w = (DocumentWrapper) getWrapper();
253  w.copyLines();
254  }
Here is the call graph for this function:

◆ onDeleteRow()

void org.turro.financials.document.logic.DocumentComposer.onDeleteRow ( )

Definition at line 278 of file DocumentComposer.java.

278  {
279  Row row = lines.getLastRow();
280  if(row != null) {
281  lines.insertInSelectedRow(row);
282  }
283  }
Here is the call graph for this function:

◆ onDocProcess()

void org.turro.financials.document.logic.DocumentComposer.onDocProcess ( )

Definition at line 210 of file DocumentComposer.java.

Here is the call graph for this function:

◆ onDocumentClone()

void org.turro.financials.document.logic.DocumentComposer.onDocumentClone ( )

Definition at line 245 of file DocumentComposer.java.

245  {
246  DocumentWrapper w = (DocumentWrapper) getWrapper();
247  w.cloneDocument();
248  }
Here is the call graph for this function:

◆ onDocumentDefinitionChange()

void org.turro.financials.document.logic.DocumentComposer.onDocumentDefinitionChange ( )

Definition at line 203 of file DocumentComposer.java.

203  {
204  entity.setDocumentDefinition(lbCtcDef.getObjectValue());
205  lines.updateDocument(entity);
206  docProcess.setDocument(entity);
207  }
Here is the call graph for this function:

◆ onInsertRow()

void org.turro.financials.document.logic.DocumentComposer.onInsertRow ( )

Definition at line 270 of file DocumentComposer.java.

270  {
271  Row row = lines.getLastRow();
272  if(row != null) {
273  lines.insertInSelectedRow(row);
274  }
275  }
Here is the call graph for this function:

◆ onLinesChange()

void org.turro.financials.document.logic.DocumentComposer.onLinesChange ( )

Definition at line 234 of file DocumentComposer.java.

Here is the call graph for this function:

◆ onPasteLines()

void org.turro.financials.document.logic.DocumentComposer.onPasteLines ( )

Definition at line 257 of file DocumentComposer.java.

257  {
258  DocumentWrapper w = (DocumentWrapper) getWrapper();
259  w.pasteLines();
260  lines.updateLines();
261  summary.updateSummary();
262  }
Here is the call graph for this function:

◆ onProperties()

void org.turro.financials.document.logic.DocumentComposer.onProperties ( )

Definition at line 217 of file DocumentComposer.java.

217  {
218  DocumentWrapper w = (DocumentWrapper) getWrapper();
219  w.changeContract(new Command() {
220  @Override
221  public Object execute(Context context) {
222  contract.setObjectValue((Contract) context.get("contract"));
223  ctcInf.setContract(contract.getObjectValue());
224  entInf.setEntity(contract.getObjectValue());
225  entInf.generate();
226  entity.setContract(contract.getObjectValue());
227  updateExpiriesOptions();
228  return null;
229  }
230  });
231  }
Here is the call graph for this function:

◆ onRelationsChange()

void org.turro.financials.document.logic.DocumentComposer.onRelationsChange ( )

Definition at line 239 of file DocumentComposer.java.

239  {
240  lines.updateLines();
241  summary.updateSummary();
242  }
Here is the call graph for this function:

◆ onSelectBatchOf()

void org.turro.financials.document.logic.DocumentComposer.onSelectBatchOf ( )

Definition at line 164 of file DocumentComposer.java.

164  {
165  batchOf.reload();
166  }
Here is the call graph for this function:

◆ onSelectExpiries()

void org.turro.financials.document.logic.DocumentComposer.onSelectExpiries ( )

Definition at line 151 of file DocumentComposer.java.

151  {
152  if(expiries.getCollection() == null || expiries.getCollection().isEmpty()) {
153  expiries.notifyChange();
154  }
155  updateExpiriesOptions();
156  }
Here is the call graph for this function:

◆ onSelectFlow()

void org.turro.financials.document.logic.DocumentComposer.onSelectFlow ( )

Definition at line 174 of file DocumentComposer.java.

174  {
175  ContractFlow cf = lbflow.getObjectValue();
176  if(cf != null) {
177  cf.generateFlows(entity);
178  expiries.notifyChange();
179  }
180  }
Here is the call graph for this function:

◆ onSelectLines()

void org.turro.financials.document.logic.DocumentComposer.onSelectLines ( )

Definition at line 146 of file DocumentComposer.java.

146  {
147  lines.updateRows();
148  }
Here is the call graph for this function:

◆ onSelectRegister()

void org.turro.financials.document.logic.DocumentComposer.onSelectRegister ( )

Definition at line 169 of file DocumentComposer.java.

169  {
170  register.updateDocument(entity, expiries.getRelations());
171  }
Here is the call graph for this function:

◆ onSelectRelations()

void org.turro.financials.document.logic.DocumentComposer.onSelectRelations ( )

Definition at line 159 of file DocumentComposer.java.

159  {
160  relations.notifyChange();
161  }
Here is the call graph for this function:

◆ retrieveEntity()

void org.turro.financials.document.logic.DocumentComposer.retrieveEntity ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 420 of file DocumentComposer.java.

420  {
421  super.retrieveEntity();
422  for(DocumentRelation dr : entity.getDescendants()) {
423  if(dr.getDescendant().isValid()) {
424  expiriesXML += new XMLSerializer(dr.getDescendant()).data();
425  }
426  }
427  }

◆ shouldBeSaved()

boolean org.turro.financials.document.logic.DocumentComposer.shouldBeSaved ( )
protected

Reimplemented from org.turro.jpa.composer.EntityComposer< E, ID >.

Definition at line 377 of file DocumentComposer.java.

377  {
378  return !entity.isEmpty() && (entity.getId() == 0) || super.shouldBeSaved();
379  }

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