getLicenses method fixed
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@130338 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
40b4ae8f50
commit
1ba0ec1f00
|
@ -28,6 +28,8 @@ import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
|||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
|
||||
import eu.trentorise.opendata.jackan.model.CkanLicense;
|
||||
|
||||
|
||||
/**
|
||||
* The Class UserUtil.
|
||||
|
@ -180,11 +182,18 @@ public class UserUtil {
|
|||
|
||||
try{
|
||||
logger.debug("User in session is " + username);
|
||||
List<String> titlesLicenses = ckanUtils.getLicenseTitles();
|
||||
LicensesBean licensesBean = new LicensesBean(titlesLicenses);
|
||||
List<CkanLicense> titlesLicenses = ckanUtils.getLicenses();
|
||||
List<String> titles = new ArrayList<String>();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
for (CkanLicense license : titlesLicenses) {
|
||||
titles.add(license.getTitle());
|
||||
String url = (license.getUrl() != null && !license.getUrl().isEmpty()) ? license.getUrl() : "";
|
||||
urls.add(url);
|
||||
}
|
||||
LicensesBean licensesBean = new LicensesBean(titles, urls);
|
||||
|
||||
session.setAttribute(ckanLicensesKey, licensesBean);
|
||||
logger.info("List of licenses has been saved into session" + licensesBean);
|
||||
|
||||
}
|
||||
catch(Exception e){
|
||||
logger.error("Failed to preload licenses list", e);
|
||||
|
|
Loading…
Reference in New Issue