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

Public Member Functions

 SingleLineDocumentWrapper (Document source, DocumentDefinition expiryDefinition)
 
 SingleLineDocumentWrapper (DocumentRelation relation, Document source)
 
DocumentRelation getRelation ()
 
String getConcept ()
 
void setConcept (String concept)
 
Date getDocumentDate ()
 
void setDocumentDate (Date documentDate)
 
String getDocumentNumber ()
 
void setDocumentNumber (String documentNumber)
 
DocumentDefinition getExpiryDefinition ()
 
void setExpiryDefinition (DocumentDefinition expiryDefinition)
 
LineType getLineType ()
 
void setLineType (LineType lineType)
 
ContractPreference getContractPreference ()
 
double getPrice ()
 
void setPrice (double price)
 
Product getProduct ()
 
void setProduct (Product product)
 
ProductByContractor getProductByContractor ()
 
void setProductByContractor (ProductByContractor productByContractor)
 
double getQuantity ()
 
void setQuantity (double quantity)
 
Contract getStore ()
 
void setStore (Contract store)
 
double getTax ()
 
void setTax (double tax)
 
double getTotal ()
 
Document getTarget ()
 
boolean isValid ()
 
DocumentLine getLine ()
 
void removeRelation ()
 
int compareTo (SingleLineDocumentWrapper o)
 

Static Public Member Functions

static Collection< SingleLineDocumentWrapperadapt (Document source, Collection< DocumentRelation > relations)
 

Detailed Description

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

Definition at line 41 of file SingleLineDocumentWrapper.java.

Constructor & Destructor Documentation

◆ SingleLineDocumentWrapper() [1/2]

org.turro.financials.model.document.SingleLineDocumentWrapper.SingleLineDocumentWrapper ( Document  source,
DocumentDefinition  expiryDefinition 
)

Definition at line 47 of file SingleLineDocumentWrapper.java.

47  {
48  this.relation = createRelation(source, expiryDefinition);
49  }
Here is the caller graph for this function:

◆ SingleLineDocumentWrapper() [2/2]

org.turro.financials.model.document.SingleLineDocumentWrapper.SingleLineDocumentWrapper ( DocumentRelation  relation,
Document  source 
)

Definition at line 51 of file SingleLineDocumentWrapper.java.

51  {
52  this.relation = relation;
53  if(relation != null && relation.getDescendant() != null &&
54  relation.getDescendant().getDocumentLines() != null &&
55  relation.getDescendant().getDocumentLines().size() == 1) {
56  this.line = relation.getDescendant().getDocumentLines().iterator().next();
57  } else {
58  errorState = true;
59  }
60  }
Set< DocumentLine > getDocumentLines()
Definition: Document.java:180
Here is the call graph for this function:

Member Function Documentation

◆ adapt()

static Collection<SingleLineDocumentWrapper> org.turro.financials.model.document.SingleLineDocumentWrapper.adapt ( Document  source,
Collection< DocumentRelation relations 
)
static

Definition at line 230 of file SingleLineDocumentWrapper.java.

230  {
231  TreeSet<SingleLineDocumentWrapper> set = new TreeSet<>();
232  for(DocumentRelation dr : relations) {
234  if(sldw.isValid()) {
235  set.add(sldw);
236  }
237  }
238  return set;
239  }
SingleLineDocumentWrapper(Document source, DocumentDefinition expiryDefinition)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compareTo()

int org.turro.financials.model.document.SingleLineDocumentWrapper.compareTo ( SingleLineDocumentWrapper  o)

Definition at line 242 of file SingleLineDocumentWrapper.java.

242  {
243  if(o == null) {
244  return -1;
245  }
246  int result = CompareUtil.compare(getDocumentDate(), o.getDocumentDate());
247  if(result == 0 && relation.getDescendant() != null && o.getRelation().getDescendant() != null) {
248  result = CompareUtil.compare(relation.getDescendant().getId(), o.getRelation().getDescendant().getId());
249  }
250  if(result == 0) {
251  result = CompareUtil.compare(getConcept(), o.getConcept());
252  }
253  return result;
254  }
Here is the call graph for this function:

◆ getConcept()

String org.turro.financials.model.document.SingleLineDocumentWrapper.getConcept ( )

Definition at line 66 of file SingleLineDocumentWrapper.java.

