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

Public Member Functions

 DocumentWrapper (Document document)
 
String getTabLabel ()
 
String getSelfLabel ()
 
boolean checkSave (PhraseBuilder pb)
 
boolean checkBatchs (PhraseBuilder pb)
 
String getDocDescription ()
 
String getFullDescription ()
 
String getTooltiptext ()
 
void changeContract (final Command command)
 
void cloneDocument ()
 
void copyLines ()
 
void pasteLines ()
 
boolean checkDuplicates (PhraseBuilder pb)
 
void relateAncestors (final DocumentDefinition documentDefinition, final Command command)
 
void relateDescendants (final DocumentDefinition documentDefinition, final Command command)
 
DocumentWorkflow getSuitableWorkflow (DocumentDefinition docDef)
 
IIssue getIssue ()
 
Object getDataEditor (String data)
 
String getDataEditorValue ()
 
- Public Member Functions inherited from org.turro.financials.model.document.DocumentWrapper
Set< RegisterWrappergetRegisters ()
 
void setPriorSavingValues (List< DocumentLine > lines, List< DocumentRelation > descendants)
 
Document save ()
 
Document save (List< DocumentLine > lines, List< DocumentRelation > descendants)
 
boolean delete ()
 
List< DocumentgetRelatedAncestor (DocumentDefinition documentDefinition)
 
List< DocumentgetRelatedDescendant (DocumentDefinition documentDefinition)
 
double getAdvance ()
 
- 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 ()
 

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 Member Functions inherited from org.turro.financials.model.document.DocumentWrapper
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)
 
- 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

Constructor & Destructor Documentation

◆ DocumentWrapper()

org.turro.financials.document.logic.DocumentWrapper.DocumentWrapper ( Document  document)

Reimplemented from org.turro.financials.model.document.DocumentWrapper.

Definition at line 61 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

61  {
62  super(document);
63  }
Here is the caller graph for this function:

Member Function Documentation

◆ changeContract()

void org.turro.financials.document.logic.DocumentWrapper.changeContract ( final Command  command)

Definition at line 127 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

127  {
128  InputDialog.getInput(
129  Framework.getCurrent().getPage(),
130  I_.get("Change"),
131  new InputField[] {
132  new InputField("Contract", null, null, 0) {
133  @Override
134  protected HtmlBasedComponent createEditor() {
135  ContractCombobox ccb = new ContractCombobox();
136  ccb.setOnlyActive(true);
137  ccb.setDocumentDefinition(entity.getDocumentDefinition());
138  ccb.setObjectValue(entity.getContract());
139  return ccb;
140  }
141  }
142  }, new Command() {
143  @Override
144  public Object execute(Context context) {
145  InputField[] fields = (InputField[]) context.get("fields");
146  if(fields.length > 0) {
147  for(InputField f : fields) {
148  if("Contract".equals(f.getLabel())) {
149  context.put("contract", f.getValue());
150  if(command != null) command.execute(context);
151  break;
152  }
153  }
154  }
155  return null;
156  }
157  });
158  }
boolean equals(Object obj)
Definition: DaoEntity.java:154
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkBatchs()

boolean org.turro.financials.document.logic.DocumentWrapper.checkBatchs ( PhraseBuilder  pb)

Definition at line 93 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

93  {
94  Collection<BatchOf> batchOfs = BatchOf.getFrom(entity);
95  if(!batchOfs.isEmpty()) {
96  pb.addWord(I_.get("Can't delete") + ":\n\n");
97  for(BatchOf b : batchOfs) {
98  pb.addWord(new DocumentWrapper(b.getBatch()).getFullDescription() + "\n");
99  }
100  return false;
101  }
102  return true;
103  }
static Collection< BatchOf > getFrom(Document document)
Definition: BatchOf.java:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkDuplicates()

boolean org.turro.financials.document.logic.DocumentWrapper.checkDuplicates ( PhraseBuilder  pb)

Definition at line 181 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

