/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2022 Nordix Foundation.
+ * Copyright (C) 2019-2023 Nordix Foundation.
* Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.models.tosca.authorative.provider;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response.Status;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
import lombok.NonNull;
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.models.base.PfConceptKey;
* @return the node templates found
* @throws PfModelException on errors getting tosca node templates
*/
- public List<Map<PfConceptKey, ToscaNodeTemplate>> getToscaNodeTemplate(
+ public List<ToscaNodeTemplate> getToscaNodeTemplate(
@NonNull final PfDao dao, final String name, final String version)
throws PfModelException {
LOGGER.debug("->getNodeTemplate: name={}, version={}", name, version);
- List<Map<PfConceptKey, ToscaNodeTemplate>> nodeTemplates = new ArrayList<>();
+ List<ToscaNodeTemplate> nodeTemplates = new ArrayList<>();
synchronized (providerLockObject) {
new SimpleToscaProvider().getToscaNodeTemplates(dao, name, version)
- .getConceptMap().forEach((key, value) -> nodeTemplates.add(Map.of(key, value.toAuthorative())));
+ .getConceptMap().forEach((key, value) -> nodeTemplates.add(value.toAuthorative()));
}
LOGGER.debug("<-getNodeTemplate: name={}, version={}, nodeTemplates={}", name, version,
private <T> List<T> asConceptList(final List<Map<String, T>> listOfMaps) {
List<T> returnList = new ArrayList<>();
for (Map<String, T> conceptMap : listOfMaps) {
- for (T concept : conceptMap.values()) {
- returnList.add(concept);
- }
+ returnList.addAll(conceptMap.values());
}
return returnList;