AT&T 1712 and 1802 release code
[so.git] / common / src / main / java / org / openecomp / mso / client / policy / RestClient.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
+import java.util.UUID;
 
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
@@ -61,11 +62,12 @@ public abstract class RestClient {
        protected Logger logger;
        protected String accept;
        protected String contentType;
+       protected UUID requestId;
 
-       protected RestClient(RestProperties props, Optional<URI> path) {
+       protected RestClient(RestProperties props, UUID requestId, Optional<URI> path) {
                logger = Logger.getLogger(getClass().getName());
                msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
-
+               this.requestId = requestId;
                headerMap = new HashMap<>();
                try {
                        host = props.getEndpoint();
@@ -78,20 +80,22 @@ public abstract class RestClient {
                initializeClient(getClient());
        }
 
-       protected RestClient(RestProperties props, Optional<URI> path, String accept, String contentType) {
-               this(props, path);
+       protected RestClient(RestProperties props, UUID requestId, Optional<URI> path, String accept, String contentType) {
+               this(props, requestId, path);
                this.accept = accept;
                this.contentType = contentType;
+               this.requestId = requestId;
 
        }
 
-       protected RestClient(URL host, String contentType) {
+       protected RestClient(URL host, UUID requestId, String contentType) {
                headerMap = new HashMap<>();
                logger = Logger.getLogger(getClass().getName());
                msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
                this.path = Optional.empty();
                this.host = host;
                this.contentType = contentType;
+               this.requestId = requestId;
                initializeClient(getClient());
        }
 
@@ -129,7 +133,7 @@ public abstract class RestClient {
 
        protected abstract Optional<ClientResponseFilter> addResponseFilter();
 
-       public abstract RestClient addRequestId(String requestId);
+       public abstract RestClient addRequestId(UUID requestId);
 
        protected ContextResolver<ObjectMapper> getMapper() {
                return new CommonObjectMapperProvider();
@@ -151,6 +155,9 @@ public abstract class RestClient {
                return ClientBuilder.newBuilder().build();
        }
 
+       protected UUID getRequestId() {
+               return this.requestId;
+       }
        protected void initializeClient(Client client) {
                if (this.enableLogging()) {
                        client.register(logger).register(new LoggingFilter(this.getMaxPayloadSize()));