Updated pom to allow maven deploy. Added try/catch into getItemURL
method
This commit is contained in:
parent
02cacd0050
commit
c45c7ab1f5
|
@ -1,9 +1,16 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
<Changeset component="org.gcube.portlets-widgets.catalogue-sharing-widget.1-0-1"
|
<Changeset
|
||||||
|
component="org.gcube.portlets-widgets.catalogue-sharing-widget.1-1-0"
|
||||||
|
date="2019-12-05">
|
||||||
|
<Change>Minor fix</Change>
|
||||||
|
</Changeset>
|
||||||
|
<Changeset
|
||||||
|
component="org.gcube.portlets-widgets.catalogue-sharing-widget.1-0-1"
|
||||||
date="2017-05-10">
|
date="2017-05-10">
|
||||||
<Change>Minor fix</Change>
|
<Change>Minor fix</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-widgets.catalogue-sharing-widget.1-0-0"
|
<Changeset
|
||||||
|
component="org.gcube.portlets-widgets.catalogue-sharing-widget.1-0-0"
|
||||||
date="2017-05-01">
|
date="2017-05-01">
|
||||||
<Change>First Release</Change>
|
<Change>First Release</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets-widgets</groupId>
|
<groupId>org.gcube.portlets-widgets</groupId>
|
||||||
<artifactId>catalogue-sharing-widget</artifactId>
|
<artifactId>catalogue-sharing-widget</artifactId>
|
||||||
<version>1.0.1-SNAPSHOT</version>
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
<name>catalogue-sharing-widget</name>
|
<name>catalogue-sharing-widget</name>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
<version>2.2</version>
|
<version>2.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptors>
|
<descriptors>
|
||||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
<descriptor>descriptor.xml</descriptor>
|
||||||
</descriptors>
|
</descriptors>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
|
|
@ -34,24 +34,28 @@ public class ShareServicesImpl extends RemoteServiceServlet implements ShareServ
|
||||||
@Override
|
@Override
|
||||||
public ItemUrls getPackageUrl(String uuid) throws Exception{
|
public ItemUrls getPackageUrl(String uuid) throws Exception{
|
||||||
|
|
||||||
String scopePerCurrentUrl = ServerUtils.getScopeFromClientUrl(getThreadLocalRequest());
|
try {
|
||||||
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
String scopePerCurrentUrl = ServerUtils.getScopeFromClientUrl(getThreadLocalRequest());
|
||||||
CkanDataset dataset = catalogue.getDataset(uuid, catalogue.getApiKeyFromUsername(ServerUtils.getUserInSession(getThreadLocalRequest())));
|
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||||
String longUrl = catalogue.getUnencryptedUrlFromDatasetIdOrName(uuid);
|
CkanDataset dataset = catalogue.getDataset(uuid, catalogue.getApiKeyFromUsername(ServerUtils.getUserInSession(getThreadLocalRequest())));
|
||||||
|
String longUrl = catalogue.getUnencryptedUrlFromDatasetIdOrName(uuid);
|
||||||
|
|
||||||
if(longUrl == null || longUrl.isEmpty())
|
if(longUrl == null || longUrl.isEmpty())
|
||||||
throw new Exception("There was a problem while retrieving the item's url, retry later");
|
throw new Exception("There was a problem while retrieving the item's url, retry later");
|
||||||
|
|
||||||
String shortUrl = null;
|
String shortUrl = null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
UrlShortener shortener = new UrlShortener();
|
UrlShortener shortener = new UrlShortener();
|
||||||
shortUrl = shortener.shorten(longUrl);
|
shortUrl = shortener.shorten(longUrl);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.warn("Short url not available");
|
logger.warn("Short url not available");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ItemUrls(shortUrl, longUrl, uuid, dataset.getName(), dataset.getTitle());
|
||||||
|
}catch (Exception e) {
|
||||||
|
throw new Exception("Unable to get the ITEM URL for id: "+uuid, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ItemUrls(shortUrl, longUrl, uuid, dataset.getName(), dataset.getTitle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue