Package net.sf.pmr.struts.administration.core.form

Examples of net.sf.pmr.struts.administration.core.form.BasicProjectForm


    // get the basicProject service
    ProjectService projectService = CoreObjectFactory.getProjectService();

    // get the form
    BasicProjectForm basicProjectForm = (BasicProjectForm) form;

    // Save or update the BasicProject
    Errors errors = null;
    if (basicProjectForm.getPersistanceId() == 0) {
      // get the current user from the session
      User user = (User) request.getSession().getAttribute("user");
      // add
      errors = projectService.add(basicProjectForm.getCode(),
          basicProjectForm.getName(), user.getPersistanceId());
    } else {
      // update
      errors = projectService.update(basicProjectForm
          .getPersistanceId(), basicProjectForm.getCode(),
          basicProjectForm.getName(), basicProjectForm
              .getPersistanceVersion());
    }

    // Convert into struts action errors
    ActionMessages actionMessages = new ActionMessages();

    if (errors.hasErrors()) {

      for (Iterator iterator = errors.getAllErrorsMessageParameters()
          .iterator(); iterator.hasNext();) {

        MessageParameters messageParameters = (MessageParameters) iterator
            .next();

        actionMessages.add(ActionMessages.GLOBAL_MESSAGE,
            new ActionMessage(messageParameters.getErrorCode(),
                messageParameters.getErrorArguments()));

      }

      saveErrors(request, actionMessages);

    }

    // if (errors.hasErrors()) {
    //
    // for (Iterator iterator = errors.getAllErrorsMessageParameters()
    // .iterator(); iterator.hasNext();) {
    //
    // MessageParameters messageParameters = (MessageParameters) iterator
    //                        .next();
    //
    //                actionMessages.add(ActionMessages.GLOBAL_MESSAGE,
    //                        new ActionMessage(messageParameters.getErrorCode(),
    //                                messageParameters.getErrorArguments()));
    //
    //            }
    //
    //            saveErrors(request, actionMessages);
    //
    //        }

    // populate the summary
    Summary.populate(request);

    // forward
    if (actionMessages.isEmpty() == false) {

      // put the persistanceId in the request
      request.setAttribute("persistanceId", Integer
          .valueOf(basicProjectForm.getPersistanceId()));

      return mapping.findForward("basicProjectDetail");

    } else {
      return this.list(mapping, form, request, response);
View Full Code Here


    // if a basicProject is found
    if (project != null) {

      // populate the form
      BasicProjectForm basicProjectForm = (BasicProjectForm) form;
      basicProjectForm.setCode(project.getCode());
      basicProjectForm.setName(project.getName());
      basicProjectForm.setPersistanceId(project.getPersistanceId());
      basicProjectForm.setPersistanceVersion(project
          .getPersistanceVersion());

    }

    // populate the summary
View Full Code Here

TOP

Related Classes of net.sf.pmr.struts.administration.core.form.BasicProjectForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.