import java.util.Collections;
import java.util.Map;
import javax.ws.rs.core.MediaType;
-import lombok.val;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.model.AaiNodeQueryResponse;
import org.onap.vid.aai.model.ResourceType;
private final AaiOverTLSPropertySupplier propertySupplier;
private SyncRestClientInterface syncRestClient;
private boolean useClientCert;
- private static String CALLER_APP_ID = "VidAaiController";
+ private static final String CALLER_APP_ID = "VidAaiController";
private String urlBase;
public AaiOverTLSClient(SyncRestClientInterface syncRestClient, AaiOverTLSPropertySupplier propertySupplier) {
@Override
public HttpResponse<AaiNodeQueryResponse> searchNodeTypeByName(String name, ResourceType type) {
- val uri = urlBase + String.format(URIS.NODE_TYPE_BY_NAME, type.getAaiFormat(), type.getNameFilter(), name);
+ String uri = urlBase + String.format(URIS.NODE_TYPE_BY_NAME, type.getAaiFormat(), type.getNameFilter(), name);
return syncRestClient.get(uri, getRequestHeaders(), Collections.emptyMap(), AaiNodeQueryResponse.class);
}
@Override
public HttpResponse<SubscriberList> getAllSubscribers() {
- val uri = urlBase + String.format(URIS.SUBSCRIBERS, 0);
+ String uri = urlBase + String.format(URIS.SUBSCRIBERS, 0);
return syncRestClient.get(uri, getRequestHeaders(), Collections.emptyMap(), SubscriberList.class);
}
private Map<String, String> getRequestHeaders() {
- val result = HashMap.of(
- TRANSACTION_ID_HEADER, propertySupplier.getRandomUUID(),
- FROM_APP_ID_HEADER, CALLER_APP_ID,
- CONTENT_TYPE, MediaType.APPLICATION_JSON,
- REQUEST_ID, propertySupplier.getRequestId(),
- ACCEPT, MediaType.APPLICATION_JSON)
- .toJavaMap();
+ Map<String, String> result = HashMap.of(
+ TRANSACTION_ID_HEADER, propertySupplier.getRandomUUID(),
+ FROM_APP_ID_HEADER, CALLER_APP_ID,
+ CONTENT_TYPE, MediaType.APPLICATION_JSON,
+ REQUEST_ID, propertySupplier.getRequestId(),
+ ACCEPT, MediaType.APPLICATION_JSON)
+ .toJavaMap();
result.putAll(getAuthorizationHeader());
return result;
}
private Map<String, String> getAuthorizationHeader() {
if (!useClientCert) {
- val vidUsername = propertySupplier.getUsername();
- val vidPassword = propertySupplier.getPassword();
- val encoded = Base64.getEncoder()
- .encodeToString((vidUsername + ":" + vidPassword).getBytes(StandardCharsets.UTF_8));
+ String vidUsername = propertySupplier.getUsername();
+ String vidPassword = propertySupplier.getPassword();
+ String encoded = Base64.getEncoder()
+ .encodeToString((vidUsername + ":" + vidPassword).getBytes(StandardCharsets.UTF_8));
return HashMap.of("Authorization", "Basic " + encoded).toJavaMap();
}
return HashMap.<String, String>empty().toJavaMap();