if (hasValidationError) {
return;
}
HTextFlowTarget hTarget =
textFlowTargetDAO.getOrCreateTarget(originalTf,
matchingTarget.getLocale());
ContentState prevState =
hTarget.getId() == null ? ContentState.New : hTarget.getState();
if (shouldOverwrite(hTarget, copyState)) {
// NB we don't touch creationDate
hTarget.setTextFlowRevision(originalTf.getRevision());
hTarget.setLastChanged(matchingTarget.getLastChanged());
hTarget.setLastModifiedBy(matchingTarget.getLastModifiedBy());
hTarget.setTranslator(matchingTarget.getTranslator());
// TODO rhbz953734 - will need a new copyTran option for
// review state
if (copyState == ContentState.Approved) {
hTarget.setReviewer(matchingTarget.getReviewer());
}
hTarget.setContents(matchingTarget.getContents());
hTarget.setState(copyState);
HSimpleComment hcomment = hTarget.getComment();
if (hcomment == null) {
hcomment = new HSimpleComment();
hTarget.setComment(hcomment);
}
hcomment.setComment(createComment(matchingTarget));
// TODO Maybe we should think about registering a Hibernate
// integrator for these updates