1 package org.openecomp.sdc.vendorlicense.errors;
4 import org.openecomp.sdc.common.errors.ErrorCategory;
5 import org.openecomp.sdc.common.errors.ErrorCode;
7 public class LimitErrorBuilder {
9 private static final String LIMIT_INVALID_ATTR_VALUE_MSG = "The %s value doesn't meet the "
10 + "expected attribute value.";
12 private static final String DUPLICATE_LIMIT_NAME_NOT_ALLOWED_MSG =
13 "Invalid request, Limit with name %s already exists for type %s.";
15 public static ErrorCode getInvalidValueErrorBuilder(String attribute, String errorCode) {
16 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
17 builder.withId(errorCode);
18 builder.withCategory(ErrorCategory.APPLICATION);
19 builder.withMessage(String.format(LIMIT_INVALID_ATTR_VALUE_MSG, attribute));
20 return builder.build();
23 public static ErrorCode getDuplicateNameErrorbuilder(String name, String type) {
24 ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
25 builder.withId(VendorLicenseErrorCodes.DUPLICATE_LIMIT_NAME_NOT_ALLOWED);
26 builder.withCategory(ErrorCategory.APPLICATION);
27 builder.withMessage(String.format(DUPLICATE_LIMIT_NAME_NOT_ALLOWED_MSG, name, type ));
28 return builder.build();