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;
}
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]));
}
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]));
}
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;
}
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;
}
Aggregations