@Override
 public void undo() {
   if (this.replacedElements != null && tx().isRollingBack()) {
     OrderMap orderMap = tx().getOrderMap();
     orderMap.updateAll(tx(), this.replacedElements);
   }
 }
  @Override
  public void doCommand() {

    for (Order order : this.orders) {
      tx().lock(order);
    }

    OrderMap orderMap = tx().getOrderMap();
    for (Order order : this.orders) {
      if (!orderMap.hasElement(tx(), order.getType(), order.getId())) {
        String msg = "The Order {0} can not be updated as it does not exist!";
        msg = MessageFormat.format(msg, order.getLocator());
        throw new StrolchException(msg);
      }
    }

    this.replacedElements = orderMap.updateAll(tx(), this.orders);
  }