use of com.axelor.apps.quality.db.ControlPointModel in project axelor-open-suite by axelor.
the class QualityControlServiceImpl method preFillOperations.
/**
* Copy control point model to control point and set it to the quality control.
*
* @param qualityControl Set control point model to control point of this object.
* @throws AxelorException
*/
@Override
@Transactional(rollbackOn = { Exception.class })
public void preFillOperations(QualityControl qualityControl, QualityProcess process) throws AxelorException {
List<ControlPointModel> controlPointModelList = process.getControlPointModelList();
List<ControlPointModel> optionalControlPointModelList = process.getOptionalControlPointModelList();
List<QualityCorrectiveAction> qualityCorrectiveActionList = process.getQualityCorrectiveActionList();
if (controlPointModelList != null) {
qualityControl.getControlPointList().clear();
for (ControlPointModel model : controlPointModelList) {
ControlPoint point = new ControlPoint();
this.createControlPointListItem(model, point, qualityControl);
qualityControl.addControlPointListItem(point);
}
}
if (optionalControlPointModelList != null) {
qualityControl.getOptionalControlPointList().clear();
for (ControlPointModel model : optionalControlPointModelList) {
ControlPoint point = new ControlPoint();
this.createControlPointListItem(model, point, qualityControl);
qualityControl.addOptionalControlPointListItem(point);
}
}
if (qualityCorrectiveActionList != null) {
qualityControl.getQualityCorrectiveActionList().clear();
for (QualityCorrectiveAction qualityCorrectiveAction : qualityCorrectiveActionList) {
qualityCorrectiveAction = Beans.get(QualityCorrectiveActionRepository.class).copy(qualityCorrectiveAction, true);
qualityControl.addQualityCorrectiveActionListItem(qualityCorrectiveAction);
}
}
}
Aggregations