* ONAP Policy API\r
* ================================================================================\r
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.\r
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.\r
+ * Modifications Copyright (C) 2019-2021 Nordix Foundation.\r
* ================================================================================\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
import org.onap.policy.models.provider.PolicyModelsProvider;\r
import org.onap.policy.models.provider.PolicyModelsProviderFactory;\r
import org.onap.policy.models.provider.PolicyModelsProviderParameters;\r
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;\r
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;\r
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;\r
\r
/**\r
* Super class for providers that use a model provider.\r
*/\r
private List<PdpGroup> getPolicyTypeFilteredPdpGroups(PfConceptKey policyType) throws PfModelException {\r
\r
- List<ToscaPolicyTypeIdentifier> policyTypes = new ArrayList<>();\r
- policyTypes.add(new ToscaPolicyTypeIdentifier(policyType.getName(), policyType.getVersion()));\r
+ List<ToscaConceptIdentifier> policyTypes = new ArrayList<>();\r
+ policyTypes.add(new ToscaConceptIdentifier(policyType.getName(), policyType.getVersion()));\r
PdpGroupFilter pdpGroupFilter = PdpGroupFilter.builder().policyTypeList(policyTypes).groupState(PdpState.ACTIVE)\r
.pdpState(PdpState.ACTIVE).build();\r
return modelsProvider.getFilteredPdpGroups(pdpGroupFilter);\r
\r
Map<Pair<String, String>, T> deployedPolicyMap = new HashMap<>();\r
for (PdpGroup pdpGroup : pdpGroups) {\r
- List<ToscaPolicyIdentifier> policyIdentifiers = extractPolicyIdentifiers(policyId, pdpGroup, policyType);\r
+ List<ToscaConceptIdentifier> policyIdentifiers = extractPolicyIdentifiers(policyId, pdpGroup, policyType);\r
T deployedPolicies = getDeployedPolicies(policyIdentifiers, policyType, getter, consumer, data);\r
deployedPolicyMap.put(Pair.of(pdpGroup.getName(), pdpGroup.getVersion()), deployedPolicies);\r
}\r
*\r
* @throws PfModelException the PfModel parsing exception\r
*/\r
- private List<ToscaPolicyIdentifier> extractPolicyIdentifiers(String policyId, PdpGroup pdpGroup,\r
+ private List<ToscaConceptIdentifier> extractPolicyIdentifiers(String policyId, PdpGroup pdpGroup,\r
PfConceptKey policyType) throws PfModelException {\r
\r
- List<ToscaPolicyIdentifier> policyIdentifiers = new ArrayList<>();\r
+ List<ToscaConceptIdentifier> policyIdentifiers = new ArrayList<>();\r
for (PdpSubGroup pdpSubGroup : pdpGroup.getPdpSubgroups()) {\r
- for (ToscaPolicyIdentifier policyIdentifier : pdpSubGroup.getPolicies()) {\r
+ for (ToscaConceptIdentifier policyIdentifier : pdpSubGroup.getPolicies()) {\r
if (policyId.equalsIgnoreCase(policyIdentifier.getName())) {\r
policyIdentifiers.add(policyIdentifier);\r
}\r
*\r
* @throws PfModelException the PfModel parsing exception\r
*/\r
- private <T, R> T getDeployedPolicies(List<ToscaPolicyIdentifier> policyIdentifiers, PfConceptKey policyType,\r
+ private <T, R> T getDeployedPolicies(List<ToscaConceptIdentifier> policyIdentifiers, PfConceptKey policyType,\r
BiFunctionWithEx<String, String, R> getter, BiConsumer<T, R> consumer, T data) throws PfModelException {\r
\r
- for (ToscaPolicyIdentifier policyIdentifier : policyIdentifiers) {\r
+ for (ToscaConceptIdentifier policyIdentifier : policyIdentifiers) {\r
R result = getter.apply(policyIdentifier.getName(),\r
getTrimedVersionForLegacyType(policyIdentifier.getVersion(), policyType));\r
consumer.accept(data, result);\r
* ONAP Policy API
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
pdpSubGroup.setPdpType("type");
pdpSubGroup.setDesiredInstanceCount(123);
pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>());
- pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion));
+ pdpSubGroup.getSupportedPolicyTypes().add(new ToscaConceptIdentifier(policyTypeId, policyTypeVersion));
pdpGroup.getPdpSubgroups().add(pdpSubGroup);
Pdp pdp = new Pdp();
// Update pdpSubGroup
pdpSubGroup.setPolicies(new ArrayList<>());
- pdpSubGroup.getPolicies().add(new ToscaPolicyIdentifier(policyId, policyVersion));
+ pdpSubGroup.getPolicies().add(new ToscaConceptIdentifier(policyId, policyVersion));
assertEquals(1,
databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size());