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 * ItemHarmonizedTariffScheduleCodeDetailFactory.java 021 */ 022 023package com.echothree.model.data.item.server.factory; 024 025import com.echothree.model.data.item.common.pk.ItemHarmonizedTariffScheduleCodePK; 026import com.echothree.model.data.item.common.pk.ItemPK; 027import com.echothree.model.data.geo.common.pk.GeoCodePK; 028import com.echothree.model.data.item.common.pk.HarmonizedTariffScheduleCodeUseTypePK; 029import com.echothree.model.data.item.common.pk.HarmonizedTariffScheduleCodePK; 030 031import com.echothree.model.data.item.server.entity.ItemHarmonizedTariffScheduleCode; 032import com.echothree.model.data.item.server.entity.Item; 033import com.echothree.model.data.geo.server.entity.GeoCode; 034import com.echothree.model.data.item.server.entity.HarmonizedTariffScheduleCodeUseType; 035import com.echothree.model.data.item.server.entity.HarmonizedTariffScheduleCode; 036 037import com.echothree.model.data.item.common.ItemHarmonizedTariffScheduleCodeDetailConstants; 038import com.echothree.model.data.item.common.pk.ItemHarmonizedTariffScheduleCodeDetailPK; 039import com.echothree.model.data.item.server.value.ItemHarmonizedTariffScheduleCodeDetailValue; 040import com.echothree.model.data.item.server.entity.ItemHarmonizedTariffScheduleCodeDetail; 041import com.echothree.util.common.exception.PersistenceDatabaseException; 042import com.echothree.util.common.exception.PersistenceDatabaseUpdateException; 043import com.echothree.util.common.exception.PersistenceNotNullException; 044import com.echothree.util.server.persistence.BaseFactory; 045import com.echothree.util.server.persistence.EntityIdGenerator; 046import com.echothree.util.server.persistence.EntityPermission; 047import com.echothree.util.server.persistence.PersistenceDebugFlags; 048import com.echothree.util.server.persistence.Session; 049import java.sql.PreparedStatement; 050import java.sql.ResultSet; 051import java.sql.SQLException; 052import java.sql.Types; 053import java.io.ByteArrayInputStream; 054import java.io.StringReader; 055import java.util.ArrayList; 056import java.util.Collection; 057import java.util.HashSet; 058import java.util.List; 059import java.util.Map; 060import java.util.Set; 061import javax.enterprise.context.ApplicationScoped; 062import javax.enterprise.inject.spi.CDI; 063import javax.inject.Inject; 064import org.jooq.ResultQuery; 065import org.slf4j.Logger; 066import org.slf4j.LoggerFactory; 067 068@ApplicationScoped 069public class ItemHarmonizedTariffScheduleCodeDetailFactory 070 implements BaseFactory<ItemHarmonizedTariffScheduleCodeDetailPK, ItemHarmonizedTariffScheduleCodeDetail> { 071 072 @Inject 073 Session session; 074 075 //private static final Logger log = LoggerFactory.getLogger(ItemHarmonizedTariffScheduleCodeDetailFactory.class); 076 077 final private static String SQL_SELECT_READ_ONLY = "SELECT itmhztscdt_itemharmonizedtariffschedulecodedetailid, itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid, itmhztscdt_itm_itemid, itmhztscdt_countrygeocodeid, itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid, itmhztscdt_hztsc_harmonizedtariffschedulecodeid, itmhztscdt_fromtime, itmhztscdt_thrutime FROM itemharmonizedtariffschedulecodedetails WHERE itmhztscdt_itemharmonizedtariffschedulecodedetailid = ?"; 078 final private static String SQL_SELECT_READ_WRITE = "SELECT itmhztscdt_itemharmonizedtariffschedulecodedetailid, itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid, itmhztscdt_itm_itemid, itmhztscdt_countrygeocodeid, itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid, itmhztscdt_hztsc_harmonizedtariffschedulecodeid, itmhztscdt_fromtime, itmhztscdt_thrutime FROM itemharmonizedtariffschedulecodedetails WHERE itmhztscdt_itemharmonizedtariffschedulecodedetailid = ? FOR UPDATE"; 079 final private static String SQL_INSERT = "INSERT INTO itemharmonizedtariffschedulecodedetails (itmhztscdt_itemharmonizedtariffschedulecodedetailid, itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid, itmhztscdt_itm_itemid, itmhztscdt_countrygeocodeid, itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid, itmhztscdt_hztsc_harmonizedtariffschedulecodeid, itmhztscdt_fromtime, itmhztscdt_thrutime) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; 080 final private static String SQL_UPDATE = "UPDATE itemharmonizedtariffschedulecodedetails SET itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid = ?, itmhztscdt_itm_itemid = ?, itmhztscdt_countrygeocodeid = ?, itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid = ?, itmhztscdt_hztsc_harmonizedtariffschedulecodeid = ?, itmhztscdt_fromtime = ?, itmhztscdt_thrutime = ? WHERE itmhztscdt_itemharmonizedtariffschedulecodedetailid = ?"; 081 final private static String SQL_DELETE = "DELETE FROM itemharmonizedtariffschedulecodedetails WHERE itmhztscdt_itemharmonizedtariffschedulecodedetailid = ?"; 082 final private static String SQL_VALID = "SELECT COUNT(*) FROM itemharmonizedtariffschedulecodedetails WHERE itmhztscdt_itemharmonizedtariffschedulecodedetailid = ?"; 083 084 final private static String PK_COLUMN = "itmhztscdt_itemharmonizedtariffschedulecodedetailid"; 085 final private static String ALL_COLUMNS = "itmhztscdt_itemharmonizedtariffschedulecodedetailid, itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid, itmhztscdt_itm_itemid, itmhztscdt_countrygeocodeid, itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid, itmhztscdt_hztsc_harmonizedtariffschedulecodeid, itmhztscdt_fromtime, itmhztscdt_thrutime"; 086 final public static String TABLE_NAME = "itemharmonizedtariffschedulecodedetails"; 087 088 final public static String ITMHZTSCDT_ITEMHARMONIZEDTARIFFSCHEDULECODEDETAILID = "itmhztscdt_itemharmonizedtariffschedulecodedetailid"; 089 final public static String ITMHZTSCDT_ITMHZTSC_ITEMHARMONIZEDTARIFFSCHEDULECODEID = "itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid"; 090 final public static String ITMHZTSCDT_ITM_ITEMID = "itmhztscdt_itm_itemid"; 091 final public static String ITMHZTSCDT_COUNTRYGEOCODEID = "itmhztscdt_countrygeocodeid"; 092 final public static String ITMHZTSCDT_HZTSCUTYP_HARMONIZEDTARIFFSCHEDULECODEUSETYPEID = "itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid"; 093 final public static String ITMHZTSCDT_HZTSC_HARMONIZEDTARIFFSCHEDULECODEID = "itmhztscdt_hztsc_harmonizedtariffschedulecodeid"; 094 final public static String ITMHZTSCDT_FROMTIME = "itmhztscdt_fromtime"; 095 final public static String ITMHZTSCDT_THRUTIME = "itmhztscdt_thrutime"; 096 097 final private static EntityIdGenerator entityIdGenerator = new EntityIdGenerator(ItemHarmonizedTariffScheduleCodeDetailConstants.COMPONENT_VENDOR_NAME, ItemHarmonizedTariffScheduleCodeDetailConstants.ENTITY_TYPE_NAME); 098 099 /** Creates a new instance of ItemHarmonizedTariffScheduleCodeDetailFactory */ 100 protected ItemHarmonizedTariffScheduleCodeDetailFactory() { 101 super(); 102 } 103 104 public static ItemHarmonizedTariffScheduleCodeDetailFactory getInstance() { 105 return CDI.current().select(ItemHarmonizedTariffScheduleCodeDetailFactory.class).get(); 106 } 107 108 @Override 109 public String getPKColumn() { 110 return PK_COLUMN; 111 } 112 113 @Override 114 public String getAllColumns() { 115 return ALL_COLUMNS; 116 } 117 118 @Override 119 public String getTableName() { 120 return TABLE_NAME; 121 } 122 123 @Override 124 public String getComponentVendorName() { 125 return ItemHarmonizedTariffScheduleCodeDetailConstants.COMPONENT_VENDOR_NAME; 126 } 127 128 @Override 129 public String getEntityTypeName() { 130 return ItemHarmonizedTariffScheduleCodeDetailConstants.ENTITY_TYPE_NAME; 131 } 132 133 public PreparedStatement prepareStatement(String query) { 134 return session.prepareStatement(ItemHarmonizedTariffScheduleCodeDetailFactory.class, query); 135 } 136 137 public ItemHarmonizedTariffScheduleCodeDetailPK getNextPK() { 138 return new ItemHarmonizedTariffScheduleCodeDetailPK(entityIdGenerator.getNextEntityId()); 139 } 140 141 public Set<ItemHarmonizedTariffScheduleCodeDetailPK> getPKsFromResultSetAsSet(ResultSet rs) 142 throws PersistenceDatabaseException { 143 Set<ItemHarmonizedTariffScheduleCodeDetailPK> _result = new HashSet<>(); 144 145 try { 146 while(rs.next()) { 147 _result.add(getPKFromResultSet(rs)); 148 } 149 } catch (SQLException se) { 150 throw new PersistenceDatabaseException(se); 151 } 152 153 return _result; 154 } 155 156 public java.util.List<ItemHarmonizedTariffScheduleCodeDetailPK> getPKsFromResultSetAsList(ResultSet rs) 157 throws PersistenceDatabaseException { 158 java.util.List<ItemHarmonizedTariffScheduleCodeDetailPK> _result = new ArrayList<>(); 159 160 try { 161 while(rs.next()) { 162 _result.add(getPKFromResultSet(rs)); 163 } 164 } catch (SQLException se) { 165 throw new PersistenceDatabaseException(se); 166 } 167 168 return _result; 169 } 170 171 public ItemHarmonizedTariffScheduleCodeDetailPK getPKFromResultSet(ResultSet rs) 172 throws PersistenceDatabaseException { 173 ItemHarmonizedTariffScheduleCodeDetailPK _result; 174 175 try { 176 long itmhztscdt_itemharmonizedtariffschedulecodedetailid = rs.getLong(ITMHZTSCDT_ITEMHARMONIZEDTARIFFSCHEDULECODEDETAILID); 177 Long _entityId = rs.wasNull() ? null : itmhztscdt_itemharmonizedtariffschedulecodedetailid; 178 179 _result = new ItemHarmonizedTariffScheduleCodeDetailPK(_entityId); 180 } catch (SQLException se) { 181 throw new PersistenceDatabaseException(se); 182 } 183 184 return _result; 185 } 186 187 public java.util.List<ItemHarmonizedTariffScheduleCodeDetailValue> getValuesFromPKs(Collection<ItemHarmonizedTariffScheduleCodeDetailPK> pks) 188 throws PersistenceDatabaseException { 189 java.util.List<ItemHarmonizedTariffScheduleCodeDetailValue> _values = new ArrayList<>(pks.size()); 190 191 for(ItemHarmonizedTariffScheduleCodeDetailPK _pk: pks) { 192 _values.add(getValueFromPK(_pk)); 193 } 194 195 return _values; 196 } 197 198 public ItemHarmonizedTariffScheduleCodeDetailValue getValueFromPK(ItemHarmonizedTariffScheduleCodeDetailPK pk) 199 throws PersistenceDatabaseException { 200 ItemHarmonizedTariffScheduleCodeDetailValue _value; 201 202 // See if we already have the entity in the session cache 203 ItemHarmonizedTariffScheduleCodeDetail _entity = (ItemHarmonizedTariffScheduleCodeDetail)session.getEntity(pk); 204 if(_entity == null) 205 _value = getEntityFromPK(EntityPermission.READ_ONLY, pk).getItemHarmonizedTariffScheduleCodeDetailValue(); 206 else 207 _value = _entity.getItemHarmonizedTariffScheduleCodeDetailValue(); 208 209 return _value; 210 } 211 212 public java.util.List<ItemHarmonizedTariffScheduleCodeDetailValue> getValuesFromResultSet(ResultSet rs) 213 throws PersistenceDatabaseException { 214 java.util.List<ItemHarmonizedTariffScheduleCodeDetailValue> _result = new ArrayList<>(); 215 216 try { 217 while(rs.next()) { 218 _result.add(getValueFromResultSet(rs)); 219 } 220 } catch (SQLException se) { 221 throw new PersistenceDatabaseException(se); 222 } 223 224 return _result; 225 } 226 227 public ItemHarmonizedTariffScheduleCodeDetailValue getValueFromResultSet(ResultSet rs) 228 throws PersistenceDatabaseException { 229 ItemHarmonizedTariffScheduleCodeDetailValue _value; 230 231 try { 232 Long itmhztscdt_itemharmonizedtariffschedulecodedetailid = rs.getLong(ITMHZTSCDT_ITEMHARMONIZEDTARIFFSCHEDULECODEDETAILID); 233 ItemHarmonizedTariffScheduleCodeDetailPK _pk = new ItemHarmonizedTariffScheduleCodeDetailPK(itmhztscdt_itemharmonizedtariffschedulecodedetailid); 234 235 // See if we already have the entity in the session cache 236 ItemHarmonizedTariffScheduleCodeDetail _entity = (ItemHarmonizedTariffScheduleCodeDetail)session.getEntity(_pk); 237 238 if(_entity == null) { 239 Long itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid = rs.getLong(ITMHZTSCDT_ITMHZTSC_ITEMHARMONIZEDTARIFFSCHEDULECODEID); 240 if(rs.wasNull()) 241 itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid = null; 242 243 Long itmhztscdt_itm_itemid = rs.getLong(ITMHZTSCDT_ITM_ITEMID); 244 if(rs.wasNull()) 245 itmhztscdt_itm_itemid = null; 246 247 Long itmhztscdt_countrygeocodeid = rs.getLong(ITMHZTSCDT_COUNTRYGEOCODEID); 248 if(rs.wasNull()) 249 itmhztscdt_countrygeocodeid = null; 250 251 Long itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid = rs.getLong(ITMHZTSCDT_HZTSCUTYP_HARMONIZEDTARIFFSCHEDULECODEUSETYPEID); 252 if(rs.wasNull()) 253 itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid = null; 254 255 Long itmhztscdt_hztsc_harmonizedtariffschedulecodeid = rs.getLong(ITMHZTSCDT_HZTSC_HARMONIZEDTARIFFSCHEDULECODEID); 256 if(rs.wasNull()) 257 itmhztscdt_hztsc_harmonizedtariffschedulecodeid = null; 258 259 Long itmhztscdt_fromtime = rs.getLong(ITMHZTSCDT_FROMTIME); 260 if(rs.wasNull()) 261 itmhztscdt_fromtime = null; 262 263 Long itmhztscdt_thrutime = rs.getLong(ITMHZTSCDT_THRUTIME); 264 if(rs.wasNull()) 265 itmhztscdt_thrutime = null; 266 267 _value = new ItemHarmonizedTariffScheduleCodeDetailValue(_pk, new ItemHarmonizedTariffScheduleCodePK(itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid), new ItemPK(itmhztscdt_itm_itemid), new GeoCodePK(itmhztscdt_countrygeocodeid), new HarmonizedTariffScheduleCodeUseTypePK(itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid), new HarmonizedTariffScheduleCodePK(itmhztscdt_hztsc_harmonizedtariffschedulecodeid), itmhztscdt_fromtime, itmhztscdt_thrutime); 268 } else 269 _value = _entity.getItemHarmonizedTariffScheduleCodeDetailValue(); 270 } catch (SQLException se) { 271 throw new PersistenceDatabaseException(se); 272 } 273 274 return _value; 275 } 276 277 public java.util.List<ItemHarmonizedTariffScheduleCodeDetail> getEntitiesFromPKs(EntityPermission entityPermission, Collection<ItemHarmonizedTariffScheduleCodeDetailPK> pks) 278 throws PersistenceDatabaseException { 279 java.util.List<ItemHarmonizedTariffScheduleCodeDetail> _entities = new ArrayList<>(pks.size()); 280 281 for(ItemHarmonizedTariffScheduleCodeDetailPK _pk: pks) { 282 _entities.add(getEntityFromPK(entityPermission, _pk)); 283 } 284 285 return _entities; 286 } 287 288 public ItemHarmonizedTariffScheduleCodeDetail getEntityFromValue(EntityPermission entityPermission, ItemHarmonizedTariffScheduleCodeDetailValue value) { 289 return getEntityFromPK(entityPermission, value.getPrimaryKey()); 290 } 291 292 public ItemHarmonizedTariffScheduleCodeDetail getEntityFromCache(ItemHarmonizedTariffScheduleCodeDetailPK pk) { 293 ItemHarmonizedTariffScheduleCodeDetailValue _value = (ItemHarmonizedTariffScheduleCodeDetailValue)session.getValueCache().get(pk); 294 295 return _value == null ? null : new ItemHarmonizedTariffScheduleCodeDetail(_value, EntityPermission.READ_ONLY); 296 } 297 298 public ItemHarmonizedTariffScheduleCodeDetail getEntityFromPK(EntityPermission entityPermission, ItemHarmonizedTariffScheduleCodeDetailPK pk) 299 throws PersistenceDatabaseException { 300 ItemHarmonizedTariffScheduleCodeDetail _entity; 301 302 // See if we already have the entity in the session cache 303 _entity = (ItemHarmonizedTariffScheduleCodeDetail)session.getEntity(pk); 304 if(_entity != null) { 305 // If the requested permission is READ_WRITE, and the cached permission is 306 // READ_ONLY, then pretend that the cached object wasn't found, and create 307 // a new entity that is READ_WRITE. 308 if(entityPermission.equals(EntityPermission.READ_WRITE)) { 309 if(_entity.getEntityPermission().equals(EntityPermission.READ_ONLY)) 310 _entity = null; 311 } 312 } 313 314 if(_entity == null && entityPermission.equals(EntityPermission.READ_ONLY)) { 315 _entity = getEntityFromCache(pk); 316 } 317 318 if(_entity == null) { 319 PreparedStatement _ps = session.prepareStatement(entityPermission.equals(EntityPermission.READ_ONLY)? SQL_SELECT_READ_ONLY: SQL_SELECT_READ_WRITE); 320 long _entityId = pk.getEntityId(); 321 ResultSet _rs = null; 322 323 try { 324 _ps.setLong(1, _entityId); 325 _rs = _ps.executeQuery(); 326 if(_rs.next()) { 327 _entity = getEntityFromResultSet(entityPermission, _rs); 328 } 329 } catch (SQLException se) { 330 throw new PersistenceDatabaseException(se); 331 } finally { 332 if(_rs != null) { 333 try { 334 _rs.close(); 335 } catch (SQLException se) { 336 // do nothing 337 } 338 } 339 } 340 } 341 342 return _entity; 343 } 344 345 public Set<ItemHarmonizedTariffScheduleCodeDetailPK> getPKsFromQueryAsSet(PreparedStatement ps, final Object... params) 346 throws PersistenceDatabaseException { 347 Set<ItemHarmonizedTariffScheduleCodeDetailPK> _pks; 348 ResultSet _rs = null; 349 350 try { 351 if(params.length != 0) { 352 Session.setQueryParams(ps, params); 353 } 354 355 _rs = ps.executeQuery(); 356 _pks = getPKsFromResultSetAsSet(_rs); 357 _rs.close(); 358 } catch (SQLException se) { 359 throw new PersistenceDatabaseException(se); 360 } finally { 361 if(_rs != null) { 362 try { 363 _rs.close(); 364 } catch (SQLException se) { 365 // do nothing 366 } 367 } 368 } 369 370 return _pks; 371 } 372 373 public java.util.List<ItemHarmonizedTariffScheduleCodeDetailPK> getPKsFromQueryAsList(PreparedStatement ps, final Object... params) 374 throws PersistenceDatabaseException { 375 java.util.List<ItemHarmonizedTariffScheduleCodeDetailPK> _pks; 376 ResultSet _rs = null; 377 378 try { 379 if(params.length != 0) { 380 Session.setQueryParams(ps, params); 381 } 382 383 _rs = ps.executeQuery(); 384 _pks = getPKsFromResultSetAsList(_rs); 385 _rs.close(); 386 } catch (SQLException se) { 387 throw new PersistenceDatabaseException(se); 388 } finally { 389 if(_rs != null) { 390 try { 391 _rs.close(); 392 } catch (SQLException se) { 393 // do nothing 394 } 395 } 396 } 397 398 return _pks; 399 } 400 401 public ItemHarmonizedTariffScheduleCodeDetailPK getPKFromQuery(PreparedStatement ps, final Object... params) 402 throws PersistenceDatabaseException { 403 ItemHarmonizedTariffScheduleCodeDetailPK _pk = null; 404 ResultSet _rs = null; 405 406 try { 407 if(params.length != 0) { 408 Session.setQueryParams(ps, params); 409 } 410 411 _rs = ps.executeQuery(); 412 if(_rs.next()) { 413 _pk = getPKFromResultSet(_rs); 414 } 415 _rs.close(); 416 } catch (SQLException se) { 417 throw new PersistenceDatabaseException(se); 418 } finally { 419 if(_rs != null) { 420 try { 421 _rs.close(); 422 } catch (SQLException se) { 423 // do nothing 424 } 425 } 426 } 427 428 return _pk; 429 } 430 431 public java.util.List<ItemHarmonizedTariffScheduleCodeDetail> getEntitiesFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap, final Object... params) 432 throws PersistenceDatabaseException { 433 PreparedStatement ps = session.prepareStatement(ItemHarmonizedTariffScheduleCodeDetailFactory.class, queryMap.get(entityPermission)); 434 435 return getEntitiesFromQuery(entityPermission, ps, params); 436 } 437 438 public java.util.List<ItemHarmonizedTariffScheduleCodeDetail> getEntitiesFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap) 439 throws PersistenceDatabaseException { 440 PreparedStatement ps = session.prepareStatement(ItemHarmonizedTariffScheduleCodeDetailFactory.class, queryMap.get(entityPermission)); 441 442 return getEntitiesFromQuery(entityPermission, ps); 443 } 444 445 public java.util.List<ItemHarmonizedTariffScheduleCodeDetail> getEntitiesFromQuery(EntityPermission entityPermission, ResultQuery<?> query) 446 throws PersistenceDatabaseException { 447 PreparedStatement ps = session.prepareStatement(ItemHarmonizedTariffScheduleCodeDetailFactory.class, query.getSQL()); 448 449 return getEntitiesFromQuery(entityPermission, ps, query.getBindValues().toArray()); 450 } 451 452 public java.util.List<ItemHarmonizedTariffScheduleCodeDetail> getEntitiesFromQuery(EntityPermission entityPermission, PreparedStatement ps, final Object... params) 453 throws PersistenceDatabaseException { 454 java.util.List<ItemHarmonizedTariffScheduleCodeDetail> _entities; 455 ResultSet _rs = null; 456 457 try { 458 if(params.length != 0) { 459 Session.setQueryParams(ps, params); 460 } 461 462 _rs = ps.executeQuery(); 463 _entities = getEntitiesFromResultSet(entityPermission, _rs); 464 _rs.close(); 465 } catch (SQLException se) { 466 throw new PersistenceDatabaseException(se); 467 } finally { 468 if(_rs != null) { 469 try { 470 _rs.close(); 471 } catch (SQLException se) { 472 // do nothing 473 } 474 } 475 } 476 477 return _entities; 478 } 479 480 public ItemHarmonizedTariffScheduleCodeDetail getEntityFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap, final Object... params) 481 throws PersistenceDatabaseException { 482 PreparedStatement ps = session.prepareStatement(ItemHarmonizedTariffScheduleCodeDetailFactory.class, queryMap.get(entityPermission)); 483 484 return getEntityFromQuery(entityPermission, ps, params); 485 } 486 487 public ItemHarmonizedTariffScheduleCodeDetail getEntityFromQuery(EntityPermission entityPermission, Map<EntityPermission, String>queryMap) 488 throws PersistenceDatabaseException { 489 PreparedStatement ps = session.prepareStatement(ItemHarmonizedTariffScheduleCodeDetailFactory.class, queryMap.get(entityPermission)); 490 491 return getEntityFromQuery(entityPermission, ps); 492 } 493 494 public ItemHarmonizedTariffScheduleCodeDetail getEntityFromQuery(EntityPermission entityPermission, ResultQuery<?> query) 495 throws PersistenceDatabaseException { 496 PreparedStatement ps = session.prepareStatement(ItemHarmonizedTariffScheduleCodeDetailFactory.class, query.getSQL()); 497 498 return getEntityFromQuery(entityPermission, ps, query.getBindValues().toArray()); 499 } 500 501 public ItemHarmonizedTariffScheduleCodeDetail getEntityFromQuery(EntityPermission entityPermission, PreparedStatement ps, final Object... params) 502 throws PersistenceDatabaseException { 503 ItemHarmonizedTariffScheduleCodeDetail _entity = null; 504 ResultSet _rs = null; 505 506 try { 507 if(params.length != 0) { 508 Session.setQueryParams(ps, params); 509 } 510 511 _rs = ps.executeQuery(); 512 if(_rs.next()) { 513 _entity = getEntityFromResultSet(entityPermission, _rs); 514 } 515 _rs.close(); 516 } catch (SQLException se) { 517 throw new PersistenceDatabaseException(se); 518 } finally { 519 if(_rs != null) { 520 try { 521 _rs.close(); 522 } catch (SQLException se) { 523 // do nothing 524 } 525 } 526 } 527 528 return _entity; 529 } 530 531 public java.util.List<ItemHarmonizedTariffScheduleCodeDetail> getEntitiesFromResultSet(EntityPermission entityPermission, ResultSet rs) 532 throws PersistenceDatabaseException { 533 java.util.List<ItemHarmonizedTariffScheduleCodeDetail> _result = new ArrayList<>(); 534 535 try { 536 while(rs.next()) { 537 _result.add(getEntityFromResultSet(entityPermission, rs)); 538 } 539 } catch (SQLException se) { 540 throw new PersistenceDatabaseException(se); 541 } 542 543 return _result; 544 } 545 546 public ItemHarmonizedTariffScheduleCodeDetail getEntityFromResultSet(EntityPermission entityPermission, ResultSet rs) 547 throws PersistenceDatabaseException { 548 ItemHarmonizedTariffScheduleCodeDetail _entity; 549 550 try { 551 Long itmhztscdt_itemharmonizedtariffschedulecodedetailid = rs.getLong(ITMHZTSCDT_ITEMHARMONIZEDTARIFFSCHEDULECODEDETAILID); 552 ItemHarmonizedTariffScheduleCodeDetailPK _pk = new ItemHarmonizedTariffScheduleCodeDetailPK(itmhztscdt_itemharmonizedtariffschedulecodedetailid); 553 554 // See if we already have the entity in the session cache 555 _entity = (ItemHarmonizedTariffScheduleCodeDetail)session.getEntity(_pk); 556 if(_entity != null) { 557 // If the requested permission is READ_WRITE, and the cached permission is 558 // READ_ONLY, then pretend that the cached object wasn't found, and create 559 // a new entity that is READ_WRITE. 560 if(entityPermission.equals(EntityPermission.READ_WRITE)) { 561 if(_entity.getEntityPermission().equals(EntityPermission.READ_ONLY)) 562 _entity = null; 563 } 564 } 565 boolean foundInSessionCache = _entity != null; 566 567 if(_entity == null && entityPermission.equals(EntityPermission.READ_ONLY)) { 568 _entity = getEntityFromCache(_pk); 569 } 570 571 if(_entity == null) { 572 Long itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid = rs.getLong(ITMHZTSCDT_ITMHZTSC_ITEMHARMONIZEDTARIFFSCHEDULECODEID); 573 if(rs.wasNull()) 574 itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid = null; 575 576 Long itmhztscdt_itm_itemid = rs.getLong(ITMHZTSCDT_ITM_ITEMID); 577 if(rs.wasNull()) 578 itmhztscdt_itm_itemid = null; 579 580 Long itmhztscdt_countrygeocodeid = rs.getLong(ITMHZTSCDT_COUNTRYGEOCODEID); 581 if(rs.wasNull()) 582 itmhztscdt_countrygeocodeid = null; 583 584 Long itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid = rs.getLong(ITMHZTSCDT_HZTSCUTYP_HARMONIZEDTARIFFSCHEDULECODEUSETYPEID); 585 if(rs.wasNull()) 586 itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid = null; 587 588 Long itmhztscdt_hztsc_harmonizedtariffschedulecodeid = rs.getLong(ITMHZTSCDT_HZTSC_HARMONIZEDTARIFFSCHEDULECODEID); 589 if(rs.wasNull()) 590 itmhztscdt_hztsc_harmonizedtariffschedulecodeid = null; 591 592 Long itmhztscdt_fromtime = rs.getLong(ITMHZTSCDT_FROMTIME); 593 if(rs.wasNull()) 594 itmhztscdt_fromtime = null; 595 596 Long itmhztscdt_thrutime = rs.getLong(ITMHZTSCDT_THRUTIME); 597 if(rs.wasNull()) 598 itmhztscdt_thrutime = null; 599 600 ItemHarmonizedTariffScheduleCodeDetailValue _value = new ItemHarmonizedTariffScheduleCodeDetailValue(_pk, itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid == null? null: new ItemHarmonizedTariffScheduleCodePK(itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid), itmhztscdt_itm_itemid == null? null: new ItemPK(itmhztscdt_itm_itemid), itmhztscdt_countrygeocodeid == null? null: new GeoCodePK(itmhztscdt_countrygeocodeid), itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid == null? null: new HarmonizedTariffScheduleCodeUseTypePK(itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid), itmhztscdt_hztsc_harmonizedtariffschedulecodeid == null? null: new HarmonizedTariffScheduleCodePK(itmhztscdt_hztsc_harmonizedtariffschedulecodeid), itmhztscdt_fromtime, itmhztscdt_thrutime); 601 _entity = new ItemHarmonizedTariffScheduleCodeDetail(_value, entityPermission); 602 } 603 604 if(!foundInSessionCache) { 605 if(entityPermission.equals(EntityPermission.READ_ONLY)) { 606 session.putReadOnlyEntity(_pk, _entity); 607 session.getValueCache().put(_entity.getItemHarmonizedTariffScheduleCodeDetailValue()); 608 } else { 609 session.putReadWriteEntity(_pk, _entity); 610 } 611 } 612 } catch (SQLException se) { 613 throw new PersistenceDatabaseException(se); 614 } 615 616 return _entity; 617 } 618 619 public ItemHarmonizedTariffScheduleCodeDetail create(ItemHarmonizedTariffScheduleCode itemHarmonizedTariffScheduleCode, Item item, GeoCode countryGeoCode, HarmonizedTariffScheduleCodeUseType harmonizedTariffScheduleCodeUseType, HarmonizedTariffScheduleCode harmonizedTariffScheduleCode, Long fromTime, Long thruTime) 620 throws PersistenceDatabaseException, PersistenceNotNullException { 621 return create(itemHarmonizedTariffScheduleCode == null ? null : itemHarmonizedTariffScheduleCode.getPrimaryKey(), item == null ? null : item.getPrimaryKey(), countryGeoCode == null ? null : countryGeoCode.getPrimaryKey(), harmonizedTariffScheduleCodeUseType == null ? null : harmonizedTariffScheduleCodeUseType.getPrimaryKey(), harmonizedTariffScheduleCode == null ? null : harmonizedTariffScheduleCode.getPrimaryKey(), fromTime, thruTime); 622 } 623 624 private void bindForCreate(PreparedStatement _ps, ItemHarmonizedTariffScheduleCodeDetailValue _value) 625 throws SQLException { 626 _ps.setLong(1, _value.getEntityId()); 627 628 ItemHarmonizedTariffScheduleCodePK itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid = _value.getItemHarmonizedTariffScheduleCodePK(); 629 if(itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid == null) 630 _ps.setNull(2, Types.BIGINT); 631 else 632 _ps.setLong(2, itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid.getEntityId()); 633 634 ItemPK itmhztscdt_itm_itemid = _value.getItemPK(); 635 if(itmhztscdt_itm_itemid == null) 636 _ps.setNull(3, Types.BIGINT); 637 else 638 _ps.setLong(3, itmhztscdt_itm_itemid.getEntityId()); 639 640 GeoCodePK itmhztscdt_countrygeocodeid = _value.getCountryGeoCodePK(); 641 if(itmhztscdt_countrygeocodeid == null) 642 _ps.setNull(4, Types.BIGINT); 643 else 644 _ps.setLong(4, itmhztscdt_countrygeocodeid.getEntityId()); 645 646 HarmonizedTariffScheduleCodeUseTypePK itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid = _value.getHarmonizedTariffScheduleCodeUseTypePK(); 647 if(itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid == null) 648 _ps.setNull(5, Types.BIGINT); 649 else 650 _ps.setLong(5, itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid.getEntityId()); 651 652 HarmonizedTariffScheduleCodePK itmhztscdt_hztsc_harmonizedtariffschedulecodeid = _value.getHarmonizedTariffScheduleCodePK(); 653 if(itmhztscdt_hztsc_harmonizedtariffschedulecodeid == null) 654 _ps.setNull(6, Types.BIGINT); 655 else 656 _ps.setLong(6, itmhztscdt_hztsc_harmonizedtariffschedulecodeid.getEntityId()); 657 658 Long itmhztscdt_fromtime = _value.getFromTime(); 659 if(itmhztscdt_fromtime == null) 660 _ps.setNull(7, Types.BIGINT); 661 else 662 _ps.setLong(7, itmhztscdt_fromtime); 663 664 Long itmhztscdt_thrutime = _value.getThruTime(); 665 if(itmhztscdt_thrutime == null) 666 _ps.setNull(8, Types.BIGINT); 667 else 668 _ps.setLong(8, itmhztscdt_thrutime); 669 670 } 671 672 public ItemHarmonizedTariffScheduleCodeDetail create(ItemHarmonizedTariffScheduleCodePK itemHarmonizedTariffScheduleCodePK, ItemPK itemPK, GeoCodePK countryGeoCodePK, HarmonizedTariffScheduleCodeUseTypePK harmonizedTariffScheduleCodeUseTypePK, HarmonizedTariffScheduleCodePK harmonizedTariffScheduleCodePK, Long fromTime, Long thruTime) 673 throws PersistenceDatabaseException, PersistenceNotNullException { 674 ItemHarmonizedTariffScheduleCodeDetailPK _pk = getNextPK(); 675 ItemHarmonizedTariffScheduleCodeDetailValue _value = new ItemHarmonizedTariffScheduleCodeDetailValue(_pk, itemHarmonizedTariffScheduleCodePK, itemPK, countryGeoCodePK, harmonizedTariffScheduleCodeUseTypePK, harmonizedTariffScheduleCodePK, fromTime, thruTime); 676 677 PreparedStatement _ps = session.prepareStatement(SQL_INSERT); 678 679 try { 680 bindForCreate(_ps, _value); 681 682 if(PersistenceDebugFlags.CheckEntityInsertRowCount) { 683 int _count = _ps.executeUpdate(); 684 685 if(_count != 1) { 686 throw new PersistenceDatabaseUpdateException("insert failed, _count = " + _count); 687 } 688 } else { 689 _ps.executeUpdate(); 690 } 691 692 session.getValueCache().put(_value); 693 } catch (SQLException se) { 694 throw new PersistenceDatabaseException(se); 695 } 696 697 ItemHarmonizedTariffScheduleCodeDetail _entity = new ItemHarmonizedTariffScheduleCodeDetail(_value, EntityPermission.READ_ONLY); 698 session.putReadOnlyEntity(_pk, _entity); 699 700 return _entity; 701 } 702 703 public void create(Collection<ItemHarmonizedTariffScheduleCodeDetailValue> _values) 704 throws PersistenceDatabaseException, PersistenceNotNullException { 705 int _size = _values.size(); 706 707 if(_size > 0) { 708 PreparedStatement _ps = session.prepareStatement(SQL_INSERT); 709 List<ItemHarmonizedTariffScheduleCodeDetailValue> _cacheValues = new ArrayList<>(_size); 710 711 try { 712 for(ItemHarmonizedTariffScheduleCodeDetailValue _value : _values) { 713 _value.setEntityId(entityIdGenerator.getNextEntityId()); 714 bindForCreate(_ps, _value); 715 716 _ps.addBatch(); 717 718 _cacheValues.add(_value); 719 } 720 721 if(PersistenceDebugFlags.CheckEntityInsertRowCount) { 722 int[] _counts = _ps.executeBatch(); 723 724 for(int _countOffset = 0 ; _countOffset < _size ; _countOffset++) { 725 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 726 throw new PersistenceDatabaseUpdateException("batch insert failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 727 } 728 } 729 } else { 730 _ps.executeBatch(); 731 } 732 733 _ps.clearBatch(); 734 } catch (SQLException se) { 735 throw new PersistenceDatabaseException(se); 736 } 737 738 _cacheValues.forEach((_cacheValue) -> { 739 ItemHarmonizedTariffScheduleCodeDetail _cacheEntity = new ItemHarmonizedTariffScheduleCodeDetail(_cacheValue, EntityPermission.READ_ONLY); 740 741 session.putReadOnlyEntity(_cacheValue.getPrimaryKey(), _cacheEntity); 742 }); 743 } 744 } 745 746 private boolean bindForStore(PreparedStatement _ps, ItemHarmonizedTariffScheduleCodeDetailValue _value) 747 throws SQLException { 748 boolean _hasBeenModified = _value.hasBeenModified(); 749 750 if(_hasBeenModified) { 751 ItemHarmonizedTariffScheduleCodePK itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid = _value.getItemHarmonizedTariffScheduleCodePK(); 752 if(itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid == null) 753 _ps.setNull(1, Types.BIGINT); 754 else 755 _ps.setLong(1, itmhztscdt_itmhztsc_itemharmonizedtariffschedulecodeid.getEntityId()); 756 757 ItemPK itmhztscdt_itm_itemid = _value.getItemPK(); 758 if(itmhztscdt_itm_itemid == null) 759 _ps.setNull(2, Types.BIGINT); 760 else 761 _ps.setLong(2, itmhztscdt_itm_itemid.getEntityId()); 762 763 GeoCodePK itmhztscdt_countrygeocodeid = _value.getCountryGeoCodePK(); 764 if(itmhztscdt_countrygeocodeid == null) 765 _ps.setNull(3, Types.BIGINT); 766 else 767 _ps.setLong(3, itmhztscdt_countrygeocodeid.getEntityId()); 768 769 HarmonizedTariffScheduleCodeUseTypePK itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid = _value.getHarmonizedTariffScheduleCodeUseTypePK(); 770 if(itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid == null) 771 _ps.setNull(4, Types.BIGINT); 772 else 773 _ps.setLong(4, itmhztscdt_hztscutyp_harmonizedtariffschedulecodeusetypeid.getEntityId()); 774 775 HarmonizedTariffScheduleCodePK itmhztscdt_hztsc_harmonizedtariffschedulecodeid = _value.getHarmonizedTariffScheduleCodePK(); 776 if(itmhztscdt_hztsc_harmonizedtariffschedulecodeid == null) 777 _ps.setNull(5, Types.BIGINT); 778 else 779 _ps.setLong(5, itmhztscdt_hztsc_harmonizedtariffschedulecodeid.getEntityId()); 780 781 Long itmhztscdt_fromtime = _value.getFromTime(); 782 if(itmhztscdt_fromtime == null) 783 _ps.setNull(6, Types.BIGINT); 784 else 785 _ps.setLong(6, itmhztscdt_fromtime); 786 787 Long itmhztscdt_thrutime = _value.getThruTime(); 788 if(itmhztscdt_thrutime == null) 789 _ps.setNull(7, Types.BIGINT); 790 else 791 _ps.setLong(7, itmhztscdt_thrutime); 792 793 _ps.setLong(8, _value.getPrimaryKey().getEntityId()); 794 795 _value.clearHasBeenModified(); 796 } 797 798 return _hasBeenModified; 799 } 800 801 @Override 802 public void store(ItemHarmonizedTariffScheduleCodeDetail entity) 803 throws PersistenceDatabaseException { 804 PreparedStatement _ps = session.prepareStatement(SQL_UPDATE); 805 806 try { 807 ItemHarmonizedTariffScheduleCodeDetailValue _value = entity.getItemHarmonizedTariffScheduleCodeDetailValue(); 808 809 if(bindForStore(_ps, _value)) { 810 if(PersistenceDebugFlags.CheckEntityUpdateRowCount) { 811 int _count = _ps.executeUpdate(); 812 813 if(_count != 1) { 814 throw new PersistenceDatabaseUpdateException("update failed, _count = " + _count); 815 } 816 } else { 817 _ps.executeUpdate(); 818 } 819 820 session.getValueCache().put(_value); 821 } 822 } catch (SQLException se) { 823 throw new PersistenceDatabaseException(se); 824 } 825 } 826 827 @Override 828 public void store(Collection<ItemHarmonizedTariffScheduleCodeDetail> entities) 829 throws PersistenceDatabaseException { 830 if(entities.size() > 0) { 831 PreparedStatement _ps = session.prepareStatement(SQL_UPDATE); 832 int _modifiedEntities = 0; 833 834 try { 835 for(ItemHarmonizedTariffScheduleCodeDetail entity : entities) { 836 if(bindForStore(_ps, entity.getItemHarmonizedTariffScheduleCodeDetailValue())) { 837 _ps.addBatch(); 838 _modifiedEntities++; 839 } 840 } 841 842 if(_modifiedEntities != 0) { 843 if(PersistenceDebugFlags.CheckEntityUpdateRowCount) { 844 int[] _counts = _ps.executeBatch(); 845 846 for(int _countOffset = 0 ; _countOffset < _modifiedEntities ; _countOffset++) { 847 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 848 throw new PersistenceDatabaseUpdateException("batch update failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 849 } 850 } 851 } else { 852 _ps.executeBatch(); 853 } 854 855 _ps.clearBatch(); 856 857 entities.forEach((entity) -> { 858 session.getValueCache().put(entity.getItemHarmonizedTariffScheduleCodeDetailValue()); 859 }); 860 } 861 } catch (SQLException se) { 862 throw new PersistenceDatabaseException(se); 863 } 864 } 865 } 866 867 @Override 868 public void remove(ItemHarmonizedTariffScheduleCodeDetail entity) 869 throws PersistenceDatabaseException { 870 remove(entity.getPrimaryKey()); 871 } 872 873 @Override 874 public void remove(ItemHarmonizedTariffScheduleCodeDetailPK pk) 875 throws PersistenceDatabaseException { 876 PreparedStatement _ps = session.prepareStatement(SQL_DELETE); 877 long _entityId = pk.getEntityId(); 878 879 try { 880 _ps.setLong(1, _entityId); 881 882 if(PersistenceDebugFlags.CheckEntityDeleteRowCount) { 883 int _count = _ps.executeUpdate(); 884 885 if(_count != 1) { 886 throw new PersistenceDatabaseUpdateException("remove failed, _count = " + _count); 887 } 888 } else { 889 _ps.executeUpdate(); 890 } 891 892 session.getValueCache().remove(pk); 893 } catch (SQLException se) { 894 throw new PersistenceDatabaseException(se); 895 } 896 897 session.removed(pk, false); 898 } 899 900 @Override 901 public void remove(Collection<ItemHarmonizedTariffScheduleCodeDetailPK> pks) 902 throws PersistenceDatabaseException { 903 if(pks.size() > 0) { 904 PreparedStatement _ps = session.prepareStatement(SQL_DELETE); 905 int _modifiedEntities = 0; 906 907 try { 908 for(ItemHarmonizedTariffScheduleCodeDetailPK pk : pks) { 909 long _entityId = pk.getEntityId(); 910 911 _ps.setLong(1, _entityId); 912 913 _ps.addBatch(); 914 _modifiedEntities++; 915 } 916 917 if(_modifiedEntities != 0) { 918 if(PersistenceDebugFlags.CheckEntityDeleteRowCount) { 919 int[] _counts = _ps.executeBatch(); 920 921 for(int _countOffset = 0 ; _countOffset < _modifiedEntities ; _countOffset++) { 922 if(_counts[_countOffset] != 1 && _counts[_countOffset] != PreparedStatement.SUCCESS_NO_INFO) { 923 throw new PersistenceDatabaseUpdateException("batch remove failed, _counts[" + _countOffset + "] = " + _counts[_countOffset]); 924 } 925 } 926 } else { 927 _ps.executeBatch(); 928 } 929 930 _ps.clearBatch(); 931 932 pks.forEach((pk) -> { 933 session.getValueCache().remove(pk); 934 }); 935 } 936 } catch (SQLException se) { 937 throw new PersistenceDatabaseException(se); 938 } 939 940 pks.forEach((pk) -> { 941 session.removed(pk, true); 942 }); 943 } 944 } 945 946 @Override 947 public boolean validPK(ItemHarmonizedTariffScheduleCodeDetailPK pk) 948 throws PersistenceDatabaseException { 949 boolean valid = false; 950 PreparedStatement _ps = session.prepareStatement(SQL_VALID); 951 ResultSet _rs = null; 952 953 try { 954 _ps.setLong(1, pk.getEntityId()); 955 956 _rs = _ps.executeQuery(); 957 if(_rs.next()) { 958 long _count = _rs.getLong(1); 959 if(_rs.wasNull()) 960 _count = 0; 961 962 if(_count == 1) 963 valid = true; 964 } 965 } catch (SQLException se) { 966 throw new PersistenceDatabaseException(se); 967 } finally { 968 if(_rs != null) { 969 try { 970 _rs.close(); 971 } catch (SQLException se) { 972 // do nothing 973 } 974 } 975 } 976 977 return valid; 978 } 979 980}