-/*
+/*-
  * ============LICENSE_START=======================================================
  * ONAP PAP
  * ================================================================================
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter.ToscaPolicyFilterBuilder;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter.ToscaTypedEntityFilterBuilder;
 import org.onap.policy.pap.main.notification.DeploymentStatus;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
     private static final Logger logger = LoggerFactory.getLogger(SessionData.class);
 
     /**
-     * If a version string matches this, then it is just a prefix (i.e., major or
-     * major.minor).
+     * If a version string matches this, then it is just a prefix (i.e., major or major.minor).
      */
     private static final Pattern VERSION_PREFIX_PAT = Pattern.compile("[^.]+(?:[.][^.]+)?");
 
     private final PolicyModelsProvider dao;
 
     /**
-     * Maps a group name to its group data. This accumulates the set of groups to be
-     * created and updated when the REST call completes.
+     * Maps a group name to its group data. This accumulates the set of groups to be created and updated when the REST
+     * call completes.
      */
     private final Map<String, GroupData> groupCache = new HashMap<>();
 
     /**
-     * Maps a policy type to the list of matching groups. Every group appearing within
-     * this map has a corresponding entry in {@link #groupCache}.
+     * Maps a policy type to the list of matching groups. Every group appearing within this map has a corresponding
+     * entry in {@link #groupCache}.
      */
     private final Map<ToscaConceptIdentifier, List<GroupData>> type2groups = new HashMap<>();
 
     }
 
     /**
-     * Gets the policy type, referenced by an identifier. Loads it from the cache, if
-     * possible. Otherwise, gets it from the DB.
+     * Gets the policy type, referenced by an identifier. Loads it from the cache, if possible. Otherwise, gets it from
+     * the DB.
      *
      * @param desiredType policy type identifier
      * @return the specified policy type
     }
 
     /**
-     * Gets the policy, referenced by an identifier. Loads it from the cache, if possible.
-     * Otherwise, gets it from the DB.
+     * Gets the policy, referenced by an identifier. Loads it from the cache, if possible. Otherwise, gets it from the
+     * DB.
      *
      * @param desiredPolicy policy identifier
      * @return the specified policy
 
         ToscaPolicy policy = policyCache.get(desiredPolicy);
         if (policy == null) {
-            ToscaPolicyFilterBuilder filterBuilder = ToscaPolicyFilter.builder().name(desiredPolicy.getName());
+            ToscaTypedEntityFilterBuilder<ToscaPolicy> filterBuilder =
+                    ToscaTypedEntityFilter.<ToscaPolicy>builder().name(desiredPolicy.getName());
             setPolicyFilterVersion(filterBuilder, desiredPolicy.getVersion());
 
             List<ToscaPolicy> lst = dao.getFilteredPolicyList(filterBuilder.build());
      * @param filterBuilder filter builder whose version should be set
      * @param desiredVersion desired version
      */
