class ProfileKtrl extends BaseKontroller {

    private static final Logger log = LoggerFactory.getLogger(ProfileKtrl.class);

    @Model(name = "sortedSet")
    SortedSet sortedSet = new SortedSet();
    @Model(name = "profile")
    Profile profile = new Profile();

    public ProfileKtrl(HttpServletRequest request, HttpServletResponse response) {
        super(request, response);
    }


    @Kontrol(path = "/manage/viewProfiles", method = MethodType.GET)
    public String viewSystems() throws ServletException {

        try {
            sortedSet = ProfileDB.getProfileSet(sortedSet);
        } catch (SQLException | GeneralSecurityException ex) {
            log.error(ex.toString(), ex);
            throw new ServletException(ex.toString(), ex);
        }

        return "/manage/view_profiles.html";
    }

    @Kontrol(path = "/manage/saveProfile", method = MethodType.POST)
    public String saveProfile() throws ServletException {<FILL_FUNCTION_BODY>}


    @Kontrol(path = "/manage/deleteProfile", method = MethodType.GET)
    public String deleteProfile() throws ServletException {

        if (profile.getId() != null) {
            try {
                ProfileDB.deleteProfile(profile.getId());
            } catch (SQLException | GeneralSecurityException ex) {
                log.error(ex.toString(), ex);
                throw new ServletException(ex.toString(), ex);
            }
        }
        return "redirect:/manage/viewProfiles.ktrl?sortedSet.orderByDirection=" + sortedSet.getOrderByDirection() + "&sortedSet.orderByField=" + sortedSet.getOrderByField();
    }

    /**
     * validate save profile
     */
    @Validate(input = "/manage/view_profiles.html")
    public void validateSaveProfile() throws ServletException {
        if (profile == null
                || profile.getNm() == null
                || profile.getNm().trim().equals("")) {
            addFieldError("profile.nm", "Required");
        }

        if (!this.getFieldErrors().isEmpty()) {
            try {
                sortedSet = ProfileDB.getProfileSet(sortedSet);
            } catch (SQLException | GeneralSecurityException ex) {
                log.error(ex.toString(), ex);
                throw new ServletException(ex.toString(), ex);
            }
        }
    }
}


        try {
            if (profile.getId() != null) {
                ProfileDB.updateProfile(profile);
            } else {
                ProfileDB.insertProfile(profile);
            }
        } catch (SQLException | GeneralSecurityException ex) {
            log.error(ex.toString(), ex);
            throw new ServletException(ex.toString(), ex);
        }
        return "redirect:/manage/viewProfiles.ktrl?sortedSet.orderByDirection=" + sortedSet.getOrderByDirection() + "&sortedSet.orderByField=" + sortedSet.getOrderByField();
    
<no_super_class>