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 {
49 // TODO move to actorServices
52 private final int status;
54 private final String body;
55 private final Coder coder;
63 public <T> T readEntity(Class<T> entityType) {
64 if (entityType == String.class) {
65 return entityType.cast(body);
69 return coder.decode(body, entityType);
70 } catch (CoderException e) {
71 throw new IllegalArgumentException("cannot decode response", e);
76 public <T> T readEntity(GenericType<T> entityType) {
77 throw new UnsupportedOperationException();
81 public <T> T readEntity(Class<T> entityType, Annotation[] annotations) {
82 throw new UnsupportedOperationException();
86 public <T> T readEntity(GenericType<T> entityType, Annotation[] annotations) {
87 throw new UnsupportedOperationException();
91 public StatusType getStatusInfo() {
92 throw new UnsupportedOperationException();
96 public Object getEntity() {
97 throw new UnsupportedOperationException();
101 public boolean hasEntity() {
102 throw new UnsupportedOperationException();
106 public boolean bufferEntity() {
107 throw new UnsupportedOperationException();
111 public MediaType getMediaType() {
112 throw new UnsupportedOperationException();
116 public Locale getLanguage() {
117 throw new UnsupportedOperationException();
121 public int getLength() {
122 throw new UnsupportedOperationException();
126 public Set<String> getAllowedMethods() {
127 throw new UnsupportedOperationException();
131 public Map<String, NewCookie> getCookies() {
132 throw new UnsupportedOperationException();
136 public EntityTag getEntityTag() {
137 throw new UnsupportedOperationException();
141 public Date getDate() {
142 throw new UnsupportedOperationException();
146 public Date getLastModified() {
147 throw new UnsupportedOperationException();
151 public URI getLocation() {
152 throw new UnsupportedOperationException();
156 public Set<Link> getLinks() {
157 throw new UnsupportedOperationException();
161 public boolean hasLink(String relation) {
162 throw new UnsupportedOperationException();
166 public Link getLink(String relation) {
167 throw new UnsupportedOperationException();
171 public Builder getLinkBuilder(String relation) {
172 throw new UnsupportedOperationException();
176 public MultivaluedMap<String, Object> getMetadata() {
177 throw new UnsupportedOperationException();
181 public MultivaluedMap<String, String> getStringHeaders() {
182 throw new UnsupportedOperationException();
186 public String getHeaderString(String name) {
187 throw new UnsupportedOperationException();