use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException 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.common.exceptions.ManagerException 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);
}
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMediaPairServiceImpl method listByDataMediaId.
@Override
public List<DataMediaPair> listByDataMediaId(Long dataMediaId) {
Assert.assertNotNull(dataMediaId);
List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
try {
List<DataMediaPairDO> dataMediaPairDos = dataMediaPairDao.listByDataMediaId(dataMediaId);
if (dataMediaPairDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair.");
return dataMediaPairs;
}
dataMediaPairs = doToModel(dataMediaPairDos);
} catch (Exception e) {
logger.error("ERROR ## query dataMediaPairs by dataMediaId:" + dataMediaId + " has an exception!", e);
throw new ManagerException(e);
}
return dataMediaPairs;
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMediaPairServiceImpl method listByPipelineId.
/**
* 根据PipelineId找到该枝干下的所有DataMediaPairs
*/
public List<DataMediaPair> listByPipelineId(Long pipelineId) {
Assert.assertNotNull(pipelineId);
List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
try {
List<DataMediaPairDO> dataMediaPairDos = dataMediaPairDao.listByPipelineId(pipelineId);
if (dataMediaPairDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair.");
return dataMediaPairs;
}
dataMediaPairs = doToModel(dataMediaPairDos);
} catch (Exception e) {
logger.error("ERROR ## query dataMediaPairs by pipelineId:" + pipelineId + " has an exception!", e);
throw new ManagerException(e);
}
return dataMediaPairs;
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMediaPairServiceImpl method listByPipelineIdWithoutColumn.
@Override
public List<DataMediaPair> listByPipelineIdWithoutColumn(Long pipelineId) {
Assert.assertNotNull(pipelineId);
List<DataMediaPair> dataMediaPairs = new ArrayList<DataMediaPair>();
try {
List<DataMediaPairDO> dataMediaPairDos = dataMediaPairDao.listByPipelineId(pipelineId);
if (dataMediaPairDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any dataMediaPair, maybe hasn't create any dataMediaPair.");
return dataMediaPairs;
}
dataMediaPairs = doToModelWithoutOther(dataMediaPairDos);
} catch (Exception e) {
logger.error("ERROR ## query dataMediaPairs by pipelineId:" + pipelineId + " has an exception!", e);
throw new ManagerException(e);
}
return dataMediaPairs;
}
Aggregations