return getDao().getStructureDao().getById(id);
}
@Override
public ServiceResponse save(Map<String, String> vo) {
StructureEntity entity = null;
if (!StringUtils.isEmpty(vo.get("id"))) {
entity = getDao().getStructureDao().getById(Long.valueOf(
vo.get("id")));
}
if (entity == null) {
entity = new StructureEntity();
}
entity.setTitle(vo.get("title"));
entity.setContent(vo.get("content"));
List<String> errors = getBusiness().getStructureBusiness()
.validateBeforeUpdate(entity);
if (errors.isEmpty()) {
getDao().getStructureDao().save(entity);
return ServiceResponse.createSuccessResponse(entity.getId()
.toString());
}
else {
return ServiceResponse.createErrorResponse(
Messages.get("errors_occured"), errors);