2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2023 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.controlloop.actor.so;
24 import jakarta.ws.rs.core.EntityTag;
25 import jakarta.ws.rs.core.GenericType;
26 import jakarta.ws.rs.core.Link;
27 import jakarta.ws.rs.core.Link.Builder;
28 import jakarta.ws.rs.core.MediaType;
29 import jakarta.ws.rs.core.MultivaluedMap;
30 import jakarta.ws.rs.core.NewCookie;
31 import jakarta.ws.rs.core.Response;
32 import java.lang.annotation.Annotation;
34 import java.util.Date;
35 import java.util.Locale;
38 import lombok.AllArgsConstructor;
40 import org.onap.policy.common.utils.coder.Coder;
41 import org.onap.policy.common.utils.coder.CoderException;
44 * RestManager Response suitable for use with subclasses of HttpOperation. Only a couple
45 * of methods are implemented; the rest throw {@link UnsupportedOperationException}.
48 public class RestManagerResponse extends Response {
51 private final int status;
53 private final String body;
54 private final Coder coder;
62 public <T> T readEntity(Class<T> entityType) {
63 if (entityType == String.class) {
64 return entityType.cast(body);
68 return coder.decode(body, entityType);
69 } catch (CoderException e) {
70 throw new IllegalArgumentException("cannot decode response", e);
75 public <T> T readEntity(GenericType<T> entityType) {
76 throw new UnsupportedOperationException();
80 public <T> T readEntity(Class<T> entityType, Annotation[] annotations) {
81 throw new UnsupportedOperationException();
85 public <T> T readEntity(GenericType<T> entityType, Annotation[] annotations) {
86 throw new UnsupportedOperationException();
90 public StatusType getStatusInfo() {
91 throw new UnsupportedOperationException();
95 public Object getEntity() {
96 throw new UnsupportedOperationException();
100 public boolean hasEntity() {
101 throw new UnsupportedOperationException();
105 public boolean bufferEntity() {
106 throw new UnsupportedOperationException();
110 public MediaType getMediaType() {
111 throw new UnsupportedOperationException();
115 public Locale getLanguage() {
116 throw new UnsupportedOperationException();
120 public int getLength() {
121 throw new UnsupportedOperationException();
125 public Set<String> getAllowedMethods() {
126 throw new UnsupportedOperationException();
130 public Map<String, NewCookie> getCookies() {
131 throw new UnsupportedOperationException();
135 public EntityTag getEntityTag() {
136 throw new UnsupportedOperationException();
140 public Date getDate() {
141 throw new UnsupportedOperationException();
145 public Date getLastModified() {
146 throw new UnsupportedOperationException();
150 public URI getLocation() {
151 throw new UnsupportedOperationException();
155 public Set<Link> getLinks() {
156 throw new UnsupportedOperationException();
160 public boolean hasLink(String relation) {
161 throw new UnsupportedOperationException();
165 public Link getLink(String relation) {
166 throw new UnsupportedOperationException();
170 public Builder getLinkBuilder(String relation) {
171 throw new UnsupportedOperationException();
175 public MultivaluedMap<String, Object> getMetadata() {
176 throw new UnsupportedOperationException();
180 public MultivaluedMap<String, String> getStringHeaders() {
181 throw new UnsupportedOperationException();
185 public String getHeaderString(String name) {
186 throw new UnsupportedOperationException();