001// --------------------------------------------------------------------------------
002// Copyright 2002-2026 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016// Generated File -- DO NOT EDIT BY HAND
017// --------------------------------------------------------------------------------
018
019/**
020 * Currency.java
021 */
022
023package com.echothree.model.data.accounting.server.entity;
024
025import com.echothree.model.data.accounting.common.pk.CurrencyPK;
026
027import com.echothree.model.data.accounting.common.pk.SymbolPositionPK;
028
029import com.echothree.model.data.accounting.server.entity.SymbolPosition;
030
031import com.echothree.model.data.accounting.server.factory.SymbolPositionFactory;
032
033import com.echothree.model.data.accounting.common.pk.CurrencyPK;
034
035import com.echothree.model.data.accounting.server.value.CurrencyValue;
036
037import com.echothree.model.data.accounting.server.factory.CurrencyFactory;
038
039import com.echothree.util.common.exception.PersistenceException;
040import com.echothree.util.common.exception.PersistenceDatabaseException;
041import com.echothree.util.common.exception.PersistenceNotNullException;
042import com.echothree.util.common.exception.PersistenceReadOnlyException;
043
044import com.echothree.util.common.persistence.BasePK;
045
046import com.echothree.util.common.persistence.type.ByteArray;
047
048import com.echothree.util.server.persistence.BaseEntity;
049import com.echothree.util.server.persistence.EntityPermission;
050import com.echothree.util.server.persistence.Session;
051import com.echothree.util.server.persistence.ThreadSession;
052
053import java.io.Serializable;
054
055import javax.annotation.Nonnull;
056import javax.annotation.Nullable;
057
058public class Currency
059        extends BaseEntity
060        implements Serializable {
061    
062    private CurrencyPK _pk;
063    private CurrencyValue _value;
064    
065    /** Creates a new instance of Currency */
066    public Currency()
067            throws PersistenceException {
068        super();
069    }
070    
071    /** Creates a new instance of Currency */
072    public Currency(CurrencyValue value, EntityPermission entityPermission) {
073        super(entityPermission);
074        
075        _value = value;
076        _pk = value.getPrimaryKey();
077    }
078    
079    @Override
080    @Nonnull
081    public CurrencyFactory getBaseFactoryInstance() {
082        return CurrencyFactory.getInstance();
083    }
084    
085    @Override
086    public boolean hasBeenModified() {
087        return _value.hasBeenModified();
088    }
089    
090    @Override
091    public int hashCode() {
092        return _pk.hashCode();
093    }
094    
095    @Override
096    @Nonnull
097    public String toString() {
098        return _pk.toString();
099    }
100    
101    @Override
102    public boolean equals(Object other) {
103        if(this == other)
104            return true;
105        
106        if(other instanceof Currency that) {
107            CurrencyValue thatValue = that.getCurrencyValue();
108            return _value.equals(thatValue);
109        } else {
110            return false;
111        }
112    }
113    
114    @Override
115    public void store()
116            throws PersistenceDatabaseException {
117        getBaseFactoryInstance().store(this);
118    }
119    
120    @Override
121    public void remove()
122            throws PersistenceDatabaseException {
123        getBaseFactoryInstance().remove(this);
124    }
125    
126    @Nonnull
127    public CurrencyValue getCurrencyValue() {
128        return _value;
129    }
130    
131    public void setCurrencyValue(@Nonnull CurrencyValue value)
132            throws PersistenceReadOnlyException {
133        checkReadWrite();
134        _value = value;
135    }
136    
137    @Override
138    @Nonnull
139    public CurrencyPK getPrimaryKey() {
140        return _pk;
141    }
142    
143    @Nonnull
144    public String getCurrencyIsoName() {
145        return _value.getCurrencyIsoName();
146    }
147    
148    public void setCurrencyIsoName(@Nonnull String currencyIsoName)
149            throws PersistenceNotNullException, PersistenceReadOnlyException {
150        checkReadWrite();
151        _value.setCurrencyIsoName(currencyIsoName);
152    }
153    
154    public boolean getCurrencyIsoNameHasBeenModified() {
155        return _value.getCurrencyIsoNameHasBeenModified();
156    }
157    
158    @Nullable
159    public String getSymbol() {
160        return _value.getSymbol();
161    }
162    
163    public void setSymbol(@Nullable String symbol)
164            throws PersistenceNotNullException, PersistenceReadOnlyException {
165        checkReadWrite();
166        _value.setSymbol(symbol);
167    }
168    
169    public boolean getSymbolHasBeenModified() {
170        return _value.getSymbolHasBeenModified();
171    }
172    
173    @Nonnull
174    public SymbolPositionPK getSymbolPositionPK() {
175        return _value.getSymbolPositionPK();
176    }
177    
178    @Nonnull
179    public SymbolPosition getSymbolPosition(EntityPermission entityPermission) {
180        return SymbolPositionFactory.getInstance().getEntityFromPK(entityPermission, getSymbolPositionPK());
181    }
182    
183    @Nonnull
184    public SymbolPosition getSymbolPosition() {
185        return getSymbolPosition(EntityPermission.READ_ONLY);
186    }
187    
188    @Nonnull
189    public SymbolPosition getSymbolPositionForUpdate() {
190        return getSymbolPosition(EntityPermission.READ_WRITE);
191    }
192    
193    public void setSymbolPositionPK(@Nonnull SymbolPositionPK symbolPositionPK)
194            throws PersistenceNotNullException, PersistenceReadOnlyException {
195        checkReadWrite();
196        _value.setSymbolPositionPK(symbolPositionPK);
197    }
198    
199    public void setSymbolPosition(@Nonnull SymbolPosition entity) {
200        setSymbolPositionPK(entity == null ? null : entity.getPrimaryKey());
201    }
202    
203    public boolean getSymbolPositionPKHasBeenModified() {
204        return _value.getSymbolPositionPKHasBeenModified();
205    }
206    
207    @Nullable
208    public Boolean getSymbolOnListStart() {
209        return _value.getSymbolOnListStart();
210    }
211    
212    public void setSymbolOnListStart(@Nullable Boolean symbolOnListStart)
213            throws PersistenceNotNullException, PersistenceReadOnlyException {
214        checkReadWrite();
215        _value.setSymbolOnListStart(symbolOnListStart);
216    }
217    
218    public boolean getSymbolOnListStartHasBeenModified() {
219        return _value.getSymbolOnListStartHasBeenModified();
220    }
221    
222    @Nullable
223    public Boolean getSymbolOnListMember() {
224        return _value.getSymbolOnListMember();
225    }
226    
227    public void setSymbolOnListMember(@Nullable Boolean symbolOnListMember)
228            throws PersistenceNotNullException, PersistenceReadOnlyException {
229        checkReadWrite();
230        _value.setSymbolOnListMember(symbolOnListMember);
231    }
232    
233    public boolean getSymbolOnListMemberHasBeenModified() {
234        return _value.getSymbolOnListMemberHasBeenModified();
235    }
236    
237    @Nullable
238    public Boolean getSymbolOnSubtotal() {
239        return _value.getSymbolOnSubtotal();
240    }
241    
242    public void setSymbolOnSubtotal(@Nullable Boolean symbolOnSubtotal)
243            throws PersistenceNotNullException, PersistenceReadOnlyException {
244        checkReadWrite();
245        _value.setSymbolOnSubtotal(symbolOnSubtotal);
246    }
247    
248    public boolean getSymbolOnSubtotalHasBeenModified() {
249        return _value.getSymbolOnSubtotalHasBeenModified();
250    }
251    
252    @Nullable
253    public Boolean getSymbolOnTotal() {
254        return _value.getSymbolOnTotal();
255    }
256    
257    public void setSymbolOnTotal(@Nullable Boolean symbolOnTotal)
258            throws PersistenceNotNullException, PersistenceReadOnlyException {
259        checkReadWrite();
260        _value.setSymbolOnTotal(symbolOnTotal);
261    }
262    
263    public boolean getSymbolOnTotalHasBeenModified() {
264        return _value.getSymbolOnTotalHasBeenModified();
265    }
266    
267    @Nonnull
268    public String getGroupingSeparator() {
269        return _value.getGroupingSeparator();
270    }
271    
272    public void setGroupingSeparator(@Nonnull String groupingSeparator)
273            throws PersistenceNotNullException, PersistenceReadOnlyException {
274        checkReadWrite();
275        _value.setGroupingSeparator(groupingSeparator);
276    }
277    
278    public boolean getGroupingSeparatorHasBeenModified() {
279        return _value.getGroupingSeparatorHasBeenModified();
280    }
281    
282    @Nonnull
283    public Integer getGroupingSize() {
284        return _value.getGroupingSize();
285    }
286    
287    public void setGroupingSize(@Nonnull Integer groupingSize)
288            throws PersistenceNotNullException, PersistenceReadOnlyException {
289        checkReadWrite();
290        _value.setGroupingSize(groupingSize);
291    }
292    
293    public boolean getGroupingSizeHasBeenModified() {
294        return _value.getGroupingSizeHasBeenModified();
295    }
296    
297    @Nullable
298    public String getFractionSeparator() {
299        return _value.getFractionSeparator();
300    }
301    
302    public void setFractionSeparator(@Nullable String fractionSeparator)
303            throws PersistenceNotNullException, PersistenceReadOnlyException {
304        checkReadWrite();
305        _value.setFractionSeparator(fractionSeparator);
306    }
307    
308    public boolean getFractionSeparatorHasBeenModified() {
309        return _value.getFractionSeparatorHasBeenModified();
310    }
311    
312    @Nullable
313    public Integer getDefaultFractionDigits() {
314        return _value.getDefaultFractionDigits();
315    }
316    
317    public void setDefaultFractionDigits(@Nullable Integer defaultFractionDigits)
318            throws PersistenceNotNullException, PersistenceReadOnlyException {
319        checkReadWrite();
320        _value.setDefaultFractionDigits(defaultFractionDigits);
321    }
322    
323    public boolean getDefaultFractionDigitsHasBeenModified() {
324        return _value.getDefaultFractionDigitsHasBeenModified();
325    }
326    
327    @Nullable
328    public Integer getPriceUnitFractionDigits() {
329        return _value.getPriceUnitFractionDigits();
330    }
331    
332    public void setPriceUnitFractionDigits(@Nullable Integer priceUnitFractionDigits)
333            throws PersistenceNotNullException, PersistenceReadOnlyException {
334        checkReadWrite();
335        _value.setPriceUnitFractionDigits(priceUnitFractionDigits);
336    }
337    
338    public boolean getPriceUnitFractionDigitsHasBeenModified() {
339        return _value.getPriceUnitFractionDigitsHasBeenModified();
340    }
341    
342    @Nullable
343    public Integer getPriceLineFractionDigits() {
344        return _value.getPriceLineFractionDigits();
345    }
346    
347    public void setPriceLineFractionDigits(@Nullable Integer priceLineFractionDigits)
348            throws PersistenceNotNullException, PersistenceReadOnlyException {
349        checkReadWrite();
350        _value.setPriceLineFractionDigits(priceLineFractionDigits);
351    }
352    
353    public boolean getPriceLineFractionDigitsHasBeenModified() {
354        return _value.getPriceLineFractionDigitsHasBeenModified();
355    }
356    
357    @Nullable
358    public Integer getCostUnitFractionDigits() {
359        return _value.getCostUnitFractionDigits();
360    }
361    
362    public void setCostUnitFractionDigits(@Nullable Integer costUnitFractionDigits)
363            throws PersistenceNotNullException, PersistenceReadOnlyException {
364        checkReadWrite();
365        _value.setCostUnitFractionDigits(costUnitFractionDigits);
366    }
367    
368    public boolean getCostUnitFractionDigitsHasBeenModified() {
369        return _value.getCostUnitFractionDigitsHasBeenModified();
370    }
371    
372    @Nullable
373    public Integer getCostLineFractionDigits() {
374        return _value.getCostLineFractionDigits();
375    }
376    
377    public void setCostLineFractionDigits(@Nullable Integer costLineFractionDigits)
378            throws PersistenceNotNullException, PersistenceReadOnlyException {
379        checkReadWrite();
380        _value.setCostLineFractionDigits(costLineFractionDigits);
381    }
382    
383    public boolean getCostLineFractionDigitsHasBeenModified() {
384        return _value.getCostLineFractionDigitsHasBeenModified();
385    }
386    
387    @Nonnull
388    public String getMinusSign() {
389        return _value.getMinusSign();
390    }
391    
392    public void setMinusSign(@Nonnull String minusSign)
393            throws PersistenceNotNullException, PersistenceReadOnlyException {
394        checkReadWrite();
395        _value.setMinusSign(minusSign);
396    }
397    
398    public boolean getMinusSignHasBeenModified() {
399        return _value.getMinusSignHasBeenModified();
400    }
401    
402    @Nonnull
403    public Boolean getIsDefault() {
404        return _value.getIsDefault();
405    }
406    
407    public void setIsDefault(@Nonnull Boolean isDefault)
408            throws PersistenceNotNullException, PersistenceReadOnlyException {
409        checkReadWrite();
410        _value.setIsDefault(isDefault);
411    }
412    
413    public boolean getIsDefaultHasBeenModified() {
414        return _value.getIsDefaultHasBeenModified();
415    }
416    
417    @Nonnull
418    public Integer getSortOrder() {
419        return _value.getSortOrder();
420    }
421    
422    public void setSortOrder(@Nonnull Integer sortOrder)
423            throws PersistenceNotNullException, PersistenceReadOnlyException {
424        checkReadWrite();
425        _value.setSortOrder(sortOrder);
426    }
427    
428    public boolean getSortOrderHasBeenModified() {
429        return _value.getSortOrderHasBeenModified();
430    }
431    
432}