licenses are now shown in sorted order and cc-by has been chosen as the default one

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@129470 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-06-27 10:36:45 +00:00
parent 18deeed31a
commit ce63c31343
2 changed files with 18 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -188,9 +189,17 @@ public class CreateDatasetForm extends Composite{
licenseBean = lBean;
// sort the list
List<String> listOfNames = licenseBean.getLicenses();
Collections.sort(listOfNames);
// fill the listbox
for(String license: licenseBean.getLicenses()){
licenseListbox.addItem(license);
for(int i = 0; i < listOfNames.size(); i++){
licenseListbox.addItem(listOfNames.get(i));
if(listOfNames.get(i).equals("Creative Commons Attribution"))
licenseListbox.setItemSelected(i, true);
}
// everything went ok
@ -727,18 +736,18 @@ public class CreateDatasetForm extends Composite{
errorMessage = "Missing title";
return errorMessage;
}
// better check for the title
String regexTitleSubWord = "^[a-zA-Z0-9_]+$";
String[] splittedTitle = titleTextBox.getText().split(" ");
for (String word : splittedTitle) {
if(!word.matches(regexTitleSubWord))
return "Please note that only alphanumeric characters are allowed for the title";
}
// name reg expression
String regexName = "^[a-zA-Z\\s]+";
if(!validateByRegExpression(maintainerTextbox.getText(), regexName)){
@ -878,7 +887,7 @@ public class CreateDatasetForm extends Composite{
// ckan accepts only alphanumeric values
if(!itemBox.getValue().matches("^[a-zA-Z0-9]*$"))
return;
if(itemBox.getValue().length() <= 1)
return;

View File

@ -72,7 +72,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
// retrieve ckan information
try{
String currentScope = getASLSession().getScope();
logger.debug("Scope is " + currentScope);
logger.debug("Scope from asl is " + currentScope);
instance = new CKanUtilsImpl(currentScope);
}catch(Exception e){
logger.error("Unable to retrieve ckan information", e);