}
@Override
protected void editOrder(FormEntrySession session, OrderTag oldOrderTag) {
OrderTag1_10 orderTag = (OrderTag1_10) oldOrderTag;
DrugOrder discontinuationOrder = null;
if (!existingOrder.getAction().equals(Action.DISCONTINUE)) {
//Discontinued orders must not be changed except for discontinue date and reason
DrugOrder revisedOrder = existingOrder.cloneForRevision();
setOrderer(session, revisedOrder);
revisedOrder.setDrug(orderTag.drug);
revisedOrder.setConcept(orderTag.drug.getConcept());
revisedOrder.setDosingType(orderTag.dosingType);
revisedOrder.setDose(orderTag.dose);
revisedOrder.setDoseUnits(orderTag.doseUnits);
revisedOrder.setQuantity(orderTag.quantity);
revisedOrder.setQuantityUnits(orderTag.quantityUnits);
revisedOrder.setDuration(orderTag.duration);
revisedOrder.setDurationUnits(orderTag.durationUnits);
revisedOrder.setRoute(orderTag.route);
revisedOrder.setCareSetting(Context.getOrderService().getCareSetting(orderTag.careSettingId));
OrderFrequency orderFrequency = Context.getOrderService().getOrderFrequency(Integer.valueOf(orderTag.frequency));
revisedOrder.setFrequency(orderFrequency);
revisedOrder.setDateActivated(orderTag.startDate);
revisedOrder.setNumRefills(orderTag.numRefills);
if (orderTag.orderDuration != null)
revisedOrder.setAutoExpireDate(calculateAutoExpireDate(orderTag.startDate, orderTag.orderDuration));
if (!StringUtils.isEmpty(orderTag.instructions))
revisedOrder.setInstructions((String) orderTag.instructions);
log.debug("modifying drug order, drugId is " + orderTag.drugId + " and startDate is " + orderTag.startDate);
session.getSubmissionActions().getCurrentEncounter().setDateChanged(new Date());
session.getSubmissionActions().getCurrentEncounter().addOrder(revisedOrder);