18 package org.turro.financials.model.document;
20 import java.util.Collection;
21 import java.util.Date;
23 import java.util.TreeSet;
24 import org.turro.financials.db.FinancialsPU;
25 import org.turro.financials.entity.Contract;
26 import org.turro.financials.entity.ContractPreference;
27 import org.turro.financials.entity.Document;
28 import org.turro.financials.entity.DocumentDefinition;
29 import org.turro.financials.entity.DocumentLine;
30 import org.turro.financials.entity.DocumentRelation;
31 import org.turro.financials.entity.LineType;
32 import org.turro.financials.entity.Product;
33 import org.turro.financials.entity.ProductByContractor;
34 import org.turro.jpa.entity.EntityCollections;
35 import org.turro.util.CompareUtil;
45 private boolean errorState =
false;
48 this.relation = createRelation(source, expiryDefinition);
52 this.relation = relation;
108 if(lineType !=
null) {
175 return relation !=
null &&
197 "delete from DocumentRelation where id = ?",
198 new Object[] { relation.
getId() });
204 Document target = createDocument(source, expiryDefinition);
225 private DocumentLine createLine() {
226 DocumentLine lin =
new DocumentLine();
230 public static Collection<SingleLineDocumentWrapper>
adapt(
Document source, Collection<DocumentRelation> relations) {
231 TreeSet<SingleLineDocumentWrapper>
set =
new TreeSet<>();
void setStore(Contract store)
void setContractPreference(ContractPreference contractPreference)
void setQuantity(double quantity)
void setLineType(LineType lineType)
ContractPreference getContractPreference()
void setDocument(Document document)
void setProduct(Product product)
void setPrice(double price)
void setProductByContractor(ProductByContractor productByContractor)
ProductByContractor getProductByContractor()
void setConcept(String concept)
void setDescendant(Document descendant)
void setAncestor(Document ancestor)
void setForcedView(RegisterView forcedView)
void setDocumentNumber(String documentNumber)
void setDocumentDate(Date documentDate)
RegisterView getForcedView()
Set< DocumentRelation > getAncestors()
Set< DocumentRelation > getDescendants()
void setContract(Contract contract)
String getDocumentNumber()
void setCurrency(Currency currency)
ContractPreference getDefaultContractPreference()
Set< DocumentLine > getDocumentLines()
void setDocumentDefinition(DocumentDefinition documentDefinition)
void setReceiptDate(Date receiptDate)
LineType getDefaultLineType()
DocumentDefinition getDocumentDefinition()
ContractPreference getContractPreference()
void setContractPreference(ContractPreference contractPreference)
static Collection< SingleLineDocumentWrapper > adapt(Document source, Collection< DocumentRelation > relations)
void setStore(Contract store)
void setLineType(LineType lineType)
ProductByContractor getProductByContractor()
SingleLineDocumentWrapper(DocumentRelation relation, Document source)
void setDocumentDate(Date documentDate)
void setProduct(Product product)
void setProductByContractor(ProductByContractor productByContractor)
int compareTo(SingleLineDocumentWrapper o)
void setConcept(String concept)
ContractPreference getContractPreference()
void setPrice(double price)
DocumentDefinition getExpiryDefinition()
void setDocumentNumber(String documentNumber)
void setExpiryDefinition(DocumentDefinition expiryDefinition)
SingleLineDocumentWrapper(Document source, DocumentDefinition expiryDefinition)
void setQuantity(double quantity)
DocumentRelation getRelation()
String getDocumentNumber()
int executeUpdate(String query)
static EntityCollections entities(Collection values)
boolean remove(IDaoEntity entity)