package fi.otavanopisto.pyramus.json.settings;
import fi.internetix.smvc.controllers.JSONRequestContext;
import fi.otavanopisto.pyramus.dao.DAOFactory;
import fi.otavanopisto.pyramus.dao.file.FileTypeDAO;
import fi.otavanopisto.pyramus.framework.JSONRequestController;
import fi.otavanopisto.pyramus.framework.UserRole;
/**
* The controller responsible of archiving a municipality.
*/
public class ArchiveFileTypeJSONRequestController extends JSONRequestController {
/**
* Processes the request to archive a municipality.
*
* @param jsonRequestContext The JSON request context
*/
public void process(JSONRequestContext jsonRequestContext) {
FileTypeDAO fileTypeDAO = DAOFactory.getInstance().getFileTypeDAO();
Long fileTypeId = jsonRequestContext.getLong("fileTypeId");
fileTypeDAO.archive(fileTypeDAO.findById(fileTypeId));
}
public UserRole[] getAllowedRoles() {
return new UserRole[] { UserRole.MANAGER, UserRole.STUDY_PROGRAMME_LEADER, UserRole.ADMINISTRATOR };
}
}