}
// состояние
if(!current.getStateRequest().equals(preUpdate.getStateRequest())) {
current.setStateDate(new Date()); // при изменении состояния обновляем дату состояния
HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
ResourceBundle.getBundle("property",
FacesContext.getCurrentInstance().getViewRoot().getLocale()).
getString("common.stateRequest"),
current.getStateRequest().getName());
em.persist(h);
}
// исполнитель. м.б. null
String curPerformer;
String prevPerformer;
if(current.getPerformer() != null) {
curPerformer = current.getPerformer().getName();
}
else {
curPerformer = "";
}
if(preUpdate.getPerformer() != null) {
prevPerformer = preUpdate.getPerformer().getName();
}
else {
prevPerformer = "";
}
if(!curPerformer.equals(prevPerformer)) {
HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
ResourceBundle.getBundle("property",
FacesContext.getCurrentInstance().getViewRoot().getLocale()).
getString("common.performer"),
curPerformer);
em.persist(h);
}
// объект обслуживания. м.б. null
String curServiceObject;
String prevServiceObject;
if(current.getServiceObject() != null) {
curServiceObject = current.getServiceObject().getName();
}
else {
curServiceObject = "";
}
if(preUpdate.getServiceObject() != null) {
prevServiceObject = preUpdate.getServiceObject().getName();
}
else {
prevServiceObject = "";
}
if(!curServiceObject.equals(prevServiceObject)) {
HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
ResourceBundle.getBundle("property",
FacesContext.getCurrentInstance().getViewRoot().getLocale()).
getString("common.serviceObject"),
curServiceObject);
em.persist(h);
}
// описание м.б. null
String curDescription;
String prevDescription;
if(current.getDescription() != null) {
curDescription = current.getDescription();
}
else {
curDescription = "";
}
if(preUpdate.getDescription() != null) {
prevDescription = preUpdate.getDescription();
}
else {
prevDescription = "";
}
if(!curDescription.equals(prevDescription)) {
HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
ResourceBundle.getBundle("property",
FacesContext.getCurrentInstance().getViewRoot().getLocale()).
getString("common.description"),
curDescription);
em.persist(h);
}
// приоритет
if(!current.getPriority().equals(preUpdate.getPriority())) {
HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
ResourceBundle.getBundle("property",
FacesContext.getCurrentInstance().getViewRoot().getLocale()).
getString("common.priority"),
current.getPriority().getName());
em.persist(h);