Add collaboration feature
[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 org.openecomp.sdc.common.errors.ErrorCategory;
5 import org.openecomp.sdc.common.errors.ErrorCode;
6
7 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.CYCLIC_DEPENDENCY_IN_COMPONENTS;
8 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.INVALID_COMPONENT_RELATION_TYPE;
9 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NO_SOURCE_COMPONENT;
10 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.SAME_SOURCE_TARGET_COMPONENT;
11
12 public class ComponentDependencyModelErrorBuilder {
13
14   private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between"
15       + " components.";
16
17   private static final String INVALID_REALTION_TYPE_MSG = "Invalid relation type for components.";
18
19   private static final String NO_SOURCE_COMPONENT_MSG = "Source component is mandatory.";
20
21   private static final String SOURCE_TARGET_COMPONENT_EQUAL_MSG = "Source and target components "
22       + "are same.";
23
24
25
26   public static ErrorCode getcyclicDependencyComponentErrorBuilder() {
27     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
28     builder.withId(CYCLIC_DEPENDENCY_IN_COMPONENTS);
29     builder.withCategory(ErrorCategory.APPLICATION);
30     builder.withMessage(String.format(CYCLIC_DEPENDENCY_COMPONENT_MSG));
31     return builder.build();
32   }
33
34   public static ErrorCode getInvalidRelationTypeErrorBuilder() {
35     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
36     builder.withId(INVALID_COMPONENT_RELATION_TYPE);
37     builder.withCategory(ErrorCategory.APPLICATION);
38     builder.withMessage(String.format(INVALID_REALTION_TYPE_MSG));
39     return builder.build();
40   }
41
42   public static ErrorCode getNoSourceComponentErrorBuilder() {
43     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
44     builder.withId(NO_SOURCE_COMPONENT);
45     builder.withCategory(ErrorCategory.APPLICATION);
46     builder.withMessage(String.format(NO_SOURCE_COMPONENT_MSG));
47     return builder.build();
48   }
49
50   public static ErrorCode getSourceTargetComponentEqualErrorBuilder() {
51     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
52     builder.withId(SAME_SOURCE_TARGET_COMPONENT);
53     builder.withCategory(ErrorCategory.APPLICATION);
54     builder.withMessage(String.format(SOURCE_TARGET_COMPONENT_EQUAL_MSG));
55     return builder.build();
56   }
57 }