package fi.otavanopisto.pyramus.json.settings; import fi.internetix.smvc.controllers.JSONRequestContext; import fi.otavanopisto.pyramus.dao.DAOFactory; import fi.otavanopisto.pyramus.dao.courses.CourseStateDAO; import fi.otavanopisto.pyramus.framework.JSONRequestController; import fi.otavanopisto.pyramus.framework.UserRole; /** * The controller responsible of archiving. */ public class ArchiveCourseStateJSONRequestController extends JSONRequestController { /** * Processes the request to archive. * * @param jsonRequestContext The JSON request context */ public void process(JSONRequestContext jsonRequestContext) { CourseStateDAO courseStateDAO = DAOFactory.getInstance().getCourseStateDAO(); Long categoryId = jsonRequestContext.getLong("courseStateId"); courseStateDAO.archive(courseStateDAO.findById(categoryId)); } public UserRole[] getAllowedRoles() { return new UserRole[] { UserRole.MANAGER, UserRole.STUDY_PROGRAMME_LEADER, UserRole.ADMINISTRATOR }; } }