use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMatrixServiceImpl method modelToDo.
/**
* 用于Model对象转化为DO对象
*/
private DataMatrixDO modelToDo(DataMatrix matrix) {
DataMatrixDO matrixDo = new DataMatrixDO();
try {
matrixDo.setId(matrix.getId());
matrixDo.setGroupKey(matrix.getGroupKey());
matrixDo.setDescription(matrix.getDescription());
matrixDo.setMaster(matrix.getMaster());
matrixDo.setSlave(matrix.getSlave());
matrixDo.setGmtCreate(matrix.getGmtCreate());
matrixDo.setGmtModified(matrix.getGmtModified());
} catch (Exception e) {
logger.error("ERROR ## change the matrix Model to Do has an exception");
throw new ManagerException(e);
}
return matrixDo;
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMatrixServiceImpl method remove.
/**
* 删除
*/
public void remove(final Long matrixId) {
Assert.assertNotNull(matrixId);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
dataMatrixDao.delete(matrixId);
} catch (Exception e) {
logger.error("ERROR ## remove canal(" + matrixId + ") has an exception!");
throw new ManagerException(e);
}
}
});
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMediaSourceServiceImpl method modify.
/**
* 修改
*/
public void modify(DataMediaSource dataMediaSource) {
Assert.assertNotNull(dataMediaSource);
try {
DataMediaSourceDO dataMediaSourceDo = modelToDo(dataMediaSource);
if (dataMediaSourceDao.checkUnique(dataMediaSourceDo)) {
dataMediaSourceDao.update(dataMediaSourceDo);
} else {
String exceptionCause = "exist the same name source in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## modify dataMediaSource has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class DataMediaSourceServiceImpl method create.
/**
* 添加
*/
public void create(DataMediaSource dataMediaSource) {
Assert.assertNotNull(dataMediaSource);
try {
DataMediaSourceDO dataMediaSourceDo = modelToDo(dataMediaSource);
dataMediaSourceDo.setId(0L);
if (!dataMediaSourceDao.checkUnique(dataMediaSourceDo)) {
String exceptionCause = "exist the same name source in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
dataMediaSourceDao.insert(dataMediaSourceDo);
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## create dataMediaSource has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.common.exceptions.ManagerException in project otter by alibaba.
the class NodeServiceImpl method remove.
/**
* 删除
*/
public void remove(final Long nodeId) {
Assert.assertNotNull(nodeId);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
nodeDao.delete(nodeId);
} catch (Exception e) {
logger.error("ERROR ## remove node(" + nodeId + ") has an exception!");
throw new ManagerException(e);
}
}
});
}
Aggregations