2 * Copyright © 2016-2017 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.vendorsoftwareproduct.errors;
20 import org.openecomp.sdc.common.errors.ErrorCategory;
21 import org.openecomp.sdc.common.errors.ErrorCode;
23 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.*;
25 public class ComponentDependencyModelErrorBuilder {
27 private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between"
30 private static final String INVALID_REALTION_TYPE_MSG = "Invalid relation type for components.";
32 private static final String NO_SOURCE_COMPONENT_MSG = "Source component is mandatory.";
34 private static final String SOURCE_TARGET_COMPONENT_EQUAL_MSG = "Source and target components "
37 private ComponentDependencyModelErrorBuilder(){
41 public static ErrorCode getcyclicDependencyComponentErrorBuilder() {
42 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
43 builder.withId(CYCLIC_DEPENDENCY_IN_COMPONENTS);
44 builder.withCategory(ErrorCategory.APPLICATION);
45 builder.withMessage(String.format(CYCLIC_DEPENDENCY_COMPONENT_MSG));
46 return builder.build();
49 public static ErrorCode getInvalidRelationTypeErrorBuilder() {
50 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
51 builder.withId(INVALID_COMPONENT_RELATION_TYPE);
52 builder.withCategory(ErrorCategory.APPLICATION);
53 builder.withMessage(String.format(INVALID_REALTION_TYPE_MSG));
54 return builder.build();
57 public static ErrorCode getNoSourceComponentErrorBuilder() {
58 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
59 builder.withId(NO_SOURCE_COMPONENT);
60 builder.withCategory(ErrorCategory.APPLICATION);
61 builder.withMessage(String.format(NO_SOURCE_COMPONENT_MSG));
62 return builder.build();
65 public static ErrorCode getSourceTargetComponentEqualErrorBuilder() {
66 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
67 builder.withId(SAME_SOURCE_TARGET_COMPONENT);
68 builder.withCategory(ErrorCategory.APPLICATION);
69 builder.withMessage(String.format(SOURCE_TARGET_COMPONENT_EQUAL_MSG));
70 return builder.build();