public BillingProcessDTOEx getReviewDTO(Integer entityId, Integer languageId) { billingProcess = billingProcessDas.findReview(entityId); if (billingProcess == null) { System.out.println("Don't found the billingProcess"); return null; } else { System.out.println("found the billingProcess"); } return getDtoEx(languageId); }
public void purgeReview(Integer entityId, boolean isReview) { BillingProcessDTO review = billingProcessDas.findReview(entityId); if (review == null) { // no review, nothing to delete then return; } // if we are here, a review exists ConfigurationBL configBL = new ConfigurationBL(entityId); if (configBL.getEntity().getGenerateReport().intValue() == 1 && !new Integer(configBL.getEntity().getReviewStatus()) .equals(Constants.REVIEW_STATUS_APPROVED) && !isReview) { eLogger.warning( entityId, null, configBL.getEntity().getId(), EventLogger.MODULE_BILLING_PROCESS, EventLogger.BILLING_REVIEW_NOT_APPROVED, Constants.TABLE_BILLING_PROCESS_CONFIGURATION); } // delete the review LOG.debug("Removing review id = " + review.getId() + " from " + " entity " + entityId); // this is needed while the order process is JPA, but the billing process is Entity OrderProcessDAS processDas = new OrderProcessDAS(); com.sapienter.jbilling.server.process.db.BillingProcessDTO processDto = new BillingProcessDAS().find(review.getId()); for (OrderProcessDTO orderDto : processDto.getOrderProcesses()) { processDas.delete(orderDto); } processDto.getOrderProcesses().clear(); // delete processRunUsers otherwise will be constraint violation for (ProcessRunDTO processRun : review.getProcessRuns()) { new ProcessRunUserDAS().removeProcessRunUsersForProcessRun(processRun.getId()); } // otherwise this line would cascade de delete getHome().delete(review); }
public boolean isReviewPresent(Integer entityId) { return billingProcessDas.findReview(entityId) != null; }