use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class VarsqlCommonController method invalidLogin.
/**
* @Method Name : invalidLogin
* @Method 설명 : 로그인 유효하지 않을때.
* @작성자 : ytkim
* @작성일 : 2018. 2. 28.
* @변경이력 :
* @param req
* @param res
* @param mav
* @return
* @throws Exception
*/
@RequestMapping(value = "/invalidLogin")
@ResponseBody
public ResponseResult invalidLogin(HttpServletRequest req, HttpServletResponse res, ModelAndView mav) throws Exception {
ResponseResult result = new ResponseResult();
result.setStatus(500);
result.setMessage("invalidLogin");
result.setResultCode(RequestResultCode.LOGIN_INVALID);
return result;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class UserPreferencesServiceImpl method updatePasswordInfo.
/**
* @Method Name : updatePasswordInfo
* @Method 설명 : 비밀번호 변경.
* @작성자 : ytkim
* @작성일 : 2017. 11. 29.
* @변경이력 :
* @param passwordForm
* @param resultObject
* @return
* @throws EncryptDecryptException
*/
public ResponseResult updatePasswordInfo(PasswordRequestDTO passwordForm) throws EncryptDecryptException {
UserEntity userInfo = userMgmtRepository.findByViewid(SecurityUtil.userViewId());
ResponseResult resultObject = new ResponseResult();
if (passwordEncoder.matches(passwordForm.getCurrPw(), userInfo.getUpw())) {
userInfo.setUpw(passwordForm.getUpw());
userMgmtRepository.save(userInfo);
resultObject.setItemOne(1);
} else {
resultObject.setResultCode(VarsqlAppCode.COMM_PASSWORD_NOT_VALID);
}
return resultObject;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class UserPreferencesServiceImpl method deleteQnaInfo.
/**
* @Method Name : deleteQnaInfo
* @Method 설명 : qna 삭제.
* @작성자 : ytkim
* @작성일 : 2019. 1. 3.
* @변경이력 :
* @param paramMap
* @return
*/
@Transactional(value = ResourceConfigConstants.APP_TRANSMANAGER, rollbackFor = Exception.class)
public ResponseResult deleteQnaInfo(String qnaid) {
QnAEntity entity = qnaEntityRepository.findByQnaid(qnaid);
if (entity.getAnswerId() == null) {
qnaEntityRepository.delete(entity);
}
ResponseResult result = new ResponseResult();
result.setMessageCode("answer.msg.notdelete");
return result;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class SqlUpdateExecutor method execute.
@Override
public SQLExecuteResult execute(SqlStatementInfo statementInfo, AbstractSQLExecutorHandler resultHandler) throws SQLException {
SQLExecuteResult result = new SQLExecuteResult();
Map sqlParamMap = VartechUtils.jsonStringToObject(statementInfo.getSqlParam(), HashMap.class);
ResponseResult parseInfo = SqlSourceBuilder.parseResponseResult(statementInfo.getSql(), sqlParamMap, DBType.getDBType(statementInfo.getDbType()));
List<SqlSource> sqlList = parseInfo.getItems();
result.setStartTime(System.currentTimeMillis());
SqlSource tmpSqlSource = null;
int sqlIdx = 0, sqlSize = sqlList.size();
int addCount = 0;
Connection conn = null;
Statement statement = null;
try {
conn = ConnectionFactory.getInstance().getConnection(statementInfo.getVconnid());
conn.setAutoCommit(false);
statement = conn.createStatement();
boolean handleFlag = (resultHandler != null);
for (sqlIdx = 0; sqlIdx < sqlSize; sqlIdx++) {
tmpSqlSource = sqlList.get(sqlIdx);
if (handleFlag) {
resultHandler.addTotalCount();
if (!resultHandler.handle(SQLHandlerParameter.builder().sql(tmpSqlSource.getQuery()).parameter(sqlParamMap).build())) {
continue;
}
}
;
statement.addBatch(tmpSqlSource.getQuery());
addCount++;
if (addCount % getBatchCount() == 0) {
statement.executeBatch();
statement.clearBatch();
}
}
if (addCount % getBatchCount() != 0) {
statement.executeBatch();
statement.clearBatch();
}
conn.commit();
} catch (Throwable e) {
if (conn != null)
conn.rollback();
result.setResultCode(VarsqlAppCode.EC_SQL_EXECUTOR);
result.setMessage("errorLine : " + sqlIdx + ", error message : " + e.getMessage());
logger.error("update : {} ", e.getMessage(), e);
} finally {
if (conn != null) {
conn.setAutoCommit(true);
JdbcUtils.close(conn, statement);
}
}
result.setTotalCount(resultHandler.getTotalCount());
result.setEndTime(System.currentTimeMillis());
result.setExecuteCount(addCount);
result.setResult(addCount);
return result;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class VarsqlFormatterUtil method formatResponseResult.
public static ResponseResult formatResponseResult(String sql, DBType dbType, FORMAT_TYPE format_type) {
ResponseResult result = new ResponseResult();
String resultSql = "";
sql = new SQLCommentRemoveConverter().convert(sql, dbType);
if (format_type.equals(FORMAT_TYPE.VARSQL)) {
resultSql = new VarsqlFormatterImpl().execute(sql);
// resultSql = SqlFormatter.format(sql);
} else {
try {
resultSql = com.varsql.core.sql.util.SQLParserUtils.getParserString(sql, dbType);
} catch (Exception e) {
resultSql = new VarsqlFormatterImpl().execute(sql);
result.setMessage(e.getMessage());
}
}
// resultSql = Native2Ascii.asciiToNative(resultSql);
result.setItemOne(resultSql + BlankConstants.NEW_LINE);
return result;
}
Aggregations