Merge "Reorder modifiers"
[so.git] / adapters / mso-vfc-adapter / src / main / java / org / openecomp / mso / adapters / vfc / constant / HttpCode.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.mso.adapters.vfc.constant;
21
22 /**
23  * Constant Class.<br/>
24  * <p>
25  * Define constant for http operation.
26  * </p>
27  * 
28  * @author
29  * @version ONAP Amsterdam 2016/8/4
30  */
31 public class HttpCode {
32
33     /**
34      * Fail to request.
35      */
36     public static final int BAD_REQUEST = 400;
37
38     /**
39      * Inner error
40      */
41     public static final int INTERNAL_SERVER_ERROR = 500;
42
43     /**
44      * Not accept request.
45      */
46     public static final int NOT_ACCEPTABLE = 406;
47
48     /**
49      * Not found service.
50      */
51     public static final int NOT_FOUND = 404;
52
53     /**
54      * Accept request.
55      */
56     public static final int RESPOND_ACCEPTED = 202;
57
58     /**
59      * Http response is ok.
60      */
61     public static final int RESPOND_OK = 200;
62
63     public static final int CREATED_OK = 201;
64
65     /**
66      * Conflict
67      */
68     public static final int RESPOND_CONFLICT = 409;
69
70     /**
71      * Constructor<br/>
72      * <p>
73      * </p>
74      * 
75      * @since ONAP Amsterdam Release 2017-9-6
76      */
77     private HttpCode() {
78
79     }
80
81     /**
82      * Whether request is successful.<br/>
83      * 
84      * @param httpCode response code
85      * @return true or false
86      * @since ONAP Amsterdam Release 2017-9-6
87      */
88     public static boolean isSucess(int httpCode) {
89         return httpCode / 100 == 2;
90     }
91 }