Catalogue at root VO or VO level works in read only mode [#26854]
This commit is contained in:
parent
36f32bf438
commit
c9811d3fb0
|
@ -30,5 +30,10 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-2.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-2.3.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -68,7 +72,11 @@
|
|||
|
||||
|
||||
<wb-module deploy-name="gcube-ckan-datacatalog-2.3.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -137,7 +145,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -206,7 +218,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -275,13 +291,18 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module archiveName="metadata-profile-form-builder-widget-2.1.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-form-builder-widget/metadata-profile-form-builder-widget">
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="catalogue-util-library-1.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/catalogue-util-library/catalogue-util-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="ckan-metadata-publisher-widget-2.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-metadata-publisher-widget/ckan-metadata-publisher-widget">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -350,7 +371,11 @@
|
|||
|
||||
|
||||
<property name="context-root" value="gcube-ckan-datacatalog"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -419,7 +444,11 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -488,7 +517,11 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
- Supported the Edit facility [#26639]
|
||||
- Support the Delete facility [#26793]
|
||||
- Revisited the Navigation Bar
|
||||
- Revisited the "Select Item Resources" step when publishing from Workspace [#26874]
|
||||
- Catalogue at root VO or VO level works in read only mode [#26854]
|
||||
|
||||
## [v2.2.7] - 2023-12-21
|
||||
|
||||
|
|
|
@ -65,9 +65,10 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
private Button types = new Button("Types");
|
||||
|
||||
// user's own
|
||||
private InlineHTML separatorMyInfo = null;
|
||||
private InlineHTML separatorAdminButtons = null;
|
||||
|
||||
private InlineHTML pipe_MyInfo_start = null;
|
||||
private InlineHTML pipe_PublishItem_start = null;
|
||||
private InlineHTML pipe_SelectedItemOptions_start = null;
|
||||
|
||||
private DropdownButton dropMyOptionButtons = new DropdownButton("My...");
|
||||
private NavLink myDatasets = new NavLink("My Items");
|
||||
private NavLink myOrganizations = new NavLink("My Organizations");
|
||||
|
@ -119,7 +120,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
manageCModS.setType(ButtonType.PRIMARY);
|
||||
manageCModS.getElement().getStyle().setFloat(Float.RIGHT);
|
||||
manageCModS.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
|
||||
|
||||
messageModerationEnanbled.setTitle(MESSAGE_MODERATED_CATALOGUE);
|
||||
messageModerationEnanbled.getElement().setInnerHTML("<i class='icon-user'></i> " + MESSAGE_MODERATED_CATALOGUE);
|
||||
messageModerationEnanbled.addStyleName("moderation-enabled-flag");
|
||||
|
@ -145,13 +146,16 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
// disabling share and upload
|
||||
shareLink.setEnabled(false);
|
||||
uploadToZenodo.setEnabled(false);
|
||||
|
||||
|
||||
// hide upload to zenodo
|
||||
uploadToZenodo.setVisible(false);
|
||||
|
||||
// hide publish/update/delete
|
||||
editMeta.setVisible(false);
|
||||
deleteItem.setVisible(false);
|
||||
insertMeta.setVisible(false);
|
||||
|
||||
//hide manage GRSF product and Moderation
|
||||
|
||||
// hide manage GRSF product and Moderation
|
||||
manageGRSFProduct.setVisible(false);
|
||||
manageGRSFProduct.setEnabled(false);
|
||||
manageCModS.setVisible(false);
|
||||
|
@ -168,6 +172,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
|
||||
nav.add(messageModerationEnanbled);
|
||||
|
||||
nav.setId("the_catalogue_nav_bar");
|
||||
nav.addStyleName("nav_bar_catalogue");
|
||||
// add to navigation bar
|
||||
nav.add(home);
|
||||
|
@ -176,10 +181,10 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
nav.add(items);
|
||||
nav.add(types);
|
||||
nav.add(statistics);
|
||||
separatorMyInfo = new InlineHTML(
|
||||
pipe_MyInfo_start = new InlineHTML(
|
||||
"<span style=\"font-weight:bold;vertical-alignment:middle;margin:0 5px;\">|</span>");
|
||||
separatorMyInfo.setVisible(true);
|
||||
nav.add(separatorMyInfo);
|
||||
pipe_MyInfo_start.setVisible(true);
|
||||
nav.add(pipe_MyInfo_start);
|
||||
|
||||
dropMyOptionButtons.setBaseIcon(IconType.USER);
|
||||
dropMyOptionButtons.add(myOrganizations);
|
||||
|
@ -187,16 +192,18 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
dropMyOptionButtons.add(myDatasets);
|
||||
dropMyOptionButtons.setType(ButtonType.LINK);
|
||||
nav.add(dropMyOptionButtons);
|
||||
|
||||
separatorAdminButtons = new InlineHTML(
|
||||
"<span style=\"font-weight:bold;vertical-alignment:middle;margin:0 5px;\">|</span>");
|
||||
separatorAdminButtons.setVisible(true);
|
||||
nav.add(separatorAdminButtons);
|
||||
|
||||
pipe_PublishItem_start = new InlineHTML(
|
||||
"<span style=\"font-weight:bold;vertical-alignment:middle;margin:0 5px;\">|</span>");
|
||||
pipe_PublishItem_start.setVisible(false);
|
||||
nav.add(pipe_PublishItem_start);
|
||||
nav.add(insertMeta);
|
||||
|
||||
nav.add(new InlineHTML("<span style=\"font-weight:bold;vertical-alignment:middle;margin:0 5px;\">|</span>"));
|
||||
|
||||
|
||||
pipe_SelectedItemOptions_start = new InlineHTML(
|
||||
"<span style=\"font-weight:bold;vertical-alignment:middle;margin:0 5px;\">|</span>");
|
||||
pipe_SelectedItemOptions_start.setVisible(true);
|
||||
nav.add(pipe_SelectedItemOptions_start);
|
||||
|
||||
nav.add(editMeta);
|
||||
nav.add(deleteItem);
|
||||
nav.add(shareLink);
|
||||
|
@ -204,7 +211,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
|
||||
nav.add(manageGRSFProduct);
|
||||
nav.add(manageCModS);
|
||||
|
||||
|
||||
addHandlers();
|
||||
add(nav);
|
||||
}
|
||||
|
@ -384,19 +391,12 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Those buttons can be only visible when the logged user has role
|
||||
* EDITOR/ADMIN/SYSADMIN
|
||||
* Enable publish button.
|
||||
*
|
||||
* @param show the show
|
||||
* @param enable the enable
|
||||
*/
|
||||
public void visibilityPublishUpdateDeleteButtons(boolean show) {
|
||||
|
||||
// editMeta.setVisible(show); TODO
|
||||
// separatorAdminButtons.setVisible(show);
|
||||
insertMeta.setVisible(show);
|
||||
editMeta.setVisible(show);
|
||||
deleteItem.setVisible(show);
|
||||
|
||||
public void enablePublishItemButton(boolean enable) {
|
||||
insertMeta.setEnabled(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -491,6 +491,20 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
uploadToZenodo.setVisible(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Visibility publish item button.
|
||||
*
|
||||
* @param value the value
|
||||
* @param alsoThePipe the also the pipe. If true set bool value also the related
|
||||
* pipe 'pipe_PublishItem_start'
|
||||
*/
|
||||
public void visibilityPublishItemButton(boolean bool, boolean alsoThePipe) {
|
||||
insertMeta.setVisible(bool);
|
||||
if (alsoThePipe) {
|
||||
pipe_PublishItem_start.setVisible(bool);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Visibility edit item button.
|
||||
*
|
||||
|
@ -514,8 +528,9 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
*/
|
||||
public void doNotShowUserRelatedInfo() {
|
||||
|
||||
separatorMyInfo.setVisible(false);
|
||||
separatorAdminButtons.setVisible(false);
|
||||
pipe_MyInfo_start.setVisible(false);
|
||||
pipe_PublishItem_start.setVisible(false);
|
||||
pipe_SelectedItemOptions_start.setVisible(false);
|
||||
shareLink.setVisible(false);
|
||||
uploadToZenodo.setVisible(false);
|
||||
insertMeta.setVisible(false);
|
||||
|
@ -540,8 +555,8 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
|||
groups.setVisible(false);
|
||||
items.setVisible(false);
|
||||
types.setVisible(false);
|
||||
separatorMyInfo.setVisible(false);
|
||||
separatorAdminButtons.setVisible(false);
|
||||
pipe_MyInfo_start.setVisible(false);
|
||||
pipe_PublishItem_start.setVisible(false);
|
||||
dropMyOptionButtons.setVisible(false);
|
||||
// myDatasets.setVisible(false);
|
||||
// myOrganizations.setVisible(false);
|
||||
|
|
|
@ -181,24 +181,56 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
showPublishUpdateDeleteButtons(false);
|
||||
managementPanel.visibilityEditItemButton(false);
|
||||
managementPanel.visibilityDeleteItemButton(false);
|
||||
managementPanel.visibilityPublishItemButton(false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(RolesCkanGroupOrOrg result) {
|
||||
switch (result) {
|
||||
case ADMIN:
|
||||
showPublishUpdateDeleteButtons(true);
|
||||
break;
|
||||
case EDITOR:
|
||||
showPublishUpdateDeleteButtons(true);
|
||||
break;
|
||||
case MEMBER:
|
||||
showPublishUpdateDeleteButtons(false);
|
||||
break;
|
||||
default:
|
||||
showPublishUpdateDeleteButtons(false);
|
||||
break;
|
||||
GWT.log("isUserLoggedInVRE: "+ckanAccessPoint.isUserLoggedInVRE());
|
||||
GWT.log("getLoggedInScope: "+ckanAccessPoint.getLoggedInScope());
|
||||
|
||||
if (ckanAccessPoint.isUserLoggedInVRE()) {
|
||||
|
||||
switch (result) {
|
||||
case ADMIN: {
|
||||
managementPanel.visibilityPublishItemButton(true, true);
|
||||
managementPanel.visibilityEditItemButton(true);
|
||||
managementPanel.visibilityDeleteItemButton(true);
|
||||
managementPanel.enablePublishItemButton(true);
|
||||
break;
|
||||
}
|
||||
case EDITOR: {
|
||||
managementPanel.visibilityPublishItemButton(true, true);
|
||||
managementPanel.visibilityEditItemButton(true);
|
||||
managementPanel.visibilityDeleteItemButton(true);
|
||||
managementPanel.enablePublishItemButton(true);
|
||||
break;
|
||||
}
|
||||
case MEMBER: {
|
||||
managementPanel.visibilityEditItemButton(false);
|
||||
managementPanel.visibilityDeleteItemButton(false);
|
||||
// Disable the button "Publish Item" is to inform the user that he/she has
|
||||
// not the rights to publish
|
||||
managementPanel.visibilityPublishItemButton(true, true);
|
||||
managementPanel.enablePublishItemButton(false);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
managementPanel.visibilityEditItemButton(false);
|
||||
managementPanel.visibilityDeleteItemButton(false);
|
||||
// Disable the button "Publish Item" is to inform the user that he/she has
|
||||
// not the rights to publish
|
||||
managementPanel.visibilityPublishItemButton(true, true);
|
||||
managementPanel.enablePublishItemButton(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
managementPanel.visibilityPublishItemButton(false, true);
|
||||
managementPanel.visibilityEditItemButton(false);
|
||||
managementPanel.visibilityDeleteItemButton(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -414,15 +446,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
updateSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* show or hide the Publish/Update/Delete buttons according to the role.
|
||||
*
|
||||
* @param show the show
|
||||
*/
|
||||
public void showPublishUpdateDeleteButtons(boolean show) {
|
||||
|
||||
managementPanel.visibilityPublishUpdateDeleteButtons(show);
|
||||
}
|
||||
// /**
|
||||
// * show or hide the Publish/Update/Delete buttons according to the role.
|
||||
// *
|
||||
// * @param show the show
|
||||
// */
|
||||
// public void showPublishUpdateDeleteButtons(boolean show) {
|
||||
//
|
||||
// managementPanel.visibilityUpdateDeleteButtons(show);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Instance ckan frame.
|
||||
|
|
|
@ -88,7 +88,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
try{
|
||||
|
||||
// just get the current scope and set it into ScopeProvider...
|
||||
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||
String loggedInScope = SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||
|
||||
// retrieve scope per current portlet url
|
||||
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
|
||||
|
@ -112,7 +112,15 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
pathInfoParameter = isViewPerVREEnabled(browserLocationURL);
|
||||
}
|
||||
|
||||
//#26854
|
||||
CkanConnectorAccessPoint ckAP = getCkanConnectorAccessPoint(browserLocationURL, pathInfoParameter, queryStringParameters, scopePerCurrentUrl);
|
||||
ckAP.setLoggedInScope(loggedInScope);
|
||||
ckAP.setOperativeScope(scopePerCurrentUrl);
|
||||
if(loggedInScope!=null) {
|
||||
ScopeBean scopeBeanLS = new ScopeBean(loggedInScope);
|
||||
boolean loggedInVRE = scopeBeanLS.is(Type.VRE);
|
||||
ckAP.setUserLoggedInVRE(loggedInVRE);
|
||||
}
|
||||
SessionUtil.saveCkanAccessPoint(this.getThreadLocalRequest().getSession(), scopePerCurrentUrl, ckAP);
|
||||
logger.info("Built the URI to CKAN (connector in case of user logged): "+ckAP.buildURI());
|
||||
logger.debug("returning ckanConnectorUri: "+ckAP);
|
||||
|
@ -238,8 +246,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
RolesCkanGroupOrOrg toReturn = RolesCkanGroupOrOrg.MEMBER;
|
||||
|
||||
if(!SessionUtil.isIntoPortal()){
|
||||
logger.warn("OUT FROM PORTAL DETECTED RETURNING ROLE: "+RolesCkanGroupOrOrg.ADMIN);
|
||||
toReturn = RolesCkanGroupOrOrg.ADMIN;
|
||||
logger.warn("OUT FROM PORTAL DETECTED RETURNING ROLE: "+toReturn);
|
||||
}else{
|
||||
|
||||
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
||||
|
|
|
@ -10,14 +10,12 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.GcubeCkanDataCatalogServiceImpl;
|
||||
|
||||
|
||||
/**
|
||||
* The Class CkanConnectorAccessPoint.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jun 23, 2016
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 23, 2016
|
||||
*/
|
||||
public class CkanConnectorAccessPoint implements Serializable{
|
||||
public class CkanConnectorAccessPoint implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -37,6 +35,10 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
private boolean outsideLoginOnPortal = false;
|
||||
private String catalogueBaseUrl = null;
|
||||
|
||||
private String operativeScope = null;
|
||||
private String loggedInScope = null;
|
||||
private boolean isUserLoggedInVRE = false;
|
||||
|
||||
/**
|
||||
* Instantiates a new ckan connector access point.
|
||||
*/
|
||||
|
@ -46,10 +48,10 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
/**
|
||||
* Instantiates a new ckan connector access point.
|
||||
*
|
||||
* @param baseUrl the base url
|
||||
* @param baseUrl the base url
|
||||
* @param serviceContext the service context
|
||||
*/
|
||||
public CkanConnectorAccessPoint(String baseUrl, String serviceContext){
|
||||
public CkanConnectorAccessPoint(String baseUrl, String serviceContext) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.catalogueBaseUrl = baseUrl.split("ckan-connector")[0];
|
||||
this.serviceContext = serviceContext;
|
||||
|
@ -58,29 +60,29 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
/**
|
||||
* Adds the generic parameter.
|
||||
*
|
||||
* @param key the key
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void addGenericParameter(String key, String value){
|
||||
queryStringParameters=queryStringParameters==null?key+"="+value:queryStringParameters+"&"+key+"="+value;
|
||||
public void addGenericParameter(String key, String value) {
|
||||
queryStringParameters = queryStringParameters == null ? key + "=" + value
|
||||
: queryStringParameters + "&" + key + "=" + value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the query string.
|
||||
*
|
||||
* @param queryString the query string
|
||||
*/
|
||||
public void addQueryString(String queryString){
|
||||
public void addQueryString(String queryString) {
|
||||
|
||||
if(queryString==null || queryString.isEmpty())
|
||||
if (queryString == null || queryString.isEmpty())
|
||||
return;
|
||||
|
||||
if(queryString.startsWith("&") || queryString.startsWith("?")){
|
||||
queryString = queryString.substring(1, queryString.length()); //removes '&' or '?'
|
||||
if (queryString.startsWith("&") || queryString.startsWith("?")) {
|
||||
queryString = queryString.substring(1, queryString.length()); // removes '&' or '?'
|
||||
}
|
||||
|
||||
queryStringParameters=queryStringParameters==null?queryString:queryStringParameters+"&"+queryString;
|
||||
queryStringParameters = queryStringParameters == null ? queryString : queryStringParameters + "&" + queryString;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,8 +90,8 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
*
|
||||
* @param value the value
|
||||
*/
|
||||
public void addGubeToken(String value){
|
||||
if(!outsideLoginOnPortal){
|
||||
public void addGubeToken(String value) {
|
||||
if (!outsideLoginOnPortal) {
|
||||
this.gcubeTokenValue = value;
|
||||
addGenericParameter(GCUBE_TOKEN_PARAMETER, value);
|
||||
}
|
||||
|
@ -100,18 +102,19 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
*
|
||||
* @param listVREs the list vr es
|
||||
*/
|
||||
public void addListOfVREs(Map<String, String> listVREs){
|
||||
public void addListOfVREs(Map<String, String> listVREs) {
|
||||
this.mapVresRoles = listVREs;
|
||||
String vres = "";
|
||||
if(listVREs!=null && listVREs.size()>0){
|
||||
if (listVREs != null && listVREs.size() > 0) {
|
||||
Set<Entry<String, String>> set = listVREs.entrySet();
|
||||
for (Entry<String, String> entry : set) {
|
||||
vres += entry.getKey().toLowerCase() + "|" + entry.getValue() + ",";
|
||||
}
|
||||
vres = vres.substring(0, vres.length()-1); //remove last "," and to lower case. A CKAN Organization ID must be lower case
|
||||
vres = vres.substring(0, vres.length() - 1); // remove last "," and to lower case. A CKAN Organization ID
|
||||
// must be lower case
|
||||
}
|
||||
|
||||
if(vres.length()>0){
|
||||
if (vres.length() > 0) {
|
||||
addGenericParameter(LIST_OF_VRES_PARAMETER, vres);
|
||||
}
|
||||
}
|
||||
|
@ -121,27 +124,75 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
*
|
||||
* @param pathInfo the path info
|
||||
*/
|
||||
public void addPathInfo(String pathInfo){
|
||||
public void addPathInfo(String pathInfo) {
|
||||
pathInfoParameter = pathInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds the URI to contact the CKAN (connector in case of user logged)
|
||||
* Builds the URI to contact the CKAN (connector in case of user logged).
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String buildURI(){
|
||||
public String buildURI() {
|
||||
|
||||
String path = "";
|
||||
String query = "";
|
||||
String path = "";
|
||||
String query = "";
|
||||
path = checkURLPathSeparator(pathInfoParameter, true, false);
|
||||
query = checkNullString(queryStringParameters);
|
||||
String url = getBaseUrlWithContext()+path;
|
||||
url+= !query.isEmpty()?"?"+query:"";
|
||||
String url = getBaseUrlWithContext() + path;
|
||||
url += !query.isEmpty() ? "?" + query : "";
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the operative scope.
|
||||
*
|
||||
* @return the operative scope
|
||||
*/
|
||||
public String getOperativeScope() {
|
||||
return operativeScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the logged in scope.
|
||||
*
|
||||
* @return the logged in scope
|
||||
*/
|
||||
public String getLoggedInScope() {
|
||||
return loggedInScope;
|
||||
}
|
||||
|
||||
public boolean isUserLoggedInVRE() {
|
||||
return isUserLoggedInVRE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user logged in VRE.
|
||||
*
|
||||
* @param isUserLoggedInVRE the new user logged in VRE
|
||||
*/
|
||||
public void setUserLoggedInVRE(boolean isUserLoggedInVRE) {
|
||||
this.isUserLoggedInVRE = isUserLoggedInVRE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the operative scope.
|
||||
*
|
||||
* @param operativeScope the new operative scope
|
||||
*/
|
||||
public void setOperativeScope(String operativeScope) {
|
||||
this.operativeScope = operativeScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the logged in scope.
|
||||
*
|
||||
* @param loggedInScope the new logged in scope
|
||||
*/
|
||||
public void setLoggedInScope(String loggedInScope) {
|
||||
this.loggedInScope = loggedInScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base url with context.
|
||||
*
|
||||
|
@ -149,10 +200,9 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
*/
|
||||
public String getBaseUrlWithContext() {
|
||||
|
||||
return baseUrl+serviceContext;
|
||||
return baseUrl + serviceContext;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the path info parameter.
|
||||
*
|
||||
|
@ -163,7 +213,6 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
return pathInfoParameter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the query string parameters.
|
||||
*
|
||||
|
@ -174,7 +223,6 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
return queryStringParameters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the gcube token value.
|
||||
*
|
||||
|
@ -185,7 +233,6 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
return gcubeTokenValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of v res.
|
||||
*
|
||||
|
@ -199,25 +246,29 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
/**
|
||||
* Check url path separator.
|
||||
*
|
||||
* @param url the url
|
||||
* @param head - checks the {@link GcubeCkanDataCatalogServiceImpl.URL_PATH_SEPARATOR} in head adding if do not exist
|
||||
* @param tail - checks the {@link GcubeCkanDataCatalogServiceImpl.URL_PATH_SEPARATOR} in tail adding if do not exist
|
||||
* @return the string - if null return an empty string otherwise a string with {@link GcubeCkanDataCatalogServiceImpl.URL_PATH_SEPARATOR}
|
||||
* @param url the url
|
||||
* @param head - checks the
|
||||
* {@link GcubeCkanDataCatalogServiceImpl.URL_PATH_SEPARATOR} in
|
||||
* head adding if do not exist
|
||||
* @param tail - checks the
|
||||
* {@link GcubeCkanDataCatalogServiceImpl.URL_PATH_SEPARATOR} in
|
||||
* tail adding if do not exist
|
||||
* @return the string - if null return an empty string otherwise a string with
|
||||
* {@link GcubeCkanDataCatalogServiceImpl.URL_PATH_SEPARATOR}
|
||||
*/
|
||||
public static String checkURLPathSeparator(String url, boolean head, boolean tail){
|
||||
public static String checkURLPathSeparator(String url, boolean head, boolean tail) {
|
||||
|
||||
if(url!=null && url.length()>0){
|
||||
if(head)
|
||||
url=url.startsWith(URL_PATH_SEPARATOR)?url:URL_PATH_SEPARATOR+url;
|
||||
if(tail)
|
||||
url=url.endsWith(URL_PATH_SEPARATOR)?url:url+URL_PATH_SEPARATOR;
|
||||
}else
|
||||
if (url != null && url.length() > 0) {
|
||||
if (head)
|
||||
url = url.startsWith(URL_PATH_SEPARATOR) ? url : URL_PATH_SEPARATOR + url;
|
||||
if (tail)
|
||||
url = url.endsWith(URL_PATH_SEPARATOR) ? url : url + URL_PATH_SEPARATOR;
|
||||
} else
|
||||
url = "";
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the base url.
|
||||
*
|
||||
|
@ -228,23 +279,20 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
return baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check null string.
|
||||
*
|
||||
* @param value the value
|
||||
* @return the string if is not null otherwise an empty string
|
||||
*/
|
||||
public static String checkNullString(String value){
|
||||
public static String checkNullString(String value) {
|
||||
|
||||
if(value==null)
|
||||
if (value == null)
|
||||
return "";
|
||||
else
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is outside login on portal.
|
||||
*
|
||||
|
@ -255,7 +303,6 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
return outsideLoginOnPortal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the outside login on portal.
|
||||
*
|
||||
|
@ -275,8 +322,14 @@ public class CkanConnectorAccessPoint implements Serializable{
|
|||
return catalogueBaseUrl;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue