Search in sources :

Example 1 with QualityCorrectiveAction

use of com.axelor.apps.quality.db.QualityCorrectiveAction 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);
        }
    }
}
Also used : QualityCorrectiveAction(com.axelor.apps.quality.db.QualityCorrectiveAction) ControlPointModel(com.axelor.apps.quality.db.ControlPointModel) ControlPoint(com.axelor.apps.quality.db.ControlPoint) Transactional(com.google.inject.persist.Transactional)

Aggregations

ControlPoint (com.axelor.apps.quality.db.ControlPoint)1 ControlPointModel (com.axelor.apps.quality.db.ControlPointModel)1 QualityCorrectiveAction (com.axelor.apps.quality.db.QualityCorrectiveAction)1 Transactional (com.google.inject.persist.Transactional)1