2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2018 Ericsson. All rights reserved.
4 * Modifications Copyright (C) 2020 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.gui.editors.apex.rest.handling;
24 import org.onap.policy.apex.model.modelapi.ApexApiResult;
27 * This class handles commands on key information in Apex models.
29 public class KeyInfoHandler implements RestCommandHandler {
34 public ApexApiResult executeRestCommand(final RestSession session, final RestCommandType commandType,
35 final RestCommand command) {
36 return getUnsupportedCommandResultMessage(session, commandType, command);
43 public ApexApiResult executeRestCommand(final RestSession session, final RestCommandType commandType,
44 final RestCommand command, final String jsonString) {
45 return getUnsupportedCommandResultMessage(session, commandType, command);
52 public ApexApiResult executeRestCommand(final RestSession session, final RestCommandType commandType,
53 final RestCommand command, final String name, final String version) {
55 if (RestCommandType.KEY_INFO.equals(commandType) && RestCommand.LIST.equals(command)) {
56 return listKeyInformation(session, name, version);
58 return getUnsupportedCommandResultMessage(session, commandType, command);
63 * Get the key information for a concept with the given name and version.
65 * @param session the editor session containing the Apex model
66 * @param name the name for the search
67 * @param version the version for the search
68 * @return the key information
70 private ApexApiResult listKeyInformation(final RestSession session, final String name, final String version) {
71 return session.getApexModel().listKeyInformation(blank2Null(name), blank2Null(version));