2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. 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.so.client.graphinventory;
 
  25 import java.util.Optional;
 
  26 import javax.ws.rs.core.Response;
 
  27 import org.onap.logging.filter.base.ONAPComponentsList;
 
  28 import org.onap.so.client.ResponseExceptionMapper;
 
  29 import org.onap.so.client.RestClientSSL;
 
  30 import org.onap.so.client.RestProperties;
 
  31 import org.onap.so.client.policy.CommonObjectMapperProvider;
 
  33 public abstract class GraphInventoryRestClient extends RestClientSSL {
 
  35     protected static final GraphInventoryCommonObjectMapperProvider standardProvider =
 
  36             new GraphInventoryCommonObjectMapperProvider();
 
  38     protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter();
 
  40     protected GraphInventoryRestClient(RestProperties props, URI uri) {
 
  41         super(props, Optional.of(uri));
 
  45     public abstract ONAPComponentsList getTargetEntity();
 
  48     protected abstract void initializeHeaderMap(Map<String, String> headerMap);
 
  51     protected abstract Optional<ResponseExceptionMapper> addResponseExceptionMapper();
 
  54     protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
 
  55         return standardProvider;
 
  59     public Response patch(Object obj) {
 
  60         return super.patch(convertToPatchFormat(obj));
 
  64     public <T> T patch(Object obj, Class<T> resultClass) {
 
  65         return super.patch(convertToPatchFormat(obj), resultClass);
 
  68     protected GraphInventoryPatchConverter getPatchConverter() {
 
  69         return this.patchConverter;
 
  72     protected String convertToPatchFormat(Object obj) {
 
  73         return getPatchConverter().convertPatchFormat(obj);