/**
* Setter artikkeltpath.
*/
public static void changeOrderLineAttributes() {
OrderManager orderManager = (OrderManager) ModelUtil
.getBean("orderManager");
OrderLineManager orderLineManager = (OrderLineManager) ModelUtil
.getBean("orderLineManager");
List<Order> orders = orderManager.findAll();
Set<OrderLine> orderLines;
Set<OrderLineAttribute> orderLineAttributes;
for (Order order : orders) {
orderManager.lazyLoadOrder(order,
new LazyLoadOrderEnum[] {LazyLoadOrderEnum.ORDER_LINES});
orderLines = order.getOrderLines();
for (OrderLine orderLine : orderLines) {
orderLineManager
.lazyLoad(
orderLine,
new LazyLoadOrderLineEnum[] {LazyLoadOrderLineEnum.ORDER_LINE_ATTRIBUTE});
if (orderLine.getArticlePath() == null) {
String path = orderLine.getGeneratedArticlePath();
orderLine.setArticlePath(path);
}
orderLineAttributes = orderLine.getOrderLineAttributes();
for (OrderLineAttribute attribute : orderLineAttributes) {
if (attribute.getOrderLineAttributeName() == null) {
attribute.setOrderLineAttributeName(attribute
.getAttributeName());
}
}
}
try {
orderManager.saveOrder(order);
} catch (ProTransException e) {
e.printStackTrace();
}
}