[SDC] Onboarding 1710 rebase.
[sdc.git] / openecomp-be / backend / openecomp-sdc-vendor-software-product-manager / src / main / java / org / openecomp / sdc / vendorsoftwareproduct / errors / DuplicateNicInComponentErrorBuilder.java
1 package org.openecomp.sdc.vendorsoftwareproduct.errors;
2
3 import org.openecomp.sdc.common.errors.ErrorCategory;
4 import org.openecomp.sdc.common.errors.ErrorCode;
5
6 public class DuplicateNicInComponentErrorBuilder {
7
8   private static final String DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG =
9       "Invalid request, NIC with name %s already exist for component with ID %s.";
10
11   private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
12
13   public DuplicateNicInComponentErrorBuilder(String nicName, String componentId ){
14     builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_NIC_NAME_NOT_ALLOWED);
15     builder.withCategory(ErrorCategory.APPLICATION);
16     builder.withMessage(String.format(DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG,nicName,componentId));
17   }
18   public ErrorCode build() {
19     return builder.build();
20   }
21
22 }