BrightSide Workbench Full Report + Source Code
BatchOfType.java
Go to the documentation of this file.
1 /*
2  * Turró i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis Turró Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.financials.model.document;
19 
20 import org.turro.financials.db.FinancialsPU;
21 import org.turro.financials.entity.ContractDefinition;
22 import org.turro.financials.entity.DocumentDefinition;
23 
28 public enum BatchOfType {
29 
30  /*
31  * Billings: Remesa cobraments, Rebut emés, Efectes a cobrar, C.Corrent
32  * Payments: Remesa pagaments, Rebut despesa, Efectes a pagar, C.Corrent
33  * CreditSettlement: Liquidació C.Credit, Rebut despesa, C.Credit, C.Corrent
34  * InvoiceDiscounting: Remesa descompte, Rebut emés, C.Credit, C.Corrent
35  */
36  BATCH_OF_BILLINGS("Billings", 45, 6, 46, 1),
37  BATCH_OF_PAYMENTS("Payments", 46, 7, 45, 1),
38  BATCH_OF_SETTLEMENT("Credit settlement", 48, 7, 2, 1),
39  BATCH_OF_DISCOUNTING("Invoice discounting", 66, 6, 2, 1);
40 
41  private String label;
42  private long batchId, portfolioId, ctcDefId, storeId;
43 
44  private BatchOfType(String label, long batchId, long portfolioId, long ctcDefId, long storeId) {
45  this.label = label;
46  this.batchId = batchId;
47  this.portfolioId = portfolioId;
48  this.ctcDefId = ctcDefId;
49  this.storeId = storeId;
50  }
51 
52  public long getBatchId() {
53  return batchId;
54  }
55 
56  public String getLabel() {
57  return label;
58  }
59 
60  public long getPortfolioId() {
61  return portfolioId;
62  }
63 
64  public long getCtcDefId() {
65  return ctcDefId;
66  }
67 
68  public long getStoreIds() {
69  return storeId;
70  }
71 
73  return new FinancialsPU().find(ContractDefinition.class, ctcDefId);
74  }
75 
77  return new FinancialsPU().find(DocumentDefinition.class, batchId);
78  }
79 
81  return new FinancialsPU().find(DocumentDefinition.class, portfolioId);
82  }
83 
85  return new FinancialsPU().find(ContractDefinition.class, storeId);
86  }
87 
88 }