fc8ecf26a47a01f104dd8a7027dd503e90c49386
[sdc.git] /
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 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED;
7
8 /**
9  * The NIC error builder.
10  */
11 public class NicErrorBuilder {
12     private static final String NIC_NAME_FORMAT_MSG = "Field does not conform to predefined criteria"
13             + ": name : must match %s";
14
15     /**
16      * Gets image name format error builder.
17      *
18      * @return the image name format error builder
19      */
20     public static ErrorCode getNicNameFormatErrorBuilder(String imageName, String pattern) {
21         ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
22         builder.withId(NIC_NAME_FORMAT_NOT_ALLOWED);
23         builder.withCategory(ErrorCategory.APPLICATION);
24         builder.withMessage(String.format(NIC_NAME_FORMAT_MSG, pattern));
25         return builder.build();
26     }
27 }