use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO in project otter by alibaba.
the class DataMediaPairServiceImpl method listByIds.
/*-----------------------------------查询方法,整合-----------------------------------------*/
public List<DataMediaPair> listByIds(Long... identities) {
List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
try {
List<DataMediaPairDO> dataMediaPairDos = null;
if (identities.length < 1) {
dataMediaPairDos = dataMediaPairDao.listAll();
if (dataMediaPairDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair.");
return dataMediaPairs;
}
} else {
dataMediaPairDos = dataMediaPairDao.listByMultiId(identities);
if (dataMediaPairDos.isEmpty()) {
String exceptionCause = "couldn't query any dataMediaPair by dataMediaPairIds:" + Arrays.toString(identities);
logger.error("ERROR ## " + exceptionCause);
throw new ManagerException(exceptionCause);
}
}
dataMediaPairs = doToModel(dataMediaPairDos);
} catch (Exception e) {
logger.error("ERROR ## query dataMediaPairs has an exception!", e);
throw new ManagerException(e);
}
return dataMediaPairs;
}
use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO in project otter by alibaba.
the class DataMediaPairServiceImpl method listByCondition.
@Override
public List<DataMediaPair> listByCondition(Map condition) {
List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
try {
List<DataMediaPairDO> dataMediaPairDos = dataMediaPairDao.listByCondition(condition);
if (dataMediaPairDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any DataMediaPairs by the condition:" + JsonUtils.marshalToString(condition));
return dataMediaPairs;
}
dataMediaPairs = doToModel(dataMediaPairDos);
} catch (Exception e) {
logger.error("ERROR ## query dataMediaPairs by condition has an exception!", e);
throw new ManagerException(e);
}
return dataMediaPairs;
}
use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO in project otter by alibaba.
the class DataMediaPairServiceImpl method modelToDo.
/**
* 用于Model对象转化为DO对象
*
* @param dataMediaPair
* @return DataMediaPairDO
*/
private DataMediaPairDO modelToDo(DataMediaPair dataMediaPair) {
DataMediaPairDO dataMediaPairDo = new DataMediaPairDO();
try {
dataMediaPairDo.setId(dataMediaPair.getId());
dataMediaPairDo.setPipelineId(dataMediaPair.getPipelineId());
dataMediaPairDo.setSourceDataMediaId(dataMediaPair.getSource().getId());
dataMediaPairDo.setTargetDataMediaId(dataMediaPair.getTarget().getId());
dataMediaPairDo.setFilter(JsonUtils.marshalToString(dataMediaPair.getFilterData()));
dataMediaPairDo.setResolver(JsonUtils.marshalToString(dataMediaPair.getResolverData()));
dataMediaPairDo.setPullWeight(dataMediaPair.getPullWeight());
dataMediaPairDo.setPushWeight(dataMediaPair.getPushWeight());
dataMediaPairDo.setColumnPairMode(dataMediaPair.getColumnPairMode());
dataMediaPairDo.setGmtCreate(dataMediaPair.getGmtCreate());
dataMediaPairDo.setGmtModified(dataMediaPair.getGmtModified());
} catch (Exception e) {
logger.error("ERROR ## change the dataMediaPair Model to Do has an exception", e);
throw new ManagerException(e);
}
return dataMediaPairDo;
}
use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO in project otter by alibaba.
the class DataMediaPairServiceImpl method createAndReturnId.
/**
* 添加并返回插入的id
*/
public Long createAndReturnId(DataMediaPair dataMediaPair) {
Assert.assertNotNull(dataMediaPair);
try {
DataMediaPairDO dataMediaPairDo = modelToDo(dataMediaPair);
dataMediaPairDo.setId(0L);
if (!dataMediaPairDao.checkUnique(dataMediaPairDo)) {
String exceptionCause = "exist the same pair in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
dataMediaPairDao.insert(dataMediaPairDo);
return dataMediaPairDo.getId();
} catch (RepeatConfigureException rcf) {
throw rcf;
} catch (Exception e) {
logger.error("ERROR ## create dataMediaPair has an exception!", e);
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject.DataMediaPairDO in project otter by alibaba.
the class DataMediaPairServiceImpl method createIfNotExist.
/**
* 添加并返回插入的id
*/
public boolean createIfNotExist(DataMediaPair dataMediaPair) {
Assert.assertNotNull(dataMediaPair);
try {
DataMediaPairDO dataMediaPairDo = modelToDo(dataMediaPair);
dataMediaPairDo.setId(0L);
if (!dataMediaPairDao.checkUnique(dataMediaPairDo)) {
return false;
}
dataMediaPairDao.insert(dataMediaPairDo);
return true;
} catch (Exception e) {
logger.error("ERROR ## create dataMediaPair has an exception!", e);
throw new ManagerException(e);
}
}
Aggregations