Java 类javax.persistence.PreRemove 实例源码

项目:my-paper    文件:Coupon.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:my-paper    文件:ShippingMethod.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:my-paper    文件:Tag.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:my-paper    文件:Product.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:my-paper    文件:Brand.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:IdentityRegistry    文件:CertificateModel.java   
@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);
        }
    }
}
项目:java-platform    文件:Product.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:java-platform    文件:Brand.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:java-platform    文件:ShippingMethod.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:java-platform    文件:Coupon.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:hotel_shop    文件:ReqServHotel.java   
@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;

}
项目:hotel_shop    文件:ServTransfer.java   
@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;

}
项目:Pet-Supply-Store    文件:PersistenceOrder.java   
/**
 * 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();
    }
}
项目:Pet-Supply-Store    文件:PersistenceUser.java   
/**
 * 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();
    }
}
项目:lams    文件:EntityClass.java   
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 ) );
    }
}
项目:lams    文件:EntityClass.java   
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 ) );
        }
    }
项目:microservices-transactions-tcc    文件:ChangeStateJpaListener.java   
@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);
    }
}
项目:my-paper    文件:Payment.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    if (getDeposit() != null) {
        getDeposit().setPayment(null);
    }
}
项目:my-paper    文件:Order.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Deposit> deposits = getDeposits();
    if (deposits != null) {
        for (Deposit deposit : deposits) {
            deposit.setOrder(null);
        }
    }
}
项目:my-paper    文件:ProductCategory.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Promotion> promotions = getPromotions();
    if (promotions != null) {
        for (Promotion promotion : promotions) {
            promotion.getProductCategories().remove(this);
        }
    }
}
项目:my-paper    文件:PaymentMethod.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Order> orders = getOrders();
    if (orders != null) {
        for (Order order : orders) {
            order.setPaymentMethod(null);
        }
    }
}
项目:my-paper    文件:Admin.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Order> orders = getOrders();
    if (orders != null) {
        for (Order order : orders) {
            order.setLockExpire(null);
            order.setOperator(null);
        }
    }
}
项目:my-paper    文件:MemberRank.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Promotion> promotions = getPromotions();
    if (promotions != null) {
        for (Promotion promotion : promotions) {
            promotion.getMemberRanks().remove(this);
        }
    }
}
项目:my-paper    文件:Area.java   
/**
 * 删除前处理
 */
@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);
        }
    }
}
项目:my-paper    文件:DeliveryCorp.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<ShippingMethod> shippingMethods = getShippingMethods();
    if (shippingMethods != null) {
        for (ShippingMethod shippingMethod : shippingMethods) {
            shippingMethod.setDefaultDeliveryCorp(null);
        }
    }
}
项目:my-paper    文件:CouponCode.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    if (getOrder() != null) {
        getOrder().setCouponCode(null);
    }
}
项目:java-platform    文件:ArticleTag.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Article> articles = getArticles();
    if (articles != null) {
        for (Article article : articles) {
            article.getTags().remove(this);
        }
    }
}
项目:java-platform    文件:ProductCategory.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Promotion> promotions = getPromotions();
    if (promotions != null) {
        for (Promotion promotion : promotions) {
            promotion.getProductCategories().remove(this);
        }
    }
}
项目:java-platform    文件:ProductTag.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Product> products = getProducts();
    if (products != null) {
        for (Product product : products) {
            product.getTags().remove(this);
        }
    }
}
项目:java-platform    文件:Payment.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    if (getDeposit() != null) {
        getDeposit().setPayment(null);
    }
}
项目:java-platform    文件:Order.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Deposit> deposits = getDeposits();
    if (deposits != null) {
        for (Deposit deposit : deposits) {
            deposit.setOrder(null);
        }
    }
}
项目:java-platform    文件:PaymentMethod.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Order> orders = getOrders();
    if (orders != null) {
        for (Order order : orders) {
            order.setPaymentMethod(null);
        }
    }
}
项目:java-platform    文件:DeliveryCorp.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<ShippingMethod> shippingMethods = getShippingMethods();
    if (shippingMethods != null) {
        for (ShippingMethod shippingMethod : shippingMethods) {
            shippingMethod.setDefaultDeliveryCorp(null);
        }
    }
}
项目:java-platform    文件:Rank.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    Set<Promotion> promotions = getPromotions();
    if (promotions != null) {
        for (Promotion promotion : promotions) {
            promotion.getMemberRanks().remove(this);
        }
    }
}
项目:java-platform    文件:CouponCode.java   
/**
 * 删除前处理
 */
@PreRemove
public void preRemove() {
    if (getOrder() != null) {
        getOrder().setCouponCode(null);
    }
}
项目:hotel_shop    文件:ServHotelRoom.java   
@PreRemove
public void preRemove() {
    for (ReqServHotel arg0 : getReqServHotels()) {
        arg0.setServHotelRoom(null);
    }



    dictGlobal = null;
    paymentTariffByCostTarriffId = null;
    paymentTariffByRrTarriffId = null;
    paymentTariffShop = null;
    servHotel = null;

}
项目:GamificationEngine-Kinben    文件:FinishedTask.java   
/**
* 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);
    }
  }
项目:MathMLCanEval    文件:CanonicOutput.java   
@PreRemove
private void removeOutputFromParents()
{
    for (Formula f : parents)
    {
        f.getOutputs().remove(this);
    }
}
项目:MathMLCanEval    文件:Formula.java   
@PreRemove
private void removeFormulaFromOutputs()
{
    for (CanonicOutput co : outputs)
    {
        co.getParents().remove(this);
    }
}