@Override
public Location apply(Network from) {
Matcher matcher = netPattern.matcher(from.getHref().toASCIIString());
if (matcher.find()) {
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName).description(
endpoint.get().toASCIIString()).iso3166Codes(isoCodes).build();
Org org = api.getBrowsingApi().getOrg(matcher.group(1));
Location orgLocation = new LocationBuilder().scope(LocationScope.REGION).id(org.getId()).description(
org.getDescription()).parent(provider).build();
VDC vdc = api.getBrowsingApi().getVDCInOrg(org.getId(), matcher.group(2));
Location vdcLocation = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getId()).description(
vdc.getDescription()).parent(orgLocation).build();
return new LocationBuilder().scope(LocationScope.NETWORK).id(from.getId()).description(from.getName()).parent(
vdcLocation).build();
} else {
throw new IllegalArgumentException("network unparsable: " + from);
}