use of com.varsql.core.db.valueobject.BaseObjectInfo in project varsql by varsqlinfo.
the class DbDiffServiceImpl method objectList.
/**
* @param objectType
* @Method Name : objectList
* @Method 설명 : object list
* @작성자 : ytkim
* @작성일 : 2018. 12. 19.
* @변경이력 :
* @param paramMap
* @return
*/
public ResponseResult objectList(String vconnid, String schema, String objectType) {
ResponseResult resultObject = new ResponseResult();
DBConnectionEntity vtConnRVO = dbConnectionEntityRepository.findByVconnid(vconnid);
if (vtConnRVO == null) {
resultObject.setResultCode(RequestResultCode.ERROR);
resultObject.setItemList(null);
} else {
DatabaseParamInfo dpi = getDatabaseParamInfo(vtConnRVO);
dpi.setSchema(schema);
dpi.setObjectType(objectType);
MetaControlBean dbMetaEnum = MetaControlFactory.getDbInstanceFactory(vtConnRVO.getDbTypeDriverProvider().getDbType());
String objectId = ObjectType.getDBObjectType(objectType).getObjectTypeId();
if (ObjectType.TABLE.getObjectTypeId().equals(objectId)) {
resultObject.setItemList(dbMetaEnum.getDBObjectMeta(objectId, dpi));
} else {
List<BaseObjectInfo> objectList = dbMetaEnum.getDBObjectList(objectId, dpi);
String[] objectNameArr = new String[objectList.size()];
int idx = 0;
for (BaseObjectInfo boi : objectList) {
// System.out.println("boi.getName() : "+ boi.getName());
objectNameArr[idx] = boi.getName();
++idx;
}
resultObject.setItemList(dbMetaEnum.getDDLScript(objectId, dpi, new DDLCreateOption(), objectNameArr));
}
}
return resultObject;
}
use of com.varsql.core.db.valueobject.BaseObjectInfo in project varsql by varsqlinfo.
the class DatabaseController method dbObjectList.
/**
* @Method Name : dbObjectList
* @Method 설명 : db object list
* @작성자 : ytkim
* @작성일 : 2017. 11. 6.
* @변경이력 :
* @param databaseParamInfo
* @param mav
* @param req
* @return
* @throws Exception
*/
@RequestMapping(value = "/dbObjectList", method = RequestMethod.POST)
@ResponseBody
public ResponseResult dbObjectList(DatabaseParamInfo databaseParamInfo, HttpServletRequest req) throws Exception {
if (databaseParamInfo.isRefresh()) {
String cacheKey = CacheUtils.getObjectTypeKey(databaseParamInfo);
Cache tableMetaCache = cacheManager.getCache(CacheInfo.CacheType.OBJECT_TYPE_METADATA.getCacheName());
ValueWrapper value = tableMetaCache.get(cacheKey);
if (value != null && databaseParamInfo.getObjectNames() != null && databaseParamInfo.getObjectNames().length > 0) {
ResponseResult objValue = (ResponseResult) value.get();
ResponseResult result = databaseServiceImpl.dbObjectList(databaseParamInfo);
List<BaseObjectInfo> resultItems = result.getItems();
HashMap<String, BaseObjectInfo> newItemInfos = new HashMap<String, BaseObjectInfo>();
resultItems.stream().forEach(item -> {
newItemInfos.put(item.getName(), item);
});
List<BaseObjectInfo> cacheItems = objValue.getItems();
cacheItems = cacheItems.stream().map(item -> {
if (newItemInfos.containsKey(item.getName())) {
return newItemInfos.get(item.getName());
}
return item;
}).collect(Collectors.toList());
objValue.setItemList(cacheItems);
;
tableMetaCache.put(cacheKey, objValue);
return objValue;
} else {
tableMetaCache.evict(cacheKey);
}
}
return databaseServiceImpl.dbObjectList(databaseParamInfo);
}
Aggregations