Package no.ugland.utransprod

Source Code of no.ugland.utransprod.SetOrderLineHasArticle

package no.ugland.utransprod;

import java.util.Set;

import no.ugland.utransprod.model.Order;
import no.ugland.utransprod.model.OrderLine;
import no.ugland.utransprod.service.OrderLineManager;
import no.ugland.utransprod.service.OrderManager;
import no.ugland.utransprod.service.enums.LazyLoadOrderEnum;
import no.ugland.utransprod.util.ModelUtil;

/**
* Hjelpeklasse som ble brukt til � sette om ordrelinje hadde artikkel
* @author atle.brekka
*
*/
public class SetOrderLineHasArticle {
  /**
   * Setter om ordrelinje har artikkel
   */
  public static void setOrderLinehasArticle(){
    OrderManager orderManager =(OrderManager)ModelUtil.getBean("orderManager");
    OrderLineManager orderLineManager =(OrderLineManager)ModelUtil.getBean("orderLineManager");
    Set<Order> orders=orderManager.findNotSent();
    Set<OrderLine> orderLines;
    for(Order order:orders){
      orderManager.lazyLoadOrder(order, new LazyLoadOrderEnum[]{LazyLoadOrderEnum.ORDER_LINES,LazyLoadOrderEnum.ORDER_LINE_ORDER_LINES});
      orderLines = order.getOrderLines();
      for(OrderLine orderLine: orderLines){
        //orderLineManager.lazyLoad(orderLine, new LazyLoadOrderLineEnum[]{LazyLoadOrderLineEnum.ORDER_LINE_ATTRIBUTE});
        orderLine.hasArticle();
        orderLineManager.saveOrderLine(orderLine);
      }
    }
  }

  /**
   * @param args
   */
  public static void main(String[] args) {
    SetOrderLineHasArticle.setOrderLinehasArticle();
    System.exit(0);

  }

}
TOP

Related Classes of no.ugland.utransprod.SetOrderLineHasArticle

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.