}
@Override
public HDocument copyDocument(HProjectIteration newVersion,
HDocument document) throws Exception {
HDocument copy =
JPACopier.<HDocument> copyBean(document, "projectIteration",
"poHeader", "poTargetHeaders", "rawDocument",
"textFlows", "allTextFlows");
copy.setProjectIteration(newVersion);
if (document.getPoHeader() != null) {
HPoHeader poHeader =
JPACopier.<HPoHeader> copyBean(document.getPoHeader());
copy.setPoHeader(poHeader);
}
for (Map.Entry<HLocale, HPoTargetHeader> entry : document
.getPoTargetHeaders().entrySet()) {
HPoTargetHeader poTargetHeader =
JPACopier.<HPoTargetHeader> copyBean(entry.getValue(),
"document");
poTargetHeader.setDocument(copy);
copy.getPoTargetHeaders().put(entry.getKey(), poTargetHeader);
}
return copy;
}