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