/** * Copyright © 2014 Instituto Superior Técnico * * This file is part of FenixEdu CMS. * * FenixEdu CMS is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * FenixEdu CMS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with FenixEdu CMS. If not, see <http://www.gnu.org/licenses/>. */ package org.fenixedu.cms.api.resource; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.fenixedu.bennu.core.domain.Bennu; import org.fenixedu.bennu.core.rest.BennuRestResource; import org.fenixedu.cms.api.json.FolderAdapter; import org.fenixedu.cms.domain.CMSFolder; @Path("/cms/folders") public class FolderResource extends BennuRestResource { //TODO: check permissions in all methods @GET @Produces(MediaType.APPLICATION_JSON) public String listAllFolders() { return view(Bennu.getInstance().getCmsFolderSet(), FolderAdapter.class); } @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{oid}") public String listFolder(@PathParam("oid") CMSFolder folder) { return view(folder, FolderAdapter.class); } }