/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Promotion> promotions = getPromotions(); if (promotions != null) { for (Promotion promotion : promotions) { promotion.getCoupons().remove(this); } } List<Order> orders = getOrders(); if (orders != null) { for (Order order : orders) { order.getCoupons().remove(this); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<PaymentMethod> paymentMethods = getPaymentMethods(); if (paymentMethods != null) { for (PaymentMethod paymentMethod : paymentMethods) { paymentMethod.getShippingMethods().remove(this); } } Set<Order> orders = getOrders(); if (orders != null) { for (Order order : orders) { order.setShippingMethod(null); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Article> articles = getArticles(); if (articles != null) { for (Article article : articles) { article.getTags().remove(this); } } Set<Product> products = getProducts(); if (products != null) { for (Product product : products) { product.getTags().remove(this); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Member> favoriteMembers = getFavoriteMembers(); if (favoriteMembers != null) { for (Member favoriteMember : favoriteMembers) { favoriteMember.getFavoriteProducts().remove(this); } } Set<Promotion> promotions = getPromotions(); if (promotions != null) { for (Promotion promotion : promotions) { promotion.getProducts().remove(this); } } Set<OrderItem> orderItems = getOrderItems(); if (orderItems != null) { for (OrderItem orderItem : orderItems) { orderItem.setProduct(null); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Product> products = getProducts(); if (products != null) { for (Product product : products) { product.setBrand(null); } } Set<ProductCategory> productCategories = getProductCategories(); if (productCategories != null) { for (ProductCategory productCategory : productCategories) { productCategory.getBrands().remove(this); } } Set<Promotion> promotions = getPromotions(); if (promotions != null) { for (Promotion promotion : promotions) { promotion.getBrands().remove(this); } } }
@PreRemove public void preRemove() { if (getCertificates() != null) { // Dates are converted to UTC before saving into the DB Calendar cal = Calendar.getInstance(); long offset = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); Date now = new Date(cal.getTimeInMillis() - offset); for (Certificate cert : getCertificates()) { // Revoke certificates cert.setRevokedAt(now); cert.setRevokeReason("cessationofoperation"); cert.setRevoked(true); // Detach certificate from entity - since the model type isn't known, just blank all. cert.setOrganization(null); cert.setDevice(null); cert.setService(null); cert.setUser(null); cert.setVessel(null); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { // Set<User> favoriteUsers = getFavoriteUsers(); // if (favoriteUsers != null) { // for (User favoriteMember : favoriteUsers) { // favoriteMember.getFavoriteProducts().remove(this); // } // } Set<Promotion> promotions = getPromotions(); if (promotions != null) { for (Promotion promotion : promotions) { promotion.getProducts().remove(this); } } Set<OrderItem> orderItems = getOrderItems(); if (orderItems != null) { for (OrderItem orderItem : orderItems) { orderItem.setProduct(null); } } }
@PreRemove public void preRemove() { for (TmContactEasy arg0 : getTmContactEasies()) { arg0.setReqServHotel(null); } docDocumentsByDocumentForUserId = null; docDocumentsByDocumentForHotelId = null; paymentPrice = null; paymentTariff = null; servHotel = null; servHotelRoom = null; usersByRequestUserId = null; usersByResponseUserId = null; }
@PreRemove public void preRemove() { for (ServTransferRoute arg0 : getServTransferRoutes()) { arg0.setServTransfer(null); } currCurrency = null; dictGlobalByPaymentTypeId = null; dictGlobalByTypeTransferId = null; dictGlobalByTransportId = null; locationCities = null; locationCountries = null; tmAccount = null; }
/** * Delete orders and order items. */ @PreRemove private void deleteOrders() { EntityManager em = OrderRepository.REPOSITORY.getEMF().createEntityManager(); try { em.getTransaction().begin(); em.createQuery("DELETE FROM PersistenceOrderItem oi WHERE oi.order = :order") .setParameter("order", this).executeUpdate(); em.getTransaction().commit(); } finally { em.close(); } }
/** * Delete orders and order items. */ @PreRemove private void deleteOrders() { EntityManager em = UserRepository.REPOSITORY.getEMF().createEntityManager(); try { em.getTransaction().begin(); em.createQuery("DELETE FROM PersistenceOrderItem oi WHERE oi.order.user = :user") .setParameter("user", this).executeUpdate(); em.createQuery("DELETE FROM PersistenceOrder o WHERE o.user = :user") .setParameter("user", this).executeUpdate(); em.getTransaction().commit(); } finally { em.close(); } }
private void processDefaultJpaCallbacks(String instanceCallbackClassName, List<JpaCallbackClass> jpaCallbackClassList) { ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName ); // Process superclass first if available and not excluded if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) { DotName superName = callbackClassInfo.superName(); if ( superName != null ) { processDefaultJpaCallbacks( instanceCallbackClassName, jpaCallbackClassList ); } } String callbackClassName = callbackClassInfo.name().toString(); Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>(); createDefaultCallback( PrePersist.class, PseudoJpaDotNames.DEFAULT_PRE_PERSIST, callbackClassName, callbacksByType ); createDefaultCallback( PreRemove.class, PseudoJpaDotNames.DEFAULT_PRE_REMOVE, callbackClassName, callbacksByType ); createDefaultCallback( PreUpdate.class, PseudoJpaDotNames.DEFAULT_PRE_UPDATE, callbackClassName, callbacksByType ); createDefaultCallback( PostLoad.class, PseudoJpaDotNames.DEFAULT_POST_LOAD, callbackClassName, callbacksByType ); createDefaultCallback( PostPersist.class, PseudoJpaDotNames.DEFAULT_POST_PERSIST, callbackClassName, callbacksByType ); createDefaultCallback( PostRemove.class, PseudoJpaDotNames.DEFAULT_POST_REMOVE, callbackClassName, callbacksByType ); createDefaultCallback( PostUpdate.class, PseudoJpaDotNames.DEFAULT_POST_UPDATE, callbackClassName, callbacksByType ); if ( !callbacksByType.isEmpty() ) { jpaCallbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, true ) ); } }
private void processJpaCallbacks(String instanceCallbackClassName, boolean isListener, List<JpaCallbackClass> callbackClassList) { ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName ); // Process superclass first if available and not excluded if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) { DotName superName = callbackClassInfo.superName(); if ( superName != null ) { processJpaCallbacks( instanceCallbackClassName, isListener, callbackClassList ); } } Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>(); createCallback( PrePersist.class, JPADotNames.PRE_PERSIST, callbacksByType, callbackClassInfo, isListener ); createCallback( PreRemove.class, JPADotNames.PRE_REMOVE, callbacksByType, callbackClassInfo, isListener ); createCallback( PreUpdate.class, JPADotNames.PRE_UPDATE, callbacksByType, callbackClassInfo, isListener ); createCallback( PostLoad.class, JPADotNames.POST_LOAD, callbacksByType, callbackClassInfo, isListener ); createCallback( PostPersist.class, JPADotNames.POST_PERSIST, callbacksByType, callbackClassInfo, isListener ); createCallback( PostRemove.class, JPADotNames.POST_REMOVE, callbacksByType, callbackClassInfo, isListener ); createCallback( PostUpdate.class, JPADotNames.POST_UPDATE, callbacksByType, callbackClassInfo, isListener ); if ( !callbacksByType.isEmpty() ) { callbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, isListener ) ); } }
@PreRemove void onPreRemove(Object o) { String txId = (String)ThreadLocalContext.get(CompositeTransactionParticipantService.CURRENT_TRANSACTION_KEY); if (null == txId){ LOG.info("onPreRemove outside any transaction"); } else { LOG.info("onPreRemove inside transaction [{}]", txId); enlist(o, EntityCommand.Action.DELETE, txId); } }
/** * 删除前处理 */ @PreRemove public void preRemove() { if (getDeposit() != null) { getDeposit().setPayment(null); } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Deposit> deposits = getDeposits(); if (deposits != null) { for (Deposit deposit : deposits) { deposit.setOrder(null); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Promotion> promotions = getPromotions(); if (promotions != null) { for (Promotion promotion : promotions) { promotion.getProductCategories().remove(this); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Order> orders = getOrders(); if (orders != null) { for (Order order : orders) { order.setPaymentMethod(null); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Order> orders = getOrders(); if (orders != null) { for (Order order : orders) { order.setLockExpire(null); order.setOperator(null); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Promotion> promotions = getPromotions(); if (promotions != null) { for (Promotion promotion : promotions) { promotion.getMemberRanks().remove(this); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Member> members = getMembers(); if (members != null) { for (Member member : members) { member.setArea(null); } } Set<Receiver> receivers = getReceivers(); if (receivers != null) { for (Receiver receiver : receivers) { receiver.setArea(null); } } Set<Order> orders = getOrders(); if (orders != null) { for (Order order : orders) { order.setArea(null); } } Set<DeliveryCenter> deliveryCenters = getDeliveryCenters(); if (deliveryCenters != null) { for (DeliveryCenter deliveryCenter : deliveryCenters) { deliveryCenter.setArea(null); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<ShippingMethod> shippingMethods = getShippingMethods(); if (shippingMethods != null) { for (ShippingMethod shippingMethod : shippingMethods) { shippingMethod.setDefaultDeliveryCorp(null); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { if (getOrder() != null) { getOrder().setCouponCode(null); } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Article> articles = getArticles(); if (articles != null) { for (Article article : articles) { article.getTags().remove(this); } } }
/** * 删除前处理 */ @PreRemove public void preRemove() { Set<Product> products = getProducts(); if (products != null) { for (Product product : products) { product.getTags().remove(this); } } }
@PreRemove public void preRemove() { for (ReqServHotel arg0 : getReqServHotels()) { arg0.setServHotelRoom(null); } dictGlobal = null; paymentTariffByCostTarriffId = null; paymentTariffByRrTarriffId = null; paymentTariffShop = null; servHotel = null; }
/** * Before a finishedTask is removed from the dataBase it should have to be removed from the player's * list of finished tasks. */ @PreRemove private void removeFTaskFromPlayer() { if(player!=null){ player.removeFinishedTask(this); } }
@PreRemove private void removeOutputFromParents() { for (Formula f : parents) { f.getOutputs().remove(this); } }
@PreRemove private void removeFormulaFromOutputs() { for (CanonicOutput co : outputs) { co.getParents().remove(this); } }