/** * <p>Additional check document for ready to account (make acc.entries).</p> * @param pAddParam additional param * @param pEntity entity * @param pRequestData Request Data * @throws Exception - an exception if don't **/ @Override public final void addCheckIsReadyToAccount( final Map<String, Object> pAddParam, final ManufacturingProcess pEntity, final IRequestData pRequestData) throws Exception { if (!pEntity.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "manufacturing_must_be_completed"); } } }
/** * <p>Check other fraud update e.g. prevent change completed unaccounted * manufacturing process.</p> * @param pAddParam additional param * @param pEntity entity * @param pOldEntity old saved entity * @throws Exception - an exception **/ @Override public final void checkOtherFraudUpdate(final Map<String, Object> pAddParam, final ManufacturingProcess pEntity, final ManufacturingProcess pOldEntity) throws Exception { if (pOldEntity.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_change_completed_manufacturing_process"); } }
/** * <p>Additional check document for ready to account (make acc.entries).</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void addCheckIsReadyToAccount( final Map<String, Object> pAddParam, final ManufacturingProcess pEntity) throws Exception { if (!pEntity.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "manufacturing_must_be_completed"); } }
/** * <p>Check other fraud update e.g. prevent change completed unaccounted * manufacturing process.</p> * @param pAddParam additional param * @param pEntity entity * @param pRequestData Request Data * @param pOldEntity old saved entity * @throws Exception - an exception **/ @Override public final void checkOtherFraudUpdate(final Map<String, Object> pAddParam, final ManufacturingProcess pEntity, final IRequestData pRequestData, final ManufacturingProcess pOldEntity) throws Exception { if (pOldEntity.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_change_completed_manufacturing_process"); } }
/** * <p>Delete entity from DB by given ID.</p> * @param pAddParam additional param * @param pId ID * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final Object pId) throws Exception { AdditionCostLine entity = getSrvOrm() .retrieveEntityById(AdditionCostLine.class, pId); if (entity.getItsOwner().getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "attempt_to_change_completed_manufacturing_process"); } getSrvOrm().deleteEntity(AdditionCostLine.class, entity.getItsId()); updateOwner(entity); }
+ ".ownerVersion")); pEntity.getItsOwner().setItsVersion(ownerVersion); if (pEntity.getItsOwner().getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "attempt_to_change_completed_manufacturing_process");
"attempt_to_change_accounted_document"); if (pEntity.getItsOwner().getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "attempt_to_change_completed_manufacturing_process");
/** * <p>Insert immutable line into DB.</p> * @param pAddParam additional param * @param pEntity entity * @param isEntityDetached ignored * @throws Exception - an exception **/ @Override public final void saveEntity(final Map<String, Object> pAddParam, final AdditionCostLine pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getItsTotal().doubleValue() == 0d) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "total_is_0"); } ManufacturingProcess itsOwner = getSrvOrm().retrieveEntityById( ManufacturingProcess.class, pEntity.getItsOwner().getItsId()); if (itsOwner.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "attempt_to_change_completed_manufacturing_process"); } pEntity.setItsOwner(itsOwner); if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity); } updateOwner(pEntity); }
/** * <p>Delete entity from DB.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final AdditionCostLine pEntity) throws Exception { if (pEntity.getItsOwner().getInvItem() == null) { ManufacturingProcess itsOwner = getSrvOrm().retrieveEntityById( ManufacturingProcess.class, pEntity.getItsOwner().getItsId()); pEntity.setItsOwner(itsOwner); } if (pEntity.getItsOwner().getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "attempt_to_change_completed_manufacturing_process"); } getSrvOrm().deleteEntity(AdditionCostLine.class, pEntity.getItsId()); updateOwner(pEntity); }
if (itsOwner.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_change_completed_manufacturing_process::"
+ ".ownerVersion")); pEntity.getItsOwner().setItsVersion(ownerVersion); if (pEntity.getItsOwner().getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_change_completed_manufacturing_process::"
if (pEntity.getIsComplete()) { //need to make warehouse entries if (pEntity.getItsCost().doubleValue() <= 0) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
if (pEntity.getIsComplete()) { //need to make warehouse entries if (pEntity.getItsCost().doubleValue() <= 0) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,