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

Public Member Functions

 FixedAssetWrapper (FixedAsset asset)
 
FixedAsset save ()
 
boolean delete ()
 
boolean canDelete ()
 
void keepRelations (Set< DocumentLine > docLines)
 
double getInvestment ()
 
double getDepreciated ()
 
double getToDepreciate (Date date)
 
Collection< RegisterEntrygetEntries ()
 

Static Public Member Functions

static LineType getBuyLineType ()
 
static DocumentDefinition getInvestmentProviderModel ()
 
static Collection< FixedAssetgetAssets ()
 

Protected Attributes

FixedAsset asset
 

Detailed Description

Constructor & Destructor Documentation

◆ FixedAssetWrapper()

Member Function Documentation

◆ canDelete()

boolean org.turro.financials.model.asset.FixedAssetWrapper.canDelete ( )

Definition at line 72 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

72  {
73  if(asset.getId() == 0) return false;
74  if(!(asset.getDocumentLines().isEmpty())) {
75  return false;
76  }
77  if(!(getEntries().isEmpty())) {
78  return false;
79  }
80  return true;
81  }
Set< DocumentLine > getDocumentLines()
Definition: FixedAsset.java:96
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete()

boolean org.turro.financials.model.asset.FixedAssetWrapper.delete ( )

Definition at line 63 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

63  {
64  // Check if possible and notify
65  if(canDelete()) {
66  SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, asset, "deleted", new XMLSerializer(asset).data());
68  }
69  return true;
70  }
void deleteObject(Object obj)
Definition: Dao.java:162
Here is the call graph for this function:

◆ getAssets()

static Collection<FixedAsset> org.turro.financials.model.asset.FixedAssetWrapper.getAssets ( )
static

Definition at line 147 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

147  {
148  Dao dao = new FinancialsPU();
149  return dao.getResultList("select fa from FixedAsset as fa where unsubscribed = FALSE order by fa.name");
150  }
Here is the caller graph for this function:

◆ getBuyLineType()

static LineType org.turro.financials.model.asset.FixedAssetWrapper.getBuyLineType ( )
static

Definition at line 137 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

137  {
138  Dao dao = new FinancialsPU();
139  return dao.find(LineType.class, 4L);
140  }
Here is the caller graph for this function:

◆ getDepreciated()

double org.turro.financials.model.asset.FixedAssetWrapper.getDepreciated ( )

Definition at line 95 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

95  {
96  double depreciated = asset.getDepreciated();
97  for(RegisterEntry re : getEntries()) {
98  depreciated += re.getDebit();
99  }
100  return depreciated;
101  }
Here is the call graph for this function:

◆ getEntries()

Collection<RegisterEntry> org.turro.financials.model.asset.FixedAssetWrapper.getEntries ( )

Definition at line 129 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

129  {
130  Dao dao = new FinancialsPU();
131  return dao.getResultList(
132  "select re from RegisterEntry as re " +
133  "where re.path = '" + FinancialsPU.getObjectPath(asset) + "' " +
134  "order by re.account, re.register.registerDate");
135  }
static String getObjectPath(Object object)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInvestment()

double org.turro.financials.model.asset.FixedAssetWrapper.getInvestment ( )

Definition at line 87 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

87  {
88  double investment = asset.getInvestment();
89  for(DocumentLine dl : asset.getDocumentLines()) {
90  investment += dl.getTaxable();
91  }
92  return investment;
93  }
Here is the call graph for this function:

◆ getInvestmentProviderModel()

static DocumentDefinition org.turro.financials.model.asset.FixedAssetWrapper.getInvestmentProviderModel ( )
static

◆ getToDepreciate()

double org.turro.financials.model.asset.FixedAssetWrapper.getToDepreciate ( Date  date)

Definition at line 103 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

103  {
104  DepreciationMap dm = new DepreciationMap();
106  if(fad.isValid()) {
107  DepreciationEntry de = new DepreciationEntry();
108  de.setPercent(fad.getPerCent());
109  dm.put(fad.getDepreciationDate(), de);
110  }
111  }
112  double toDepreciate = 0.0;
113  if(asset.getInvestment() > 0.00) {
114  toDepreciate = dm.getToDepreciate(asset.getInvestment(), null, date);
115  }
116  for(DocumentLine dl : asset.getDocumentLines()) {
117  toDepreciate += dm.getToDepreciate(dl.getTaxable(), dl.getDocument().getReceiptDate(), date);
118  }
119  double depreciated = asset.getDepreciated();
120  for(RegisterEntry re : getEntries()) {
121  Date regDate = re.getRegister().getRegisterDate();
122  if(regDate.before(date) || regDate.equals(date)) {
123  depreciated += re.getDebit();
124  }
125  }
126  return toDepreciate - depreciated;
127  }
Set< FixedAssetDepreciation > getDepreciations()
Definition: FixedAsset.java:88
Here is the call graph for this function:

◆ keepRelations()

void org.turro.financials.model.asset.FixedAssetWrapper.keepRelations ( Set< DocumentLine docLines)

Definition at line 83 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

83  {
84  asset.setDocumentLines(docLines);
85  }
void setDocumentLines(Set< DocumentLine > documentLines)
Here is the call graph for this function:

◆ save()

FixedAsset org.turro.financials.model.asset.FixedAssetWrapper.save ( )

Definition at line 44 of file bsfinancials-core/src/main/java/org/turro/financials/model/asset/FixedAssetWrapper.java.

44  {
45  Dao dao = new FinancialsPU();
46  Iterator<FixedAssetDepreciation> it = asset.getDepreciations().iterator();
47  while(it.hasNext()) {
48  if(!(it.next().isValid())) {
49  it.remove();
50  }
51  }
52  for(DocumentLine dl : asset.getDocumentLines()) {
53  dl.setLineType(getBuyLineType());
54  dl.setContractPreference(asset.getInvestmentPreference());
55  new DocumentWrapper(dl.getDocument()).save(null, null);
56  }
58  asset = dao.saveObject(asset);
59  SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, asset, "saved", new XMLSerializer(asset).data());
60  return asset;
61  }
ContractPreference getInvestmentPreference()
Here is the call graph for this function:

Member Data Documentation

◆ asset

FixedAsset org.turro.financials.model.asset.FixedAssetWrapper.asset
protected

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