use of eu.ggnet.dwoss.stock.ee.emo.EquilibrationResult in project dwoss by gg-net.
the class RedTapeWorkflow method equilibrateOrRemoveLogicTransaction.
/**
* Equilibrates the LogicTransaction to the Document and added History to all UniqueUnits.
* <p>
* @param document
* @param remove if true everything is removed.
* @return
*/
protected void equilibrateOrRemoveLogicTransaction(Document document, boolean remove) {
LogicTransactionEmo ltEmo = new LogicTransactionEmo(stockEm);
EquilibrationResult equilibrate = ltEmo.equilibrate(document.getDossier().getId(), remove ? new ArrayList<>() : document.getPositionsUniqueUnitIds());
if (equilibrate == null)
return;
L.debug("Equilibrated Stock LogicTransaction: {}", equilibrate);
for (Integer uuid : equilibrate.getAdded()) {
uniqueUnitEm.find(UniqueUnit.class, uuid).addHistory("Added to Dossier " + document.getDossier().getIdentifier() + " of Customer " + document.getDossier().getCustomerId() + " by " + arranger);
}
for (Integer uuid : equilibrate.getRemoved()) {
uniqueUnitEm.find(UniqueUnit.class, uuid).addHistory("Removed from Dossier " + document.getDossier().getIdentifier() + " of Customer " + document.getDossier().getCustomerId() + " by " + arranger);
}
}
Aggregations