Merge branch 'rel-1.4.1' into dev-1.4

This commit is contained in:
anhefti 2022-11-14 15:36:26 +01:00
commit 8dd687d530
2 changed files with 9 additions and 3 deletions

View file

@ -12,6 +12,9 @@ import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.EntityType;
import ch.ethz.seb.sebserver.gbl.model.EntityKey; import ch.ethz.seb.sebserver.gbl.model.EntityKey;
import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.gbl.util.Result;
@ -23,6 +26,8 @@ import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.AdditionalAttribut
* in a separated data-base table. */ * in a separated data-base table. */
public interface AdditionalAttributesDAO { public interface AdditionalAttributesDAO {
Logger log = LoggerFactory.getLogger(AdditionalAttributesDAO.class);
/** Use this to get all additional attribute records for a specific entity. /** Use this to get all additional attribute records for a specific entity.
* *
* @param type the entity type * @param type the entity type
@ -85,8 +90,9 @@ public interface AdditionalAttributesDAO {
return Result.tryCatch(() -> attributes.entrySet() return Result.tryCatch(() -> attributes.entrySet()
.stream() .stream()
.map(attr -> saveAdditionalAttribute(type, entityId, attr.getKey(), attr.getValue())) .map(attr -> saveAdditionalAttribute(type, entityId, attr.getKey(), attr.getValue())
.flatMap(Result::onErrorLogAndSkip) .onError(error -> log.warn("Failed to save additional attribute: ", error.getMessage())))
.flatMap(Result::skipOnError)
.collect(Collectors.toList())); .collect(Collectors.toList()));
} }

View file

@ -95,7 +95,7 @@ public class AdditionalAttributesDAOImpl implements AdditionalAttributesDAO {
if (value == null) { if (value == null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"value cannot be null. Use delete to delete an additional attribute"); "value cannot be null. Use delete to delete an additional attribute: " + String.valueOf(name));
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {