2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2024 Ericsson
4 * Modifications Copyright (C) 2024 OpenInfra Foundation Europe
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
21 package org.oran.smo.teiv.pgsqlgenerator;
26 public class PgSchemaGeneratorException extends RuntimeException {
27 private PgSchemaGeneratorException(String errorMessage, Throwable err) {
28 super(errorMessage, err);
31 public static PgSchemaGeneratorException extractYangDataException(Exception ex) {
32 return new PgSchemaGeneratorException("Unable to load YAM!", ex);
35 public static PgSchemaGeneratorException prepareBaselineException(final String schemaName, Exception ex) { //
36 return new PgSchemaGeneratorException(String.format("%s : Failed to copy skeleton schema file!", schemaName), ex);
39 public static PgSchemaGeneratorException readBaselineException(final String schemaName, Exception ex) {
40 return new PgSchemaGeneratorException(String.format("%s : Failed to read baseline sql file!", schemaName), ex);
43 public static PgSchemaGeneratorException writeGeneratedSchemaException(final String schemaName, Exception ex) {
44 return new PgSchemaGeneratorException(String.format("%s : data writing failed!", schemaName), ex);
47 public static PgSchemaGeneratorException generateSHA1HashException(Exception ex) {
48 return new PgSchemaGeneratorException("Error occurred while generating hash for hash_info table entry", ex);
51 public static PgSchemaGeneratorException extractMoTypeFromUrnException(final String urn, Exception ex) {
52 return new PgSchemaGeneratorException(String.format("Unable to extract Managed object from urn - %s", urn), ex);
55 public static PgSchemaGeneratorException assignModuleRefException(final String relationshipName, Exception ex) {
56 return new PgSchemaGeneratorException(String.format("ties.model : Unable to assign module reference to - %s",
57 relationshipName), ex);
60 public static PgSchemaGeneratorException assignRelationshipDataLocation(final String relationshipName, Exception ex) {
61 return new PgSchemaGeneratorException(String.format(
62 "Unable to assign RelationshipDataLocation to - %s, unknown cardinalities", relationshipName), ex);
65 public static PgSchemaGeneratorException nbcChangeIdentifiedException(String errorMsg, Exception ex) {
66 return new PgSchemaGeneratorException(String.format(
67 "NBC change has been introduced: %s, please make sure you've enabled green-field installation!!%nFor more info please refer to README",
71 public static PgSchemaGeneratorException readCustomSqlFileException(final String schemaName, Exception ex) {
72 return new PgSchemaGeneratorException(String.format("%s : Failed to read custom sql file!", schemaName), ex);