Merge branch 'rel-1.4.1' into dev-1.4
This commit is contained in:
commit
8dd687d530
2 changed files with 9 additions and 3 deletions
|
@ -12,6 +12,9 @@ import java.util.Collection;
|
|||
import java.util.Map;
|
||||
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.model.EntityKey;
|
||||
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. */
|
||||
public interface AdditionalAttributesDAO {
|
||||
|
||||
Logger log = LoggerFactory.getLogger(AdditionalAttributesDAO.class);
|
||||
|
||||
/** Use this to get all additional attribute records for a specific entity.
|
||||
*
|
||||
* @param type the entity type
|
||||
|
@ -85,8 +90,9 @@ public interface AdditionalAttributesDAO {
|
|||
|
||||
return Result.tryCatch(() -> attributes.entrySet()
|
||||
.stream()
|
||||
.map(attr -> saveAdditionalAttribute(type, entityId, attr.getKey(), attr.getValue()))
|
||||
.flatMap(Result::onErrorLogAndSkip)
|
||||
.map(attr -> saveAdditionalAttribute(type, entityId, attr.getKey(), attr.getValue())
|
||||
.onError(error -> log.warn("Failed to save additional attribute: ", error.getMessage())))
|
||||
.flatMap(Result::skipOnError)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public class AdditionalAttributesDAOImpl implements AdditionalAttributesDAO {
|
|||
|
||||
if (value == null) {
|
||||
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()) {
|
||||
|
|
Loading…
Reference in a new issue