[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-be / backend / openecomp-sdc-vendor-software-product-manager / src / main / java / org / openecomp / sdc / vendorsoftwareproduct / errors / ComponentDependencyModelErrorBuilder.java
1 package org.openecomp.sdc.vendorsoftwareproduct.errors;
2
3
4 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
5     .CYCLIC_DEPENDENCY_IN_COMPONENTS;
6 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
7     .INVALID_COMPONENT_RELATION_TYPE;
8 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
9     .NO_SOURCE_COMPONENT;
10 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
11     .SAME_SOURCE_TARGET_COMPONENT;
12
13 import org.openecomp.sdc.common.errors.ErrorCategory;
14 import org.openecomp.sdc.common.errors.ErrorCode;
15
16 public class ComponentDependencyModelErrorBuilder {
17
18   private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between"
19       + " components.";
20
21   private static final String INVALID_REALTION_TYPE_MSG = "Invalid relation type for components.";
22
23   private static final String NO_SOURCE_COMPONENT_MSG = "Source component is mandatory.";
24
25   private static final String SOURCE_TARGET_COMPONENT_EQUAL_MSG = "Source and target components "
26       + "are same.";
27
28
29
30   public static ErrorCode getcyclicDependencyComponentErrorBuilder() {
31     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
32     builder.withId(CYCLIC_DEPENDENCY_IN_COMPONENTS);
33     builder.withCategory(ErrorCategory.APPLICATION);
34     builder.withMessage(String.format(CYCLIC_DEPENDENCY_COMPONENT_MSG));
35     return builder.build();
36   }
37
38   public static ErrorCode getInvalidRelationTypeErrorBuilder() {
39     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
40     builder.withId(INVALID_COMPONENT_RELATION_TYPE);
41     builder.withCategory(ErrorCategory.APPLICATION);
42     builder.withMessage(String.format(INVALID_REALTION_TYPE_MSG));
43     return builder.build();
44   }
45
46   public static ErrorCode getNoSourceComponentErrorBuilder() {
47     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
48     builder.withId(NO_SOURCE_COMPONENT);
49     builder.withCategory(ErrorCategory.APPLICATION);
50     builder.withMessage(String.format(NO_SOURCE_COMPONENT_MSG));
51     return builder.build();
52   }
53
54   public static ErrorCode getSourceTargetComponentEqualErrorBuilder() {
55     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
56     builder.withId(SAME_SOURCE_TARGET_COMPONENT);
57     builder.withCategory(ErrorCategory.APPLICATION);
58     builder.withMessage(String.format(SOURCE_TARGET_COMPONENT_EQUAL_MSG));
59     return builder.build();
60   }
61 }