</BUG>
Boolean randomPort) {
return getDomainId(cloudFoundryClient, organizationId, domain)
.then(domainId -> getRoute(cloudFoundryClient, domainId, host, path, port)
<BUG>.map(OperationUtils.<RouteResource, Resource<RouteEntity>>cast())
.otherwiseIfEmpty(requestCreateRoute(cloudFoundryClient, domainId, host, path, port, randomPort, spaceId)))

.map(ResourceUtils::getId);</BUG>
}
private static Mono<RouteResource> getRoute(CloudFoundryClient cloudFoundryClient, String domainId, String domain, String host, String path, Integer port) {

private static Mono<String> getOptionalDomainId(CloudFoundryClient cloudFoundryClient, String organizationId, String domain) {
return getDomains(cloudFoundryClient, organizationId, domain)
.singleOrEmpty()
.map(ResourceUtils::getId);
}
private static Mono<AbstractRouteResource> getOrCreateRoute(CloudFoundryClient cloudFoundryClient, String organizationId, String spaceId, String domain, String host, String path, Integer port,
Boolean randomPort) {
return getDomainId(cloudFoundryClient, organizationId, domain)
.then(domainId -> getRoute(cloudFoundryClient, domainId, host, path, port)
.cast(AbstractRouteResource.class)
.otherwiseIfEmpty(requestCreateRoute(cloudFoundryClient, domainId, host, path, port, randomPort, spaceId)));
}
private static Mono<RouteResource> getRoute(CloudFoundryClient cloudFoundryClient, String domainId, String domain, String host, String path, Integer port) {
