[Minor] Fixed logging in CachedElementMap
This commit is contained in:
parent
875c9dd27f
commit
6328827f9e
|
@ -1,12 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -163,7 +163,16 @@ public abstract class CachedElementMap<T extends StrolchRootElement> implements
|
||||||
String type = refP.getUom();
|
String type = refP.getUom();
|
||||||
List<String> ids = refP.getValue();
|
List<String> ids = refP.getValue();
|
||||||
|
|
||||||
return ids.stream().map(id -> getBy(tx, type, id, assertExists)).filter(Objects::nonNull)
|
return ids.stream() //
|
||||||
|
.map(id -> {
|
||||||
|
T t = getBy(tx, type, id, false);
|
||||||
|
if (assertExists && t == null) {
|
||||||
|
String msg = "The element with type {0} and id {1} does not exist for param {2}"; //$NON-NLS-1$
|
||||||
|
throw new StrolchException(MessageFormat.format(msg, type, id, refP.getLocator()));
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}) //
|
||||||
|
.filter(Objects::nonNull) //
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +379,7 @@ public abstract class CachedElementMap<T extends StrolchRootElement> implements
|
||||||
@Override
|
@Override
|
||||||
public T revertToVersion(StrolchTransaction tx, String type, String id, int version) throws StrolchException {
|
public T revertToVersion(StrolchTransaction tx, String type, String id, int version) throws StrolchException {
|
||||||
if (!this.realm.isVersioningEnabled()) {
|
if (!this.realm.isVersioningEnabled()) {
|
||||||
throw new StrolchPersistenceException("Can not und a version if versioning is not enabled!");
|
throw new StrolchPersistenceException("Can not undo a version if versioning is not enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the current and specified version
|
// get the current and specified version
|
||||||
|
@ -393,7 +402,7 @@ public abstract class CachedElementMap<T extends StrolchRootElement> implements
|
||||||
@Override
|
@Override
|
||||||
public void undoVersion(StrolchTransaction tx, T element) throws StrolchException {
|
public void undoVersion(StrolchTransaction tx, T element) throws StrolchException {
|
||||||
if (!this.realm.isVersioningEnabled()) {
|
if (!this.realm.isVersioningEnabled()) {
|
||||||
throw new StrolchPersistenceException("Can not und a version if versioning is not enabled!");
|
throw new StrolchPersistenceException("Can not undo a version if versioning is not enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
String type = element.getType();
|
String type = element.getType();
|
||||||
|
|
Loading…
Reference in New Issue