com.fota.fota3g.serviceMgt.controller.AccountPermissionsMgtCTR.java Source code

Java tutorial

Introduction

Here is the source code for com.fota.fota3g.serviceMgt.controller.AccountPermissionsMgtCTR.java

Source

/*
 * M2M ServiceFOTA ONM version 1.0
 *
 *  Copyright  2014 kt corp. All rights reserved.
 *
 *  This is a proprietary software of kt corp, and you may not use this file except in
 *  compliance with license agreement with kt corp. Any redistribution or use of this
 *  software, with or without modification shall be strictly prohibited without prior written
 *  approval of kt corp, and the copyright notice above does not evidence any actual or
 *  intended publication of such software.
 */
package com.fota.fota3g.serviceMgt.controller;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.io.FileUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.json.MappingJacksonJsonView;

import com.fota.comm.util.VoV;
import com.fota.commMgt.vo.UserLoginVO;
import com.fota.devMgt.vo.DevSearchVO;
import com.fota.fota3g.comm.service.ThreeFotaSystemMgtSVC;
import com.fota.fota3g.deviceMgt.service.TargetGroupMgtSVC;
import com.fota.fota3g.deviceMgt.vo.FotaServiceVo;
import com.fota.fota3g.deviceMgt.vo.TargetGroupVo;
import com.fota.fota3g.managementMgt.service.SectionTimeSVC;
import com.fota.fota3g.monitoringMgt.service.DmRetrySubmissionStatusMgtSVC;
import com.fota.fota3g.monitoringMgt.vo.DmRetrySubmissionStatusVo;
import com.fota.fota3g.selffotaMgt.service.ListManagementSVC;
import com.fota.fota3g.selffotaMgt.vo.ListManagementVo;
import com.fota.fota3g.serviceMgt.service.AccountPermissionsMgtSVC;
import com.fota.fota3g.serviceMgt.service.MenuMgtSVC;
import com.fota.fota3g.serviceMgt.vo.AccountPermissionsMgtVo;
import com.fota.fota3g.serviceMgt.vo.MenuMgtVo;
import com.oreilly.servlet.MultipartRequest;

@Controller
@RequestMapping("/commonServiceMgt/managementMgt")
public class AccountPermissionsMgtCTR {

    private static final Logger logger = LoggerFactory.getLogger(AccountPermissionsMgtCTR.class);

    /**
     * @uml.property  name="firmSVC"
     * @uml.associationEnd  readOnly="true"
     */
    @Autowired
    AccountPermissionsMgtSVC accountPermissionsMgtSVC;

    /**
     * @uml.property  name="ajaxMainView"
     * @uml.associationEnd  readOnly="true"
     */
    @Autowired
    private MappingJacksonJsonView ajaxMainView;

    /**
     * dmRetry View
     * @param request
     * @param model
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/accountPermissionsMgtView")
    public String getView(HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
        logger.warn("#############accountPermissionsMgtView################");
        if (!request.getServletPath().equals("/commonServiceMgt/managementMgt/accountPermissionsMgtView")) {
            response.setStatus(403);
            return "redirect:/lresources/errorPage.jsp";
        }

        return "fota3g/managementMgt/accountPermissionsMgtView";
    }

    /*   
    /**
     * dmRetry list
     * @param param
     * @param response
     * @return
     */
    @RequestMapping(value = "/accountPermissionsMgtList")
    @ResponseBody
    public ModelAndView getList(HttpServletRequest request, HttpServletResponse response,
            @ModelAttribute("AccountPermissionsMgtVo") AccountPermissionsMgtVo vo, ModelMap model)
            throws Exception {
        //      logger.warn("#############accountPermissionsMgtList################");

        vo = accountPermissionsMgtSVC.accountPermissionsList(vo);

        //      int totalCount = accountPermissionsMgtSVC.getUserListTotalCount(vo);

        //      int totalPage = totalCount / Integer.valueOf(vo.getRowsPerPage());
        //      if ( totalCount % Integer.valueOf(vo.getRowsPerPage()) != 0)
        //         totalPage++;

        //      logger.warn("page : " + vo.getPage() + " / rowsPerPage : " + vo.getRowsPerPage() 
        //            + " / totalPage : " + totalPage + " / totalCount : " + totalCount);

        model.addAttribute("gridData", vo.getResults());
        //      model.addAttribute("page", vo.getPage());
        //      model.addAttribute("totalPage", totalPage);

        return new ModelAndView(ajaxMainView, model);
    }

    /**
     * accountPermissions Update admin 
     * @param param
     * @param response
     * @return
     */
    @RequestMapping(value = "/accountAdminUpdate")
    @ResponseBody
    public ModelAndView accountPermissionsUpdateAdmin(HttpServletRequest request, HttpServletResponse response,
            @ModelAttribute("AccountPermissionsMgtVo") AccountPermissionsMgtVo vo, ModelMap model)
            throws Exception {
        logger.warn("#############accountAdminUpdate################");
        int retValue = 0;

        retValue = accountPermissionsMgtSVC.updateAccountAdmin(vo);

        model.addAttribute("retValue", retValue);

        return new ModelAndView(ajaxMainView, model);
    }

    /**
     * accountPermissions Update user 
     * @param param
     * @param response
     * @return
     */
    @RequestMapping(value = "/accountUserUpdate")
    @ResponseBody
    public ModelAndView accountPermissionsUpdateUser(HttpServletRequest request, HttpServletResponse response,
            @ModelAttribute("AccountPermissionsMgtVo") AccountPermissionsMgtVo vo, ModelMap model)
            throws Exception {
        logger.warn("#############accountUserUpdate################");
        int retValue = 0;

        retValue = accountPermissionsMgtSVC.updateAccountUser(vo);

        model.addAttribute("retValue", retValue);

        return new ModelAndView(ajaxMainView, model);
    }

}