Search in sources :

Example 1 with ParamMap

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

the class UserMgmtServiceImpl method updateAccept.

/**
 * @Method Name  : updateAccept
 * @Method 설명 : 사용자 수락 거부 .
 * @작성자   : ytkim
 * @작성일   : 2017. 12. 1.
 * @변경이력  :
 * @param paramMap
 * @return
 */
@Transactional(value = ResourceConfigConstants.APP_TRANSMANAGER, rollbackFor = Exception.class)
public ResponseResult updateAccept(String acceptyn, String selectItem) {
    String[] viewidArr = StringUtils.split(selectItem, ",");
    AuthorityType role = "Y".equals(acceptyn) ? AuthorityType.USER : AuthorityType.GUEST;
    List<UserEntity> users = userMgmtRepository.findByViewidIn(Arrays.asList(viewidArr)).stream().map(item -> {
        item.setUserRole(role.name());
        item.setAcceptYn("Y".equals(acceptyn) ? true : false);
        return item;
    }).collect(Collectors.toList());
    userMgmtRepository.saveAll(users);
    return VarsqlUtils.getResponseResultItemOne(1);
}
Also used : Arrays(java.util.Arrays) UserEntity(com.varsql.web.model.entity.user.UserEntity) Configuration(com.varsql.core.configuration.Configuration) ResourceConfigConstants(com.varsql.web.constants.ResourceConfigConstants) Autowired(org.springframework.beans.factory.annotation.Autowired) UUIDUtil(com.varsql.core.common.util.UUIDUtil) ResponseResult(com.vartech.common.app.beans.ResponseResult) DBGroupEntityRepository(com.varsql.web.repository.db.DBGroupEntityRepository) VarsqlUtils(com.varsql.web.util.VarsqlUtils) ParamMap(com.vartech.common.app.beans.ParamMap) SecurityUtil(com.varsql.core.common.util.SecurityUtil) DBBlockingUserEntity(com.varsql.web.model.entity.db.DBBlockingUserEntity) Service(org.springframework.stereotype.Service) MessageDTO(com.varsql.web.dto.websocket.MessageDTO) Qualifier(org.springframework.beans.factory.annotation.Qualifier) UserMgmtRepository(com.varsql.web.repository.user.UserMgmtRepository) EncryptDecryptException(com.vartech.common.crypto.EncryptDecryptException) DBManagerSpec(com.varsql.web.repository.spec.DBManagerSpec) SearchParameter(com.vartech.common.app.beans.SearchParameter) DBGroupMappingUserEntityRepository(com.varsql.web.repository.db.DBGroupMappingUserEntityRepository) PasswordUtil(com.vartech.common.crypto.password.PasswordUtil) AbstractService(com.varsql.web.common.service.AbstractService) UserDBConnectionEntityRepository(com.varsql.web.repository.user.UserDBConnectionEntityRepository) MessageType(com.varsql.web.constants.MessageType) StringUtils(com.vartech.common.utils.StringUtils) RequestResultCode(com.vartech.common.constants.RequestResultCode) Page(org.springframework.data.domain.Page) DBGroupSpec(com.varsql.web.repository.spec.DBGroupSpec) Collectors(java.util.stream.Collectors) WebSocketServiceImpl(com.varsql.web.app.websocket.service.WebSocketServiceImpl) UserSpec(com.varsql.web.repository.spec.UserSpec) List(java.util.List) PasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder) DBManagerEntityRepository(com.varsql.web.repository.db.DBManagerEntityRepository) DBBlockingUserEntityRepository(com.varsql.web.repository.db.DBBlockingUserEntityRepository) AuthorityType(com.varsql.core.auth.AuthorityType) Transactional(org.springframework.transaction.annotation.Transactional) UserMapper(com.varsql.web.model.mapper.user.UserMapper) AuthorityType(com.varsql.core.auth.AuthorityType) UserEntity(com.varsql.web.model.entity.user.UserEntity) DBBlockingUserEntity(com.varsql.web.model.entity.db.DBBlockingUserEntity) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with ParamMap

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

the class TableInfoHandler method handleResult.

