use of com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO in project otter by alibaba.
the class DataMediaServiceImpl method createReturnId.
/**
* 添加
*/
@Override
public Long createReturnId(DataMedia dataMedia) {
Assert.assertNotNull(dataMedia);
try {
DataMediaDO dataMediaDo = modelToDo(dataMedia);
dataMediaDo.setId(0L);
DataMediaDO dataMediaDoInDb = dataMediaDao.checkUniqueAndReturnExist(dataMediaDo);
if (dataMediaDoInDb == null) {
dataMediaDo = dataMediaDao.insert(dataMediaDo);
} else {
dataMediaDo = dataMediaDoInDb;
}
return dataMediaDo.getId();
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## create dataMedia has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO in project otter by alibaba.
the class DataMediaServiceImpl method listByCondition.
@Override
public List<DataMedia> listByCondition(Map condition) {
List<DataMedia> dataMedias = new ArrayList<DataMedia>();
try {
List<DataMediaDO> dataMediaDos = dataMediaDao.listByCondition(condition);
if (dataMediaDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any dataMedias by the condition:" + JsonUtils.marshalToString(condition));
return dataMedias;
}
dataMedias = doToModel(dataMediaDos);
} catch (Exception e) {
logger.error("ERROR ## query dataMedias by condition has an exception!");
throw new ManagerException(e);
}
return dataMedias;
}
use of com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO in project otter by alibaba.
the class DataMediaServiceImpl method listByDataMediaSourceId.
@Override
public List<DataMedia> listByDataMediaSourceId(Long dataMediaSourceId) {
Assert.assertNotNull(dataMediaSourceId);
List<DataMediaDO> dataMediaDos = null;
try {
dataMediaDos = dataMediaDao.listByDataMediaSourceId(dataMediaSourceId);
if (dataMediaDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any dataMedia, maybe hasn't create any dataMedia.");
return new ArrayList<DataMedia>();
}
} catch (Exception e) {
logger.error("ERROR ## query dataMedias by sourceId:" + dataMediaSourceId + " has an exception!");
throw new ManagerException(e);
}
return doToModel(dataMediaDos);
}
use of com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO in project otter by alibaba.
the class DataMediaServiceImpl method modify.
/**
* 修改
*/
@Override
public void modify(DataMedia dataMedia) {
Assert.assertNotNull(dataMedia);
try {
DataMediaDO dataMediaDo = modelToDo(dataMedia);
if (dataMediaDao.checkUnique(dataMediaDo)) {
dataMediaDao.update(dataMediaDo);
} else {
String exceptionCause = "exist the same name dataMedia in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## modify dataMedia has an exception!");
throw new ManagerException(e);
}
}
use of com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject.DataMediaDO in project otter by alibaba.
the class DataMediaServiceImpl method listByIds.
@Override
public List<DataMedia> listByIds(Long... identities) {
List<DataMedia> dataMedias = new ArrayList<DataMedia>();
try {
List<DataMediaDO> dataMediaDos = null;
if (identities.length < 1) {
dataMediaDos = dataMediaDao.listAll();
if (dataMediaDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any dataMedia, maybe hasn't create any dataMedia.");
return dataMedias;
}
} else {
dataMediaDos = dataMediaDao.listByMultiId(identities);
if (dataMediaDos.isEmpty()) {
String exceptionCause = "couldn't query any dataMedia by dataMediaIds:" + Arrays.toString(identities);
logger.error("ERROR ## " + exceptionCause);
throw new ManagerException(exceptionCause);
}
}
dataMedias = doToModel(dataMediaDos);
} catch (Exception e) {
logger.error("ERROR ## query dataMedias has an exception!");
throw new ManagerException(e);
}
return dataMedias;
}
Aggregations