package memento;
public class OrderForm {
private int clientID;
private int productID;
private OrderState state;
/**
* Класс Memento применительно к данной
* сущности OrderForm
*/
private class OrderState {
private int productID;
public OrderState
(String comment,
int productID
) { super();
this.comment = comment;
this.productID = productID;
}
return comment;
}
public int getProductID() {
return productID;
}
}
public OrderForm
(int clientID,
int productID,
String clientComment,
Date orderDate
) { super();
this.clientID = clientID;
this.productID = productID;
this.clientComment = clientComment;
this.orderDate = orderDate;
}
public void UpdateOrder
(String comment,
int prodID
) { state = new OrderState(clientComment, productID);
/* Изменения >> */
setClientComment(comment);
setProductID(prodID);
}
/**
* Восстанавливаем величины
*/
public void RollbackChanges() {
setClientComment(state.getComment());
setProductID(state.getProductID());
}
/* Getters / Setters >> */
public String getClientComment
() { return clientComment;
}
public void setClientComment
(String clientComment
) { this.clientComment = clientComment;
}
public int getProductID() {
return productID;
}
public void setProductID(int productID) {
this.productID = productID;
}
public int getClientID() {
return clientID;
}
public Date getOrderDate
() { return orderDate;
}
}