@Override public DashboardEntity create(DashboardEntity entity) { Preconditions.checkNotNull(entity, "Entity should not be null"); entity.ensureDefault(); try { int retCode = queryService.insert(CREATE_SQL, Collections.singletonList(entity), DASHBOARD_SERIALIZER); if (retCode > 0) { return entity; } else { throw new SQLException("Insertion returned: " + retCode); } } catch (SQLException e) { LOGGER.error("Error to insert entity {} (entity: {}): {}", CREATE_SQL, entity.toString(), e.getMessage(), e); throw new IllegalArgumentException("SQL execution error:" + e.getMessage(), e); } }
@Override public synchronized DashboardEntity create(DashboardEntity entity) { Preconditions.checkNotNull(entity, "DashboardEntity is null"); Preconditions.checkArgument(entity.getUuid() == null, "Dashboard Entity uuid should be null"); entity.ensureDefault(); try { Preconditions.checkArgument(getByUUIDOrName(entity.getUuid(), entity.getName()) == null, "Duplicated dashboard name"); } catch (EntityNotFoundException e) { // ignore } dashboardEntityMap.put(entity.getUuid(), entity); return entity; }
LOGGER.warn("modifiedTime is not updatable but provided: {}, ignore", current.getModifiedTime()); current.ensureDefault(); try { if (!queryService.execute(UPDATE_SQL, current, DASHBOARD_SERIALIZER)) {
LOGGER.warn("modifiedTime is not updatable but provided: {}, ignore", current.getModifiedTime()); current.ensureDefault(); dashboardEntityMap.put(current.getUuid(), current); return current;