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