/** {@inheritDoc} */ public ProductionRun getProductionRun(String workEffortId) throws RepositoryException, EntityNotFoundException { ProductionRun productionRun = findOneNotNull( ProductionRun.class, map(ProductionRun.Fields.workEffortId, workEffortId), "Production Run [" + workEffortId + "] not found."); // TODO: should this accept Production run tasks as well ? if (!"PROD_ORDER_HEADER".equals(productionRun.getWorkEffortTypeId())) { throw new EntityNotFoundException( ProductionRun.class, "Production Run [" + workEffortId + "] not found (a Work effort that is not a Production Run but of type " + productionRun.getWorkEffortTypeId() + " was found for the given ID)."); } return productionRun; }
/** {@inheritDoc} */ public BigDecimal getProductionRunCost(ProductionRun productionRun) throws RepositoryException { try { GetProductionRunCostService service = new GetProductionRunCostService(getUser()); service.setInWorkEffortId(productionRun.getWorkEffortId()); service.runSync(getInfrastructure()); if (service.isError()) { throw new RepositoryException(service.getErrorMessage()); } return service.getOutTotalCost(); } catch (ServiceException e) { throw new RepositoryException(e); } }