@Slf4j\r
public class Application {\r
\r
- static InstanceStartupDelayManager instanceStartupDelayManager = new InstanceStartupDelayManager();\r
+ static final InstanceStartupDelayManager instanceStartupDelayManager = new InstanceStartupDelayManager();\r
\r
/**\r
* The main method which serves as the entry point to the Spring Boot application.\r
final Matcher matcher = HOST_NAME_WITH_SEQUENCE_PATTERN.matcher(hostName);
final long startupDelayInMillis;
if (matcher.matches()) {
- startupDelayInMillis = Integer.valueOf(matcher.group(1)) * 2_000L;
+ startupDelayInMillis = Integer.parseInt(matcher.group(1)) * 2_000L;
log.info("Sequenced host name detected, calculated delay = {} ms", startupDelayInMillis);
} else {
startupDelayInMillis = Math.abs(hostName.hashCode() % 10_000L);
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2025 Nordix Foundation
+ * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
BATCH_RESPONSE_V1("urn:cps:org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent:1.0.0"),
SUBSCRIPTIONS_V1("urn:cps:org.onap.ncmp.events.subscription:1.0.0"),
- MOI_CHANGES_V1("urn:cps:org.onap.cps.ncmp.events.moi-changes:1.0.0"),
- INVENTORY_EVENTS_V1("urn:cps:org.onap.cps.ncmp.events:inventory-event:1.0.0"),
- CM_HANDLE_TRUST_LEVEL_V1("urn:cps:org.onap.cps.ncmp.dmi.events:cm-handle-trust-level:1.0.0");
+ INVENTORY_EVENTS_V1("urn:cps:org.onap.cps.ncmp.events:inventory-event:1.0.0");
private final String dataSchema;
*
* @param restDmiPluginRegistration the registration data
*/
+ @SuppressWarnings({"unchecked", "rawtypes"})
@Override
@Timed(value = "cps.ncmp.inventory.controller.update",
description = "Time taken to handle registration request")
*
* @return the description of the metric.
*/
+ @SuppressWarnings("UnusedReturnValue")
String description();
}
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.cpspath.parser;
+import java.io.Serial;
import lombok.Getter;
/**
*/
public class PathParsingException extends RuntimeException {
+ @Serial
private static final long serialVersionUID = 7072864354925271894L;
@Getter
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2025 Nordix Foundation
+ * Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2020-2021 Bell Canada.
* Modifications Copyright (C) 2021 Pantheon.tech
* Modifications Copyright (C) 2022-2025 TechMahindra Ltd.
* Create a dataspace.
*
* @param dataspaceName dataspace name
- * @return a {@Link ResponseEntity} of created dataspace name & {@link HttpStatus} CREATED
+ * @return a { {@code @Link} ResponseEntity } of created dataspace name & {@link HttpStatus} CREATED
*/
@Override
public ResponseEntity<String> createDataspace(@NotNull @Valid final String dataspaceName) {
* Create a dataspace without returning any response body.
*
* @param dataspaceName dataspace name
- * @return a {@Link ResponseEntity} of created dataspace name & {@link HttpStatus} CREATED
+ * @return a { {@code @Link} ResponseEntity } of created dataspace name & {@link HttpStatus} CREATED
*/
@Override
public ResponseEntity<Void> createDataspaceV2(@NotNull @Valid final String dataspaceName) {
* Delete a dataspace.
*
* @param dataspaceName name of dataspace to be deleted
- * @return a {@Link ResponseEntity} of {@link HttpStatus} NO_CONTENT
+ * @return a { {@code @Link} ResponseEntity } of {@link HttpStatus} NO_CONTENT
*/
@Override
public ResponseEntity<Void> deleteDataspace(final String apiVersion, final String dataspaceName) {
* @param dataspaceName dataspace name
* @param schemaSetName schemaset name
* @param multipartFile multipart file
- * @return a {@Link ResponseEntity} of created schemaset name & {@link HttpStatus} CREATED
+ * @return a { {@code @Link} ResponseEntity } of created schemaset name & {@link HttpStatus} CREATED
*/
@Override
public ResponseEntity<String> createSchemaSet(final String dataspaceName,
* @param dataspaceName dataspace name
* @param schemaSetName schemaset name
* @param multipartFile multipart file
- * @return a {@Link ResponseEntity} of created schema set without any response body & {@link HttpStatus} CREATED
+ * @return a { {@code @Link} ResponseEntity } of created schema set
+ * without any response body & {@link HttpStatus} CREATED
*/
@Override
@Timed(value = "cps.rest.admin.controller.schemaset.create",
* @param apiVersion api version
* @param dataspaceName dataspace name
* @param schemaSetName schemaset name
- * @return a {@Link ResponseEntity} of {@Link SchemaSetDetails} & {@link HttpStatus} OK
+ * @return a { {@code @Link} ResponseEntity } of { {@code @Link} SchemaSetDetails } & {@link HttpStatus} OK
*/
@Override
public ResponseEntity<SchemaSetDetails> getSchemaSet(final String apiVersion,
*
* @param apiVersion api version
* @param dataspaceName dataspace name
- * @return a {@Link ResponseEntity} of schema sets & {@link HttpStatus} OK
+ * @return a { {@code @Link} ResponseEntity } of schema sets & {@link HttpStatus} OK
*/
@Override
public ResponseEntity<List<SchemaSetDetails>> getSchemaSets(final String apiVersion, final String dataspaceName) {
* @param apiVersion api version
* @param dataspaceName dataspace name
* @param schemaSetName schemaset name
- * @return a {@Link ResponseEntity} of {@link HttpStatus} NO_CONTENT
+ * @return a { {@code @Link} ResponseEntity } of {@link HttpStatus} NO_CONTENT
*/
@Override
public ResponseEntity<Void> deleteSchemaSet(final String apiVersion,
* @param apiVersion api version
* @param dataspaceName dataspace name
*
- * @return a {@Link ResponseEntity} of {@link HttpStatus} NO_CONTENT
+ * @return a { {@code @Link} ResponseEntity } of {@link HttpStatus} NO_CONTENT
*/
@Override
public ResponseEntity<Void> cleanDataspace(final String apiVersion, final String dataspaceName) {
* @param apiVersion api version
* @param dataspaceName dataspace name
* @param anchorName anchor name
- * @return a {@Link ResponseEntity} of {@link HttpStatus} NO_CONTENT
+ * @return a { {@code @Link} ResponseEntity } of {@link HttpStatus} NO_CONTENT
*/
@Override
public ResponseEntity<Void> deleteAnchor(final String apiVersion,
* @param apiVersion api version
* @param dataspaceName dataspace name
* @param anchorName anchor name
- * @return a {@Link ResponseEntity} of an {@Link AnchorDetails} & {@link HttpStatus} OK
+ * @return a { {@code @Link} ResponseEntity } of an { {@code @Link} AnchorDetails } & {@link HttpStatus} OK
*/
@Override
public ResponseEntity<AnchorDetails> getAnchor(final String apiVersion,
*
* @param apiVersion api version
* @param dataspaceName dataspace name
- * @return a {@Link ResponseEntity} of all {@Link AnchorDetails} & {@link HttpStatus} OK
+ * @return a { {@code @Link} ResponseEntity } of all { {@code @Link} AnchorDetails } & {@link HttpStatus} OK
*/
@Override
public ResponseEntity<List<AnchorDetails>> getAnchors(final String apiVersion,
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
* Modifications Copyright (C) 2021 Bell Canada.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
* Modifications Copyright (C) 2025 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
*
* @param multipartFile the json file uploaded
* @return the string representation of the JSON content
- * @throws IOException if the file is null or empty
+ * @throws DataValidationException if the file is null or empty
*/
public static String extractJsonContent(final MultipartFile multipartFile, final JsonObjectMapper
byteArrayOutputStream.write(buffer, 0, numberOfBytesRead);
totalSizeEntry += numberOfBytesRead;
zipFileSizeValidator.updateTotalUncompressedSizeOfYangFilesInArchive(numberOfBytesRead);
- zipFileSizeValidator.validateCompresssionRatio(totalSizeEntry);
+ zipFileSizeValidator.validateCompressionRatio(totalSizeEntry);
}
return byteArrayOutputStream.toString(StandardCharsets.UTF_8);
}
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Bell Canada.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public class ZipFileSizeValidator {
private static final int THRESHOLD_ENTRIES = 10000;
- private static int thresholdSize = 100000000;
+ @SuppressWarnings("FieldCanBeLocal")
+ private static int THRESHOLD_SIZE = 100000000;
private static final double THRESHOLD_RATIO = 40;
private static final String INVALID_ZIP = "Invalid ZIP archive content.";
*
* @param totalEntrySize the size of the unzipped entry.
*/
- public void validateCompresssionRatio(final int totalEntrySize) {
+ public void validateCompressionRatio(final int totalEntrySize) {
final double compressionRatio = (double) totalEntrySize / compressedSize;
if (compressionRatio > THRESHOLD_RATIO) {
throw new ModelValidationException(INVALID_ZIP,
* Validate the total Size and number of entries in the zip.
*/
public void validateSizeAndEntries() {
- if (totalUncompressedSizeOfYangFilesInArchive > thresholdSize) {
+ if (totalUncompressedSizeOfYangFilesInArchive > THRESHOLD_SIZE) {
throw new ModelValidationException(INVALID_ZIP,
String.format("The total size of uncompressed yang files exceeds the CPS limit of %s bytes.",
- thresholdSize));
+ THRESHOLD_SIZE));
}
if (totalYangFileEntriesInArchive > THRESHOLD_ENTRIES) {
throw new ModelValidationException(INVALID_ZIP,
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
def 'Yang file limits in zip archive: #scenario for the bug reported in CPS-1477'() {
given: 'a yang file size (uncompressed) limit of #threshold bytes'
- ZipFileSizeValidator.thresholdSize = threshold
+ ZipFileSizeValidator.THRESHOLD_SIZE = threshold
and: 'an archive with a yang file of 1083 bytes'
def multipartFile = multipartZipFileFromResource('/yang-files-set-total-1083-bytes.zip')
when: 'attempt to extract yang files'
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Bell Canada.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
class ZipFileSizeValidatorSpec extends Specification {
- def static thresholdSize = ZipFileSizeValidator.thresholdSize
+ def static thresholdSize = ZipFileSizeValidator.THRESHOLD_SIZE
def static thresholdEntries = ZipFileSizeValidator.THRESHOLD_ENTRIES
def static thresholdRatio = ZipFileSizeValidator.THRESHOLD_RATIO
given: 'the totalEntrySize of the archive so that compression ratio is within the threshold'
int totalEntrySize = compressedFileSize * thresholdRatio - 1
when: 'the validation is performed against the threshold compression ratio'
- objectUnderTest.validateCompresssionRatio(totalEntrySize)
+ objectUnderTest.validateCompressionRatio(totalEntrySize)
then: 'validation passes and no exception is thrown'
noExceptionThrown()
}
given: 'the totalEntrySize of the archive so that compression ratio is higher than the threshold'
int totalEntrySize = compressedFileSize * thresholdRatio + 1
when: 'the validation is performed against the threshold compression ratio'
- objectUnderTest.validateCompresssionRatio(totalEntrySize)
+ objectUnderTest.validateCompressionRatio(totalEntrySize)
then: 'validation fails and exception is thrown'
thrown ModelValidationException
}
}
final AnchorEntity anchorEntity = getAnchorEntity(dataspaceName, anchorName);
return fragmentRepository.findAttributeValuesByAnchorAndCpsPath(anchorEntity, cpsPathQuery,
- cpsPathQuery.getAttributeAxisAttributeName(), queryResultLimit, targetClass);
+ queryResultLimit, targetClass);
}
@Override
return Collections.unmodifiableList(dataNodes);
}
+ @SuppressWarnings("unchecked")
private DataNode toDataNode(final FragmentEntity fragmentEntity,
final FetchDescendantsOption fetchDescendantsOption) {
final List<DataNode> childDataNodes = getChildDataNodes(fragmentEntity, fetchDescendantsOption);
return existingListElementEntity;
}
+ @SuppressWarnings("unchecked")
private String mergeLeaves(final Map<String, Serializable> updateLeaves, final String currentLeavesAsString) {
Map<String, Serializable> currentLeavesAsMap = new HashMap<>();
if (currentLeavesAsString != null) {
if (currentLeavesAsString == null) {
return "{}";
}
+ @SuppressWarnings("unchecked")
final Map<String, Serializable> sortedLeaves = jsonObjectMapper.convertJsonString(currentLeavesAsString,
TreeMap.class);
return jsonObjectMapper.asJsonString(sortedLeaves);
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class AnchorEntity implements Serializable {
+ @Serial
private static final long serialVersionUID = -8049987915308262518L;
@Id
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2023 Nordix Foundation.
+ * Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2020-2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class DataspaceEntity implements Serializable {
+ @Serial
private static final long serialVersionUID = 8395254649813051882L;
@Id
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2024 Nordix Foundation.
+ * Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
import java.io.Serializable;
import java.util.Set;
import lombok.AllArgsConstructor;
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class FragmentEntity implements Serializable {
+ @Serial
private static final long serialVersionUID = 7737669789097119667L;
@Id
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
import java.io.Serializable;
import java.util.Set;
import lombok.Getter;
@Table(name = "schema_set")
public class SchemaSetEntity implements Serializable {
+ @Serial
private static final long serialVersionUID = 6665056955069047269L;
@Id
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * Modifications Copyright (C) 2021-2023 Nordix Foundation
+ * Modifications Copyright (C) 2021-2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import jakarta.persistence.ManyToMany;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
import java.io.Serializable;
import java.util.Set;
import lombok.Getter;
@Table(name = "yang_resource")
public class YangResourceEntity implements Serializable {
+ @Serial
private static final long serialVersionUID = -4496883162142106774L;
@Id
import org.onap.cps.ri.utils.EscapeUtils;
import org.springframework.stereotype.Component;
+@SuppressWarnings("unused")
@RequiredArgsConstructor
@Component
public class FragmentQueryBuilder {
}
}
+ @SuppressWarnings("SameParameterValue")
private static <V> String substitute(final String template, final Map<String, V> valueMap) {
final StringSubstitutor stringSubstitutor = new StringSubstitutor(valueMap);
return stringSubstitutor.replace(template);
int queryResultLimit);
<T> Set<T> findAttributeValuesByAnchorAndCpsPath(AnchorEntity anchorEntity, CpsPathQuery cpsPathQuery,
- String attributeName, int queryResultLimit, Class<T> targetClass);
+ int queryResultLimit, Class<T> targetClass);
List<FragmentEntity> findByDataspaceAndCpsPath(DataspaceEntity dataspaceEntity,
CpsPathQuery cpsPathQuery, List<Long> anchorIds);
import org.onap.cps.ri.models.FragmentEntity;
import org.onap.cps.utils.JsonObjectMapper;
+@SuppressWarnings("unused")
@RequiredArgsConstructor
@Slf4j
public class FragmentRepositoryCpsPathQueryImpl implements FragmentRepositoryCpsPathQuery {
final int queryResultLimit) {
final Query query = fragmentQueryBuilder.getQueryForAnchorAndCpsPath(anchorEntity, cpsPathQuery,
queryResultLimit);
+ @SuppressWarnings("unchecked")
final List<FragmentEntity> fragmentEntities = query.getResultList();
log.debug("Fetched {} fragment entities by anchor and cps path.", fragmentEntities.size());
if (queryResultLimit > 0) {
@Transactional
public <T> Set<T> findAttributeValuesByAnchorAndCpsPath(final AnchorEntity anchorEntity,
final CpsPathQuery cpsPathQuery,
- final String attributeName,
final int queryResultLimit,
final Class<T> targetClass) {
final Query query = fragmentQueryBuilder.getQueryForAnchorAndCpsPath(anchorEntity, cpsPathQuery,
queryResultLimit);
+ @SuppressWarnings("unchecked")
final List<String> jsonResultList = query.getResultList();
return jsonResultList.stream()
.map(jsonValue -> jsonObjectMapper.convertJsonString(jsonValue, targetClass))
@Override
@Transactional
public List<FragmentEntity> findByDataspaceAndCpsPath(final DataspaceEntity dataspaceEntity,
- final CpsPathQuery cpsPathQuery, final List<Long> anchorIds) {
+ final CpsPathQuery cpsPathQuery,
+ final List<Long> anchorIds) {
final Query query = fragmentQueryBuilder.getQueryForDataspaceAndCpsPath(
dataspaceEntity, cpsPathQuery, anchorIds);
+ @SuppressWarnings("unchecked")
final List<FragmentEntity> fragmentEntities = query.getResultList();
log.debug("Fetched {} fragment entities by cps path across all anchors.", fragmentEntities.size());
return fragmentEntities;
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2025 Nordix Foundation.
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.cps.api.model.ModuleReference;
import org.springframework.transaction.annotation.Transactional;
+@SuppressWarnings("unused")
@Transactional
@RequiredArgsConstructor
public class ModuleReferenceRepositoryImpl implements ModuleReferenceQuery {
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @param commit indicator whether session will commit or rollback
*/
public void closeSession(final String sessionId, final boolean commit) {
+ Session session = null;
try {
- final Session session = getSession(sessionId);
+ session = getSession(sessionId);
if (commit) {
session.getTransaction().commit();
} else {
throw new SessionManagerException("Cannot close session",
String.format("Unable to close session with session ID '%s'", sessionId), e);
} finally {
- sessionMap.remove(sessionId);
+ if (session != null) {
+ sessionMap.remove(sessionId);
+ }
}
}
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.cps.api.exceptions;
+import java.io.Serial;
import java.util.Collection;
import java.util.Collections;
import lombok.Getter;
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class AlreadyDefinedException extends CpsAdminException {
+ @Serial
private static final long serialVersionUID = 501929839139881112L;
public static final String ALREADY_DEFINED_EXCEPTION_MESSAGE = "Already defined exception";
alreadyDefinedObjectNames = Collections.singletonList(objectName);
}
- private AlreadyDefinedException(final String objectType, final Collection<String> objectNames,
+ private AlreadyDefinedException(final Collection<String> objectNames,
final String contextName) {
super(ALREADY_DEFINED_EXCEPTION_MESSAGE,
- String.format("%d %s already exist for %s.", objectNames.size(), objectType, contextName));
+ String.format("%d data node(s) already exist for %s.", objectNames.size(), contextName));
alreadyDefinedObjectNames = objectNames;
}
}
public static AlreadyDefinedException forDataNodes(final Collection<String> xpaths, final String contextName) {
- return new AlreadyDefinedException("data node(s)", xpaths, contextName);
+ return new AlreadyDefinedException(xpaths, contextName);
}
}
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class AnchorNotFoundException extends CpsAdminException {
+ @Serial
private static final long serialVersionUID = -1821064664642194882L;
/**
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Bell Canada. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* CPS Admin exception.
*/
public class CpsAdminException extends CpsException {
+ @Serial
private static final long serialVersionUID = 5573438585188332404L;
/**
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
import lombok.Getter;
/**
*/
public class CpsException extends RuntimeException {
+ @Serial
private static final long serialVersionUID = 1592619410918497467L;
@Getter
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
public class CpsPathException extends CpsException {
+ @Serial
private static final long serialVersionUID = 1006899957127327791L;
private static final String ERROR_MESSAGE = "Error while parsing cpsPath expression";
/*
- * ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
* Copyright (C) 2021 Pantheon.tech
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* Runtime exception. Thrown when data record rejected to be deleted because it's being referenced by other data.
*/
public class DataInUseException extends CpsException {
+ @Serial
private static final long serialVersionUID = 5011830482789788314L;
/**
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* DataNode Not Found Exception. Indicates the requested data being absent.
*/
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class DataNodeNotFoundException extends DataValidationException {
+ @Serial
private static final long serialVersionUID = 7786740001662205407L;
private static final String DATANODE_NOT_FOUND = "DataNode not found";
/**
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * Modifications Copyright (C) 2020-2021 Nordix Foundation
+ * Modifications Copyright (C) 2020-2025 OpenInfra Foundation Europe.
* Modifications Copyright (C) 2020 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
public class DataValidationException extends CpsException {
+ @Serial
private static final long serialVersionUID = 7747941311132087621L;
/**
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* Runtime exception.
* Thrown when given dataspace name is rejected to be deleted because it has anchor or schemasets associated.
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class DataspaceInUseException extends DataInUseException {
+ @Serial
private static final long serialVersionUID = 4531370947720760347L;
/**
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Bell Canada. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* Dataspace Not Found Exception. Indicates the requested data being absent.
*/
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class DataspaceNotFoundException extends CpsAdminException {
+ @Serial
private static final long serialVersionUID = -1852996415384288431L;
/**
/*
* ============LICENSE_START=======================================================
- * Copyright (c) 2021 Bell Canada.
+ * Copyright (c) 2021 Bell Canada.
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
import lombok.Getter;
/**
@Getter
public class DuplicatedYangResourceException extends CpsException {
+ @Serial
private static final long serialVersionUID = 9085557087319212380L;
private final String name;
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Bell Canada. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* Yang Model Validation exception.
*/
public class ModelValidationException extends CpsException {
+ @Serial
private static final long serialVersionUID = 650368325928748496L;
/**
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.exceptions;
+import java.io.Serial;
import java.util.Collection;
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class ModuleNamesNotFoundException extends CpsAdminException {
+ @Serial
private static final long serialVersionUID = 3105694256583924137L;
/**
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* Not found in dataspace exception. Indicates the requested data being absent in a given dataspace
*/
public class NotFoundInDataspaceException extends CpsException {
+ @Serial
private static final long serialVersionUID = 3838769447129047713L;
public NotFoundInDataspaceException(final String dataspaceName, final String descriptionOfObject) {
/*
- * ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
* Copyright (C) 2021 Pantheon.tech
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* Runtime exception. Thrown when schema set record rejected to be deleted because it has anchor records associated.
*/
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class SchemaSetInUseException extends DataInUseException {
+ @Serial
private static final long serialVersionUID = -3729328573253023683L;
/**
/*
- * ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
/**
* Schema set not found exception. Indicates the schema set is not found in a given dataspace
*/
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class SchemaSetNotFoundException extends CpsAdminException {
+ @Serial
private static final long serialVersionUID = 7422782395935450035L;
/**
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
public class SessionManagerException extends CpsException {
+ @Serial
private static final long serialVersionUID = 7957090904519019500L;
/**
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.exceptions;
+import java.io.Serial;
+
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class SessionTimeoutException extends SessionManagerException {
+ @Serial
private static final long serialVersionUID = -8809577494038691360L;
public SessionTimeoutException(final String message, final String details, final Throwable cause) {
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.model;
+import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
@AllArgsConstructor
public class Anchor implements Serializable {
+ @Serial
private static final long serialVersionUID = 1464791260718603291L;
private String name;
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2022 Nordix Foundation.
+ * Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada.
* Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
package org.onap.cps.api.model;
+import java.io.Serial;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
@NoArgsConstructor
public class DataNode implements Serializable {
+ @Serial
private static final long serialVersionUID = 1482619410918597467L;
private String dataspace;
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2022 TechMahindra Ltd.
+ * Modifications (C) 2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.model;
+import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
@EqualsAndHashCode
public class Dataspace implements Serializable {
+ @Serial
private static final long serialVersionUID = 1464791062718603291L;
private String name;
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2024 Nordix Foundation
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.model;
+import java.io.Serial;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@ToString
public class ModuleDefinition extends ModuleReference {
+ @Serial
private static final long serialVersionUID = -6591435720836327732L;
private final String content;
super(moduleName, revision);
this.content = content;
}
-}
\ No newline at end of file
+}
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.model;
+import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
@AllArgsConstructor
public class ModuleReference implements Serializable {
+ @Serial
private static final long serialVersionUID = -1761408847591042599L;
private String moduleName;
private String revision;
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * Modifications Copyright (C) 2022 Nordix Foundation.
+ * Modifications Copyright (C) 2022-2025 OpenInfra Foundation Europe.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.api.model;
+import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public class SchemaSet implements Serializable {
+ @Serial
private static final long serialVersionUID = 1464791260718603291L;
private String name;
private String dataspaceName;
/**
* KafkaTemplate for legacy (non-cloud) events.
- * Note: Cloud events should be used. This will be addressed as part of https://lf-onap.atlassian.net/browse/CPS-1717.
+ * Note: Cloud events should be used. This will be addressed as part of <a href="https://lf-onap.atlassian.net/browse/CPS-1717">...</a>.
*/
private final KafkaTemplate<String, T> legacyKafkaEventTemplate;
/**
* Generic Event sender.
- * Note: Cloud events should be used. This will be addressed as part of https://lf-onap.atlassian.net/browse/CPS-1717.
+ * Note: Cloud events should be used. This will be addressed as part of <a href="https://lf-onap.atlassian.net/browse/CPS-1717">...</a>.
*
* @param topicName valid topic name
* @param eventKey message key
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Bell Canada. All rights reserved.
* Modifications Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2022-2024 Nordix Foundation.
+ * Modifications Copyright (C) 2022-2025 OpenInfra Foundation Europe.
* Modifications Copyright (C) 2022-2023 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
}
private Collection<DataNode> buildCollectionFromContainerNode() {
- final var parentDataNode = new DataNodeBuilder().withXpath(parentNodeXpath).build();
- if (containerNode.body() != null) {
- for (final NormalizedNode normalizedNode: containerNode.body()) {
- addDataNodeFromNormalizedNode(parentDataNode, normalizedNode);
- }
+ final DataNode parentDataNode = new DataNodeBuilder().withXpath(parentNodeXpath).build();
+ for (final NormalizedNode normalizedNode : containerNode.body()) {
+ addDataNodeFromNormalizedNode(parentDataNode, normalizedNode);
}
return parentDataNode.getChildDataNodes();
}
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Pantheon.tech
* Modifications Copyright (C) 2022 Bell Canada
- * Modifications Copyright (C) 2022-2025 Nordix Foundation
+ * Modifications Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @param yangTextSchemaSourceSet yangTextSchemaSourceSet
* @return YangTextSchemaSourceSet
*/
+ @SuppressWarnings("unused")
@CachePut(key = "#p0.concat('-').concat(#p1)")
@CanIgnoreReturnValue
public YangTextSchemaSourceSet updateCache(final String dataspaceName, final String schemaSetName,
* @param dataspaceName dataspace name
* @param schemaSetName schema set name
*/
+ @SuppressWarnings("unused")
@CacheEvict(key = "#p0.concat('-').concat(#p1)")
public void removeFromCache(final String dataspaceName, final String schemaSetName) {
cpsValidator.validateNameCharacters(dataspaceName);
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2022 Deutsche Telekom AG
- * Modifications Copyright (C) 2023-2024 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
* Modifications Copyright (C) 2024-2025 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* @param dataMaps List of data maps to convert
* @return XML string representation of the data maps
*/
+ @SuppressWarnings("unchecked")
@SuppressFBWarnings(value = "DCN_NULLPOINTER_EXCEPTION")
public static String convertDataMapsToXml(final Object dataMaps) {
try {
}
}
+ @SuppressWarnings("unchecked")
private static void appendList(final Document document, final Node parentNode,
final Map.Entry<String, Object> dataNodeMapEntry) {
final List<Object> dataNodeMaps = (List<Object>) dataNodeMapEntry.getValue();
}
}
+ @SuppressWarnings("unchecked")
private static void appendMap(final Document document, final Node parentNode,
final Map.Entry<String, Object> dataNodeMapEntry) {
final Element childElement = document.createElement(dataNodeMapEntry.getKey());
return writer.toString();
}
+ @SuppressWarnings("SameReturnValue")
private static DocumentBuilderFactory getDocumentBuilderFactory() {
-
if (isNewDocumentBuilderFactoryInstance) {
documentBuilderFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
documentBuilderFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
return documentBuilderFactory;
}
+ @SuppressWarnings("SameReturnValue")
private static TransformerFactory getTransformerFactory() {
-
if (isNewTransformerFactoryInstance) {
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2024 Nordix Foundation
+ * Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return Builders.containerBuilder().withChild(dataContainerChild).withNodeIdentifier(nodeIdentifier).build();
}
+ @SuppressWarnings("unchecked")
private static Collection<QName> getDataSchemaNodeIdentifiers(final SchemaContext schemaContext,
final String parentNodeXpath) {
return (Collection<QName>) getDataSchemaNodeAndIdentifiersByXpath(parentNodeXpath, schemaContext)
private static NormalizedNode getFirstChildXmlRoot(final NormalizedNode parent) {
final String rootNodeType = parent.getIdentifier().getNodeType().getLocalName();
+ @SuppressWarnings("unchecked")
final Collection<DataContainerChild> children = (Collection<DataContainerChild>) parent.body();
final Iterator<DataContainerChild> iterator = children.iterator();
NormalizedNode child = null;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.util.stream.Collectors;
import lombok.NoArgsConstructor;
import org.onap.cps.api.exceptions.ModelValidationException;
import org.onap.cps.api.model.ModuleReference;
try {
return yangParser.buildEffectiveModel();
} catch (final YangParserException yangParserException) {
- final List<String> resourceNames = yangResourceNameToContent.keySet().stream().collect(Collectors.toList());
+ final List<String> resourceNames = new ArrayList<>(yangResourceNameToContent.keySet());
Collections.sort(resourceNames);
throw new ModelValidationException("Invalid schema set.",
String.format("Effective schema context build failed for resources %s.", resourceNames),
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2021-2024 Nordix Foundation.
+ * Modifications Copyright (C) 2021-2025 OpenInfra Foundation Europe.
* Modifications Copyright (C) 2022 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
def 'Converting ContainerNode to a Collection with #scenario.'() {
expect: 'converting null to a collection returns an empty collection'
- assert objectUnderTest.withContainerNode(containerNode).buildCollection().isEmpty()
- where: 'the following container node is used'
- scenario | containerNode
- 'null object' | null
- 'object without body' | Mock(ContainerNode)
+ assert objectUnderTest.withContainerNode(null).buildCollection().isEmpty()
}
def 'Converting ContainerNode to a DataNode with unsupported Normalized Node.'() {
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2024 Nordix Foundation
+ * Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
private final Sleeper sleeper;
private static final Pattern ERROR_CODE_PATTERN = Pattern.compile("(\\d{3})");
private int decisionCounter = 0;
- // Do NOT change below to final as it needs to be set during test
+ @SuppressWarnings("CanBeFinal") // Do NOT change below to final as it needs to be set during test
private static int slowResponseTimeInSeconds = 40;
@Override
final Operation firstOperation = permissionRequest.getOperations().iterator().next();
log.info("1st Operation: {}", firstOperation.getOperation());
if (!"delete".equals(firstOperation.getOperation()) && firstOperation.getChangeRequest() == null) {
- log.warn("Change Request is required for " + firstOperation.getOperation() + " operations");
+ log.warn("Change Request is required for {} operations", firstOperation.getOperation());
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
return handleOperation(firstOperation);
final Matcher matcher = ERROR_CODE_PATTERN.matcher(targetIdentifier);
if (matcher.find()) {
final int errorCode = Integer.parseInt(matcher.group(1));
- log.warn("Stub is mocking an error response, code: " + errorCode);
+ log.warn("Stub is mocking an error response, code: {}", errorCode);
return new ResponseEntity<>(HttpStatusCode.valueOf(errorCode));
}