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:
parent
18deeed31a
commit
ce63c31343
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui;
|
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -188,9 +189,17 @@ public class CreateDatasetForm extends Composite{
|
||||||
|
|
||||||
licenseBean = lBean;
|
licenseBean = lBean;
|
||||||
|
|
||||||
|
// sort the list
|
||||||
|
List<String> listOfNames = licenseBean.getLicenses();
|
||||||
|
Collections.sort(listOfNames);
|
||||||
|
|
||||||
|
|
||||||
// fill the listbox
|
// fill the listbox
|
||||||
for(String license: licenseBean.getLicenses()){
|
for(int i = 0; i < listOfNames.size(); i++){
|
||||||
licenseListbox.addItem(license);
|
licenseListbox.addItem(listOfNames.get(i));
|
||||||
|
if(listOfNames.get(i).equals("Creative Commons Attribution"))
|
||||||
|
licenseListbox.setItemSelected(i, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// everything went ok
|
// everything went ok
|
||||||
|
@ -727,18 +736,18 @@ public class CreateDatasetForm extends Composite{
|
||||||
errorMessage = "Missing title";
|
errorMessage = "Missing title";
|
||||||
return errorMessage;
|
return errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// better check for the title
|
// better check for the title
|
||||||
String regexTitleSubWord = "^[a-zA-Z0-9_]+$";
|
String regexTitleSubWord = "^[a-zA-Z0-9_]+$";
|
||||||
String[] splittedTitle = titleTextBox.getText().split(" ");
|
String[] splittedTitle = titleTextBox.getText().split(" ");
|
||||||
|
|
||||||
for (String word : splittedTitle) {
|
for (String word : splittedTitle) {
|
||||||
|
|
||||||
if(!word.matches(regexTitleSubWord))
|
if(!word.matches(regexTitleSubWord))
|
||||||
return "Please note that only alphanumeric characters are allowed for the title";
|
return "Please note that only alphanumeric characters are allowed for the title";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// name reg expression
|
// name reg expression
|
||||||
String regexName = "^[a-zA-Z\\s]+";
|
String regexName = "^[a-zA-Z\\s]+";
|
||||||
if(!validateByRegExpression(maintainerTextbox.getText(), regexName)){
|
if(!validateByRegExpression(maintainerTextbox.getText(), regexName)){
|
||||||
|
@ -878,7 +887,7 @@ public class CreateDatasetForm extends Composite{
|
||||||
// ckan accepts only alphanumeric values
|
// ckan accepts only alphanumeric values
|
||||||
if(!itemBox.getValue().matches("^[a-zA-Z0-9]*$"))
|
if(!itemBox.getValue().matches("^[a-zA-Z0-9]*$"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(itemBox.getValue().length() <= 1)
|
if(itemBox.getValue().length() <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
// retrieve ckan information
|
// retrieve ckan information
|
||||||
try{
|
try{
|
||||||
String currentScope = getASLSession().getScope();
|
String currentScope = getASLSession().getScope();
|
||||||
logger.debug("Scope is " + currentScope);
|
logger.debug("Scope from asl is " + currentScope);
|
||||||
instance = new CKanUtilsImpl(currentScope);
|
instance = new CKanUtilsImpl(currentScope);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("Unable to retrieve ckan information", e);
|
logger.error("Unable to retrieve ckan information", e);
|
||||||
|
|
Loading…
Reference in New Issue