code: @GET
  	@Produces(MediaType.APPLICATION_JSON)
  	@Description("Return a list of charts owned by a user. Optionally, provide an entityId to filter charts associated "
  			+ "with a given entity. ")
  	public List<ChartDto> getCharts(@Context HttpServletRequest req, 
  			@QueryParam("ownerName") String ownerName,
  			@QueryParam("entityId") BigInteger entityId) {
  		
  		PrincipalUser remoteUser = getRemoteUser(req);
  		PrincipalUser owner;
  		owner = validateAndGetOwner(req,ownerName);
  		List<Chart> result = new ArrayList<>();
  		if(entityId == null) {
  			result.addAll(_chartService.getChartsByOwner(owner));
  		} else {
  		    Dashboard dashboard = _dService.findDashboardByPrimaryKey(entityId);
  		    if(dashboard==null)
              {
                  throw new WebApplicationException(entityId + ": Dashboard does not exist.", Status.NOT_FOUND);
              }
  		    else if(dashboard.isShared() || remoteUser.isPrivileged())
              {
                  result.addAll(_chartService.getChartsForEntity(entityId));
              }
              else {
                  result.addAll(_chartService.getChartsByOwnerForEntity(owner, entityId));
              }
  		}
  
  		return ChartDto.transformToDto(result);
  	}
docs: Return a list of charts owned by a user. Optionally, provide an entityId to filter charts associated
  with a given entity.
  
  @param   req      	The HttpServlet request object. Cannot be null.
  @param   ownerName  	Optional. The username for which to retrieve charts. For non-privileged this must be null
  or equal to the logged in user.
  @param   entityId  	Optional. The entity id associated with these charts.
  
  @return  A list of charts filtered using the provided parameters.
  
  @throws  WebApplicationException  An exception with 404 NOT_FOUND will be thrown if the user does not exist.