Search in sources :

Example 11 with ParamMap

use of com.vartech.common.app.beans.ParamMap in project varsql by varsqlinfo.

the class IndexInfoHandler method handleResult.

@Override
public void handleResult(ResultContext<? extends ParamMap> paramResultContext) {
    ParamMap rowData = paramResultContext.getResultObject();
    String indexName = rowData.getString(MetaColumnConstants.INDEX_NAME);
    if (!indexName.equals(beforeTableName)) {
        currentIndexInfo = new IndexInfo();
        currentIndexInfo.setName(indexName);
        currentIndexInfo.setBufferPool(rowData.getString(MetaColumnConstants.BUFFER_POOL));
        currentIndexInfo.setStatus(rowData.getString(MetaColumnConstants.STATUS));
        currentIndexInfo.setTableSpace(rowData.getString(MetaColumnConstants.TABLE_SPACE));
        currentIndexInfo.setTblName(rowData.getString(MetaColumnConstants.TABLE_NAME));
        currentIndexInfo.setType(rowData.getString(MetaColumnConstants.INDEX_TYPE));
        currentIndexInfo.setColList(new ArrayList<ObjectColumnInfo>());
        indexInfoList.add(currentIndexInfo);
    }
    ObjectColumnInfo column = new ObjectColumnInfo();
    column.setName(rowData.getString(MetaColumnConstants.COLUMN_NAME));
    column.setNo(rowData.getInt(MetaColumnConstants.ORDINAL_POSITION));
    column.setAscOrdesc(rowData.getString(MetaColumnConstants.ASC_OR_DESC));
    currentIndexInfo.addColInfo(column);
    beforeTableName = indexName;
}
Also used : ParamMap(com.vartech.common.app.beans.ParamMap) ObjectColumnInfo(com.varsql.core.db.valueobject.ObjectColumnInfo) IndexInfo(com.varsql.core.db.valueobject.IndexInfo)

Example 12 with ParamMap

use of com.vartech.common.app.beans.ParamMap in project varsql by varsqlinfo.

the class FileDownloadController method fileDownload.

// 첨부파일 다운로드
@RequestMapping(value = "/download")
public void fileDownload(@RequestParam(value = "contId") String contId, @RequestParam(value = "fileId") String fileId, HttpServletRequest req, HttpServletResponse res) throws Exception {
    logger.debug("fileDownload");
    List<FileInfoEntity> fileList = new ArrayList<>();
    if (!StringUtils.isBlank(fileId)) {
        FileInfoEntity fie = fileInfoEntityRepository.findByFileId(fileId);
        if (fie != null) {
            fileList.add(fie);
        }
    } else if (!StringUtils.isBlank(contId)) {
        fileList = fileInfoEntityRepository.findByFileContId(fileId);
    }
    if (fileList.size() < 1) {
        res.setContentType("text/html");
        res.setStatus(HttpStatus.OK.value());
        try (PrintWriter out = res.getWriter()) {
            out.write("<script>alert('file not found')</script>");
        }
        return;
    }
    ParamMap param = HttpUtils.getServletRequestParam(req);
    String downFileName = "";
    int fileSize = fileList.size();
    if (fileSize == 1) {
        downFileName = fileList.get(0).getFileName();
    } else {
        downFileName = param.getString("downFileName", "downloadFile");
        downFileName = java.net.URLDecoder.decode(downFileName, "UTF-8");
        downFileName = downFileName + ".zip";
    }
    FileServiceUtils.fileDownload(req, res, downFileName, fileList.toArray(new FileInfoEntity[0]));
}
Also used : ParamMap(com.vartech.common.app.beans.ParamMap) ArrayList(java.util.ArrayList) FileInfoEntity(com.varsql.web.model.entity.app.FileInfoEntity) PrintWriter(java.io.PrintWriter) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 13 with ParamMap

use of com.vartech.common.app.beans.ParamMap in project varsql by varsqlinfo.

the class FileDownloadController method driverFileDownload.

@RequestMapping(value = "/driverFileDownload")
public void driverFileDownload(@RequestParam(value = "contId") String contId, @RequestParam(value = "fileId") String fileId, HttpServletRequest req, HttpServletResponse res) throws Exception {
    logger.debug("fileDownload");
    List<DBTypeDriverFileEntity> fileList = new ArrayList<>();
    if (!StringUtils.isBlank(fileId)) {
        DBTypeDriverFileEntity fie = dbTypeDriverFileEntityRepository.findByFileId(fileId);
        if (fie != null) {
            fileList.add(fie);
        }
    } else if (!StringUtils.isBlank(contId)) {
        fileList = dbTypeDriverFileEntityRepository.findByFileContId(fileId);
    }
    if (fileList.size() < 1) {
        res.setContentType("text/html");
        res.setStatus(HttpStatus.OK.value());
        try (PrintWriter out = res.getWriter()) {
            out.write("<script>alert('file not found')</script>");
        }
        return;
    }
    ParamMap param = HttpUtils.getServletRequestParam(req);
    String downFileName = "";
    int fileSize = fileList.size();
    if (fileSize == 1) {
        downFileName = fileList.get(0).getFileName();
    } else {
        downFileName = param.getString("downFileName", "downloadFile");
        downFileName = java.net.URLDecoder.decode(downFileName, "UTF-8");
        downFileName = downFileName + ".zip";
    }
    FileServiceUtils.fileDownload(req, res, downFileName, fileList.toArray(new DBTypeDriverFileEntity[0]));
}
Also used : ParamMap(com.vartech.common.app.beans.ParamMap) DBTypeDriverFileEntity(com.varsql.web.model.entity.db.DBTypeDriverFileEntity) ArrayList(java.util.ArrayList) PrintWriter(java.io.PrintWriter) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with ParamMap