-    private void setPolicyFilterVersion(ToscaPolicyFilterBuilder filterBuilder, String desiredVersion) {
+    private void setPolicyFilterVersion(ToscaTypedEntityFilterBuilder<ToscaPolicy> filterBuilder,
+            String desiredVersion) {
 
         if (desiredVersion == null) {
             // no version specified - get the latest
-            filterBuilder.version(ToscaPolicyFilter.LATEST_VERSION);
+            filterBuilder.version(ToscaTypedEntityFilter.LATEST_VERSION);
 
         } else if (isVersionPrefix(desiredVersion)) {
             // version prefix provided - match the prefix and then pick the latest
-            filterBuilder.versionPrefix(desiredVersion + ".").version(ToscaPolicyFilter.LATEST_VERSION);
+            filterBuilder.versionPrefix(desiredVersion + ".").version(ToscaTypedEntityFilter.LATEST_VERSION);
 
         } else {
             // must be an exact match
      * Determines if a version contains only a prefix.
      *
      * @param version version to inspect
-     * @return {@code true} if the version contains only a prefix, {@code false} if it is
-     *         fully qualified
+     * @return {@code true} if the version contains only a prefix, {@code false} if it is fully qualified
      */
     public static boolean isVersionPrefix(String version) {
         return VERSION_PREFIX_PAT.matcher(version).matches();
     }
 
     /**
-     * Adds an update and state-change to the sets, replacing any previous entries for the
-     * given PDP.
+     * Adds an update and state-change to the sets, replacing any previous entries for the given PDP.
      *
      * @param update the update to be added
      * @param change the state-change to be added
         }
 
         logger.info("add update and state-change {} {} {} policies={}", update.getName(), update.getPdpGroup(),
-                        update.getPdpSubgroup(), update.getPolicies().size());
+                update.getPdpSubgroup(), update.getPolicies().size());
         pdpRequests.put(update.getName(), Pair.of(update, change));
     }
 
     /**
-     * Adds an update to the set of updates, replacing any previous entry for the given
-     * PDP.
+     * Adds an update to the set of updates, replacing any previous entry for the given PDP.
      *
      * @param update the update to be added
      */
     public void addUpdate(PdpUpdate update) {
         logger.info("add update {} {} {} policies={}", update.getName(), update.getPdpGroup(), update.getPdpSubgroup(),
-                        update.getPolicies().size());
+                update.getPolicies().size());
         pdpRequests.compute(update.getName(), (name, data) -> Pair.of(update, (data == null ? null : data.getRight())));
     }
 
     /**
-     * Adds a state-change to the set of state-change requests, replacing any previous
-     * entry for the given PDP.
+     * Adds a state-change to the set of state-change requests, replacing any previous entry for the given PDP.
      *
      * @param change the state-change to be added
      */
      */
     public List<PdpUpdate> getPdpUpdates() {
         return pdpRequests.values().stream().filter(req -> req.getLeft() != null).map(Pair::getLeft)
-                        .collect(Collectors.toList());
+                .collect(Collectors.toList());
     }
 
     /**
      */
     public List<PdpStateChange> getPdpStateChanges() {
         return pdpRequests.values().stream().filter(req -> req.getRight() != null).map(Pair::getRight)
-                        .collect(Collectors.toList());
+                .collect(Collectors.toList());
     }
 
     /**
      */
     public List<PdpGroup> getActivePdpGroupsByPolicyType(ToscaConceptIdentifier type) throws PfModelException {
         /*
-         * Cannot use computeIfAbsent() because the enclosed code throws an unchecked
-         * exception and handling that would obfuscate the code too much, thus disabling
-         * the sonar.
+         * Cannot use computeIfAbsent() because the enclosed code throws an unchecked exception and handling that would
+         * obfuscate the code too much, thus disabling the sonar.
          */
         List<GroupData> data = type2groups.get(type); // NOSONAR
         if (data == null) {
             PdpGroupFilter filter = PdpGroupFilter.builder().policyTypeList(Collections.singletonList(type))
-                            .groupState(PdpState.ACTIVE).build();
+                    .groupState(PdpState.ACTIVE).build();
 
             List<PdpGroup> groups = dao.getFilteredPdpGroups(filter);
 
 
     /**
      * Update the DB with the changes.
+     *
      * @param notification notification to which to add policy status
      *
      * @throws PfModelException if an error occurred
 
         // update existing groups
         List<GroupData> updated =
-                        groupCache.values().stream().filter(GroupData::isUpdated).collect(Collectors.toList());
+                groupCache.values().stream().filter(GroupData::isUpdated).collect(Collectors.toList());
         if (!updated.isEmpty()) {
             if (logger.isInfoEnabled()) {
                 updated.forEach(group -> logger.info("updating DB group {}", group.getGroup().getName()));
     }
 
     /**
-     * Deletes a group from the DB, immediately (i.e., without caching the request to be
-     * executed later).
+     * Deletes a group from the DB, immediately (i.e., without caching the request to be executed later).
      *
      * @param group the group to be deleted
      * @throws PfModelException if an error occurred
      * @throws PfModelException if an error occurred
      */
     protected void trackDeploy(ToscaConceptIdentifier policyId, Collection<String> pdps, String pdpGroup,
-                    String pdpType) throws PfModelException {
+            String pdpType) throws PfModelException {
         addData(policyId, pdps, pdpGroup, pdpType, true);
     }
 
      * @throws PfModelException if an error occurred
      */
     protected void trackUndeploy(ToscaConceptIdentifier policyId, Collection<String> pdps, String pdpGroup,
-                    String pdpType) throws PfModelException {
+            String pdpType) throws PfModelException {
         addData(policyId, pdps, pdpGroup, pdpType, false);
     }
 
      *
      * @param policyId ID of the policy being deployed/undeployed
      * @param pdps PDPs to which the policy is being deployed/undeployed
-     * @param deploy {@code true} if the policy is being deployed, {@code false} if
-     *        undeployed
+     * @param deploy {@code true} if the policy is being deployed, {@code false} if undeployed
      * @param pdpGroup PdpGroup containing the PDP of interest
      * @param pdpType PDP type (i.e., PdpSubGroup) containing the PDP of interest
      * @throws PfModelException if an error occurred
      */
     private void addData(ToscaConceptIdentifier policyId, Collection<String> pdps, String pdpGroup, String pdpType,
-                    boolean deploy) throws PfModelException {
+            boolean deploy) throws PfModelException {
 
         // delete all records whose "deploy" flag is the opposite of what we want
         deployStatus.deleteDeployment(policyId, !deploy);
 
-/*
+/*-
  * ============LICENSE_START=======================================================
  * ONAP PAP
  * ================================================================================
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
 import org.onap.policy.pap.main.notification.DeploymentStatus;
 
 public class TestSessionData extends ProviderSuper {
         ident.setVersion(null);
         assertSame(policy1, session.getPolicy(ident));
 
-        ToscaPolicyFilter filter = getPolicyFilter();
+        ToscaTypedEntityFilter<ToscaPolicy> filter = getPolicyFilter();
         assertEquals(POLICY_NAME, filter.getName());
-        assertEquals(ToscaPolicyFilter.LATEST_VERSION, filter.getVersion());
+        assertEquals(ToscaTypedEntityFilter.LATEST_VERSION, filter.getVersion());
         assertEquals(null, filter.getVersionPrefix());
 
         // retrieve a second time using full version - should use cache
         ident.setVersion("1");
         assertSame(policy1, session.getPolicy(ident));
 
-        ToscaPolicyFilter filter = getPolicyFilter();
+        ToscaTypedEntityFilter<ToscaPolicy> filter = getPolicyFilter();
         assertEquals(POLICY_NAME, filter.getName());
-        assertEquals(ToscaPolicyFilter.LATEST_VERSION, filter.getVersion());
+        assertEquals(ToscaTypedEntityFilter.LATEST_VERSION, filter.getVersion());
         assertEquals("1.", filter.getVersionPrefix());
 
         // retrieve a second time using full version - should use cache
         ident.setVersion(POLICY_VERSION);
         assertSame(policy1, session.getPolicy(ident));
 
-        ToscaPolicyFilter filter = getPolicyFilter();
+        ToscaTypedEntityFilter<ToscaPolicy> filter = getPolicyFilter();
         assertEquals(POLICY_NAME, filter.getName());
         assertEquals(POLICY_VERSION, filter.getVersion());
         assertEquals(null, filter.getVersionPrefix());
         PdpUpdate update = makeUpdate(PDP1);
         PdpStateChange change = makeStateChange(PDP2);
         assertThatIllegalArgumentException().isThrownBy(() -> session.addRequests(update, change))
-                        .withMessage("PDP name mismatch pdp_1, pdp_2");
+                .withMessage("PDP name mismatch pdp_1, pdp_2");
     }
 
     @Test
 
         // cannot overwrite
         assertThatIllegalStateException().isThrownBy(() -> session.create(group1))
-                        .withMessage("group already cached: groupA");
+                .withMessage("group already cached: groupA");
     }
 
     @Test
         when(dao.getFilteredPdpGroups(any())).thenReturn(Arrays.asList(group1));
 
         assertThatIllegalStateException().isThrownBy(() -> session.update(new PdpGroup(group1)))
-                        .withMessage("group not cached: groupA");
+                .withMessage("group not cached: groupA");
     }
 
     @Test
         testTrack(false);
     }
 
-    protected void testTrack(boolean deploy)
-                    throws PfModelException {
+    protected void testTrack(boolean deploy) throws PfModelException {
 
         DeploymentStatus status = mock(DeploymentStatus.class);
 
         return change;
     }
 
-    private ToscaPolicyFilter getPolicyFilter() throws Exception {
-        ArgumentCaptor<ToscaPolicyFilter> captor = ArgumentCaptor.forClass(ToscaPolicyFilter.class);
+    private ToscaTypedEntityFilter<ToscaPolicy> getPolicyFilter() throws Exception {
+        @SuppressWarnings("unchecked")
+        ArgumentCaptor<ToscaTypedEntityFilter<ToscaPolicy>> captor =
+                ArgumentCaptor.forClass(ToscaTypedEntityFilter.class);
         verify(dao).getFilteredPolicyList(captor.capture());
 
         return captor.getValue();