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.CYCLIC_DEPENDENCY_IN_COMPONENTS;
24 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.INVALID_COMPONENT_RELATION_TYPE;
25 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NO_SOURCE_COMPONENT;
26 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.SAME_SOURCE_TARGET_COMPONENT;
28 public class ComponentDependencyModelErrorBuilder {
30 private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between"
33 private static final String INVALID_REALTION_TYPE_MSG = "Invalid relation type for components.";
35 private static final String NO_SOURCE_COMPONENT_MSG = "Source component is mandatory.";
37 private static final String SOURCE_TARGET_COMPONENT_EQUAL_MSG = "Source and target components "
40 private ComponentDependencyModelErrorBuilder(){
44 public static ErrorCode getcyclicDependencyComponentErrorBuilder() {
45 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
46 builder.withId(CYCLIC_DEPENDENCY_IN_COMPONENTS);
47 builder.withCategory(ErrorCategory.APPLICATION);
48 builder.withMessage(String.format(CYCLIC_DEPENDENCY_COMPONENT_MSG));
49 return builder.build();
52 public static ErrorCode getInvalidRelationTypeErrorBuilder() {
53 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
54 builder.withId(INVALID_COMPONENT_RELATION_TYPE);
55 builder.withCategory(ErrorCategory.APPLICATION);
56 builder.withMessage(String.format(INVALID_REALTION_TYPE_MSG));
57 return builder.build();
60 public static ErrorCode getNoSourceComponentErrorBuilder() {
61 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
62 builder.withId(NO_SOURCE_COMPONENT);
63 builder.withCategory(ErrorCategory.APPLICATION);
64 builder.withMessage(String.format(NO_SOURCE_COMPONENT_MSG));
65 return builder.build();
68 public static ErrorCode getSourceTargetComponentEqualErrorBuilder() {
69 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
70 builder.withId(SAME_SOURCE_TARGET_COMPONENT);
71 builder.withCategory(ErrorCategory.APPLICATION);
72 builder.withMessage(String.format(SOURCE_TARGET_COMPONENT_EQUAL_MSG));
73 return builder.build();