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