View Javadoc
1   /*
2    * MoneyWise: Finance Application
3    * Copyright 2012-2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package io.github.tonywasher.joceanus.moneywise.data.basic;
18  
19  import io.github.tonywasher.joceanus.metis.field.MetisFieldSet;
20  import io.github.tonywasher.joceanus.metis.list.MetisListKey;
21  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseAssetBase.MoneyWiseDataSetCtl;
22  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseCash.MoneyWiseCashList;
23  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseCashCategory.MoneyWiseCashCategoryList;
24  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseCashInfo.MoneyWiseCashInfoList;
25  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseDeposit.MoneyWiseDepositList;
26  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseDepositCategory.MoneyWiseDepositCategoryList;
27  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseDepositInfo.MoneyWiseDepositInfoList;
28  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseDepositRate.MoneyWiseDepositRateDataMap;
29  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseDepositRate.MoneyWiseDepositRateList;
30  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseExchangeRate.MoneyWiseExchangeRateDataMap;
31  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseExchangeRate.MoneyWiseExchangeRateList;
32  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseLoan.MoneyWiseLoanList;
33  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseLoanCategory.MoneyWiseLoanCategoryList;
34  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseLoanInfo.MoneyWiseLoanInfoList;
35  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWisePayee.MoneyWisePayeeList;
36  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWisePayeeInfo.MoneyWisePayeeInfoList;
37  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWisePortfolio.MoneyWisePortfolioList;
38  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWisePortfolioInfo.MoneyWisePortfolioInfoList;
39  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseRegion.MoneyWiseRegionList;
40  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseSecurity.MoneyWiseSecurityList;
41  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseSecurityHoldingMapCtl.MoneyWiseSecurityHoldingMapGenerator;
42  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseSecurityInfo.MoneyWiseSecurityInfoList;
43  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseSecurityPrice.MoneyWiseSecurityPriceDataMap;
44  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseSecurityPrice.MoneyWiseSecurityPriceList;
45  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseTax.MoneyWiseTaxFactory;
46  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseTransCategory.MoneyWiseTransCategoryList;
47  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseTransInfo.MoneyWiseTransInfoList;
48  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseTransTag.MoneyWiseTransTagList;
49  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseTransaction.MoneyWiseTransactionList;
50  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseAccountInfoType.MoneyWiseAccountInfoTypeList;
51  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseCashCategoryType.MoneyWiseCashCategoryTypeList;
52  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseCurrency;
53  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseCurrency.MoneyWiseCurrencyList;
54  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseDepositCategoryType.MoneyWiseDepositCategoryTypeList;
55  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseLoanCategoryType.MoneyWiseLoanCategoryTypeList;
56  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWisePayeeType.MoneyWisePayeeTypeList;
57  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWisePortfolioType.MoneyWisePortfolioTypeList;
58  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseSecurityType.MoneyWiseSecurityTypeList;
59  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseStaticDataType;
60  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseStaticResource;
61  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseTaxBasis.MoneyWiseTaxBasisList;
62  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseTransCategoryType.MoneyWiseTransCategoryTypeList;
63  import io.github.tonywasher.joceanus.moneywise.data.statics.MoneyWiseTransInfoType.MoneyWiseTransInfoTypeList;
64  import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
65  import io.github.tonywasher.joceanus.oceanus.date.OceanusDateRange;
66  import io.github.tonywasher.joceanus.oceanus.format.OceanusDataFormatter;
67  import io.github.tonywasher.joceanus.prometheus.data.PrometheusCryptographyDataType;
68  import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataList;
69  import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataSet;
70  import io.github.tonywasher.joceanus.prometheus.toolkit.PrometheusToolkit;
71  import io.github.tonywasher.joceanus.prometheus.views.PrometheusEditSet;
72  import io.github.tonywasher.joceanus.tethys.api.thread.TethysUIThreadStatusReport;
73  
74  import java.util.Iterator;
75  import java.util.Map.Entry;
76  
77  /**
78   * MoneyWise dataSet.
79   */
80  public class MoneyWiseDataSet
81          extends PrometheusDataSet
82          implements MoneyWiseDataSetCtl, MoneyWiseSecurityHoldingMapGenerator {
83      /**
84       * Local Report fields.
85       */
86      private static final MetisFieldSet<MoneyWiseDataSet> FIELD_DEFS = MetisFieldSet.newFieldSet(MoneyWiseDataSet.class);
87  
88      /*
89       * Declare Fields.
90       */
91      static {
92          FIELD_DEFS.declareLocalFieldsForEnum(MoneyWiseStaticDataType.class, MoneyWiseDataSet::getFieldListValue);
93          FIELD_DEFS.declareLocalFieldsForEnum(MoneyWiseBasicDataType.class, MoneyWiseDataSet::getFieldListValue);
94          FIELD_DEFS.declareLocalField(MoneyWiseStaticResource.CURRENCY_REPORTING, MoneyWiseDataSet::getReportingCurrency);
95      }
96  
97      /**
98       * TaxFactory.
99       */
100     private final MoneyWiseTaxFactory theTaxFactory;
101 
102     /**
103      * Reporting Currency.
104      */
105     private MoneyWiseCurrency theReportingCurrency;
106 
107     /**
108      * Check Closed Accounts.
109      */
110     private boolean ignoreCheckClosedAccounts;
111 
112     /**
113      * New validity checks.
114      */
115     private boolean newValidityChecks;
116 
117     /**
118      * Standard constructor.
119      *
120      * @param pUtilitySet the utility set
121      * @param pTaxFactory the tax factory
122      */
123     public MoneyWiseDataSet(final PrometheusToolkit pUtilitySet,
124                             final MoneyWiseTaxFactory pTaxFactory) {
125         /* Call Super-constructor */
126         super(pUtilitySet);
127 
128         /* Record the tax factory */
129         theTaxFactory = pTaxFactory;
130 
131         /* Loop through the list types */
132         for (MoneyWiseStaticDataType myType : MoneyWiseStaticDataType.values()) {
133             /* Create the empty list */
134             addList(myType, newList(myType));
135         }
136 
137         /* Loop through the list types */
138         for (MoneyWiseBasicDataType myType : MoneyWiseBasicDataType.values()) {
139             /* Create the empty list */
140             addList(myType, newList(myType));
141         }
142     }
143 
144     /**
145      * Constructor for a cloned DataSet.
146      *
147      * @param pSource the source DataSet
148      */
149     private MoneyWiseDataSet(final MoneyWiseDataSet pSource) {
150         super(pSource);
151         theTaxFactory = pSource.getTaxFactory();
152     }
153 
154     @Override
155     public MetisFieldSet<MoneyWiseDataSet> getDataFieldSet() {
156         return FIELD_DEFS;
157     }
158 
159     @Override
160     public String formatObject(final OceanusDataFormatter pFormatter) {
161         return MoneyWiseDataSet.class.getSimpleName();
162     }
163 
164     /**
165      * Obtain DepositCategoryTypes.
166      *
167      * @return the Deposit category types
168      */
169     public MoneyWiseDepositCategoryTypeList getDepositCategoryTypes() {
170         return getDataList(MoneyWiseStaticDataType.DEPOSITTYPE, MoneyWiseDepositCategoryTypeList.class);
171     }
172 
173     /**
174      * Obtain CashCategoryTypes.
175      *
176      * @return the Cash category types
177      */
178     public MoneyWiseCashCategoryTypeList getCashCategoryTypes() {
179         return getDataList(MoneyWiseStaticDataType.CASHTYPE, MoneyWiseCashCategoryTypeList.class);
180     }
181 
182     /**
183      * Obtain LoanCategoryTypes.
184      *
185      * @return the Loan category types
186      */
187     public MoneyWiseLoanCategoryTypeList getLoanCategoryTypes() {
188         return getDataList(MoneyWiseStaticDataType.LOANTYPE, MoneyWiseLoanCategoryTypeList.class);
189     }
190 
191     /**
192      * Obtain PayeeTypes.
193      *
194      * @return the Payee types
195      */
196     public MoneyWisePayeeTypeList getPayeeTypes() {
197         return getDataList(MoneyWiseStaticDataType.PAYEETYPE, MoneyWisePayeeTypeList.class);
198     }
199 
200     /**
201      * Obtain PortfolioTypes.
202      *
203      * @return the Portfolio types
204      */
205     public MoneyWisePortfolioTypeList getPortfolioTypes() {
206         return getDataList(MoneyWiseStaticDataType.PORTFOLIOTYPE, MoneyWisePortfolioTypeList.class);
207     }
208 
209     /**
210      * Obtain SecurityTypes.
211      *
212      * @return the Security types
213      */
214     public MoneyWiseSecurityTypeList getSecurityTypes() {
215         return getDataList(MoneyWiseStaticDataType.SECURITYTYPE, MoneyWiseSecurityTypeList.class);
216     }
217 
218     /**
219      * Obtain TransactionCategoryTypes.
220      *
221      * @return the Transaction Category types
222      */
223     public MoneyWiseTransCategoryTypeList getTransCategoryTypes() {
224         return getDataList(MoneyWiseStaticDataType.TRANSTYPE, MoneyWiseTransCategoryTypeList.class);
225     }
226 
227     /**
228      * Obtain TaxBases.
229      *
230      * @return the Tax bases
231      */
232     public MoneyWiseTaxBasisList getTaxBases() {
233         return getDataList(MoneyWiseStaticDataType.TAXBASIS, MoneyWiseTaxBasisList.class);
234     }
235 
236     /**
237      * Obtain Asset Currencies.
238      *
239      * @return the Asset Currencies
240      */
241     public MoneyWiseCurrencyList getAccountCurrencies() {
242         return getDataList(MoneyWiseStaticDataType.CURRENCY, MoneyWiseCurrencyList.class);
243     }
244 
245     /**
246      * Obtain AccountInfoTypes.
247      *
248      * @return the Account Info types
249      */
250     public MoneyWiseAccountInfoTypeList getActInfoTypes() {
251         return getDataList(MoneyWiseStaticDataType.ACCOUNTINFOTYPE, MoneyWiseAccountInfoTypeList.class);
252     }
253 
254     /**
255      * Obtain TransactionInfoTypes.
256      *
257      * @return the Transaction Info types
258      */
259     public MoneyWiseTransInfoTypeList getTransInfoTypes() {
260         return getDataList(MoneyWiseStaticDataType.TRANSINFOTYPE, MoneyWiseTransInfoTypeList.class);
261     }
262 
263     /**
264      * Obtain Transaction Tags.
265      *
266      * @return the Transaction Tags
267      */
268     public MoneyWiseTransTagList getTransactionTags() {
269         return getDataList(MoneyWiseBasicDataType.TRANSTAG, MoneyWiseTransTagList.class);
270     }
271 
272     /**
273      * Obtain Regions.
274      *
275      * @return the regions
276      */
277     public MoneyWiseRegionList getRegions() {
278         return getDataList(MoneyWiseBasicDataType.REGION, MoneyWiseRegionList.class);
279     }
280 
281     /**
282      * Obtain DepositCategories.
283      *
284      * @return the Deposit categories
285      */
286     public MoneyWiseDepositCategoryList getDepositCategories() {
287         return getDataList(MoneyWiseBasicDataType.DEPOSITCATEGORY, MoneyWiseDepositCategoryList.class);
288     }
289 
290     /**
291      * Obtain CashCategories.
292      *
293      * @return the Cash categories
294      */
295     public MoneyWiseCashCategoryList getCashCategories() {
296         return getDataList(MoneyWiseBasicDataType.CASHCATEGORY, MoneyWiseCashCategoryList.class);
297     }
298 
299     /**
300      * Obtain LoanCategories.
301      *
302      * @return the Loan categories
303      */
304     public MoneyWiseLoanCategoryList getLoanCategories() {
305         return getDataList(MoneyWiseBasicDataType.LOANCATEGORY, MoneyWiseLoanCategoryList.class);
306     }
307 
308     /**
309      * Obtain TransactionCategories.
310      *
311      * @return the Transaction categories
312      */
313     public MoneyWiseTransCategoryList getTransCategories() {
314         return getDataList(MoneyWiseBasicDataType.TRANSCATEGORY, MoneyWiseTransCategoryList.class);
315     }
316 
317     /**
318      * Obtain ExchangeRates.
319      *
320      * @return the ExchangeRates
321      */
322     public MoneyWiseExchangeRateList getExchangeRates() {
323         return getDataList(MoneyWiseBasicDataType.EXCHANGERATE, MoneyWiseExchangeRateList.class);
324     }
325 
326     /**
327      * Obtain Payees.
328      *
329      * @return the Payees
330      */
331     public MoneyWisePayeeList getPayees() {
332         return getDataList(MoneyWiseBasicDataType.PAYEE, MoneyWisePayeeList.class);
333     }
334 
335     /**
336      * Obtain PayeeInfo.
337      *
338      * @return the Payee Info
339      */
340     public MoneyWisePayeeInfoList getPayeeInfo() {
341         return getDataList(MoneyWiseBasicDataType.PAYEEINFO, MoneyWisePayeeInfoList.class);
342     }
343 
344     /**
345      * Obtain Securities.
346      *
347      * @return the Securities
348      */
349     public MoneyWiseSecurityList getSecurities() {
350         return getDataList(MoneyWiseBasicDataType.SECURITY, MoneyWiseSecurityList.class);
351     }
352 
353     /**
354      * Obtain SecurityPrices.
355      *
356      * @return the Security prices
357      */
358     public MoneyWiseSecurityPriceList getSecurityPrices() {
359         return getDataList(MoneyWiseBasicDataType.SECURITYPRICE, MoneyWiseSecurityPriceList.class);
360     }
361 
362     /**
363      * Obtain SecurityInfo.
364      *
365      * @return the Security Info
366      */
367     public MoneyWiseSecurityInfoList getSecurityInfo() {
368         return getDataList(MoneyWiseBasicDataType.SECURITYINFO, MoneyWiseSecurityInfoList.class);
369     }
370 
371     /**
372      * Obtain Deposits.
373      *
374      * @return the Deposits
375      */
376     public MoneyWiseDepositList getDeposits() {
377         return getDataList(MoneyWiseBasicDataType.DEPOSIT, MoneyWiseDepositList.class);
378     }
379 
380     /**
381      * Obtain DepositRates.
382      *
383      * @return the Deposit rates
384      */
385     public MoneyWiseDepositRateList getDepositRates() {
386         return getDataList(MoneyWiseBasicDataType.DEPOSITRATE, MoneyWiseDepositRateList.class);
387     }
388 
389     /**
390      * Obtain DepositInfo.
391      *
392      * @return the Deposit Info
393      */
394     public MoneyWiseDepositInfoList getDepositInfo() {
395         return getDataList(MoneyWiseBasicDataType.DEPOSITINFO, MoneyWiseDepositInfoList.class);
396     }
397 
398     /**
399      * Obtain Cash.
400      *
401      * @return the Cash
402      */
403     public MoneyWiseCashList getCash() {
404         return getDataList(MoneyWiseBasicDataType.CASH, MoneyWiseCashList.class);
405     }
406 
407     /**
408      * Obtain CashInfo.
409      *
410      * @return the Cash Info
411      */
412     public MoneyWiseCashInfoList getCashInfo() {
413         return getDataList(MoneyWiseBasicDataType.CASHINFO, MoneyWiseCashInfoList.class);
414     }
415 
416     /**
417      * Obtain Loans.
418      *
419      * @return the Loans
420      */
421     public MoneyWiseLoanList getLoans() {
422         return getDataList(MoneyWiseBasicDataType.LOAN, MoneyWiseLoanList.class);
423     }
424 
425     /**
426      * Obtain LoanInfo.
427      *
428      * @return the Loan Info
429      */
430     public MoneyWiseLoanInfoList getLoanInfo() {
431         return getDataList(MoneyWiseBasicDataType.LOANINFO, MoneyWiseLoanInfoList.class);
432     }
433 
434     /**
435      * Obtain Portfolios.
436      *
437      * @return the Portfolios
438      */
439     public MoneyWisePortfolioList getPortfolios() {
440         return getDataList(MoneyWiseBasicDataType.PORTFOLIO, MoneyWisePortfolioList.class);
441     }
442 
443     /**
444      * Obtain PortfolioInfo.
445      *
446      * @return the Portfolio Info
447      */
448     public MoneyWisePortfolioInfoList getPortfolioInfo() {
449         return getDataList(MoneyWiseBasicDataType.PORTFOLIOINFO, MoneyWisePortfolioInfoList.class);
450     }
451 
452     /**
453      * Obtain Transactions.
454      *
455      * @return the Transactions
456      */
457     public MoneyWiseTransactionList getTransactions() {
458         return getDataList(MoneyWiseBasicDataType.TRANSACTION, MoneyWiseTransactionList.class);
459     }
460 
461     /**
462      * Obtain TransactionInfo.
463      *
464      * @return the Transaction Info
465      */
466     public MoneyWiseTransInfoList getTransactionInfo() {
467         return getDataList(MoneyWiseBasicDataType.TRANSACTIONINFO, MoneyWiseTransInfoList.class);
468     }
469 
470     @Override
471     public MoneyWiseTaxFactory getTaxFactory() {
472         return theTaxFactory;
473     }
474 
475     @Override
476     public OceanusDateRange getDateRange() {
477         return theTaxFactory.getDateRange();
478     }
479 
480     @Override
481     public MoneyWiseCurrency getReportingCurrency() {
482         /* If we have note yet determined the reporting currency */
483         if (theReportingCurrency == null) {
484             /* Determine the default currency */
485             theReportingCurrency = getAccountCurrencies().findReporting();
486         }
487         return theReportingCurrency;
488     }
489 
490     @Override
491     public MoneyWiseSecurityHoldingMap newSecurityHoldingMap() {
492         return new MoneyWiseSecurityHoldingMap(this);
493     }
494 
495 
496     @Override
497     public MoneyWiseSecurityHoldingMap newSecurityHoldingMap(final PrometheusEditSet pEditSet) {
498         return new MoneyWiseSecurityHoldingMap(pEditSet);
499     }
500 
501     /**
502      * Obtain security prices map.
503      *
504      * @return the prices map
505      */
506     public MoneyWiseSecurityPriceDataMap getSecurityPriceDataMap() {
507         return getSecurityPrices().getDataMap();
508     }
509 
510     /**
511      * Obtain deposit rates map.
512      *
513      * @return the rates map
514      */
515     public MoneyWiseDepositRateDataMap getDepositRateDataMap() {
516         return getDepositRates().getDataMap();
517     }
518 
519     /**
520      * Obtain exchange rates map.
521      *
522      * @return the rates map
523      */
524     public MoneyWiseExchangeRateDataMap getExchangeRateDataMap() {
525         return getExchangeRates().getDataMap();
526     }
527 
528     /**
529      * Should we check closed accounts?
530      *
531      * @return true/false
532      */
533     public boolean checkClosedAccounts() {
534         return !ignoreCheckClosedAccounts;
535     }
536 
537     /**
538      * Note that we hit the last event limit.
539      */
540     public void hitEventLimit() {
541         ignoreCheckClosedAccounts = true;
542     }
543 
544     /**
545      * Set new Validity checks.
546      */
547     public void doNewValidityChecks() {
548         newValidityChecks = true;
549     }
550 
551     /**
552      * Should we perform new validity checks?
553      *
554      * @return true/false
555      */
556     public boolean newValidityChecks() {
557         return newValidityChecks;
558     }
559 
560     /**
561      * Create new list of required type.
562      *
563      * @param pListType the list type
564      * @return the new list
565      */
566     private PrometheusDataList<?> newList(final MoneyWiseStaticDataType pListType) {
567         /* Switch on list Type */
568         switch (pListType) {
569             case DEPOSITTYPE:
570                 return new MoneyWiseDepositCategoryTypeList(this);
571             case CASHTYPE:
572                 return new MoneyWiseCashCategoryTypeList(this);
573             case LOANTYPE:
574                 return new MoneyWiseLoanCategoryTypeList(this);
575             case PAYEETYPE:
576                 return new MoneyWisePayeeTypeList(this);
577             case PORTFOLIOTYPE:
578                 return new MoneyWisePortfolioTypeList(this);
579             case SECURITYTYPE:
580                 return new MoneyWiseSecurityTypeList(this);
581             case TRANSTYPE:
582                 return new MoneyWiseTransCategoryTypeList(this);
583             case TAXBASIS:
584                 return new MoneyWiseTaxBasisList(this);
585             case CURRENCY:
586                 return new MoneyWiseCurrencyList(this);
587             case ACCOUNTINFOTYPE:
588                 return new MoneyWiseAccountInfoTypeList(this);
589             case TRANSINFOTYPE:
590                 return new MoneyWiseTransInfoTypeList(this);
591             default:
592                 throw new IllegalArgumentException(pListType.toString());
593         }
594     }
595 
596     /**
597      * Create new list of required type.
598      *
599      * @param pListType the list type
600      * @return the new list
601      */
602     private PrometheusDataList<?> newList(final MoneyWiseBasicDataType pListType) {
603         /* Switch on list Type */
604         switch (pListType) {
605             case TRANSTAG:
606                 return new MoneyWiseTransTagList(this);
607             case REGION:
608                 return new MoneyWiseRegionList(this);
609             case DEPOSITCATEGORY:
610                 return new MoneyWiseDepositCategoryList(this);
611             case CASHCATEGORY:
612                 return new MoneyWiseCashCategoryList(this);
613             case LOANCATEGORY:
614                 return new MoneyWiseLoanCategoryList(this);
615             case TRANSCATEGORY:
616                 return new MoneyWiseTransCategoryList(this);
617             case EXCHANGERATE:
618                 return new MoneyWiseExchangeRateList(this);
619             case PAYEE:
620                 return new MoneyWisePayeeList(this);
621             case PAYEEINFO:
622                 return new MoneyWisePayeeInfoList(this);
623             case SECURITY:
624                 return new MoneyWiseSecurityList(this);
625             case SECURITYPRICE:
626                 return new MoneyWiseSecurityPriceList(this);
627             case SECURITYINFO:
628                 return new MoneyWiseSecurityInfoList(this);
629             case DEPOSIT:
630                 return new MoneyWiseDepositList(this);
631             case DEPOSITRATE:
632                 return new MoneyWiseDepositRateList(this);
633             case DEPOSITINFO:
634                 return new MoneyWiseDepositInfoList(this);
635             case CASH:
636                 return new MoneyWiseCashList(this);
637             case CASHINFO:
638                 return new MoneyWiseCashInfoList(this);
639             case LOAN:
640                 return new MoneyWiseLoanList(this);
641             case LOANINFO:
642                 return new MoneyWiseLoanInfoList(this);
643             case PORTFOLIO:
644                 return new MoneyWisePortfolioList(this);
645             case PORTFOLIOINFO:
646                 return new MoneyWisePortfolioInfoList(this);
647             case TRANSACTION:
648                 return new MoneyWiseTransactionList(this);
649             case TRANSACTIONINFO:
650                 return new MoneyWiseTransInfoList(this);
651             default:
652                 throw new IllegalArgumentException(pListType.toString());
653         }
654     }
655 
656     @Override
657     public MoneyWiseDataSet deriveUpdateSet() throws OceanusException {
658         /* Build an empty DataSet */
659         final MoneyWiseDataSet myExtract = new MoneyWiseDataSet(this);
660 
661         /* Obtain underlying updates */
662         myExtract.deriveUpdateSet(this);
663 
664         /* Return the extract */
665         return myExtract;
666     }
667 
668     @Override
669     public MoneyWiseDataSet deriveCloneSet() throws OceanusException {
670         /* Build an empty DataSet */
671         final MoneyWiseDataSet myExtract = new MoneyWiseDataSet(this);
672 
673         /* Create empty clone lists */
674         myExtract.buildEmptyCloneSet(this);
675 
676         /* Obtain underlying updates */
677         myExtract.deriveCloneSet(this);
678 
679         /* Return the extract */
680         return myExtract;
681     }
682 
683     /**
684      * Construct a difference extract between two DataSets. The difference extract will only contain
685      * items that differ between the two DataSets. Items that are in this list, but not in the old
686      * list will be viewed as inserted. Items that are in the old list but not in this list will be
687      * viewed as deleted. Items that are in both lists but differ will be viewed as changed
688      *
689      * @param pReport the report
690      * @param pOld    The DataSet to compare to
691      * @return the difference extract
692      * @throws OceanusException on error
693      */
694     @Override
695     public MoneyWiseDataSet getDifferenceSet(final TethysUIThreadStatusReport pReport,
696                                              final PrometheusDataSet pOld) throws OceanusException {
697         /* Build an empty DataSet */
698         final MoneyWiseDataSet myDiffers = new MoneyWiseDataSet(this);
699 
700         /* Obtain underlying differences */
701         myDiffers.deriveDifferences(pReport, this, pOld);
702 
703         /* Return the differences */
704         return myDiffers;
705     }
706 
707     /**
708      * Update Maps.
709      */
710     public void updateMaps() {
711         /* Loop through the list types */
712         final Iterator<Entry<MetisListKey, PrometheusDataList<?>>> myIterator = entryIterator();
713         while (myIterator.hasNext()) {
714             final Entry<MetisListKey, PrometheusDataList<?>> myEntry = myIterator.next();
715 
716             /* Prepare list for analysis (ignoring cryptography tables) */
717             if (!(myEntry.getKey() instanceof PrometheusCryptographyDataType)) {
718                 final PrometheusDataList<?> myList = myEntry.getValue();
719                 myList.updateMaps();
720             }
721         }
722     }
723 }