+ /**
+ * Construct cloudConfiguration for the SO requestDetails. Overridden for custom
+ * query.
+ *
+ * @param tenantItem tenant item from A&AI named-query response
+ * @return SO cloud configuration
+ */
+ protected SoCloudConfiguration constructCloudConfigurationCq(Tenant tenantItem, CloudRegion cloudRegionItem) {
+ SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration();
+ cloudConfiguration.setTenantId(tenantItem.getTenantId());
+ cloudConfiguration.setLcpCloudRegionId(cloudRegionItem.getCloudRegionId());
+ return cloudConfiguration;
+ }
+
+ /**
+ * Create simple HTTP headers for unauthenticated requests to SO.
+ *
+ * @return the HTTP headers
+ */
+ protected Map<String, Object> createSimpleHeaders() {
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("Accept", MediaType.APPLICATION_JSON);
+ return headers;
+ }
+
+ /**
+ * Gets an item from a property. If the property is not found, then it invokes the
+ * given function to retrieve it from the custom query data. If that fails as well,
+ * then an exception is thrown.
+ *
+ * @param propName property name
+ * @param getter method to extract the value from the custom query data
+ * @param errmsg error message to include in any exception
+ * @return the retrieved item
+ */
+ protected <T> T getItem(String propName, Function<AaiCqResponse, T> getter, String errmsg) {
+ if (containsProperty(propName)) {
+ return getProperty(propName);
+ }
+
+ final AaiCqResponse aaiCqResponse = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY);
+ T item = getter.apply(aaiCqResponse);
+ if (item == null) {
+ throw new IllegalArgumentException(errmsg);
+ }
+
+ return item;
+ }
+