Patched the method DataCatalogueImpl#gePortletUrl

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@174068 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-11-09 10:35:22 +00:00
parent ed288fcda2
commit 0dc39399dd
3 changed files with 39 additions and 23 deletions

View File

@ -2,7 +2,7 @@
<!DOCTYPE xml>
<ReleaseNotes>
<Changeset component="org.gcube.data-catalogue.ckan-util-library.2-8-0" date="${buildDate}">
<Change></Change>
<Change>Patched method DataCatalogueImpl#getPortletURL</Change>
</Changeset>
<Changeset component="org.gcube.data-catalogue.ckan-util-library.2-7-0" date="2018-10-10">
<Change>Added the possibility to deny social post on catalogue-ws #12514</Change>

View File

@ -172,10 +172,26 @@ public class DataCatalogueImpl implements DataCatalogue{
@Override
public String getPortletUrl() {
/*
ScopeBean context = new ScopeBean(CONTEXT);
String buildedUrl = PORTLET_URL_FOR_SCOPE.endsWith("/") ? PORTLET_URL_FOR_SCOPE : PORTLET_URL_FOR_SCOPE + "/";
buildedUrl += context.name().toLowerCase() + CATALOGUE_TAB_ENDING_URL;
return buildedUrl;
*/
//PATCHED By Francesco
ScopeBean context = new ScopeBean(CONTEXT);
//CHECKING IF THE PORTLET URL CONTAINS THE VRE NAME INTO URL
if(PORTLET_URL_FOR_SCOPE.contains(context.name())){
//THE PORLTET URL READ FROM GENERIC RESOUCE 'CkanPortlet' SHOULD BE ALREADY VALID
return PORTLET_URL_FOR_SCOPE;
}else{
//ADDING VRE NAME AND THE SUFFIX 'CATALOGUE_TAB_ENDING_URL' TO URL
String buildedUrl = PORTLET_URL_FOR_SCOPE.endsWith("/") ? PORTLET_URL_FOR_SCOPE : PORTLET_URL_FOR_SCOPE + "/";
buildedUrl += context.name().toLowerCase() + CATALOGUE_TAB_ENDING_URL;
return buildedUrl;
}
}
@Override

View File

@ -54,7 +54,7 @@ public class DataCatalogueRunningCluster {
// data catalogue info
private final static String RUNTIME_CATALOGUE_RESOURCE_NAME = "CKanDataCatalogue";
private final static String PLATFORM_CATALOGUE_NAME = "Tomcat";
private final static String PLATFORM_CATALOGUE_NAME = "Tomcat";
// api key property for SYSADMIN
private final static String API_KEY_PROPERTY = "API_KEY";
@ -65,7 +65,7 @@ public class DataCatalogueRunningCluster {
// property to retrieve the master service endpoint into the /root scope
private final static String IS_MASTER_ROOT_KEY_PROPERTY = "IS_ROOT_MASTER"; // true, false.. missing means false as well
private final static String IS_MANAGE_PRODUCT_ENABLED = "IS_MANAGE_PRODUCT_ENABLED"; // true, false.. missing means false as well (for GRSF records)
private final static String SOCIAL_POST = "SOCIAL_POST";
private final static String ALERT_USERS_ON_POST_CREATION = "ALERT_USERS_ON_POST_CREATION";
private final static String SOLR_INDEX_ADDRESS = "SOLR_INDEX_ADDRESS";
@ -74,7 +74,7 @@ public class DataCatalogueRunningCluster {
private final static String URL_RESOLVER = "URL_RESOLVER";
// Other generic resource for delegating roles in groups to users
private final static String CATALOGUE_EXTENDING_ROLES = "CatalogueDelegateRoles";
private final static String CATALOGUE_EXTENDING_ROLES = "CatalogueDelegateRoles";
// retrieved data
private List<String> datacatalogueUrls = new ArrayList<String>();
@ -92,7 +92,7 @@ public class DataCatalogueRunningCluster {
private Map<String, String> extendRoleInOrganization = new HashMap<String, String>(0);
// generic role key
public static final String CKAN_GENERIC_ROLE = "*";
public static final String CKAN_GENERIC_ROLE = "*";
public static final String ROLE_ORGANIZATION_SEPARATOR = "|";
public static final String TUPLES_SEPARATOR = ",";
@ -148,8 +148,8 @@ public class DataCatalogueRunningCluster {
/**
* Evaluate the right configuration about ckan
* @param resources
* @throws NoDataCatalogueRuntimeResourceException
* @throws ServiceEndPointException
* @throws NoDataCatalogueRuntimeResourceException
* @throws ServiceEndPointException
*/
private void evaluateRightConfigurationCatalogue(
List<ServiceEndpoint> resources) throws NoDataCatalogueRuntimeResourceException, ServiceEndPointException {
@ -170,7 +170,7 @@ public class DataCatalogueRunningCluster {
Iterator<AccessPoint> accessPointIterator = res.profile().accessPoints().iterator();
while (accessPointIterator.hasNext()) {
ServiceEndpoint.AccessPoint accessPoint = (ServiceEndpoint.AccessPoint) accessPointIterator
ServiceEndpoint.AccessPoint accessPoint = accessPointIterator
.next();
// get the is master property
@ -215,7 +215,7 @@ public class DataCatalogueRunningCluster {
Iterator<AccessPoint> accessPointIterator = res.profile().accessPoints().iterator();
while (accessPointIterator.hasNext()) {
ServiceEndpoint.AccessPoint accessPoint = (ServiceEndpoint.AccessPoint) accessPointIterator
ServiceEndpoint.AccessPoint accessPoint = accessPointIterator
.next();
// add this host
@ -230,7 +230,7 @@ public class DataCatalogueRunningCluster {
catalogueEmail = accessPoint.propertyMap().get(CKAN_EMAIL_PROPERTY).value();
catalogueEmail = StringEncrypter.getEncrypter().decrypt(catalogueEmail);
}
// get the is manage product property
Property entry = accessPoint.propertyMap().get(IS_MANAGE_PRODUCT_ENABLED);
String isManageProduct = entry != null ? entry.value() : null;
@ -245,8 +245,8 @@ public class DataCatalogueRunningCluster {
if(accessPoint.propertyMap().containsKey(SOCIAL_POST))
if(accessPoint.propertyMap().get(SOCIAL_POST).value().trim().equalsIgnoreCase("false"))
socialPost = false;
// retrieve option for user alert
if(accessPoint.propertyMap().containsKey(ALERT_USERS_ON_POST_CREATION))
if(accessPoint.propertyMap().get(ALERT_USERS_ON_POST_CREATION).value().trim().equalsIgnoreCase("true"))
@ -295,7 +295,7 @@ public class DataCatalogueRunningCluster {
Iterator<AccessPoint> accessPointIterator = res.profile().accessPoints().iterator();
while (accessPointIterator.hasNext()) {
ServiceEndpoint.AccessPoint accessPoint = (ServiceEndpoint.AccessPoint) accessPointIterator
ServiceEndpoint.AccessPoint accessPoint = accessPointIterator
.next();
// get the is master property
@ -336,7 +336,7 @@ public class DataCatalogueRunningCluster {
Iterator<AccessPoint> accessPointIterator = res.profile().accessPoints().iterator();
while (accessPointIterator.hasNext()) {
ServiceEndpoint.AccessPoint accessPoint = (ServiceEndpoint.AccessPoint) accessPointIterator
ServiceEndpoint.AccessPoint accessPoint = accessPointIterator
.next();
// add this host
@ -391,7 +391,7 @@ public class DataCatalogueRunningCluster {
List<ServiceEndpoint> toReturn = client.submit(query);
return toReturn;
}
}
/**
* Retrieve the url of the ckan portlet deployed into this scope
@ -411,7 +411,7 @@ public class DataCatalogueRunningCluster {
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
if (appProfile == null || appProfile.size() == 0)
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("Your applicationProfile is not registered in the infrastructure");
else {
String elem = appProfile.get(0);
@ -424,13 +424,13 @@ public class DataCatalogueRunningCluster {
if (currValue != null && currValue.size() > 0) {
logger.debug("Portlet url found is " + currValue.get(0));
return currValue.get(0);
}
}
}
} catch (Exception e) {
logger.error("Error while trying to fetch applicationProfile profile from the infrastructure", e);
}
}
return null;
@ -438,9 +438,9 @@ public class DataCatalogueRunningCluster {
/**
* Parse the CatalogueDelegateRoles in this context
* @throws ParserConfigurationException
* @throws IOException
* @throws SAXException
* @throws ParserConfigurationException
* @throws IOException
* @throws SAXException
*/
private void parseExtendingRoles() throws ParserConfigurationException, SAXException, IOException {
@ -454,7 +454,7 @@ public class DataCatalogueRunningCluster {
logger.debug("Resource for extending role has size " + appProfile.size());
if (appProfile == null || appProfile.size() == 0)
if (appProfile == null || appProfile.size() == 0)
return;
else {
String profile = appProfile.get(0);
@ -472,7 +472,7 @@ public class DataCatalogueRunningCluster {
if(nodeI.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element)nodeI;
Element elem = (Element)nodeI;
String role = elem.getElementsByTagName("sourceRole").item(0).getTextContent();
String destOrg = elem.getElementsByTagName("destOrganization").item(0).getTextContent();
String sourceOrg = elem.getElementsByTagName("sourceOrganization").item(0).getTextContent();