1 package org.openecomp.sdc.vendorsoftwareproduct.errors;
4 import org.openecomp.sdc.common.errors.ErrorCategory;
5 import org.openecomp.sdc.common.errors.ErrorCode;
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;
12 public class ComponentDependencyModelErrorBuilder {
14 private static final String CYCLIC_DEPENDENCY_COMPONENT_MSG = "Cyclic dependency exists between"
17 private static final String INVALID_REALTION_TYPE_MSG = "Invalid relation type for components.";
19 private static final String NO_SOURCE_COMPONENT_MSG = "Source component is mandatory.";
21 private static final String SOURCE_TARGET_COMPONENT_EQUAL_MSG = "Source and target components "
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();
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();
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();
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();