1 package org.openecomp.sdc.vendorsoftwareproduct.errors;
4 import org.openecomp.sdc.common.errors.ErrorCategory;
5 import org.openecomp.sdc.common.errors.ErrorCode;
6 import org.openecomp.sdc.versioning.dao.types.Version;
8 public class DeploymentFlavorErrorBuilder {
9 private static final String CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG=
10 "Deployment Flavor cannot be added for VSPs onboarded with HEAT.";
11 private static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP_MSG=
12 "Invalid request,Feature Group with Id %s does not exist for Vsp with Id %s and version " +
14 private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_MSG
15 ="Invalid request,for valid association please provide ComponentId for Compute Flavor";
16 private static final String SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG=
17 "Invalid Request,Same Vfc cannot be associated more than once.";
18 private static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG =
19 "Invalid request, Deployment Flavor with model %s already exists for Vsp with Id %s.";
20 private static final String INVALID_COMPUTE_FLAVOR_ID_MSG =
21 "Invalid request, Compute Flavor with Id %s does not exist for VFC with Id %s.";
22 private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG="VSP cannot be " +
23 "submitted with an invalid Deployment Flavor. All Deployment Flavor should have atleast a VFC included with it's required Compute needs. Please fix the Deployment Flavor and re-submit the VSP.";
25 private static final String FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG = "VSP cannot be " +
26 "submitted with an invalid Deployment Flavor. All Deployment Flavor should have " +
27 "FeatureGroup. Please fix the Deployment Flavor and re-submit the VSP.";
29 public static ErrorCode getAddDeploymentNotSupportedHeatOnboardErrorBuilder(){
30 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
31 builder.withId(VendorSoftwareProductErrorCodes.CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
32 builder.withCategory(ErrorCategory.APPLICATION);
33 builder.withMessage(String.format(CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG));
34 return builder.build();
37 public static ErrorCode getFeatureGroupNotexistErrorBuilder( String featureGroupId, String
38 VspId, Version activeVersion){
39 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
40 builder.withId(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP);
41 builder.withCategory(ErrorCategory.APPLICATION);
42 builder.withMessage(String.format(FEATURE_GROUP_NOT_EXIST_FOR_VSP_MSG,featureGroupId,
43 VspId,activeVersion.toString()));
44 return builder.build();
47 public static ErrorCode getDuplicateVfcAssociationErrorBuilder(){
48 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
49 builder.withId(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED);
50 builder.withCategory(ErrorCategory.APPLICATION);
51 builder.withMessage(String.format(SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED_MSG));
52 return builder.build();
55 public static ErrorCode getInvalidAssociationErrorBuilder(){
56 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
57 builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION);
58 builder.withCategory(ErrorCategory.APPLICATION);
59 builder.withMessage(String.format(INVALID_COMPONENT_COMPUTE_ASSOCIATION_MSG));
60 return builder.build();
63 public static ErrorCode getDuplicateDeploymentFlavorModelErrorBuilder(String name, String vspId){
64 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
65 builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED);
66 builder.withCategory(ErrorCategory.APPLICATION);
67 builder.withMessage(String.format(DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG,name,vspId));
68 return builder.build();
70 public static ErrorCode getInvalidComputeIdErrorBuilder( String computeFlavorId, String
72 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
73 builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID);
74 builder.withCategory(ErrorCategory.APPLICATION);
75 builder.withMessage(String.format(INVALID_COMPUTE_FLAVOR_ID_MSG,computeFlavorId,
77 return builder.build();
80 public static ErrorCode getInvalidComponentComputeAssociationErrorBuilder(){
81 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
82 builder.withId(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION);
83 builder.withCategory(ErrorCategory.APPLICATION);
84 builder.withMessage(String.format(INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG));
85 return builder.build();
88 public static ErrorCode getFeatureGroupMandatoryErrorBuilder(){
89 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
90 builder.withId(VendorSoftwareProductErrorCodes.FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR);
91 builder.withCategory(ErrorCategory.APPLICATION);
92 builder.withMessage(String.format(FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG));
93 return builder.build();