use of org.springframework.transaction.support.TransactionCallbackWithoutResult in project ma-modules-public by infiniteautomation.
the class MaintenanceEventDao method deleteMaintenanceEvent.
public void deleteMaintenanceEvent(final int maintenanceEventId) {
MaintenanceEventVO me = getMaintenanceEvent(maintenanceEventId);
final ExtendedJdbcTemplate ejt2 = ejt;
if (me != null) {
getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
ejt2.update("delete from eventHandlersMapping where eventTypeName=? and eventTypeRef1=?", new Object[] { MaintenanceEventType.TYPE_NAME, maintenanceEventId });
ejt2.update("delete from maintenanceEvents where id=?", new Object[] { maintenanceEventId });
}
});
AuditEventType.raiseDeletedEvent(AuditEvent.TYPE_NAME, me);
}
}
use of org.springframework.transaction.support.TransactionCallbackWithoutResult in project ma-modules-public by infiniteautomation.
the class GraphicalViewDao method saveView.
public void saveView(final GraphicalView view) {
getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
// Decide whether to insert or update.
if (view.getId() == Common.NEW_ID)
insertView(view);
else
updateView(view);
}
});
}
use of org.springframework.transaction.support.TransactionCallbackWithoutResult in project otter by alibaba.
the class CanalServiceImpl method modify.
/**
* 修改
*/
public void modify(final Canal canal) {
Assert.assertNotNull(canal);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
CanalDO canalDo = modelToDo(canal);
if (canalDao.checkUnique(canalDo)) {
canalDao.update(canalDo);
} else {
String exceptionCause = "exist the same repeat canal in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## modify canal(" + canal.getId() + ") has an exception!");
throw new ManagerException(e);
}
}
});
}
use of org.springframework.transaction.support.TransactionCallbackWithoutResult in project otter by alibaba.
the class ChannelServiceImpl method create.
/**
* 添加Channel
*/
public void create(final Channel channel) {
Assert.assertNotNull(channel);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
ChannelDO channelDo = modelToDo(channel);
channelDo.setId(0L);
if (!channelDao.checkUnique(channelDo)) {
String exceptionCause = "exist the same name channel in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
channelDao.insert(channelDo);
arbitrateManageService.channelEvent().init(channelDo.getId());
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## create channel has an exception ", e);
throw new ManagerException(e);
}
}
});
}
use of org.springframework.transaction.support.TransactionCallbackWithoutResult in project otter by alibaba.
the class ChannelServiceImpl method remove.
/**
* 删除Channel
*/
public void remove(final Long channelId) {
Assert.assertNotNull(channelId);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
arbitrateManageService.channelEvent().destory(channelId);
channelDao.delete(channelId);
} catch (Exception e) {
logger.error("ERROR ## remove channel has an exception ", e);
throw new ManagerException(e);
}
}
});
}
Aggregations