summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DuplicateNicInComponentErrorBuilder.java
blob: 741dddb4f507b46ca2b777bc3c347e753169bda2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package org.openecomp.sdc.vendorsoftwareproduct.errors;

import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;

public class DuplicateNicInComponentErrorBuilder {

  private static final String DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG =
      "Invalid request, NIC with name %s already exist for component with ID %s.";

  private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();

  public DuplicateNicInComponentErrorBuilder(String nicName, String componentId ){
    builder.withId(VendorSoftwareProductErrorCodes.DUPLICATE_NIC_NAME_NOT_ALLOWED);
    builder.withCategory(ErrorCategory.APPLICATION);
    builder.withMessage(String.format(DUPLICATE_NIC_NAME_NOT_ALLOWED_MSG,nicName,componentId));
  }
  public ErrorCode build() {
    return builder.build();
  }

}