@Override
public void handleResult(ResultContext<? extends ParamMap> paramResultContext) {
    ParamMap rowData = paramResultContext.getResultObject();
    String tblName = rowData.getString(MetaColumnConstants.TABLE_NAME);
    if (!tblName.equals(beforeTableName)) {
        if (useTableIndex) {
            currentTableInfo = this.tableInfoList.get(this.tableIndexInfo.get(tblName));
            currentTableInfo.setColList(new ArrayList<ColumnInfo>());
            currentTableInfo.setRemarks(StringUtils.nullToString(currentTableInfo.getRemarks(), ""));
        } else {
            currentTableInfo = new TableInfo();
            currentTableInfo.setName(tblName);
            currentTableInfo.setColList(new ArrayList<ColumnInfo>());
            currentTableInfo.setRemarks(rowData.getString(MetaColumnConstants.REMARKS, ""));
            tableInfoList.add(currentTableInfo);
        }
    }
    ColumnInfo column = new ColumnInfo();
    String cName = rowData.getString(MetaColumnConstants.COLUMN_NAME);
    String columnSize = rowData.getString(MetaColumnConstants.COLUMN_SIZE);
    String degitsLen = rowData.getString(MetaColumnConstants.DECIMAL_DIGITS);
    String dataType = rowData.getString(MetaColumnConstants.DATA_TYPE);
    DataTypeInfo dataTypeInfo = dataTypeImpl.getDataType(dataType);
    column.setName(cName);
    column.setDataType(dataType);
    Object lenInfoObj = rowData.get(MetaColumnConstants.COLUMN_SIZE);
    if (lenInfoObj != null) {
        if (lenInfoObj instanceof Integer) {
            column.setLength(Integer.parseInt(lenInfoObj + ""));
        } else {
            column.setLength(new BigDecimal(lenInfoObj + ""));
        }
    }
    column.setDefaultVal(rowData.getString(MetaColumnConstants.COLUMN_DEF));
    column.setNullable(rowData.getString(MetaColumnConstants.IS_NULLABLE));
    column.setTypeName(dataTypeInfo.getDataTypeName());
    String typeAndLength = rowData.getString(MetaColumnConstants.TYPE_NAME_SIZE, "");
    if ("".equals(typeAndLength)) {
        column.setTypeAndLength(DbMetaUtils.getTypeName(dataTypeInfo, column, dataTypeInfo.getDataTypeName(), columnSize, degitsLen));
    } else {
        column.setTypeAndLength(typeAndLength);
    }
    column.setComment(rowData.getString(MetaColumnConstants.COMMENT, ""));
    column.setConstraints(rowData.getString(MetaColumnConstants.CONSTRAINTS, ""));
    currentTableInfo.addColInfo(column);
    beforeTableName = tblName;
}
Also used : DataTypeInfo(com.varsql.core.db.valueobject.DataTypeInfo) ParamMap(com.vartech.common.app.beans.ParamMap) ColumnInfo(com.varsql.core.db.valueobject.ColumnInfo) TableInfo(com.varsql.core.db.valueobject.TableInfo) BigDecimal(java.math.BigDecimal)

Example 3 with ParamMap

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

the class AuthDAO method loadUserByUsername.

/**
 * @Method Name  : loadUserByUsername
 * @Method 설명 : 사용자 로그인 정보 추출.
 * @작성일   : 2015. 6. 22.
 * @작성자   : ytkim
 * @변경이력  :
 * @param username
 * @return
 * @throws UsernameNotFoundException
 */
public User loadUserByUsername(final String userInfoJson) throws UsernameNotFoundException {
    ParamMap userInfo = VartechUtils.jsonStringToObject(userInfoJson);
    String username = userInfo.getString("username");
    String password = userInfo.getString("password");
    return loadUserByUsername(username, password, false);
}
Also used : ParamMap(com.vartech.common.app.beans.ParamMap)

Example 4 with ParamMap

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

the class AbstractXmlLoad method getNodeValue.

private ParamMap<String, Object> getNodeValue(Element el) {
    ParamMap<String, Object> dataMap = new ParamMap<String, Object>();
    List list = el.getChildren();
    Iterator<Element> it = list.iterator();
    Map childMap = null;
    List childList = null;
    Object tmpChildObj = null;
    int childNodeLen = -1;
    Element sEle = null;
    String nodeName = null;
    List sChildList = null;
    while (it.hasNext()) {
        childMap = new HashMap();
        sEle = (Element) it.next();
        nodeName = sEle.getName();
        sChildList = sEle.getChildren();
        childNodeLen = sChildList.size();
        if (childNodeLen != 0) {
            childMap = getNodeValue(sEle);
        }
        if (dataMap.containsKey(nodeName)) {
            tmpChildObj = dataMap.get(nodeName);
            if (!(tmpChildObj instanceof List)) {
                childList = new ArrayList();
                childList.add(tmpChildObj);
            } else {
                childList = (List) tmpChildObj;
            }
            childList.add(childNodeLen > 0 ? childMap : sEle.getValue());
            dataMap.put(nodeName, childList);
        } else {
            dataMap.put(nodeName, childNodeLen > 0 ? childMap : sEle.getValue());
        }
    }
    return dataMap;
}
Also used : ParamMap(com.vartech.common.app.beans.ParamMap) HashMap(java.util.HashMap) Element(org.jdom.Element) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) ParamMap(com.vartech.common.app.beans.ParamMap)

Example 5 with ParamMap

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

the class CubridDDLScript method getTables.

@Override
public List<DDLInfo> getTables(DatabaseParamInfo dataParamInfo, DDLCreateOption ddlOption, String... objNmArr) throws Exception {
    SqlSession client = SQLManager.getInstance().sqlSessionTemplate(dataParamInfo.getVconnid());
    List<DDLInfo> reval = new ArrayList<DDLInfo>();
    DDLInfo ddlInfo;
    StringBuilder ddlStr;
    for (String name : objNmArr) {
        ddlStr = new StringBuilder();
        ddlInfo = new DDLInfo();
        ddlInfo.setName(name);
        dataParamInfo.setObjectName(name);
        if (ddlOption.isAddDropClause()) {
            ddlStr.append("/* DROP TABLE " + name + "; */").append(BlankConstants.NEW_LINE_TWO);
        }
        ParamMap source = client.selectOne("tableScript", dataParamInfo);
        ddlStr.append(source.getString("CREATE TABLE"));
        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