From 6cd048cba6728c56dd6989440d28b1a3005e576c Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Fri, 10 Jun 2016 15:16:42 +0000 Subject: [PATCH] Visibility can now be set. Tags can only contain alpha numerical chars git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@129063 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/ui/CreateDatasetForm.java | 14 +++++++++----- .../server/CKANPublisherServicesImpl.java | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.java index 60ae8fd..2b76eda 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.java @@ -542,7 +542,7 @@ public class CreateDatasetForm extends Composite{ // disable dataset fields disableDatasetFields(); - + // disable reset resetButton.setEnabled(false); @@ -564,10 +564,10 @@ public class CreateDatasetForm extends Composite{ // leave to back button, but remove create and add go to dataset createButton.removeFromParent(); - + // set go to dataset as primary goToDatasetButton.setType(ButtonType.PRIMARY); - + }else{ // remove create button @@ -719,11 +719,11 @@ public class CreateDatasetForm extends Composite{ errorMessage = "Missing title"; return errorMessage; } - + // name reg expression String regexName = "^[a-zA-Z\\s]+"; if(!validateByRegExpression(maintainerTextbox.getText(), regexName)){ - errorMessage = "Not valid maintainer name"; // TODO + errorMessage = "Not valid maintainer name"; return errorMessage; } @@ -852,6 +852,10 @@ public class CreateDatasetForm extends Composite{ if(tagsList.contains(itemBox.getValue())) return; + // ckan accepts only alphanumeric values + if(!itemBox.getValue().matches("^[a-zA-Z0-9]*$")) + return; + final String value = itemBox.getValue(); final ListItem displayItem = new ListItem(); displayItem.setStyleName("tag-style"); diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java index f8cf328..f8d6e20 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java @@ -551,11 +551,12 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C */ private void setVisibility(DatasetMetadataBean created, String orgOwnerId) throws Exception{ + logger.debug("Setting visibility of the dataset"); // set its visibility (true means public, false means private) boolean mustbePrivate = !created.getVisibility(); String currentScope = getCurrentScope(); CKanUtilsFactory.getInstance(). - getCkanUtilsForScope(currentScope).setDatasetPrivate(mustbePrivate, orgOwnerId, created.getId(), getCKANApikeyFromUser(created.getOwnerIdentifier())); + getCkanUtilsForScope(currentScope).setDatasetPrivate(mustbePrivate, orgOwnerId, created.getId(), created.getOwnerIdentifier()); }