[Minor] Added PolicyContainer.getPolicyDef(Class)
This commit is contained in:
parent
a7a33e4e0c
commit
d385025609
|
@ -129,6 +129,11 @@ public class Order extends AbstractStrolchRootElement implements StrolchRootElem
|
|||
return this.policyDefs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyDef getPolicyDef(Class<?> clazz) {
|
||||
return getPolicyDefs().getPolicyDef(clazz.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyDef getPolicyDef(String type) {
|
||||
return getPolicyDefs().getPolicyDef(type);
|
||||
|
|
|
@ -47,6 +47,16 @@ public interface PolicyContainer {
|
|||
*/
|
||||
public PolicyDef getPolicyDef(String type);
|
||||
|
||||
/**
|
||||
* Returns the {@link PolicyDef} for the given class
|
||||
*
|
||||
* @param clazz
|
||||
* the type of policy def to return
|
||||
*
|
||||
* @return the policy def of the given class
|
||||
*/
|
||||
public PolicyDef getPolicyDef(Class<?> clazz);
|
||||
|
||||
/**
|
||||
* Set the reference to the {@link PolicyDefs}
|
||||
*
|
||||
|
|
|
@ -162,6 +162,11 @@ public class Resource extends AbstractStrolchRootElement implements StrolchRootE
|
|||
return this.policyDefs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyDef getPolicyDef(Class<?> clazz) {
|
||||
return getPolicyDefs().getPolicyDef(clazz.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyDef getPolicyDef(String type) {
|
||||
return getPolicyDefs().getPolicyDef(type);
|
||||
|
|
|
@ -122,6 +122,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
|
|||
|
||||
/**
|
||||
* @param resourceType
|
||||
* the resource type
|
||||
*/
|
||||
public void setResourceType(String resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
|
@ -137,7 +138,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
|
|||
}
|
||||
|
||||
/**
|
||||
* @param add
|
||||
* @param change
|
||||
* <code>IValueChange</code> to be applied to the <code>Resource</code>
|
||||
*
|
||||
* @return <tt>true</tt> (as specified by {@link Collection#add})
|
||||
|
@ -212,6 +213,11 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
|
|||
return this.policyDefs != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyDef getPolicyDef(Class<?> clazz) {
|
||||
return getPolicyDefs().getPolicyDef(clazz.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPolicyDef(String type) {
|
||||
return this.policyDefs != null && policyDefs.hasPolicyDef(type);
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
*/
|
||||
package li.strolch.model.activity;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.exception.StrolchModelException;
|
||||
import li.strolch.exception.StrolchPolicyException;
|
||||
|
@ -27,11 +32,6 @@ import li.strolch.model.visitor.IActivityElementVisitor;
|
|||
import li.strolch.model.visitor.StrolchElementVisitor;
|
||||
import li.strolch.utils.dbc.DBC;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Parameterized object grouping a collection of {@link Activity} and {@link Action} objects defining the process to be
|
||||
* scheduled
|
||||
|
@ -143,6 +143,7 @@ public class Activity extends AbstractStrolchRootElement
|
|||
* add an activity element to the <code>LinkedHashMap</code> of <code>IActivityElements</code>
|
||||
*
|
||||
* @param activityElement
|
||||
*
|
||||
* @return the element added
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -186,6 +187,7 @@ public class Activity extends AbstractStrolchRootElement
|
|||
*
|
||||
* @param id
|
||||
* the id of the <code>IActivityElement</code>
|
||||
*
|
||||
* @return IActivityElement
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -419,6 +421,11 @@ public class Activity extends AbstractStrolchRootElement
|
|||
return this.policyDefs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyDef getPolicyDef(Class<?> clazz) {
|
||||
return getPolicyDefs().getPolicyDef(clazz.getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyDef getPolicyDef(String type) {
|
||||
return getPolicyDefs().getPolicyDef(type);
|
||||
|
|
Loading…
Reference in New Issue