Coverage report

  %line %branch
org.demosys.web.user.action.SelectUserAction
100% 
100% 

 1  
 /*
 2  
  * Demosys.
 3  
  *
 4  
  * Terms of license - http://opensource.org/licenses/apachepl.php
 5  
  */
 6  
 package org.demosys.web.user.action;
 7  
 import java.lang.reflect.InvocationTargetException;
 8  
 import javax.servlet.http.HttpServletRequest;
 9  
 import javax.servlet.http.HttpServletResponse;
 10  
 import org.apache.commons.beanutils.BeanUtils;
 11  
 import org.apache.commons.lang.StringUtils;
 12  
 import org.apache.struts.action.*;
 13  
 import org.demosys.web.ServiceLocator;
 14  
 import org.demosys.web.user.InvalidUserException;
 15  
 import org.demosys.web.user.UnknownUserException;
 16  
 import org.demosys.web.user.UserService;
 17  
 import org.demosys.web.user.UserView;
 18  
 /**
 19  
  * Select a specific user to Edit the record.
 20  
  */
 21  8
 public class SelectUserAction extends Action {
 22  
     public ActionForward execute(ActionMapping mapping, ActionForm objForm,
 23  
         HttpServletRequest request, HttpServletResponse res)
 24  
         throws IllegalAccessException, InvocationTargetException {
 25  
         // Get user id from request parameter
 26  8
         String id = request.getParameter("id");
 27  
 
 28  
         try {
 29  8
             UserService userService = ServiceLocator.getServiceLocator().getUserService();
 30  8
             UserView user = userService.getUser(id);
 31  4
             BeanUtils.copyProperties(objForm, user);
 32  4
             return mapping.findForward("success");
 33  
         }
 34  
         catch (UnknownUserException e) {
 35  4
             ActionErrors errors = new ActionErrors();
 36  4
             errors.add("id", new ActionError("user.edit.unknown.user"));
 37  4
             saveErrors(request, errors);
 38  4
             return mapping.findForward("failure");
 39  
         }
 40  
     }
 41  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.