001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 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 055public class Currency 056 extends BaseEntity 057 implements Serializable { 058 059 private CurrencyPK _pk; 060 private CurrencyValue _value; 061 062 /** Creates a new instance of Currency */ 063 public Currency() 064 throws PersistenceException { 065 super(); 066 } 067 068 /** Creates a new instance of Currency */ 069 public Currency(CurrencyValue value, EntityPermission entityPermission) { 070 super(entityPermission); 071 072 _value = value; 073 _pk = value.getPrimaryKey(); 074 } 075 076 @Override 077 public CurrencyFactory getBaseFactoryInstance() { 078 return CurrencyFactory.getInstance(); 079 } 080 081 @Override 082 public boolean hasBeenModified() { 083 return _value.hasBeenModified(); 084 } 085 086 @Override 087 public int hashCode() { 088 return _pk.hashCode(); 089 } 090 091 @Override 092 public String toString() { 093 return _pk.toString(); 094 } 095 096 @Override 097 public boolean equals(Object other) { 098 if(this == other) 099 return true; 100 101 if(other instanceof Currency) { 102 Currency that = (Currency)other; 103 104 CurrencyValue thatValue = that.getCurrencyValue(); 105 return _value.equals(thatValue); 106 } else { 107 return false; 108 } 109 } 110 111 @Override 112 public void store(Session session) 113 throws PersistenceDatabaseException { 114 getBaseFactoryInstance().store(session, this); 115 } 116 117 @Override 118 public void remove(Session session) 119 throws PersistenceDatabaseException { 120 getBaseFactoryInstance().remove(session, this); 121 } 122 123 @Override 124 public void remove() 125 throws PersistenceDatabaseException { 126 getBaseFactoryInstance().remove(ThreadSession.currentSession(), this); 127 } 128 129 public CurrencyValue getCurrencyValue() { 130 return _value; 131 } 132 133 public void setCurrencyValue(CurrencyValue value) 134 throws PersistenceReadOnlyException { 135 checkReadWrite(); 136 _value = value; 137 } 138 139 @Override 140 public CurrencyPK getPrimaryKey() { 141 return _pk; 142 } 143 144 public String getCurrencyIsoName() { 145 return _value.getCurrencyIsoName(); 146 } 147 148 public void setCurrencyIsoName(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 public String getSymbol() { 159 return _value.getSymbol(); 160 } 161 162 public void setSymbol(String symbol) 163 throws PersistenceNotNullException, PersistenceReadOnlyException { 164 checkReadWrite(); 165 _value.setSymbol(symbol); 166 } 167 168 public boolean getSymbolHasBeenModified() { 169 return _value.getSymbolHasBeenModified(); 170 } 171 172 public SymbolPositionPK getSymbolPositionPK() { 173 return _value.getSymbolPositionPK(); 174 } 175 176 public SymbolPosition getSymbolPosition(Session session, EntityPermission entityPermission) { 177 return SymbolPositionFactory.getInstance().getEntityFromPK(session, entityPermission, getSymbolPositionPK()); 178 } 179 180 public SymbolPosition getSymbolPosition(EntityPermission entityPermission) { 181 return getSymbolPosition(ThreadSession.currentSession(), entityPermission); 182 } 183 184 public SymbolPosition getSymbolPosition(Session session) { 185 return getSymbolPosition(session, EntityPermission.READ_ONLY); 186 } 187 188 public SymbolPosition getSymbolPosition() { 189 return getSymbolPosition(ThreadSession.currentSession(), EntityPermission.READ_ONLY); 190 } 191 192 public SymbolPosition getSymbolPositionForUpdate(Session session) { 193 return getSymbolPosition(session, EntityPermission.READ_WRITE); 194 } 195 196 public SymbolPosition getSymbolPositionForUpdate() { 197 return getSymbolPosition(ThreadSession.currentSession(), EntityPermission.READ_WRITE); 198 } 199 200 public void setSymbolPositionPK(SymbolPositionPK symbolPositionPK) 201 throws PersistenceNotNullException, PersistenceReadOnlyException { 202 checkReadWrite(); 203 _value.setSymbolPositionPK(symbolPositionPK); 204 } 205 206 public void setSymbolPosition(SymbolPosition entity) { 207 setSymbolPositionPK(entity == null? null: entity.getPrimaryKey()); 208 } 209 210 public boolean getSymbolPositionPKHasBeenModified() { 211 return _value.getSymbolPositionPKHasBeenModified(); 212 } 213 214 public Boolean getSymbolOnListStart() { 215 return _value.getSymbolOnListStart(); 216 } 217 218 public void setSymbolOnListStart(Boolean symbolOnListStart) 219 throws PersistenceNotNullException, PersistenceReadOnlyException { 220 checkReadWrite(); 221 _value.setSymbolOnListStart(symbolOnListStart); 222 } 223 224 public boolean getSymbolOnListStartHasBeenModified() { 225 return _value.getSymbolOnListStartHasBeenModified(); 226 } 227 228 public Boolean getSymbolOnListMember() { 229 return _value.getSymbolOnListMember(); 230 } 231 232 public void setSymbolOnListMember(Boolean symbolOnListMember) 233 throws PersistenceNotNullException, PersistenceReadOnlyException { 234 checkReadWrite(); 235 _value.setSymbolOnListMember(symbolOnListMember); 236 } 237 238 public boolean getSymbolOnListMemberHasBeenModified() { 239 return _value.getSymbolOnListMemberHasBeenModified(); 240 } 241 242 public Boolean getSymbolOnSubtotal() { 243 return _value.getSymbolOnSubtotal(); 244 } 245 246 public void setSymbolOnSubtotal(Boolean symbolOnSubtotal) 247 throws PersistenceNotNullException, PersistenceReadOnlyException { 248 checkReadWrite(); 249 _value.setSymbolOnSubtotal(symbolOnSubtotal); 250 } 251 252 public boolean getSymbolOnSubtotalHasBeenModified() { 253 return _value.getSymbolOnSubtotalHasBeenModified(); 254 } 255 256 public Boolean getSymbolOnTotal() { 257 return _value.getSymbolOnTotal(); 258 } 259 260 public void setSymbolOnTotal(Boolean symbolOnTotal) 261 throws PersistenceNotNullException, PersistenceReadOnlyException { 262 checkReadWrite(); 263 _value.setSymbolOnTotal(symbolOnTotal); 264 } 265 266 public boolean getSymbolOnTotalHasBeenModified() { 267 return _value.getSymbolOnTotalHasBeenModified(); 268 } 269 270 public String getGroupingSeparator() { 271 return _value.getGroupingSeparator(); 272 } 273 274 public void setGroupingSeparator(String groupingSeparator) 275 throws PersistenceNotNullException, PersistenceReadOnlyException { 276 checkReadWrite(); 277 _value.setGroupingSeparator(groupingSeparator); 278 } 279 280 public boolean getGroupingSeparatorHasBeenModified() { 281 return _value.getGroupingSeparatorHasBeenModified(); 282 } 283 284 public Integer getGroupingSize() { 285 return _value.getGroupingSize(); 286 } 287 288 public void setGroupingSize(Integer groupingSize) 289 throws PersistenceNotNullException, PersistenceReadOnlyException { 290 checkReadWrite(); 291 _value.setGroupingSize(groupingSize); 292 } 293 294 public boolean getGroupingSizeHasBeenModified() { 295 return _value.getGroupingSizeHasBeenModified(); 296 } 297 298 public String getFractionSeparator() { 299 return _value.getFractionSeparator(); 300 } 301 302 public void setFractionSeparator(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 public Integer getDefaultFractionDigits() { 313 return _value.getDefaultFractionDigits(); 314 } 315 316 public void setDefaultFractionDigits(Integer defaultFractionDigits) 317 throws PersistenceNotNullException, PersistenceReadOnlyException { 318 checkReadWrite(); 319 _value.setDefaultFractionDigits(defaultFractionDigits); 320 } 321 322 public boolean getDefaultFractionDigitsHasBeenModified() { 323 return _value.getDefaultFractionDigitsHasBeenModified(); 324 } 325 326 public Integer getPriceUnitFractionDigits() { 327 return _value.getPriceUnitFractionDigits(); 328 } 329 330 public void setPriceUnitFractionDigits(Integer priceUnitFractionDigits) 331 throws PersistenceNotNullException, PersistenceReadOnlyException { 332 checkReadWrite(); 333 _value.setPriceUnitFractionDigits(priceUnitFractionDigits); 334 } 335 336 public boolean getPriceUnitFractionDigitsHasBeenModified() { 337 return _value.getPriceUnitFractionDigitsHasBeenModified(); 338 } 339 340 public Integer getPriceLineFractionDigits() { 341 return _value.getPriceLineFractionDigits(); 342 } 343 344 public void setPriceLineFractionDigits(Integer priceLineFractionDigits) 345 throws PersistenceNotNullException, PersistenceReadOnlyException { 346 checkReadWrite(); 347 _value.setPriceLineFractionDigits(priceLineFractionDigits); 348 } 349 350 public boolean getPriceLineFractionDigitsHasBeenModified() { 351 return _value.getPriceLineFractionDigitsHasBeenModified(); 352 } 353 354 public Integer getCostUnitFractionDigits() { 355 return _value.getCostUnitFractionDigits(); 356 } 357 358 public void setCostUnitFractionDigits(Integer costUnitFractionDigits) 359 throws PersistenceNotNullException, PersistenceReadOnlyException { 360 checkReadWrite(); 361 _value.setCostUnitFractionDigits(costUnitFractionDigits); 362 } 363 364 public boolean getCostUnitFractionDigitsHasBeenModified() { 365 return _value.getCostUnitFractionDigitsHasBeenModified(); 366 } 367 368 public Integer getCostLineFractionDigits() { 369 return _value.getCostLineFractionDigits(); 370 } 371 372 public void setCostLineFractionDigits(Integer costLineFractionDigits) 373 throws PersistenceNotNullException, PersistenceReadOnlyException { 374 checkReadWrite(); 375 _value.setCostLineFractionDigits(costLineFractionDigits); 376 } 377 378 public boolean getCostLineFractionDigitsHasBeenModified() { 379 return _value.getCostLineFractionDigitsHasBeenModified(); 380 } 381 382 public String getMinusSign() { 383 return _value.getMinusSign(); 384 } 385 386 public void setMinusSign(String minusSign) 387 throws PersistenceNotNullException, PersistenceReadOnlyException { 388 checkReadWrite(); 389 _value.setMinusSign(minusSign); 390 } 391 392 public boolean getMinusSignHasBeenModified() { 393 return _value.getMinusSignHasBeenModified(); 394 } 395 396 public Boolean getIsDefault() { 397 return _value.getIsDefault(); 398 } 399 400 public void setIsDefault(Boolean isDefault) 401 throws PersistenceNotNullException, PersistenceReadOnlyException { 402 checkReadWrite(); 403 _value.setIsDefault(isDefault); 404 } 405 406 public boolean getIsDefaultHasBeenModified() { 407 return _value.getIsDefaultHasBeenModified(); 408 } 409 410 public Integer getSortOrder() { 411 return _value.getSortOrder(); 412 } 413 414 public void setSortOrder(Integer sortOrder) 415 throws PersistenceNotNullException, PersistenceReadOnlyException { 416 checkReadWrite(); 417 _value.setSortOrder(sortOrder); 418 } 419 420 public boolean getSortOrderHasBeenModified() { 421 return _value.getSortOrderHasBeenModified(); 422 } 423 424}