2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 Nokia. 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.blueprintgenerator.service;
23 import org.onap.blueprintgenerator.model.base.Blueprint;
24 import org.onap.blueprintgenerator.model.common.Input;
25 import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
26 import org.onap.blueprintgenerator.service.dmaap.DmaapBlueprintCreatorService;
27 import org.onap.blueprintgenerator.service.onap.OnapBlueprintCreatorService;
28 import org.springframework.beans.factory.annotation.Autowired;
29 import org.springframework.stereotype.Service;
32 * @author : Remigiusz Janeczek
33 * @date 12/17/2020 Application: ONAP - Blueprint Generator Service to create ONAP and DMAAP Blueprints
36 public class BlueprintCreatorService {
38 private final OnapBlueprintCreatorService onapBlueprintCreatorService;
40 private final DmaapBlueprintCreatorService dmaapBlueprintCreatorService;
43 public BlueprintCreatorService(OnapBlueprintCreatorService onapBlueprintCreatorService,
44 DmaapBlueprintCreatorService dmaapBlueprintCreatorService) {
45 this.onapBlueprintCreatorService = onapBlueprintCreatorService;
46 this.dmaapBlueprintCreatorService = dmaapBlueprintCreatorService;
50 * Creates Blueprint from given OnapComponentSpec and Input objects if the input is json file or not
52 * @param componentSpec OnapComponentSpec object
53 * @param input Input object, needs to have bpType defined (either as "o" (ONAP Blueprint) or "d" (DMAAP
55 * @return blueprint generated from componentSpec and input
57 public Blueprint createBlueprint(OnapComponentSpec componentSpec, Input input) {
58 if (input.getBpType() == null) {
61 Blueprint blueprint = null;
62 if (input.getBpType().equals("o")) {
63 blueprint = onapBlueprintCreatorService.createBlueprint(componentSpec, input);
64 } else if (input.getBpType().equals("d")) {
65 blueprint = dmaapBlueprintCreatorService.createBlueprint(componentSpec, input);