String path = null;
WebUrl url = null;
if (metadataMap.get(PATH) != null) {
try {
path = (String) metadataMap.get(PATH).getValues().get(0);
url = new WebUrlImpl(site, path);
} catch (IllegalArgumentException e) {
logger.debug("Path {}:/{} for movie {} is invalid", new Object[] {
site.getIdentifier(),
path,
id });
path = URI_PREFIX + "/" + id;
url = new WebUrlImpl(site, path);
}
} else {
path = URI_PREFIX + "/" + id;
url = new WebUrlImpl(site, path);
}
ResourceURI uri = new MovieResourceURIImpl(site, path, id, version);
MovieResourceSearchResultItemImpl result = new MovieResourceSearchResultItemImpl(uri, url, relevance, site, metadata);