use of com.vartech.common.app.beans.ParamMap in project varsql by varsqlinfo.

the class MysqlDDLScript method getProcedures.

@Override
public List<DDLInfo> getProcedures(DatabaseParamInfo dataParamInfo, DDLCreateOption ddlOption, String... objNmArr) throws Exception {
    SqlSession sqlSesseion = SQLManager.getInstance().sqlSessionTemplate(dataParamInfo.getVconnid());
    logger.debug(" Procedure DDL Generation...");
    List<DDLInfo> reval = new ArrayList<DDLInfo>();
    DDLInfo ddlInfo;
    StringBuilder ddlStr;
    for (String name : objNmArr) {
        ddlInfo = new DDLInfo();
        ddlInfo.setName(name);
        ddlStr = new StringBuilder();
        dataParamInfo.setObjectName(name);
        ParamMap source = sqlSesseion.selectOne("procedureScript", dataParamInfo);
        ddlStr.append(source.getString("Create Procedure"));
        ddlInfo.setCreateScript(VarsqlFormatterUtil.ddlFormat(VarsqlFormatterUtil.addLastSemicolon(ddlStr, ddlOption), dbType));
        reval.add(ddlInfo);
    }
    return reval;
}
Also used : ParamMap(com.vartech.common.app.beans.ParamMap) SqlSession(org.apache.ibatis.session.SqlSession) ArrayList(java.util.ArrayList) DDLInfo(com.varsql.core.db.valueobject.ddl.DDLInfo)

Example 15 with ParamMap

use of com.vartech.common.app.beans.ParamMap in project varsql by varsqlinfo.

the class MysqlDDLScript method getViews.

@Override
public List<DDLInfo> getViews(DatabaseParamInfo dataParamInfo, DDLCreateOption ddlOption, String... objNmArr) throws Exception {
    StringBuilder ddlStr;
    SqlSession sqlSesseion = SQLManager.getInstance().sqlSessionTemplate(dataParamInfo.getVconnid());
    List<DDLInfo> reval = new ArrayList<DDLInfo>();
    DDLInfo ddlInfo;
    for (String name : objNmArr) {
        ddlStr = new StringBuilder();
        ddlInfo = new DDLInfo();
        ddlInfo.setName(name);
        dataParamInfo.setObjectName(name);
        if (ddlOption.isAddDropClause()) {
            ddlStr.append("/* DROP ViEW " + dataParamInfo.getObjectName() + "; */").append(BlankConstants.NEW_LINE_TWO);
        }
        ParamMap source = sqlSesseion.selectOne("viewScript", dataParamInfo);
        ddlStr.append(source.getString("Create View"));
        ddlInfo.setCreateScript(VarsqlFormatterUtil.ddlFormat(VarsqlFormatterUtil.addLastSemicolon(ddlStr, ddlOption), dbType));
        reval.add(ddlInfo);
    }
    return reval;
}
Also used : ParamMap(com.vartech.common.app.beans.ParamMap) SqlSession(org.apache.ibatis.session.SqlSession) ArrayList(java.util.ArrayList) DDLInfo(com.varsql.core.db.valueobject.ddl.DDLInfo)

Aggregations

ParamMap (com.vartech.common.app.beans.ParamMap)27 ArrayList (java.util.ArrayList)21 DDLInfo (com.varsql.core.db.valueobject.ddl.DDLInfo)17 SqlSession (org.apache.ibatis.session.SqlSession)17 List (java.util.List)8 HashMap (java.util.HashMap)6 Map (java.util.Map)6 DataTypeImpl (com.varsql.core.db.meta.datatype.DataTypeImpl)4 DataTypeInfo (com.varsql.core.db.valueobject.DataTypeInfo)4 PrintWriter (java.io.PrintWriter)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 SecurityUtil (com.varsql.core.common.util.SecurityUtil)2 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonParser (com.fasterxml.jackson.core.JsonParser)1 JsonToken (com.fasterxml.jackson.core.JsonToken)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 AuthorityType (com.varsql.core.auth.AuthorityType)1 VarsqlAppCode (com.varsql.core.common.code.VarsqlAppCode)1 VarsqlFileType (com.varsql.core.common.code.VarsqlFileType)1 SqlDataConstants (com.varsql.core.common.constants.SqlDataConstants)1