Code example for Logger

Methods: info, x 1

0
	 * @param name the name of the Role to be retrieved 
	 * @return the specific role object 
	 * @throws RoleNotFoundException 
	 */ 
	public Role getRoleByName(String name) throws RoleNotFoundException{
		log.info("creating query");
		Query query = manager.createQuery("SELECT r FROM RoleImpl AS r WHERE r.name =:name");
		log.info("setting parameter name to " + name);
		query.setParameter("name", name);
		log.info("query.getsingleresult()");
		Role role = null;
		try { 
			log.info("In catch block to retrieve user");
			role = (Role)query.getSingleResult();
		} catch (NoResultException e) {
			// Catch the runtime exception and set user to null 
			log.info("Role doesn't exist so setting to null");
			role = null;
		} 
		log.info("testing for role == null");
		if( role == null ) throw new RoleNotFoundException();
		log.info("Role name = " + role.getName());
		return role;
	} 
 
	/** 
	 *