use of com.axelor.apps.quality.db.ControlPoint 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);
}
}
}
use of com.axelor.apps.quality.db.ControlPoint in project axelor-open-suite by axelor.
the class QualityControlServiceImpl method preFillOperationsFromOptionals.
@Override
@Transactional
public void preFillOperationsFromOptionals(QualityControl qualityControl, List<ControlPoint> optionalControlPointList) {
for (ControlPoint optionalControlPoint : optionalControlPointList) {
optionalControlPoint = Beans.get(ControlPointRepository.class).copy(optionalControlPoint, true);
optionalControlPoint.setOptionalQualityControl(null);
qualityControl.addControlPointListItem(optionalControlPoint);
}
Beans.get(QualityControlRepository.class).save(qualityControl);
}
use of com.axelor.apps.quality.db.ControlPoint in project axelor-open-suite by axelor.
the class QualityControlController method preFillOperationsFromOptionals.
@SuppressWarnings("unchecked")
public void preFillOperationsFromOptionals(ActionRequest request, ActionResponse response) {
Set<Map<String, Object>> optionalControlPoints = new HashSet<Map<String, Object>>();
List<ControlPoint> optionalControlPointList = new ArrayList<ControlPoint>();
Collection<Map<String, Object>> optionalControlPointSet = (Collection<Map<String, Object>>) request.getContext().get("optionalControlPointSet");
if (optionalControlPointSet != null) {
optionalControlPoints.addAll(optionalControlPointSet);
}
for (Map<String, Object> optionalControlPointData : optionalControlPoints) {
ControlPoint optionalControlPoint = Beans.get(ControlPointRepository.class).find(Long.parseLong(optionalControlPointData.get("id").toString()));
optionalControlPointList.add(optionalControlPoint);
}
LinkedHashMap<String, Object> qualityControlMap = (LinkedHashMap<String, Object>) request.getContext().get("_qualityControl");
QualityControl qualityControl = Beans.get(QualityControlRepository.class).find(((Integer) qualityControlMap.get("id")).longValue());
Beans.get(QualityControlService.class).preFillOperationsFromOptionals(qualityControl, optionalControlPointList);
response.setCanClose(true);
}
Aggregations