/** * Given some resource parameters, reconstruct the URL of resource page in the catalog website. * * <p>Valid URLs have this format with the dataset name 'impianti-di-risalita-vivifiemme-2013': * http://dati.trentino.it/dataset/impianti-di-risalita-vivifiemme-2013/resource/779d1d9d-9370-47f4-a194-1b0328c32f02 * * @param catalogUrl i.e. http://dati.trentino.it * @param datasetIdentifier the dataset name (preferred) or the alphanumerical id * @param resourceId the alphanumerical id of the resource (DON'T use resource name) */ public static String makeResourceURL( String catalogUrl, String datasetIdentifier, String resourceId) { checkNotEmpty(catalogUrl, "invalid catalog url"); checkNotEmpty(datasetIdentifier, "invalid dataset identifier"); checkNotEmpty(resourceId, "invalid resource id"); return OdtUtils.removeTrailingSlash(catalogUrl) + "/" + datasetIdentifier + "/resource/" + resourceId; }
/** * Given some group parameters, reconstruct the URL of group page in the catalog website. * * <p>Valid URLs have this format with the group name 'gestione-del-territorio': * * <p>http://dati.trentino.it/group/gestione-del-territorio * * @param catalogUrl i.e. http://dati.trentino.it * @param groupId the group name as in {@link CkanGroup#getName()} (preferred), or the group's * alphanumerical id. */ public static String makeGroupURL(String catalogUrl, String groupId) { checkNotEmpty(catalogUrl, "invalid catalog url"); checkNotEmpty(groupId, "invalid dataset identifier"); return OdtUtils.removeTrailingSlash(catalogUrl) + "/group/" + groupId; }