/** * Rest-Call for {@link TeamCalDao#getList(org.projectforge.core.BaseSearchFilter)} */ @GET @Path(RestPaths.LIST) @Produces(MediaType.APPLICATION_JSON) public Response getList(@QueryParam("fullAccess") final boolean fullAccess) { final TeamCalFilter filter = new TeamCalFilter(); if (fullAccess == true) { filter.setFullAccess(true); filter.setMinimalAccess(false); filter.setReadonlyAccess(false); } final List<TeamCalDO> list = teamCalDao.getList(filter); Integer[] teamCalBlackListIds = userXmlPreferencesDao .getDeserializedUserPreferencesByUserId(ThreadLocalUserContext.getUserId(), TeamCalDO.TEAMCALRESTBLACKLIST, Integer[].class); if(teamCalBlackListIds != null && teamCalBlackListIds.length > 0) { Arrays.stream(teamCalBlackListIds).forEach(calId -> list.remove(teamCalDao.getById(calId))); } final List<CalendarObject> result = new LinkedList<CalendarObject>(); if (list != null && list.size() > 0) { for (final TeamCalDO cal : list) { result.add(TeamCalDOConverter.getCalendarObject(cal, userRights)); } } final String json = JsonUtils.toJson(result); return Response.ok(json).build(); }
/** * Gets a list of all calendars with full access of the current logged-in user as well as the calendars owned by the * current logged-in user. * * @return */ public List<TeamCalDO> getAllCalendarsWithFullAccess() { final TeamCalFilter filter = new TeamCalFilter(); filter.setOwnerType(OwnerType.ALL); filter.setFullAccess(true).setReadonlyAccess(false).setMinimalAccess(false); return getList(filter); }