com.formkiq.server.controller.admin.UserFoldersController Maven / Gradle / Ivy
/*
* Copyright (C) 2016 FormKiQ Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.formkiq.server.controller.admin;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.formkiq.server.domain.type.FormDTO;
import com.formkiq.server.service.FolderService;
import com.formkiq.server.service.SpringSecurityService;
/**
* Admin Users Folder Controller.
*
*/
@Controller
@RequestMapping(value = "/admin/users/folders")
public class UserFoldersController {
/** FolderService. */
@Autowired
private FolderService folderservice;
/** SpringSecurityService. */
@Autowired
private SpringSecurityService securityService;
/**
* Edit page.
* @return {@link String}
*/
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit() {
return "admin/users/folders/edit";
}
/**
* List Forms page.
* @return {@link String}
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list() {
return "admin/users/folders/list";
}
/**
* Delete Forms page.
* @return {@link String}
*/
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public String delete() {
return "admin/users/folders/delete";
}
/**
* Files page.
* @return {@link String}
*/
@RequestMapping(value = "/files", method = RequestMethod.GET)
public String files() {
return "admin/users/folders/files";
}
/**
* Files page.
* @param model {@link Model}
* @param folder {@link String}
* @param uuid {@link String}
* @return {@link String}
*/
@Transactional
@RequestMapping(value = "/filesdelete", method = RequestMethod.GET)
public String filesDelete(
final Model model,
@RequestParam(value = "folder", required = true)
final String folder,
@RequestParam(value = "uuid", required = true)
final String uuid) {
UserDetails user = this.securityService.getUserDetails();
FormDTO dto = this.folderservice.findForm(user, folder, uuid);
model.addAttribute("form", dto);
return "admin/users/folders/filesdelete";
}
}