diff options
author | Jim Hahn <jrh3@att.com> | 2020-08-26 16:57:52 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2020-08-27 14:29:28 -0400 |
commit | 3052f10337897ea25983f35f4158c5626febbe7d (patch) | |
tree | 19da96c57189c04f1b6dd8cf17702b7ff36f367f /controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java | |
parent | 14c9b3e48963d9283d77d140bcbe1ee4d4d24200 (diff) |
Use ToscaPolicy instead of legacy Policy
Removed usage of policy-yaml and old targetType definition.
Switched to using TOSCA operational policy classes and new
definitions for Target type enum.
Issue-ID: POLICY-2428
Change-Id: I25d1c5219764df27bdae7f2cbeb7ada7bcef4e1e
Signed-off-by: Jim Hahn <jrh3@att.com>
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java')
-rw-r--r-- | controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java index e1259e48d..f9d90af4d 100644 --- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java +++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java @@ -33,10 +33,10 @@ import org.onap.aai.domain.yang.GenericVnf; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; +import org.onap.policy.controlloop.actorserviceprovider.TargetType; import org.onap.policy.controlloop.actorserviceprovider.impl.OperationPartial; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; import org.onap.policy.controlloop.eventmanager.StepContext; -import org.onap.policy.controlloop.policy.Target; /** * An operation to get the target entity. This is a "pseudo" operation; it is not found @@ -65,7 +65,7 @@ public class GetTargetEntityOperation2 extends OperationPartial { @Override public List<String> getPropertyNames() { - String propName = detmTarget(params.getTarget()); + String propName = detmTarget(params.getTargetType()); return (propName == null ? Collections.emptyList() : List.of(propName)); } @@ -77,26 +77,22 @@ public class GetTargetEntityOperation2 extends OperationPartial { /** * Determines the target entity. * - * @param target policy target + * @param targetType policy target type * * @return the property containing the target entity, or {@code null} if the target * entity is already known */ - private String detmTarget(Target target) { + private String detmTarget(TargetType targetType) { if (stepContext.contains(OperationProperties.AAI_TARGET_ENTITY)) { // the target entity has already been determined return null; } - if (target == null) { - throw new IllegalArgumentException("The target is null"); - } - - if (target.getType() == null) { + if (targetType == null) { throw new IllegalArgumentException("The target type is null"); } - switch (target.getType()) { + switch (targetType) { case PNF: return detmPnfTarget(); case VM: |