Replaced all tabs with spaces in java and pom.xml
[so.git] / common / src / main / java / org / onap / so / client / graphinventory / GraphInventoryRestClient.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.client.graphinventory;
22
23 import java.net.URI;
24 import java.util.Map;
25 import java.util.Optional;
26 import javax.ws.rs.core.Response;
27 import org.onap.so.client.ResponseExceptionMapper;
28 import org.onap.so.client.RestClientSSL;
29 import org.onap.so.client.RestProperties;
30 import org.onap.so.client.policy.CommonObjectMapperProvider;
31 import org.onap.so.utils.TargetEntity;
32
33 public abstract class GraphInventoryRestClient extends RestClientSSL {
34
35     protected static final GraphInventoryCommonObjectMapperProvider standardProvider =
36             new GraphInventoryCommonObjectMapperProvider();
37
38     protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter();
39
40     protected GraphInventoryRestClient(RestProperties props, URI uri) {
41         super(props, Optional.of(uri));
42     }
43
44     @Override
45     public abstract TargetEntity getTargetEntity();
46
47     @Override
48     protected abstract void initializeHeaderMap(Map<String, String> headerMap);
49
50     @Override
51     protected abstract Optional<ResponseExceptionMapper> addResponseExceptionMapper();
52
53     @Override
54     protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
55         return standardProvider;
56     }
57
58     @Override
59     public Response patch(Object obj) {
60         return super.patch(convertToPatchFormat(obj));
61     }
62
63     @Override
64     public <T> T patch(Object obj, Class<T> resultClass) {
65         return super.patch(convertToPatchFormat(obj), resultClass);
66     }
67
68     protected GraphInventoryPatchConverter getPatchConverter() {
69         return this.patchConverter;
70     }
71
72     protected String convertToPatchFormat(Object obj) {
73         return getPatchConverter().convertPatchFormat(obj);
74     }
75
76 }