54e22c97aec89fb0a94986296f12cebb244a86a8
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019, Nordix Foundation. 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
21 package org.openecomp.sdc.tosca.errors;
22
23 import org.openecomp.sdc.common.errors.ErrorCategory;
24 import org.openecomp.sdc.common.errors.ErrorCode;
25
26
27 public class InvalidToscaMetaFile {
28
29     private static final String INVALID_TOSCA_META_FILE = "Missing data - TOSCA.meta file must include '%s' data.";
30     private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
31
32     /**
33      * Instantiates a new invalid TOSCA meta file error builder.
34      *
35      * @param missingData name of the missing data
36      */
37     public InvalidToscaMetaFile(String missingData) {
38         builder.withId(ToscaErrorCodes.INVALID_TOSCA_META_FILE);
39         builder.withCategory(ErrorCategory.APPLICATION);
40         builder.withMessage(String.format(INVALID_TOSCA_META_FILE, missingData));
41     }
42
43     /**
44      * Build error code.
45      *
46      * @return the error code
47      */
48     public ErrorCode build() {
49         return builder.build();
50     }
51 }