1 package org.openecomp.sdc.vendorsoftwareproduct.errors;
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
10 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes
11 .SAME_SOURCE_TARGET_COMPONENT;
13 import org.openecomp.sdc.common.errors.ErrorCategory;
14 import org.openecomp.sdc.common.errors.ErrorCode;
16 public class ComponentDependencyModelErrorBuilder {
18 private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between"
21 private static final String INVALID_REALTION_TYPE_MSG = "Invalid relation type for components.";
23 private static final String NO_SOURCE_COMPONENT_MSG = "Source component is mandatory.";
25 private static final String SOURCE_TARGET_COMPONENT_EQUAL_MSG = "Source and target components "
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();
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();
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();
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();