66  {
67  return line.getConcept();
68  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContractPreference()

ContractPreference org.turro.financials.model.document.SingleLineDocumentWrapper.getContractPreference ( )

Definition at line 113 of file SingleLineDocumentWrapper.java.

113  {
114  return line.getContractPreference();
115  }
Here is the call graph for this function:

◆ getDocumentDate()

Date org.turro.financials.model.document.SingleLineDocumentWrapper.getDocumentDate ( )

Definition at line 74 of file SingleLineDocumentWrapper.java.

74  {
75  return relation.getDescendant().getReceiptDate();
76  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDocumentNumber()

String org.turro.financials.model.document.SingleLineDocumentWrapper.getDocumentNumber ( )

Definition at line 83 of file SingleLineDocumentWrapper.java.

83  {
84  return relation.getDescendant().getDocumentNumber();
85  }
Here is the call graph for this function:

◆ getExpiryDefinition()

DocumentDefinition org.turro.financials.model.document.SingleLineDocumentWrapper.getExpiryDefinition ( )

Definition at line 91 of file SingleLineDocumentWrapper.java.

91  {
92  return relation.getDescendant().getDocumentDefinition();
93  }
DocumentDefinition getDocumentDefinition()
Definition: Document.java:167
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLine()

DocumentLine org.turro.financials.model.document.SingleLineDocumentWrapper.getLine ( )

Definition at line 181 of file SingleLineDocumentWrapper.java.

181  {
182  return line;
183  }
Here is the caller graph for this function:

◆ getLineType()

LineType org.turro.financials.model.document.SingleLineDocumentWrapper.getLineType ( )

Definition at line 99 of file SingleLineDocumentWrapper.java.

99  {
100  if(line.getLineType().getContractPreference() == null) {
102  }
103  return line.getLineType();
104  }
ContractPreference getDefaultContractPreference()
Definition: Document.java:429
ContractPreference getContractPreference()
Definition: LineType.java:77
void setContractPreference(ContractPreference contractPreference)
Definition: LineType.java:81
Here is the call graph for this function:

◆ getPrice()

double org.turro.financials.model.document.SingleLineDocumentWrapper.getPrice ( )

Definition at line 118 of file SingleLineDocumentWrapper.java.

118  {
119  return line.getPrice();
120  }
Here is the call graph for this function:

◆ getProduct()

Product org.turro.financials.model.document.SingleLineDocumentWrapper.getProduct ( )

Definition at line 126 of file SingleLineDocumentWrapper.java.

126  {
127  return line.getProduct();
128  }
Here is the call graph for this function:

◆ getProductByContractor()

ProductByContractor org.turro.financials.model.document.SingleLineDocumentWrapper.getProductByContractor ( )

Definition at line 134 of file SingleLineDocumentWrapper.java.

134  {
135  return line.getProductByContractor();
136  }
ProductByContractor getProductByContractor()
Here is the call graph for this function:

◆ getQuantity()

double org.turro.financials.model.document.SingleLineDocumentWrapper.getQuantity ( )

Definition at line 142 of file SingleLineDocumentWrapper.java.

142  {
143  return line.getQuantity();
144  }
Here is the call graph for this function:

◆ getRelation()

DocumentRelation org.turro.financials.model.document.SingleLineDocumentWrapper.getRelation ( )

Definition at line 62 of file SingleLineDocumentWrapper.java.

62  {
63  return relation;
64  }
Here is the caller graph for this function:

◆ getStore()

Contract org.turro.financials.model.document.SingleLineDocumentWrapper.getStore ( )

Definition at line 150 of file SingleLineDocumentWrapper.java.

150  {
151  return line.getStore();
152  }
Here is the call graph for this function:

◆ getTarget()

Document org.turro.financials.model.document.SingleLineDocumentWrapper.getTarget ( )

Definition at line 170 of file SingleLineDocumentWrapper.java.

170  {
171  return relation.getDescendant();
172  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTax()

double org.turro.financials.model.document.SingleLineDocumentWrapper.getTax ( )

Definition at line 158 of file SingleLineDocumentWrapper.java.

158  {
159  return line.getTax();
160  }
Here is the call graph for this function:

◆ getTotal()

double org.turro.financials.model.document.SingleLineDocumentWrapper.getTotal ( )

Definition at line 166 of file SingleLineDocumentWrapper.java.

166  {
167  return relation.getDescendant().getTotalAmount();
168  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isValid()

boolean org.turro.financials.model.document.SingleLineDocumentWrapper.isValid ( )

Definition at line 174 of file SingleLineDocumentWrapper.java.

174  {
175  return relation != null &&
176  relation.getDescendant() != null &&
177  line != null &&
178  !line.isEmpty();
179  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeRelation()

void org.turro.financials.model.document.SingleLineDocumentWrapper.removeRelation ( )

Definition at line 185 of file SingleLineDocumentWrapper.java.

185  {
186  Set<DocumentRelation> rels = relation.getAncestor().getAncestors();
187  EntityCollections.entities(rels).remove(relation);
188  rels = relation.getAncestor().getDescendants();
189  EntityCollections.entities(rels).remove(relation);
190  rels = relation.getDescendant().getAncestors();
191  EntityCollections.entities(rels).remove(relation);
192  rels = relation.getDescendant().getDescendants();
193  EntityCollections.entities(rels).remove(relation);
194  relation.setDescendant(null);
195  relation.setAncestor(null);
196  new FinancialsPU().executeUpdate(
197  "delete from DocumentRelation where id = ?",
198  new Object[] { relation.getId() });
199  }
Set< DocumentRelation > getAncestors()
Definition: Document.java:107
Set< DocumentRelation > getDescendants()
Definition: Document.java:139
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setConcept()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setConcept ( String  concept)

Definition at line 70 of file SingleLineDocumentWrapper.java.

70  {
71  line.setConcept(concept);
72  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDocumentDate()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setDocumentDate ( Date  documentDate)

Definition at line 78 of file SingleLineDocumentWrapper.java.

78  {
79  relation.getDescendant().setReceiptDate(documentDate);
80  relation.getDescendant().setDocumentDate(documentDate);
81  }
void setDocumentDate(Date documentDate)
Definition: Document.java:163
void setReceiptDate(Date receiptDate)
Definition: Document.java:256
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDocumentNumber()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setDocumentNumber ( String  documentNumber)

Definition at line 87 of file SingleLineDocumentWrapper.java.

87  {
88  relation.getDescendant().setDocumentNumber(documentNumber);
89  }
void setDocumentNumber(String documentNumber)
Definition: Document.java:192
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setExpiryDefinition()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setExpiryDefinition ( DocumentDefinition  expiryDefinition)

Definition at line 95 of file SingleLineDocumentWrapper.java.

95  {
96  relation.getDescendant().setDocumentDefinition(expiryDefinition);
97  }
void setDocumentDefinition(DocumentDefinition documentDefinition)
Definition: Document.java:175
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLineType()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setLineType ( LineType  lineType)

Definition at line 106 of file SingleLineDocumentWrapper.java.

106  {
107  line.setLineType(lineType);
108  if(lineType != null) {
109  line.setContractPreference(lineType.getContractPreference());
110  }
111  }
void setContractPreference(ContractPreference contractPreference)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPrice()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setPrice ( double  price)

Definition at line 122 of file SingleLineDocumentWrapper.java.

122  {
123  line.setPrice(price);
124  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProduct()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setProduct ( Product  product)

Definition at line 130 of file SingleLineDocumentWrapper.java.

130  {
131  line.setProduct(product);
132  }
Here is the call graph for this function:

◆ setProductByContractor()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setProductByContractor ( ProductByContractor  productByContractor)

Definition at line 138 of file SingleLineDocumentWrapper.java.

138  {
139  line.setProductByContractor(productByContractor);
140  }
void setProductByContractor(ProductByContractor productByContractor)
Here is the call graph for this function:

◆ setQuantity()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setQuantity ( double  quantity)

Definition at line 146 of file SingleLineDocumentWrapper.java.

146  {
147  line.setQuantity(quantity);
148  }
Here is the call graph for this function:

◆ setStore()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setStore ( Contract  store)

Definition at line 154 of file SingleLineDocumentWrapper.java.

154  {
155  line.setStore(store);
156  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTax()

void org.turro.financials.model.document.SingleLineDocumentWrapper.setTax ( double  tax)

Definition at line 162 of file SingleLineDocumentWrapper.java.

162  {
163  line.setTax(tax);
164  }
Here is the call graph for this function:

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