181  {
182  Dao dao = new FinancialsPU();
183  List<Document> docs = dao.getResultList(
184  "select doc from Document as doc " +
185  "where doc.documentNumber = ? " +
186  "and doc.documentDefinition = ? " +
187  "and doc.contract = ? " +
188  "and year(doc.documentDate) = ? " +
189  "and doc.id <> ?",
190  new Object[] {
191  entity.getDocumentNumber(),
192  entity.getDocumentDefinition(),
193  entity.getContract(),
194  new CheckDate(entity.getDocumentDate()).getYear(),
195  entity.getId()
196  });
197  if(!docs.isEmpty()) {
198  pb.addWord(I_.get("Posible duplicates, save anyway?"));
199  pb.addWord("\n");
200  for(Document d : docs) {
201  pb.addWord("\n");
202  pb.addWord(new DocumentWrapper(d).getFullDescription());
203  }
204  pb.addWord("\n");
205  return false;
206  } else {
207  return true;
208  }
209  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkSave()

boolean org.turro.financials.document.logic.DocumentWrapper.checkSave ( PhraseBuilder  pb)

Definition at line 73 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

73  {
74  if(!CompanyWrapper.isValidDate(entity.getReceiptDate())) {
75  pb.addWord(I_.get("Closing date"));
76  pb.addWord("\n");
77  pb.addWord(DateFormats.format(CompanyWrapper.getCompanyClosingDate(), true));
78  pb.addWord("\n");
79  return false;
80  }
81  for(DocumentRelation dr : entity.getDescendants()) {
82  if(dr.getDescendant() != null && !CompanyWrapper.isValidDate(dr.getDescendant().getReceiptDate())) {
83  pb.addWord(I_.get("Closing date"));
84  pb.addWord("\n");
85  pb.addWord(DateFormats.format(CompanyWrapper.getCompanyClosingDate(), true));
86  pb.addWord("\n");
87  return false;
88  }
89  }
90  return true;
91  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cloneDocument()

void org.turro.financials.document.logic.DocumentWrapper.cloneDocument ( )

Definition at line 160 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

160  {
161  try {
162  Context ctx = new Context();
163  ctx.put("entity", entity);
164  new CloneDocumentAction().execute(ctx);
165  } catch (Exception ex) {
166  Logger.getLogger(DocumentWrapper.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
167  }
168  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyLines()

void org.turro.financials.document.logic.DocumentWrapper.copyLines ( )

Definition at line 170 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

170  {
171  Framework.getClipboard().put("bbf_clip_doc_lin", new SimpleDocumentLineList(entity));
172  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDataEditor()

Object org.turro.financials.document.logic.DocumentWrapper.getDataEditor ( String  data)

Implements org.turro.plugin.scheduler.ScheduledEdit.

Definition at line 300 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

300  {
301  GridLayout gl = new GridLayout("min,1");
302  actions = new CollectionListbox<String>() {
303  @Override
304  protected String convertToString(String v) {
305  return v;
306  }
307  };
308  actions.setMold("select");
309  actions.setCollection(Arrays.asList(new String[] { I_.get("Clone document") }));
310  if(data != null) {
311  if(data.contains(":clone")) {
312  actions.setObjectValue(I_.get("Clone document"));
313  }
314  }
315  gl.addCaption(I_.get("Action"));
316  gl.addComponent(actions);
317  gl.addRow();
318  draft = new Checkbox(I_.get("Draft"));
319  draft.setChecked(data == null || data.contains(":draft"));
320  gl.addSpace();
321  gl.addComponent(draft);
322  return gl;
323  }
void setCollection(Collection< V > collection)
Here is the call graph for this function:

◆ getDataEditorValue()

String org.turro.financials.document.logic.DocumentWrapper.getDataEditorValue ( )

Implements org.turro.plugin.scheduler.ScheduledEdit.

Definition at line 326 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

326  {
327  String data = "action";
328  if(actions.getObjectValue().equals(I_.get("Clone document"))) {
329  data += ":clone";
330  }
331  if(draft.isChecked()) {
332  data += ":draft";
333  }
334  return data;
335  }
Here is the call graph for this function:

◆ getDocDescription()

String org.turro.financials.document.logic.DocumentWrapper.getDocDescription ( )

Definition at line 105 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

105  {
106  return entity.getDocumentDefinition().getName() + ": " +
107  (entity.getForcedView() == null ? "" : "(" + entity.getForcedView().getName() + ") ") +
108  entity.getDocumentNumber() + " " +
109  DateFormats.format(entity.getDocumentDate(), true);
110  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFullDescription()

String org.turro.financials.document.logic.DocumentWrapper.getFullDescription ( )

Definition at line 112 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

112  {
113  return getDocDescription() + " | " +
114  DecimalFormats.format(entity.getTotalAmount());
115  }
Here is the call graph for this function:

◆ getIssue()

IIssue org.turro.financials.document.logic.DocumentWrapper.getIssue ( )

Definition at line 283 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

283  {
284  if(entity.getId() > 0) {
285  IDossier dossier = new ContractWrapper(entity.getContract()).getDossier();
286  IIssue issue = dossier.addIssue();
288  issue.setPath(FinancialsPU.getObjectPath(entity));
289  return issue;
290  }
291  return null;
292  }
static String getObjectPath(Object object)
void setDescription(String description)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSelfLabel()

String org.turro.financials.document.logic.DocumentWrapper.getSelfLabel ( )

Definition at line 69 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

69  {
70  return I_.get("Document");
71  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSuitableWorkflow()

DocumentWorkflow org.turro.financials.document.logic.DocumentWrapper.getSuitableWorkflow ( DocumentDefinition  docDef)

Definition at line 271 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

271  {
272  for(DocumentWorkflow dw : entity.getContract().getContractDefinition().getDocumentWorkflows()) {
273  if((dw.getAncestor().getId() == entity.getDocumentDefinition().getId() &&
274  dw.getDescendant().getId() == docDef.getId()) ||
275  (dw.getDescendant().getId() == entity.getDocumentDefinition().getId() &&
276  dw.getAncestor().getId() == docDef.getId())) {
277  return dw;
278  }
279  }
280  return null;
281  }
Here is the call graph for this function:

◆ getTabLabel()

String org.turro.financials.document.logic.DocumentWrapper.getTabLabel ( )

Definition at line 65 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTooltiptext()

String org.turro.financials.document.logic.DocumentWrapper.getTooltiptext ( )

Definition at line 117 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

117  {
118  try {
119  return entity.getContract().getFullDescription() + "\n" +
120  getDocDescription() + " | " +
121  DecimalFormats.format(entity.getTotalAmount());
122  } catch(Exception ex) {
123  return null;
124  }
125  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pasteLines()

void org.turro.financials.document.logic.DocumentWrapper.pasteLines ( )

Definition at line 174 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

174  {
175  SimpleDocumentLineList sdll = (SimpleDocumentLineList) Framework.getClipboard().get("bbf_clip_doc_lin");
176  if(sdll != null) {
177  sdll.addLines(entity);
178  }
179  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ relateAncestors()

void org.turro.financials.document.logic.DocumentWrapper.relateAncestors ( final DocumentDefinition  documentDefinition,
final Command  command 
)

Definition at line 211 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

211  {
212  HashMap args = new HashMap();
213  List<Document> list = getRelatedAncestor(documentDefinition);
214  args.put("relatedDoc", list);
215  args.put("mode", "descendant");
216  final ModalWindow rels = Modal.getModal("/WEB-INF/_zul/financials/document/relation.zul", null, args);
217  Modal.doModal(rels, new Command() {
218  @Override
219  public Object execute(Context context) {
220  if(rels.getResult() > 0) {
221  for(Document doc : (Collection<Document>) rels.getResultValue()) {
222  addRelation(doc, true, rels.getResult(), getSuitableWorkflow(documentDefinition));
223  }
224  if(command != null) command.execute(null);
225  }
226  return null;
227  }
228  });
229  }
Here is the call graph for this function:

◆ relateDescendants()

void org.turro.financials.document.logic.DocumentWrapper.relateDescendants ( final DocumentDefinition  documentDefinition,
final Command  command 
)

Definition at line 231 of file bsfinancials-www/src/main/java/org/turro/financials/document/logic/DocumentWrapper.java.

231  {
232  HashMap args = new HashMap();
233  List<Document> list = getRelatedDescendant(documentDefinition);
234  args.put("relatedDoc", list);
235  args.put("mode", "ancestor");
236  final ModalWindow rels = Modal.getModal("/WEB-INF/_zul/financials/document/relation.zul", null, args);
237  Modal.doModal(rels, new Command() {
238  @Override
239  public Object execute(Context context) {
240  if(rels.getResult() > 0) {
241  for(Document doc : (Collection<Document>) rels.getResultValue()) {
242  addRelation(doc, false, rels.getResult(), getSuitableWorkflow(documentDefinition));
243  }
244  if(command != null) command.execute(null);
245  }
246  return null;
247  }
248  });
249  }
Here is the call graph for this function:

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