5e7d8b98e3a23b0e3076079eed5513bd2f4a8bfd
[sdc.git] /
1 /*
2  * Copyright © 2016-2017 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdc.vendorsoftwareproduct.errors;
18
19 import org.openecomp.sdc.common.errors.ErrorCategory;
20 import org.openecomp.sdc.common.errors.ErrorCode;
21
22 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK;
23 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_TYPE_UPDATE_NOT_ALLOWED;
24
25 public class NicInternalNetworkErrorBuilder {
26   private static final String NULL_NETWORKID_NOT_ALLOWED_MSG =
27       "Internal Networks are currently not supported for VSP created Manually, so please fix all the NIC to be of Type External and re-submit the VSP.";
28
29   private static final String NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG =
30       "Invalid request, Network Description not allowed for Internal Networks";
31   private static final String NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG =
32           "Invalid request, Network Type Update not allowed for a Nic";
33
34   private NicInternalNetworkErrorBuilder() {
35     
36   }
37
38
39   public static ErrorCode getNicNullNetworkIdInternalNetworkIdErrorBuilder(){
40     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
41     builder.withId(VendorSoftwareProductErrorCodes.NULL_NETWORKID_NOT_ALLOWED);
42     builder.withCategory(ErrorCategory.APPLICATION);
43     builder.withMessage(NULL_NETWORKID_NOT_ALLOWED_MSG);
44     return builder.build();
45   }
46
47
48   public static ErrorCode getNetworkDescriptionInternalNetworkErrorBuilder(){
49     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
50     builder.withId(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK);
51     builder.withCategory(ErrorCategory.APPLICATION);
52     builder.withMessage(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG);
53     return builder.build();
54   }
55
56
57   public static ErrorCode getNetworkTypeErrorBuilder(){
58     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
59     builder.withId(NETWORK_TYPE_UPDATE_NOT_ALLOWED);
60     builder.withCategory(ErrorCategory.APPLICATION);
61     builder.withMessage(NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG);
62     return builder.build();
63   }
64
65
66 }