コード例 #1
0
  @Override
  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  public Boolean remove(Long id) throws IabakoActionForbiddenException {

    saleDAO.deleteAttachedObjects(id);

    Sale sale = saleDAO.findById(id);
    if (sale == null) {
      log.warn("No sale found with id :" + id);
      return false;
    }

    stockRollBack(sale);

    Client client = sale.getClient();

    boolean result = super.remove(id);

    if (client != null) {
      clientService.calculateStatus(client);
    }

    trackingService.addTrackingToUserSession(TrackingType.saleDelete, sale);

    return result;
  }
コード例 #2
0
 @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
 public Sale calculateStatusAndSave(Sale sale, boolean isDraft) {
   sale.calculateStatus(isDraft);
   sale = (Sale) super.save(sale);
   if (!isDraft) {
     clientService.calculateStatus(sale.getClient());
   }
   return sale;
 }
コード例 #3
0
  /**
   * Process the specified HTTP request, and create the corresponding HTTP response (or forward to
   * another web component that will create it). Return an <code>ActionForward</code> instance
   * describing where and how control should be forwarded, or <code>null</code> if the response has
   * already been completed.
   *
   * @param mapping The ActionMapping used to select this instance
   * @param form The optional ActionForm bean for this request (if any)
   * @param request The HTTP request we are processing
   * @param response The HTTP response we are creating
   * @exception Exception if business logic throws an exception
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    // Extract attributes we will need
    MessageResources messages = getResources(request);

    // save errors
    ActionMessages errors = new ActionMessages();

    // START check for login (security)
    if (!SecurityService.getInstance().checkForLogin(request.getSession(false))) {
      return (mapping.findForward("welcome"));
    }
    // END check for login (security)

    // values for adding the related contact
    DynaValidatorForm qae2 = (DynaValidatorForm) form;

    // from wizard add clientContact
    String contactId = (String) request.getAttribute("clientContactViewId");
    if (contactId == null) {
      contactId = (String) (qae2.get("contact"));
    }

    // need the project and contact to build the link between contact and project
    String projectId = StandardCode.getInstance().getCookie("projectAddId", request.getCookies());
    Project p = ProjectService.getInstance().getSingleProject(Integer.valueOf(projectId));

    ClientContact cc =
        ClientService.getInstance().getSingleClientContact(Integer.valueOf(contactId));

    // insert into db, building link between contact and project
    ProjectService.getInstance().linkProjectClientContact(p, cc);

    // Forward control to the specified success URI
    return (mapping.findForward("Success"));
  }