public List<Option> fetchRemoteOptions(ContainerProvidedOptionsParameterRequest parameterRequest) { Optional<RuntimeResolvableSelectionStaticProperty> runtimeResolvableOpt = findProperty (parameterRequest.getStaticProperties(), parameterRequest.getRuntimeResolvableInternalId()); if (runtimeResolvableOpt.isPresent()) { RuntimeResolvableSelectionStaticProperty rsp = runtimeResolvableOpt.get(); RuntimeOptionsRequest request = new RuntimeOptionsRequest(rsp.getInternalName()); if (rsp.getLinkedMappingPropertyId() != null) { Optional<EventProperty> eventPropertyOpt = findEventProperty(parameterRequest.getEventProperties(), parameterRequest.getStaticProperties(), rsp .getLinkedMappingPropertyId()); eventPropertyOpt.ifPresent(request::setMappedEventProperty); } String httpRequestBody = GsonSerializer.getGsonWithIds() .toJson (request); try { Response httpResp = Request.Post(parameterRequest.getBelongsTo() +"/configurations").bodyString(httpRequestBody, ContentType.APPLICATION_JSON).execute(); return handleResponse(httpResp); } catch (Exception e) { e.printStackTrace(); return new ArrayList<>(); } } else { return new ArrayList<>(); } }
public List<Option> fetchRemoteOptions(ContainerProvidedOptionsParameterRequest parameterRequest) { Optional<RuntimeResolvableSelectionStaticProperty> runtimeResolvableOpt = findProperty (parameterRequest.getStaticProperties(), parameterRequest.getRuntimeResolvableInternalId()); if (runtimeResolvableOpt.isPresent()) { RuntimeResolvableSelectionStaticProperty rsp = runtimeResolvableOpt.get(); RuntimeOptionsRequest request = new RuntimeOptionsRequest(rsp.getInternalName()); if (rsp.getLinkedMappingPropertyId() != null) { Optional<EventProperty> eventPropertyOpt = findEventProperty(parameterRequest.getEventProperties(), parameterRequest.getStaticProperties(), rsp .getLinkedMappingPropertyId()); eventPropertyOpt.ifPresent(request::setMappedEventProperty); } String httpRequestBody = GsonSerializer.getGsonWithIds() .toJson (request); try { Response httpResp = Request.Post(parameterRequest.getBelongsTo() +"/configurations").bodyString(httpRequestBody, ContentType.APPLICATION_JSON).execute(); return handleResponse(httpResp); } catch (Exception e) { e.printStackTrace(); return new ArrayList<>(); } } else { return new ArrayList<>(); } }