diff --git a/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java b/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java
index c810bf520..2bfe0f7db 100644
--- a/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java
+++ b/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java
@@ -343,6 +343,27 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
return parameter;
}
+ @Override
+ public PolicyDef findPolicy(Class> clazz, PolicyDef defaultDef) throws StrolchModelException {
+ return findPolicy(clazz.getSimpleName(), defaultDef);
+ }
+
+ @Override
+ public PolicyDef findPolicy(String className, PolicyDef defaultDef) throws StrolchModelException {
+ if (hasPolicyDef(className))
+ return getPolicyDef(className);
+
+ if (this.parent == null) {
+ if (defaultDef != null)
+ return defaultDef;
+
+ String msg = "The PolicyDef {0} does not exist";
+ throw new StrolchModelException(MessageFormat.format(msg, className));
+ }
+
+ return this.parent.findPolicy(className, defaultDef);
+ }
+
@Override
public
- * If the parameter does not exist and {@code assertExists} is true, then an + * If the parameter does not exist and {@code assertExists} is true, then a {@link StrolchModelException} is thrown *
- * - * @see GroupedParameterizedElement#getParameter(String, String, boolean) */ > T findParameter(String bagKey, String paramKey, boolean assertExists) throws StrolchModelException; + /** + *+ * Checks if this element contains the {@link PolicyDef}, or otherwise queries its parent, until the root element is + * reached. + *
+ * + *+ * If the policy def does not exist and no default policy is passed, then a {@link StrolchModelException} is thrown + *
+ * + * @param className + * the class name of the policy to find + * @param defaultDef + * default {@link PolicyDef} to return if not found + * + * @throws StrolchModelException + * if no default policy, and policy not found + */ + PolicyDef findPolicy(String className, PolicyDef defaultDef) throws StrolchModelException; + + /** + *+ * Checks if this element contains the {@link PolicyDef}, or otherwise queries its parent, until the root element is + * reached. + *
+ * + *+ * If the policy def does not exist and no default policy is passed, then a {@link StrolchModelException} is thrown + *
+ * + * @param clazz + * the class of the policy to find + * @param defaultDef + * default {@link PolicyDef} to return if not found + * + * @throws StrolchModelException + * if no default policy, and policy not found + */ + PolicyDef findPolicy(Class> clazz, PolicyDef defaultDef) throws StrolchModelException; + @Override Activity getParent(); diff --git a/li.strolch.model/src/main/java/li/strolch/model/activity/TimeOrderingVisitor.java b/li.strolch.model/src/main/java/li/strolch/model/activity/TimeOrderingVisitor.java index 21317a26e..231079866 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/activity/TimeOrderingVisitor.java +++ b/li.strolch.model/src/main/java/li/strolch/model/activity/TimeOrderingVisitor.java @@ -2,7 +2,7 @@ package li.strolch.model.activity; public interface TimeOrderingVisitor { - public void visitSeries(Activity activity); + void visitSeries(Activity activity); - public void visitParallel(Activity activity); + void visitParallel(Activity activity); }