Example usage for org.apache.ibatis.session SqlSession rollback

List of usage examples for org.apache.ibatis.session SqlSession rollback

Introduction

In this page you can find the example usage for org.apache.ibatis.session SqlSession rollback.

Prototype

void rollback();

Source Link

Document

Discards pending batch statements and rolls database connection back.

Usage

From source file:com.skt.adcas.lte.action.DownLinkByQMSAction.java

public String selectCellTraffic() {

    this.log.debug("selectCellTraffic Start");
    SqlSession session = null;

    try {/*from w w w  .  j a  v  a 2s.com*/
        parseParam();

        session = SqlSessionManager.getSqlSession().openSession();

        this.log.debug("###################### ?? =" + "DownLinkByQMS.selectCellTraffic"
                + VIEWTYPE);
        this.rows = session.selectList("DownLinkByQMS.selectCellTraffic" + VIEWTYPE, param);
        this.log.debug("###################### ");
        if (this.rows.size() > 0) {
            this.msg = "?.";
        } else {
            this.msg = " .";
        }
        this.status = "SUCCESS";
    } catch (Exception e) {
        this.msg = "? ?. ?? ?.\n\n" + e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTraffic End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkByQMSAction.java

public String selectCellTrafficHistogramExcelDownload() {

    this.log.debug("selectCellTrafficHistogramExcelDownload Start");
    SqlSession session = null;
    FileOutputStream fileOut = null;

    try {//from   w w  w  .  j  av  a 2  s .  com
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        Workbook wb = new HSSFWorkbook();
        //CreationHelper createHelper = wb.getCreationHelper();

        String sheetName = this.FROMYMD + "~" + this.TOYMD;
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);

        //sheet 
        Sheet sheet = wb.createSheet(safeName);

        //header ?
        Row hrow0 = sheet.createRow((short) 0);
        hrow0.setHeightInPoints(20);
        hrow0.createCell(0).setCellValue("MBPS");
        hrow0.createCell(1).setCellValue("COUNT");
        hrow0.createCell(2).setCellValue("??");
        hrow0.createCell(3).setCellValue("CDF");

        StringMap categoryVal = (StringMap) map.get("categoryVal");
        StringMap rVal = (StringMap) map.get("rVal");
        StringMap rate = (StringMap) map.get("rate");
        StringMap cdf = (StringMap) map.get("cdf");

        short i = 1;
        for (int j = 0; j < 10; j++) {
            //  
            Row row = sheet.createRow((short) i);
            row.setHeightInPoints(20);
            row.createCell(0).setCellValue(Double.parseDouble(categoryVal.get(String.valueOf(j)).toString()));
            row.createCell(1).setCellValue(Double.parseDouble(rVal.get(String.valueOf(j)).toString()));
            row.createCell(2).setCellValue(Double.parseDouble(rate.get(String.valueOf(j)).toString()));
            row.createCell(3).setCellValue(Double.parseDouble(cdf.get(String.valueOf(j)).toString()));
            i++;
        }

        log.debug("selectCellTrafficHistogramExcelDownload : file start");

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkHistogram(QMS).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);
        log.debug("selectCellTrafficHistogramExcelDownload : file end");

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficHistogramExcelDownload End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkByQMSStatsAction.java

public String selectCellTrafficStats() {

    this.log.debug("selectCellTrafficStats Start");
    SqlSession session = null;

    try {/*from ww  w  . j  a v a 2  s. c  o m*/
        parseParam();

        this.log.debug("######################   ");
        session = SqlSessionManager.getSqlSession().openSession();

        //this.param.put("BTS_NM_CMS",BTS_NM_CMS);
        this.log.debug(
                "###################### ?? =" + "DownLinkByQMSStats.selectCellTrafficStats");
        this.rows = session.selectList("DownLinkByQMSStats.selectCellTrafficStats", param);
        this.log.debug("###################### ");
        if (this.rows.size() > 0) {
            this.msg = "?.";
        } else {
            this.msg = " .";
        }
        this.status = "SUCCESS";
    } catch (Exception e) {
        this.msg = "? ?. ?? ?.\n\n" + e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficStats End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkByQMSStatsAction.java

public String selectCellTrafficStatsCQIExcelDownload() {

    this.log.debug("selectCellTrafficStatsCQIExcelDownload Start");
    SqlSession session = null;
    FileOutputStream fileOut = null;

    try {/*from   www .  j  a  v  a  2  s. co m*/
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        String searchType = this.SEARCHTYPE;
        log.debug("SEARCHTYPE : " + searchType);

        Workbook wb = new HSSFWorkbook();

        //PDFsheet
        String sheetName = "CQI PDF";
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);
        Sheet PDFsheet = wb.createSheet(safeName);

        createCellTrafficStatsCQIExcelSheet(PDFsheet, "PDF", searchType, map);

        //CDFsheet
        sheetName = "CQI CDF";
        safeName = WorkbookUtil.createSafeSheetName(sheetName);
        Sheet CDFsheet = wb.createSheet(safeName);

        createCellTrafficStatsCQIExcelSheet(CDFsheet, "CDF", searchType, map);

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkStatsCQI(PDF_CDF)(QMS).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficStatsCQIExcelDownload End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkByQMSStatsAction.java

public String selectCellTrafficStatsExcelDownload() {

    this.log.debug("selectCellTrafficStatsExcelDownload Start");
    SqlSession session = null;
    FileOutputStream fileOut = null;

    try {/*w w  w.  ja  v  a2s  .  com*/
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        String searchType = this.SEARCHTYPE;

        Workbook wb = new HSSFWorkbook();
        //CreationHelper createHelper = wb.getCreationHelper();

        String sheetName = "data";
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);

        //sheet 
        Sheet sheet = wb.createSheet(safeName);

        //            CellStyle cellStyle = wb.createCellStyle();
        //            cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
        //            cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        createCellTrafficStatsExcelSheet(sheet, searchType, map);

        log.debug("selectCellTrafficStatsExcelDownload : file start");

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkStatsData(QMS).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);
        log.debug("selectCellTrafficStatsExcelDownload : file end");

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficStatsExcelDownload End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkByQMSStatsAction.java

public String selectCellTrafficStatsHistogramExcelDownload() {

    this.log.debug("selectCellTrafficStatsHistogramExcelDownload Start");
    SqlSession session = null;
    FileOutputStream fileOut = null;

    try {//from  w  w  w  .ja  va2 s .c  o m
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        Workbook wb = new HSSFWorkbook();
        //CreationHelper createHelper = wb.getCreationHelper();

        String sheetName = this.FROMYMD + "~" + this.TOYMD;
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);

        //sheet 
        Sheet sheet = wb.createSheet(safeName);

        //header ?
        Row hrow0 = sheet.createRow((short) 0);
        hrow0.setHeightInPoints(20);
        hrow0.createCell(0).setCellValue("MBPS");
        hrow0.createCell(1).setCellValue("COUNT");
        hrow0.createCell(2).setCellValue("??");
        hrow0.createCell(3).setCellValue("CDF");

        StringMap categoryVal = (StringMap) map.get("categoryVal");
        StringMap rVal = (StringMap) map.get("rVal");
        StringMap rate = (StringMap) map.get("rate");
        StringMap cdf = (StringMap) map.get("cdf");

        short i = 1;
        for (int j = 0; j < 10; j++) {
            //  
            Row row = sheet.createRow((short) i);
            row.setHeightInPoints(20);
            row.createCell(0).setCellValue(Double.parseDouble(categoryVal.get(String.valueOf(j)).toString()));
            row.createCell(1).setCellValue(Double.parseDouble(rVal.get(String.valueOf(j)).toString()));
            row.createCell(2).setCellValue(Double.parseDouble(rate.get(String.valueOf(j)).toString()));
            row.createCell(3).setCellValue(Double.parseDouble(cdf.get(String.valueOf(j)).toString()));
            i++;
        }

        log.debug("selectCellTrafficStatsHistogramExcelDownload : file start");

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkStatsHistogram(QMS).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);
        log.debug("selectCellTrafficStatsHistogramExcelDownload : file end");

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficStatsHistogramExcelDownload End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkBySTDAction.java

public String selectCellTraffic() {

    this.log.debug("selectCellTraffic Start");
    SqlSession session = null;

    try {/* ww w.j a v a  2 s  . co m*/
        parseParam();

        session = SqlSessionManager.getSqlSession().openSession();

        //this.param.put("BTS_NM_CMS",BTS_NM_CMS);
        this.log.debug("###################### ?? =" + "DownLinkBySTD.selectCellTraffic"
                + VIEWTYPE);
        this.rows = session.selectList("DownLinkBySTD.selectCellTraffic" + VIEWTYPE, param);
        this.log.debug("###################### ");
        if (this.rows.size() > 0) {
            this.msg = "?.";
        } else {
            this.msg = " .";
        }
        this.status = "SUCCESS";
    } catch (Exception e) {
        this.msg = "? ?. ?? ?.\n\n" + e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTraffic End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkBySTDAction.java

public String selectCellTrafficThrpCompGraphExcelDownload() {

    this.log.debug("selectCellTrafficThrpCompGraphExcelDownload Start");
    SqlSession session = null;
    FileOutputStream fileOut = null;

    try {/* w  w w  .  j  a v  a2s  .  c  om*/
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        Workbook wb = new HSSFWorkbook();
        //CreationHelper createHelper = wb.getCreationHelper();

        String sheetName = " ?";
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);

        //sheet 
        Sheet sheet = wb.createSheet(safeName);

        //header ?
        Row hrow0 = sheet.createRow((short) 0);
        hrow0.setHeightInPoints(20);
        hrow0.createCell(0).setCellValue("");
        hrow0.createCell(1).setCellValue("(" + this.FROMYMD + ")");
        hrow0.createCell(2).setCellValue("(" + this.TOYMD + ")");

        StringMap categories = (StringMap) map.get("categories");
        StringMap beforeSeries = (StringMap) map.get("beforeSeries");
        StringMap afterSeries = (StringMap) map.get("afterSeries");

        short i = 1;
        for (int j = 0; j < categories.size(); j++) {
            //  
            Row row = sheet.createRow((short) i);
            row.setHeightInPoints(20);
            row.createCell(0)
                    .setCellValue(categories.get(String.valueOf(j)).toString().replaceAll("<br>", " : "));
            row.createCell(1).setCellValue(Double.parseDouble(beforeSeries.get(String.valueOf(j)).toString()));
            row.createCell(2).setCellValue(Double.parseDouble(afterSeries.get(String.valueOf(j)).toString()));
            i++;
        }

        log.debug("selectCellTrafficThrpCompGraphExcelDownload : file start");

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkThrpCompGraph(STD).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);
        log.debug("selectCellTrafficThrpCompGraphExcelDownload : file end");

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficThrpCompGraphExcelDownload End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkBySTDStatsAction.java

public String selectCellTrafficStats() {

    this.log.debug("selectCellTrafficStats Start");
    SqlSession session = null;

    try {//from  www . j  av  a 2s . c  om
        parseParam();

        this.log.debug("######################   ");
        session = SqlSessionManager.getSqlSession().openSession();

        //this.param.put("BTS_NM_CMS",BTS_NM_CMS);
        this.log.debug(
                "###################### ?? =" + "DownLinkBySTDStats.selectCellTrafficStats");
        this.rows = session.selectList("DownLinkBySTDStats.selectCellTrafficStats", param);
        this.log.debug("###################### ");
        if (this.rows.size() > 0) {
            this.msg = "?.";
        } else {
            this.msg = " .";
        }
        this.status = "SUCCESS";
    } catch (Exception e) {
        this.msg = "? ?. ?? ?.\n\n" + e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficStats End");
    return SUCCESS;
}

From source file:com.skt.adcas.lte.action.DownLinkBySTDStatsAction.java

public String selectCellTrafficStatsThrpCompGraphExcelDownload() {

    this.log.debug("selectCellTrafficStatsThrpCompGraphExcelDownload Start");
    SqlSession session = null;
    FileOutputStream fileOut = null;

    try {//from  w w  w .  ja v  a2s.  com
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        Workbook wb = new HSSFWorkbook();
        //CreationHelper createHelper = wb.getCreationHelper();

        String sheetName = " ?";
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);

        //sheet 
        Sheet sheet = wb.createSheet(safeName);

        //header ?
        Row hrow0 = sheet.createRow((short) 0);
        hrow0.setHeightInPoints(20);
        hrow0.createCell(0).setCellValue("");
        hrow0.createCell(1).setCellValue("(" + this.FROMYMD + ")");
        hrow0.createCell(2).setCellValue("(" + this.TOYMD + ")");

        StringMap categories = (StringMap) map.get("categories");
        StringMap beforeSeries = (StringMap) map.get("beforeSeries");
        StringMap afterSeries = (StringMap) map.get("afterSeries");

        short i = 1;
        for (int j = 0; j < categories.size(); j++) {
            //  
            Row row = sheet.createRow((short) i);
            row.setHeightInPoints(20);
            row.createCell(0)
                    .setCellValue(categories.get(String.valueOf(j)).toString().replaceAll("<br>", " : "));
            row.createCell(1).setCellValue(Double.parseDouble(beforeSeries.get(String.valueOf(j)).toString()));
            row.createCell(2).setCellValue(Double.parseDouble(afterSeries.get(String.valueOf(j)).toString()));
            i++;
        }

        log.debug("selectCellTrafficStatsThrpCompGraphExcelDownload : file start");

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkThrpCompGraph(STD).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);
        log.debug("selectCellTrafficStatsThrpCompGraphExcelDownload : file end");

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficStatsThrpCompGraphExcelDownload End");
    return SUCCESS;
}