diff --git a/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedElementMap.java b/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedElementMap.java index f35c4db75..20b1f04e0 100644 --- a/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedElementMap.java +++ b/li.strolch.agent/src/main/java/li/strolch/agent/impl/CachedElementMap.java @@ -185,7 +185,7 @@ public abstract class CachedElementMap extends Tra throws StrolchException { T t = getDbDao(tx).queryBy(type, id, version); if (assertExists && t == null) { - String msg = "The element with type {0} and id {1} and version {2} does not exist!"; //$NON-NLS-1$ + String msg = "The element with type '{0}' and id '{1}' and version '{2}' does not exist!"; //$NON-NLS-1$ msg = MessageFormat.format(msg, type, id, version); throw new StrolchException(msg); } diff --git a/li.strolch.agent/src/main/java/li/strolch/agent/impl/TransientElementMap.java b/li.strolch.agent/src/main/java/li/strolch/agent/impl/TransientElementMap.java index 7c45d13a0..dd590385a 100644 --- a/li.strolch.agent/src/main/java/li/strolch/agent/impl/TransientElementMap.java +++ b/li.strolch.agent/src/main/java/li/strolch/agent/impl/TransientElementMap.java @@ -87,7 +87,7 @@ public abstract class TransientElementMap implemen T t = getBy(tx, StrolchConstants.TEMPLATE, type); if (assertExists && t == null) { - String msg = "The template with type {0} does not exist!"; //$NON-NLS-1$ + String msg = "The template with type '{0}' does not exist!"; //$NON-NLS-1$ throw new StrolchException(MessageFormat.format(msg, type)); } @@ -116,7 +116,7 @@ public abstract class TransientElementMap implemen } if (assertExists && t == null) { - String msg = "The element with type {0} and id {1} does not exist!"; //$NON-NLS-1$ + String msg = "The element with type '{0}' and id '{1}' does not exist!"; //$NON-NLS-1$ throw new StrolchException(MessageFormat.format(msg, type, id)); } @@ -135,7 +135,7 @@ public abstract class TransientElementMap implemen String id = refP.getValue(); 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$ + 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; @@ -153,7 +153,7 @@ public abstract class TransientElementMap implemen .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$ + 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; @@ -256,7 +256,7 @@ public abstract class TransientElementMap implemen // assert no object already exists with this id if (byType.containsKey(element.getId())) { - String msg = "An element already exists with the id {0}. Elements of the same class must always have a unique id, regardless of their type!"; //$NON-NLS-1$ + String msg = "An element already exists with the id '{0}'. Elements of the same class must always have a unique id, regardless of their type!"; //$NON-NLS-1$ msg = MessageFormat.format(msg, element.getId()); throw new StrolchPersistenceException(msg); } @@ -280,7 +280,7 @@ public abstract class TransientElementMap implemen // assert no object already exists with this id if (byType.containsKey(element.getId())) { - String msg = "An element already exists with the id {0}. Elements of the same class must always have a unique id, regardless of their type!"; //$NON-NLS-1$ + String msg = "An element already exists with the id '{0}'. Elements of the same class must always have a unique id, regardless of their type!"; //$NON-NLS-1$ msg = MessageFormat.format(msg, element.getId()); throw new StrolchPersistenceException(msg); } @@ -306,14 +306,14 @@ public abstract class TransientElementMap implemen private void internalUpdate(StrolchTransaction tx, T element) { Map byType = this.elementMap.get(element.getType()); if (byType == null) { - String msg = "The element does not yet exist with the type {0} and id {1}. Use add() for new objects!"; //$NON-NLS-1$ + String msg = "The element does not yet exist with the type '{0}' and id '{1}'. Use add() for new objects!"; //$NON-NLS-1$ msg = MessageFormat.format(msg, element.getType(), element.getId()); throw new StrolchPersistenceException(msg); } // assert no object already exists with this id if (!byType.containsKey(element.getId())) { - String msg = "The element does not yet exist with the type {0} and id {1}. Use add() for new objects!"; //$NON-NLS-1$ + String msg = "The element does not yet exist with the type '{0}' and id '{1}'. Use add() for new objects!"; //$NON-NLS-1$ msg = MessageFormat.format(msg, element.getType(), element.getId()); throw new StrolchPersistenceException(msg); } diff --git a/li.strolch.agent/src/main/java/li/strolch/persistence/api/AbstractTransaction.java b/li.strolch.agent/src/main/java/li/strolch/persistence/api/AbstractTransaction.java index 82f7ba909..7fc6c897e 100644 --- a/li.strolch.agent/src/main/java/li/strolch/persistence/api/AbstractTransaction.java +++ b/li.strolch.agent/src/main/java/li/strolch/persistence/api/AbstractTransaction.java @@ -613,6 +613,11 @@ public abstract class AbstractTransaction implements StrolchTransaction { DBC.PRE.assertNotNull("refP", refP); ElementMapHelpers.assertIsRefParam(INTERPRETATION_ORDER_REF, refP); + if (assertExists && refP.isEmpty()) { + String msg = "The Order with type '{0}' and id '{1}' does not exist for param '{2}'"; //$NON-NLS-1$ + throw new StrolchException(MessageFormat.format(msg, refP.getUom(), refP.getValue(), refP.getLocator())); + } + Order element = getElementFromFilter(Tags.ORDER, Order.locatorFor(refP.getUom(), refP.getValue())); if (element != null) return element; @@ -684,6 +689,11 @@ public abstract class AbstractTransaction implements StrolchTransaction { DBC.PRE.assertNotNull("refP", refP); ElementMapHelpers.assertIsRefParam(INTERPRETATION_RESOURCE_REF, refP); + if (assertExists && refP.isEmpty()) { + String msg = "The Resource with type '{0}' and id '{1}' does not exist for param '{2}'"; //$NON-NLS-1$ + throw new StrolchException(MessageFormat.format(msg, refP.getUom(), refP.getValue(), refP.getLocator())); + } + Resource element = getElementFromFilter(Tags.RESOURCE, Resource.locatorFor(refP.getUom(), refP.getValue())); if (element != null) return element; @@ -767,6 +777,11 @@ public abstract class AbstractTransaction implements StrolchTransaction { DBC.PRE.assertNotNull("refP", refP); ElementMapHelpers.assertIsRefParam(INTERPRETATION_ACTIVITY_REF, refP); + if (assertExists && refP.isEmpty()) { + String msg = "The Activity with type '{0}' and id '{1}' does not exist for param '{2}'"; //$NON-NLS-1$ + throw new StrolchException(MessageFormat.format(msg, refP.getUom(), refP.getValue(), refP.getLocator())); + } + Activity element = getElementFromFilter(Tags.ACTIVITY, Activity.locatorFor(refP.getUom(), refP.getValue())); if (element != null) return element;