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.atlas.data.analysis.base;
18  
19  import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
20  import io.github.tonywasher.joceanus.oceanus.date.OceanusDate;
21  import io.github.tonywasher.joceanus.metis.field.MetisFieldSet;
22  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseTransaction;
23  import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataItem;
24  import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataList;
25  import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataMapItem;
26  import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataValues;
27  import io.github.tonywasher.joceanus.prometheus.views.PrometheusEditSet;
28  
29  /**
30   * AnalysisEvent list.
31   */
32  public class MoneyWiseXAnalysisEventList
33          extends PrometheusDataList<MoneyWiseXAnalysisEvent> {
34      /**
35       * Report fields.
36       */
37      private static final MetisFieldSet<MoneyWiseXAnalysisEventList> FIELD_DEFS = MetisFieldSet.newFieldSet(MoneyWiseXAnalysisEventList.class);
38  
39      /**
40       * Constructor.
41       *
42       * @param pEditSet the editSet
43       */
44      public MoneyWiseXAnalysisEventList(final PrometheusEditSet pEditSet) {
45          super(MoneyWiseXAnalysisEvent.class, pEditSet.getDataSet(), MoneyWiseXAnalysisDataType.EVENT, PrometheusListStyle.EDIT);
46      }
47  
48      @Override
49      public MetisFieldSetDef getItemFields() {
50          return FIELD_DEFS;
51      }
52  
53      @Override
54      public MetisFieldSetDef getDataFieldSet() {
55          return MoneyWiseXAnalysisEvent.FIELD_DEFS;
56      }
57  
58      @Override
59      public String listName() {
60          return MoneyWiseXAnalysisDataType.EVENT.getListName();
61      }
62  
63      @Override
64      protected PrometheusDataList<MoneyWiseXAnalysisEvent> getEmptyList(final PrometheusListStyle pStyle) {
65          throw new UnsupportedOperationException();
66      }
67  
68      @Override
69      protected PrometheusDataMapItem allocateDataMap() {
70          throw new UnsupportedOperationException();
71      }
72  
73      @Override
74      public MoneyWiseXAnalysisEvent addCopyItem(final PrometheusDataItem pElement) {
75          throw new UnsupportedOperationException();
76      }
77  
78      @Override
79      public MoneyWiseXAnalysisEvent addNewItem() {
80          throw new UnsupportedOperationException();
81      }
82  
83      @Override
84      public MoneyWiseXAnalysisEvent addValuesItem(final PrometheusDataValues pValues) throws OceanusException {
85          throw new UnsupportedOperationException();
86      }
87  
88      /**
89       * Create and add an event for a transaction.
90       *
91       * @param pTrans the transaction
92       * @return the event
93       */
94      public MoneyWiseXAnalysisEvent newTransaction(final MoneyWiseTransaction pTrans) {
95          final MoneyWiseXAnalysisEvent myEvent = new MoneyWiseXAnalysisEvent(this, pTrans);
96          add(myEvent);
97          return myEvent;
98      }
99  
100     /**
101      * Create and add an event for a securityPrice change.
102      *
103      * @param pDate the date
104      * @return the event
105      */
106     public MoneyWiseXAnalysisEvent newSecurityPrice(final OceanusDate pDate) {
107         final MoneyWiseXAnalysisEvent myEvent = new MoneyWiseXAnalysisEvent(this, MoneyWiseXAnalysisEventType.SECURITYPRICE, pDate);
108         add(myEvent);
109         return myEvent;
110     }
111 
112     /**
113      * Create and add an event for an exchangeRate change.
114      *
115      * @param pDate the date
116      * @return the event
117      */
118     public MoneyWiseXAnalysisEvent newXchangeRate(final OceanusDate pDate) {
119         final MoneyWiseXAnalysisEvent myEvent = new MoneyWiseXAnalysisEvent(this, MoneyWiseXAnalysisEventType.XCHANGERATE, pDate);
120         add(myEvent);
121         return myEvent;
122     }
123 
124     /**
125      * Create and add an event for a depositRate change.
126      *
127      * @param pDate the date
128      * @return the event
129      */
130     public MoneyWiseXAnalysisEvent newDepositRate(final OceanusDate pDate) {
131         final MoneyWiseXAnalysisEvent myEvent = new MoneyWiseXAnalysisEvent(this, MoneyWiseXAnalysisEventType.DEPOSITRATE, pDate);
132         add(myEvent);
133         return myEvent;
134     }
135 
136     /**
137      * Create and add an event for opening balances.
138      *
139      * @param pDate the date
140      * @return the event
141      */
142     public MoneyWiseXAnalysisEvent newOpeningBalance(final OceanusDate pDate) {
143         final MoneyWiseXAnalysisEvent myEvent = new MoneyWiseXAnalysisEvent(this, MoneyWiseXAnalysisEventType.OPENINGBALANCE, pDate);
144         add(myEvent);
145         return myEvent;
146     }
147 }