diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c49746..bc000f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,101 +4,105 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [v2.1.0-SNAPSHOT] - 2022-06-13
+
+**Enhancements**
+
+- [#23491] The final URL provided to go to the item is the "Catalogue Portlet URL"
## [v2.0.1] - 2021-05-24
**Bug fixes**
-[#21470] Fixing: publishing widget uses the orgTitle instead of orgName
+- [#21470] Fixing: publishing widget uses the orgTitle instead of orgName
**New**
-Moved to maven-portal-bom 3.6.2
-
+- Moved to maven-portal-bom 3.6.2
## [v2.0.0] - 2021-04-12
**Enhancements**
-[#19764] Porting ckan-metadata-publisher-widget to catalogue-util-library
-[#20680] Ported to SHUB
-[#19568] Unify and extend the tags allowed values
-[#20828] Revisited title size and format
-[#20868] Redesigned the "Manage Resources" user experience
-[#21068] Add Resources facility: only HTTPS URLs must be allowed
-[#21153] Upgrade the maven-portal-bom to 3.6.1 version
+- [#19764] Porting ckan-metadata-publisher-widget to catalogue-util-library
+- [#20680] Ported to SHUB
+- [#19568] Unify and extend the tags allowed values
+- [#20828] Revisited title size and format
+- [#20868] Redesigned the "Manage Resources" user experience
+- [#21068] Add Resources facility: only HTTPS URLs must be allowed
+- [#21153] Upgrade the maven-portal-bom to 3.6.1 version
## [v1.6.2] - 2021-02-08
**Bug Fixes**
-[#20446] Catalogue Publishing Widget: field value unexpectedly added in case of optional field
-[#20663] Fixing Time_Interval placeholder
+- [#20446] Catalogue Publishing Widget: field value unexpectedly added in case of optional field
+- [#20663] Fixing Time_Interval placeholder
-## [v1.6.1] [r4.24.0] - 2020-06-18
+## [v1.6.1] - 2020-06-18
**New Features**
-[#18700] Do not skip regex validation on catalogue item when a field is empty (UI side)
+- [#18700] Do not skip regex validation on catalogue item when a field is empty (UI side)
## [v1.6.0] - 2019-09-25
-[Feature #11331] Field repeatability: support for catalogue widget
+- [Feature #11331] Field repeatability: support for catalogue widget
-[Task #12480] Data Catalogue Publishing widget: filter the VREs for the working gateway widget
+- [Task #12480] Data Catalogue Publishing widget: filter the VREs for the working gateway widget
-[Feature #17577] Modify ckan-metadata-publisher-widget posts to cite people with @username
+- [Feature #17577] Modify ckan-metadata-publisher-widget posts to cite people with @username
-[Support #13188] Fixed some logs
+- [Support #13188] Fixed some logs
## [v1.5.0] - 2019-06-11
-[Feature #13074] Integrated with 'openlayer-basic-widgets'
+- [Feature #13074] Integrated with 'openlayer-basic-widgets'
## [v1.4.1] - 2018-11-20
-[Bug #12914] The form to add/choice the resources to publishing remains frozen
+- [Bug #12914] The form to add/choice the resources to publishing remains frozen
## [v1.4.0] - 2018-09-28
-[Incident #12563] Error when trying to publish the content of a workspace folder into the catalogue
+- [Incident #12563] Error when trying to publish the content of a workspace folder into the catalogue
## [v1.3.3] - 2018-03-02
-Minor update
+- Minor update
## [v1.3.2] - 2018-02-26
-Minor update due to interface changed
+- Minor update due to interface changed
## [v1.3.1] - 2017-06-26
-External Url files are properly managed as resources
+- External Url files are properly managed as resources
## [v1.3.0] - 2017-05-05
-Metadata model v.3 supported
+- Metadata model v.3 supported
## [v1.2.3] - 2017-04-05
-Some bug fixes
+- Some bug fixes
## [v1.2.2] - 2017-02-27
-Some minor terms changed
+- Some minor terms changed
-added support for ticket #7207
+- added support for ticket #7207
## [v1.2.1] - 2017-02-02
diff --git a/pom.xml b/pom.xml
index ba3096d..fd64da5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
org.gcube.portlets.widgets
ckan-metadata-publisher-widget
- 2.0.1
+ 2.1.0-SNAPSHOT
gCube Ckan metadata publisher widget
@@ -42,7 +42,7 @@
org.gcube.distribution
maven-portal-bom
- 3.6.2
+ 3.6.2-SNAPSHOT
pom
import
diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.java
index c0bf516..d59b84b 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.java
@@ -47,6 +47,7 @@ import com.github.gwtbootstrap.client.ui.TextArea;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
+import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.ResizeType;
import com.github.gwtbootstrap.client.ui.resources.Bootstrap.Tabs;
import com.google.gwt.core.client.GWT;
@@ -74,105 +75,187 @@ import com.google.gwt.user.client.ui.Widget;
/**
* Create metadata form for ckan product.
+ *
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
-public class CreateDatasetForm extends Composite{
+public class CreateDatasetForm extends Composite {
- private static EditMetadataFormUiBinder uiBinder = GWT
- .create(EditMetadataFormUiBinder.class);
+ private static EditMetadataFormUiBinder uiBinder = GWT.create(EditMetadataFormUiBinder.class);
- interface EditMetadataFormUiBinder extends
- UiBinder {
+ interface EditMetadataFormUiBinder extends UiBinder {
}
- @UiField HTMLPanel createDatasetMainPanel;
- @UiField TextBox titleTextBox;
- @UiField TextArea descriptionTextarea;
- @UiField ListBox licenseListbox;
- @UiField ListBox visibilityListbox;
- @UiField ListBox organizationsListbox;
- @UiField TextBox versionTextbox;
- @UiField TextBox authorTextbox;
- @UiField TextBox authorEmailTextbox;
- @UiField TextBox maintainerTextbox;
- @UiField TextBox maintainerEmailTextbox;
- @UiField ControlGroup customFields;
- @UiField Button addCustomFieldButton;
- @UiField Button createButton;
- @UiField Button resetButton;
- @UiField AlertBlock infoBlock;
- @UiField AlertBlock alertNoResources;
- @UiField AlertBlock onContinueAlertBlock;
- @UiField AlertBlock onCreateAlertBlock;
- @UiField VerticalPanel metadataFieldsPanel;
- @UiField ListBox metadataTypeListbox;
- @UiField Form formFirstStep;
- @UiField Form formSecondStep;
- @UiField Form formThirdStep;
- @UiField Button continueButton;
- @UiField Button goBackButtonSecondStep;
- @UiField Paragraph selectedProfile;
- @UiField Button goToDatasetButton;
- @UiField HorizontalPanel goToDatasetButtonPanel;
- @UiField Button addResourcesButton;
- @UiField SimplePanel workspaceResourcesContainer;
- @UiField Button continueThirdStep;
- @UiField Button goBackButtonFirstStep;
- @UiField Anchor licenseUrlAnchor;
- @UiField Paragraph unavailableUrl;
- @UiField TagsPanel tagsPanel;
- @UiField ListBox groupsListbox;
+ @UiField
+ HTMLPanel createDatasetMainPanel;
+ @UiField
+ TextBox titleTextBox;
+ @UiField
+ TextArea descriptionTextarea;
+ @UiField
+ ListBox licenseListbox;
+ @UiField
+ ListBox visibilityListbox;
+ @UiField
+ ListBox organizationsListbox;
+ @UiField
+ TextBox versionTextbox;
+ @UiField
+ TextBox authorTextbox;
+ @UiField
+ TextBox authorEmailTextbox;
+ @UiField
+ TextBox maintainerTextbox;
+ @UiField
+ TextBox maintainerEmailTextbox;
+ @UiField
+ ControlGroup customFields;
+ @UiField
+ Button addCustomFieldButton;
+ @UiField
+ Button createButton;
+ @UiField
+ Button resetButton;
+ @UiField
+ AlertBlock infoBlock;
+ @UiField
+ AlertBlock alertNoResources;
+ @UiField
+ AlertBlock onContinueAlertBlock;
+ @UiField
+ AlertBlock onCreateAlertBlock;
+ @UiField
+ VerticalPanel metadataFieldsPanel;
+ @UiField
+ ListBox metadataTypeListbox;
+ @UiField
+ Form formFirstStep;
+ @UiField
+ Form formSecondStep;
+ @UiField
+ Form formThirdStep;
+ @UiField
+ Button continueButton;
+ @UiField
+ Button goBackButtonSecondStep;
+ @UiField
+ Paragraph selectedProfile;
+ @UiField
+ Button goToDatasetButton;
+ @UiField
+ HorizontalPanel goToDatasetButtonPanel;
+ @UiField
+ Button addResourcesButton;
+ @UiField
+ SimplePanel workspaceResourcesContainer;
+ @UiField
+ Button continueThirdStep;
+ @UiField
+ Button goBackButtonFirstStep;
+ @UiField
+ Anchor licenseUrlAnchor;
+ @UiField
+ Paragraph unavailableUrl;
+ @UiField
+ TagsPanel tagsPanel;
+ @UiField
+ ListBox groupsListbox;
// info panels
- @UiField Icon infoIconLicenses;
- @UiField FocusPanel focusPanelLicenses;
- @UiField Popover popoverLicenses;
- @UiField Icon infoIconVisibility;
- @UiField FocusPanel focusPanelVisibility;
- @UiField Popover popoverVisibility;
- @UiField Icon infoIconAuthor;
- @UiField FocusPanel focusPanelAuthor;
- @UiField Popover popoverAuthor;
- @UiField Icon infoIconMaintainerEmail;
- @UiField FocusPanel focusPanelMaintainerEmail;
- @UiField Popover popoverMaintainerEmail;
- @UiField Icon infoIconAuthorEmail;
- @UiField FocusPanel focusPanelAuthorEmail;
- @UiField Popover popoverAuthorEmail;
- @UiField Icon infoIconTypes;
- @UiField FocusPanel focusPanelTypes;
- @UiField Popover popoverTypes;
- @UiField Icon infoIconMaintainer;
- @UiField FocusPanel focusPanelMaintainer;
- @UiField Popover popoverMaintainer;
- @UiField Icon infoIconCustomFields;
- @UiField FocusPanel focusPanelCustomFields;
- @UiField Popover popoverCustomFields;
- @UiField Icon infoIconResources;
- @UiField FocusPanel focusPanelResources;
- @UiField Popover popoverResources;
- @UiField Icon infoIconTitle;
- @UiField FocusPanel focusPanelTitle;
- @UiField Popover popoverGroups;
- @UiField Icon infoIconGroups;
- @UiField FocusPanel focusPanelGroups;
- @UiField Popover popoverTitle;
- @UiField Icon infoIconDescription;
- @UiField Popover popoverDescription;
- @UiField FocusPanel focusPanelDescription;
- @UiField ControlGroup metadataTypesControlGroup;
- @UiField ControlGroup productTitleGroup;
- @UiField ControlGroup maintainerControlGroup;
- @UiField ControlGroup versionControlGroup;
- @UiField ControlGroup organizationsGroup;
- @UiField ControlGroup groupsControlGroup;
+ @UiField
+ Icon infoIconLicenses;
+ @UiField
+ FocusPanel focusPanelLicenses;
+ @UiField
+ Popover popoverLicenses;
+ @UiField
+ Icon infoIconVisibility;
+ @UiField
+ FocusPanel focusPanelVisibility;
+ @UiField
+ Popover popoverVisibility;
+ @UiField
+ Icon infoIconAuthor;
+ @UiField
+ FocusPanel focusPanelAuthor;
+ @UiField
+ Popover popoverAuthor;
+ @UiField
+ Icon infoIconMaintainerEmail;
+ @UiField
+ FocusPanel focusPanelMaintainerEmail;
+ @UiField
+ Popover popoverMaintainerEmail;
+ @UiField
+ Icon infoIconAuthorEmail;
+ @UiField
+ FocusPanel focusPanelAuthorEmail;
+ @UiField
+ Popover popoverAuthorEmail;
+ @UiField
+ Icon infoIconTypes;
+ @UiField
+ FocusPanel focusPanelTypes;
+ @UiField
+ Popover popoverTypes;
+ @UiField
+ Icon infoIconMaintainer;
+ @UiField
+ FocusPanel focusPanelMaintainer;
+ @UiField
+ Popover popoverMaintainer;
+ @UiField
+ Icon infoIconCustomFields;
+ @UiField
+ FocusPanel focusPanelCustomFields;
+ @UiField
+ Popover popoverCustomFields;
+ @UiField
+ Icon infoIconResources;
+ @UiField
+ FocusPanel focusPanelResources;
+ @UiField
+ Popover popoverResources;
+ @UiField
+ Icon infoIconTitle;
+ @UiField
+ FocusPanel focusPanelTitle;
+ @UiField
+ Popover popoverGroups;
+ @UiField
+ Icon infoIconGroups;
+ @UiField
+ FocusPanel focusPanelGroups;
+ @UiField
+ Popover popoverTitle;
+ @UiField
+ Icon infoIconDescription;
+ @UiField
+ Popover popoverDescription;
+ @UiField
+ FocusPanel focusPanelDescription;
+ @UiField
+ ControlGroup metadataTypesControlGroup;
+ @UiField
+ ControlGroup productTitleGroup;
+ @UiField
+ ControlGroup maintainerControlGroup;
+ @UiField
+ ControlGroup versionControlGroup;
+ @UiField
+ ControlGroup organizationsGroup;
+ @UiField
+ ControlGroup groupsControlGroup;
+
+ @UiField
+ HTMLPanel wizardCreatorPanel;
- @UiField HTMLPanel wizardCreatorPanel;
+ private Icon iconSpinner = new Icon(IconType.SPINNER);
+
// Create a remote service proxy to talk to the server-side ckan service.
private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class);
- //private static final String REGEX_TITLE_PRODUCT_SUBWORD = "[^a-zA-Z0-9_.-]";
+ // private static final String REGEX_TITLE_PRODUCT_SUBWORD = "[^a-zA-Z0-9_.-]";
private static final String REGEX_MAIL = "\\b[\\w.%-]+@[-.\\w]+\\.[A-Za-z]{2,4}\\b";
private static final String NONE_PROFILE = "none";
@@ -210,8 +293,8 @@ public class CreateDatasetForm extends Composite{
private boolean isWorkspaceRequest = false;
// resource table
- //private TwinColumnSelectionMainPanel resourcesTwinPanel;
-
+ // private TwinColumnSelectionMainPanel resourcesTwinPanel;
+
// resource table
private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel;
@@ -220,11 +303,12 @@ public class CreateDatasetForm extends Composite{
// map of organization name title
private Map nameTitleOrganizationMap = new HashMap();
-
+
private WizardCreator wizCreator;
/**
* Invoked in the most general case
+ *
* @param eventBus the event bus
*/
public CreateDatasetForm(HandlerManager eventBus) {
@@ -233,8 +317,9 @@ public class CreateDatasetForm extends Composite{
/**
* Invoked when the workspace is used
+ *
* @param idFolderWorkspace
- * @param eventBus the event bus
+ * @param eventBus the event bus
*/
public CreateDatasetForm(String idFolderOrFileWorkspace, HandlerManager eventBus) {
createDatasetFormBody(true, idFolderOrFileWorkspace, eventBus);
@@ -265,27 +350,33 @@ public class CreateDatasetForm extends Composite{
/**
* The real constructor
+ *
* @param isWorkspaceRequest
* @param idFolderWorkspace
* @param owner
* @param eventBus
*/
- private void createDatasetFormBody(final boolean isWorkspaceRequest, final String idFolderOrFileWorkspace, final HandlerManager eventBus){
+ private void createDatasetFormBody(final boolean isWorkspaceRequest, final String idFolderOrFileWorkspace,
+ final HandlerManager eventBus) {
initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus;
this.isWorkspaceRequest = isWorkspaceRequest;
+ iconSpinner.setSpin(true);
+ iconSpinner.getElement().getStyle().setMarginLeft(5, Unit.PX);
+
List listOfSteps = null;
- if(isWorkspaceRequest) {
- listOfSteps = Arrays.asList("Edit Common Metadata","Select Item Resources", "Edit Item Specific Metadata & Publish");
- }else {
+ if (isWorkspaceRequest) {
+ listOfSteps = Arrays.asList("Edit Common Metadata", "Select Item Resources",
+ "Edit Item Specific Metadata & Publish");
+ } else {
listOfSteps = Arrays.asList("Edit Common Metadata", "Edit Item Specific Metadata & Publish");
}
-
+
this.wizCreator = new WizardCreator(listOfSteps);
wizardCreatorPanel.add(wizCreator);
-
+
this.descriptionTextarea.setResize(ResizeType.VERTICAL);
bind();
prepareInfoIcons();
@@ -305,7 +396,7 @@ public class CreateDatasetForm extends Composite{
@Override
public void onSuccess(Boolean result) {
- if(result){
+ if (result) {
// set info block
setAlertBlock("Retrieving information, please wait...", AlertType.INFO, true);
@@ -323,11 +414,10 @@ public class CreateDatasetForm extends Composite{
@Override
public void onSuccess(final DatasetBean bean) {
- if(bean == null){
+ if (bean == null) {
setAlertBlock("Error while retrieving information.", AlertType.ERROR, true);
- }
- else{
+ } else {
// save it
receivedBean = bean;
@@ -351,10 +441,11 @@ public class CreateDatasetForm extends Composite{
Map> customFieldsMap = bean.getCustomFields();
// TODO Check if these tags are ok for the vocabulary
- if(customFieldsMap != null && vocabularyTags == null){
+ if (customFieldsMap != null && vocabularyTags == null) {
// get the keys and put them as tags
- Iterator>> iteratorOverCustomField = customFieldsMap.entrySet().iterator();
+ Iterator>> iteratorOverCustomField = customFieldsMap
+ .entrySet().iterator();
while (iteratorOverCustomField.hasNext()) {
Map.Entry> entry = iteratorOverCustomField
@@ -364,7 +455,8 @@ public class CreateDatasetForm extends Composite{
for (String value : values) {
// these are fixed key, variable value custom fields
- CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, entry.getKey(), value, false);
+ CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, entry.getKey(),
+ value, false);
customFieldEntriesList.add(toAdd);
customFields.add(toAdd);
@@ -377,14 +469,17 @@ public class CreateDatasetForm extends Composite{
// set it as visible anyway
tagsPanel.setVisible(true);
- if(isWorkspaceRequest){
- // if there are not resources, for now just checked it ( and hide so that the step will be skipped)
- if(hideManageResources()){
+ if (isWorkspaceRequest) {
+ // if there are not resources, for now just checked it ( and hide so that the
+ // step will be skipped)
+ if (hideManageResources()) {
alertNoResources.setType(AlertType.WARNING);
alertNoResources.setVisible(true);
- }else
- //resourcesSelectByWEMainPanel = new TwinColumnSelectionMainPanel(bean.getResourceRoot());
- resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel(bean.getResourceRoot());
+ } else
+ // resourcesSelectByWEMainPanel = new
+ // TwinColumnSelectionMainPanel(bean.getResourceRoot());
+ resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel(
+ bean.getResourceRoot());
}
// set organizations
@@ -409,7 +504,8 @@ public class CreateDatasetForm extends Composite{
});
// get the name of the organization from the title
- final String orgName = nameTitleOrganizationMap.get(organizationsListbox.getSelectedItemText());
+ final String orgName = nameTitleOrganizationMap
+ .get(organizationsListbox.getSelectedItemText());
// force tags
setAlertBlock("Checking for tags vocabulary, please wait...", AlertType.INFO, true);
@@ -425,7 +521,9 @@ public class CreateDatasetForm extends Composite{
@Override
public void onFailure(Throwable arg0) {
- setAlertBlock("Error while checking if a vocabulary of tags is defined in the selected organization.", AlertType.ERROR, true);
+ setAlertBlock(
+ "Error while checking if a vocabulary of tags is defined in the selected organization.",
+ AlertType.ERROR, true);
tagsPanel.setVisible(true);
}
@@ -445,15 +543,16 @@ public class CreateDatasetForm extends Composite{
@Override
public void onSuccess(final List profiles) {
- if(profiles == null){
- setAlertBlock("An unknow error occurred while retrieving types, sorry", AlertType.ERROR, true);
- }
- else{
-
- GWT.log("Profile returned are: "+profiles.size());
- if(!GWT.isProdMode()) {
+ if (profiles == null) {
+ setAlertBlock("An unknow error occurred while retrieving types, sorry",
+ AlertType.ERROR, true);
+ } else {
+
+ GWT.log("Profile returned are: " + profiles.size());
+ if (!GWT.isProdMode()) {
for (MetaDataProfileBean profile : profiles) {
- GWT.log("Profile title: "+profile.getTitle() + ", type: "+profile.getType());
+ GWT.log("Profile title: " + profile.getTitle() + ", type: "
+ + profile.getType());
}
}
@@ -467,19 +566,19 @@ public class CreateDatasetForm extends Composite{
ckanServices.getLicenses(new AsyncCallback>() {
@Override
- public void onFailure(Throwable caught){
+ public void onFailure(Throwable caught) {
setAlertBlock(caught.getMessage(), AlertType.ERROR, true);
}
@Override
public void onSuccess(List licenses) {
- if(licenses != null && !licenses.isEmpty()){
+ if (licenses != null && !licenses.isEmpty()) {
licenseBean = licenses;
// fill the listbox
- for(int i = 0; i < licenses.size(); i++){
+ for (int i = 0; i < licenses.size(); i++) {
licenseListbox.addItem(licenses.get(i).getTitle());
}
@@ -487,42 +586,50 @@ public class CreateDatasetForm extends Composite{
showLicenseUrl();
// try to retrieve the licenses
- setAlertBlock("Retrieving groups, please wait...", AlertType.INFO, true);
+ setAlertBlock("Retrieving groups, please wait...",
+ AlertType.INFO, true);
// request groups
- ckanServices.getUserGroups(orgName, new AsyncCallback>() {
+ ckanServices.getUserGroups(orgName,
+ new AsyncCallback>() {
- @Override
- public void onSuccess(List groups) {
- if(groups == null){
- setAlertBlock("Error while retrieving groups", AlertType.ERROR, true);
- }else{
- if(groups.isEmpty()){
- groupsControlGroup.setVisible(false);
- }
- else{
+ @Override
+ public void onSuccess(
+ List groups) {
+ if (groups == null) {
+ setAlertBlock(
+ "Error while retrieving groups",
+ AlertType.ERROR, true);
+ } else {
+ if (groups.isEmpty()) {
+ groupsControlGroup.setVisible(false);
+ } else {
- // add groups
- for (OrganizationBean group : groups) {
- groupsListbox.addItem(group.getTitle(), group.getName());
+ // add groups
+ for (OrganizationBean group : groups) {
+ groupsListbox.addItem(
+ group.getTitle(),
+ group.getName());
+ }
+ hideGroupsAlreadyInProfile(profiles);
+ }
+ // everything went ok
+ setAlertBlock("", AlertType.ERROR, false);
+ continueButton.setEnabled(true);
+ resetButton.setEnabled(true);
}
- hideGroupsAlreadyInProfile(profiles);
}
- // everything went ok
- setAlertBlock("", AlertType.ERROR, false);
- continueButton.setEnabled(true);
- resetButton.setEnabled(true);
- }
- }
- @Override
- public void onFailure(Throwable caught) {
- setAlertBlock(caught.getMessage(), AlertType.ERROR, true);
- }
- });
+ @Override
+ public void onFailure(Throwable caught) {
+ setAlertBlock(caught.getMessage(),
+ AlertType.ERROR, true);
+ }
+ });
- }else{
- setAlertBlock("Error while retrieving licenses", AlertType.ERROR, true);
+ } else {
+ setAlertBlock("Error while retrieving licenses",
+ AlertType.ERROR, true);
}
}
});
@@ -533,7 +640,7 @@ public class CreateDatasetForm extends Composite{
}
});
- }else{
+ } else {
setAlertBlock(MISSING_PUBLISH_RIGHTS, AlertType.ERROR, true);
}
@@ -545,13 +652,11 @@ public class CreateDatasetForm extends Composite{
}
});
-
-
}
-
/**
- * When the organization name is changed we need to retrieve the list of profiles and groups
+ * When the organization name is changed we need to retrieve the list of
+ * profiles and groups
*/
private void organizationsListboxChangeHandlerBody() {
@@ -571,7 +676,8 @@ public class CreateDatasetForm extends Composite{
// try to retrieve the profiles
setAlertBlock("Retrieving types, please wait...", AlertType.INFO, true);
- // disable the list of organizations name so that the user doesn't change it again
+ // disable the list of organizations name so that the user doesn't change it
+ // again
// also disable the profiles and the list of groups
organizationsListbox.setEnabled(false);
metadataTypeListbox.setEnabled(false);
@@ -584,7 +690,7 @@ public class CreateDatasetForm extends Composite{
@Override
public void onSuccess(final List profiles) {
- if(profiles != null){
+ if (profiles != null) {
receivedBean.setMetadataList(profiles);
prepareMetadataList(receivedBean);
@@ -600,13 +706,12 @@ public class CreateDatasetForm extends Composite{
@Override
public void onSuccess(List groups) {
- if(groups == null){
+ if (groups == null) {
setAlertBlock("Error while retrieving groups, try later", AlertType.ERROR, true);
- }else{
- if(groups.isEmpty()){
+ } else {
+ if (groups.isEmpty()) {
groupsControlGroup.setVisible(false);
- }
- else{
+ } else {
// add groups
for (OrganizationBean group : groups) {
@@ -625,7 +730,6 @@ public class CreateDatasetForm extends Composite{
}
});
-
// check also for tags (if for that context there is a vocabulary or not)
tagsPanel.setVisible(false);
setAlertBlock("Checking for tags vocabulary, please wait...", AlertType.INFO, true);
@@ -642,14 +746,16 @@ public class CreateDatasetForm extends Composite{
@Override
public void onFailure(Throwable arg0) {
- setAlertBlock("Error while checking if a vocabulary of tags is defined in the selected organization.", AlertType.ERROR, true);
+ setAlertBlock(
+ "Error while checking if a vocabulary of tags is defined in the selected organization.",
+ AlertType.ERROR, true);
tagsPanel.setVocabulary(null);
tagsPanel.setVisible(true);
}
});
- }else
+ } else
setAlertBlock("Error while retrieving types, sorry", AlertType.ERROR, true);
}
@@ -666,14 +772,15 @@ public class CreateDatasetForm extends Composite{
/**
* Add the items to the listbox and put data into the metadataPanel
+ *
* @param receivedBean
*/
private void prepareMetadataList(final DatasetBean receivedBean) {
List profiles = receivedBean.getMetadataList();
- if(profiles != null && !profiles.isEmpty()){
- for(MetaDataProfileBean metadataBean: profiles){
+ if (profiles != null && !profiles.isEmpty()) {
+ for (MetaDataProfileBean metadataBean : profiles) {
metadataTypeListbox.addItem(metadataBean.getType());
@@ -685,10 +792,10 @@ public class CreateDatasetForm extends Composite{
String selectedItemText = metadataTypeListbox.getSelectedItemText();
metadataFieldsPanel.clear();
- if(selectedItemText.equals(NONE_PROFILE)){
+ if (selectedItemText.equals(NONE_PROFILE)) {
metadataFieldsPanel.setVisible(false);
receivedBean.setChosenType(null);
- }else{
+ } else {
receivedBean.setChosenType(selectedItemText);
addFields(selectedItemText);
}
@@ -696,24 +803,25 @@ public class CreateDatasetForm extends Composite{
});
}
- // hide elements or show them if needed (groups in profiles cannot be present again in groups listbox)
- if(groupsControlGroup.isVisible()){
+ // hide elements or show them if needed (groups in profiles cannot be present
+ // again in groups listbox)
+ if (groupsControlGroup.isVisible()) {
List groupsToHide = new ArrayList();
- for(MetaDataProfileBean profile: profiles)
+ for (MetaDataProfileBean profile : profiles)
groupsToHide.add(profile.getType().toString());
SelectElement se = groupsListbox.getElement().cast();
for (int i = 0; i < groupsListbox.getItemCount(); i++) {
- if(groupsToHide.contains(groupsListbox.getItemText(i))){
+ if (groupsToHide.contains(groupsListbox.getItemText(i))) {
se.getOptions().getItem(i).getStyle().setProperty("display", "none");
- }else
+ } else
se.getOptions().getItem(i).getStyle().setProperty("display", "");
}
}
metadataTypesControlGroup.setVisible(true);
- }else{
+ } else {
// just hide this listbox
metadataTypesControlGroup.setVisible(false);
metadataFieldsPanel.clear();
@@ -724,12 +832,13 @@ public class CreateDatasetForm extends Composite{
/**
* Add fields of the selected metadata profile to the widget
+ *
* @param selectedItem
*/
protected void addFields(String selectedItem) {
- for(MetaDataProfileBean bean: receivedBean.getMetadataList()){
- if(bean.getType().equals(selectedItem)){
+ for (MetaDataProfileBean bean : receivedBean.getMetadataList()) {
+ if (bean.getType().equals(selectedItem)) {
// clear old data
listOfMetadataFields.clear();
@@ -740,17 +849,15 @@ public class CreateDatasetForm extends Composite{
GWT.log("There are " + categories.size() + " categories for profile " + bean.getTitle());
- if(categories == null || categories.isEmpty()){
+ if (categories == null || categories.isEmpty()) {
for (MetadataFieldWrapper field : fields) {
- /*MetaDataFieldSkeleton fieldWidget;
- try {
- fieldWidget = new MetaDataFieldSkeleton(field, eventBus);
- metadataFieldsPanel.add(fieldWidget);
- listOfMetadataFields.add(fieldWidget);
- } catch (Exception e) {
- GWT.log("Unable to build such widget", e);
- }*/
-
+ /*
+ * MetaDataFieldSkeleton fieldWidget; try { fieldWidget = new
+ * MetaDataFieldSkeleton(field, eventBus); metadataFieldsPanel.add(fieldWidget);
+ * listOfMetadataFields.add(fieldWidget); } catch (Exception e) {
+ * GWT.log("Unable to build such widget", e); }
+ */
+
MetaDataField fieldWidget;
try {
fieldWidget = new MetaDataField(field, eventBus);
@@ -760,26 +867,28 @@ public class CreateDatasetForm extends Composite{
GWT.log("Unable to build such widget", e);
}
}
- }else{
+ } else {
- // create the categories, then parse the fields. Fields do not belonging to a category are put at the end
+ // create the categories, then parse the fields. Fields do not belonging to a
+ // category are put at the end
for (CategoryWrapper categoryWrapper : categories) {
- if(categoryWrapper.getFieldsForThisCategory() != null && categoryWrapper.getFieldsForThisCategory().size() > 0){
- CategoryPanel cp = new CategoryPanel(categoryWrapper.getTitle(), categoryWrapper.getDescription());
- List fieldsForThisCategory = categoryWrapper.getFieldsForThisCategory();
+ if (categoryWrapper.getFieldsForThisCategory() != null
+ && categoryWrapper.getFieldsForThisCategory().size() > 0) {
+ CategoryPanel cp = new CategoryPanel(categoryWrapper.getTitle(),
+ categoryWrapper.getDescription());
+ List fieldsForThisCategory = categoryWrapper
+ .getFieldsForThisCategory();
fields.removeAll(fieldsForThisCategory);
for (MetadataFieldWrapper metadataFieldWrapper : fieldsForThisCategory) {
-
- /*MetaDataFieldSkeleton fieldWidget;
- try {
- fieldWidget = new MetaDataFieldSkeleton(metadataFieldWrapper, eventBus);
- cp.addField(fieldWidget);
- listOfMetadataFields.add(fieldWidget);
- } catch (Exception e) {
- GWT.log("Unable to build such widget", e);
- }*/
-
+
+ /*
+ * MetaDataFieldSkeleton fieldWidget; try { fieldWidget = new
+ * MetaDataFieldSkeleton(metadataFieldWrapper, eventBus);
+ * cp.addField(fieldWidget); listOfMetadataFields.add(fieldWidget); } catch
+ * (Exception e) { GWT.log("Unable to build such widget", e); }
+ */
+
MetaDataField fieldWidget;
try {
fieldWidget = new MetaDataField(metadataFieldWrapper, eventBus);
@@ -796,16 +905,14 @@ public class CreateDatasetForm extends Composite{
// add the remaining one at the end of the categories
CategoryPanel extrasCategory = new CategoryPanel("Other", null);
for (MetadataFieldWrapper field : fields) {
-
- /*MetaDataFieldSkeleton fieldWidget;
- try {
- fieldWidget = new MetaDataFieldSkeleton(field, eventBus);
- extrasCategory.addField(fieldWidget);
- listOfMetadataFields.add(fieldWidget);
- } catch (Exception e) {
- GWT.log("Unable to build such widget", e);
- }*/
-
+
+ /*
+ * MetaDataFieldSkeleton fieldWidget; try { fieldWidget = new
+ * MetaDataFieldSkeleton(field, eventBus); extrasCategory.addField(fieldWidget);
+ * listOfMetadataFields.add(fieldWidget); } catch (Exception e) {
+ * GWT.log("Unable to build such widget", e); }
+ */
+
MetaDataField fieldWidget;
try {
fieldWidget = new MetaDataField(field, eventBus);
@@ -822,9 +929,8 @@ public class CreateDatasetForm extends Composite{
}
}
-
@UiHandler("addCustomFieldButton")
- void addCustomFieldEvent(ClickEvent e){
+ void addCustomFieldEvent(ClickEvent e) {
CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, "", "", true);
customFieldEntriesList.add(toAdd);
@@ -833,38 +939,41 @@ public class CreateDatasetForm extends Composite{
}
@UiHandler("continueButton")
- void onContinueButton(ClickEvent e){
+ void onContinueButton(ClickEvent e) {
// validate data
final String errorMsg = validateDataOnContinue();
- if(errorMsg != null){
+ if (errorMsg != null) {
alertOnContinue("Please check inserted data [" + errorMsg + "]", AlertType.ERROR);
return;
- }else{
+ } else {
- // better check for title (only if the dataset was not created.. if it is the case, fields are not frozen)
- if(!titleTextBox.isEnabled())
+ // better check for title (only if the dataset was not created.. if it is the
+ // case, fields are not frozen)
+ if (!titleTextBox.isEnabled())
actionsAfterOnContinue();
- else{
+ else {
alertOnContinue("Checking if a item with such title already exists, please wait...", AlertType.INFO);
final String orgName = nameTitleOrganizationMap.get(organizationsListbox.getSelectedItemText());
ckanServices.datasetIdAlreadyExists(titleTextBox.getText(), orgName, new AsyncCallback() {
@Override
public void onSuccess(Boolean result) {
- if(result){
- alertOnContinue("Sorry but an item with such title already exists, try to change it", AlertType.WARNING);
- }else{
+ if (result) {
+ alertOnContinue("Sorry but an item with such title already exists, try to change it",
+ AlertType.WARNING);
+ } else {
actionsAfterOnContinue();
}
}
@Override
public void onFailure(Throwable caught) {
- alertOnContinue("Sorry but there was a problem while checking if the inserted data are correct", AlertType.ERROR);
+ alertOnContinue("Sorry but there was a problem while checking if the inserted data are correct",
+ AlertType.ERROR);
}
});
}
@@ -874,32 +983,32 @@ public class CreateDatasetForm extends Composite{
/**
* After onContinue ...
*/
- private void actionsAfterOnContinue(){
+ private void actionsAfterOnContinue() {
// check what to do
- if(isWorkspaceRequest){
+ if (isWorkspaceRequest) {
// we need to show the page to handle resources one by one from the workspace
formFirstStep.setVisible(false);
boolean hideManageRes = hideManageResources();
int stepActive = -1;
- if(hideManageRes) {
+ if (hideManageRes) {
stepActive = 3;
- }else {
+ } else {
stepActive = 2;
}
-
+
formSecondStep.setVisible(!hideManageRes);
formThirdStep.setVisible(hideManageRes);
activeWizardStep(stepActive);
// add the resources to the container panel
- if(workspaceResourcesContainer.getWidget() == null){
+ if (workspaceResourcesContainer.getWidget() == null) {
workspaceResourcesContainer.getElement().getStyle().setMarginLeft(20, Unit.PX);
workspaceResourcesContainer.add(resourcesSelectByWEMainPanel);
}
- }else{
+ } else {
// this is not a workspace request
formFirstStep.setVisible(false);
@@ -908,22 +1017,21 @@ public class CreateDatasetForm extends Composite{
}
- if(metadataTypeListbox.getSelectedItemText().equals(NONE_PROFILE))
+ if (metadataTypeListbox.getSelectedItemText().equals(NONE_PROFILE))
selectedProfile.setText("");
else
selectedProfile.setText("Selected Type is " + metadataTypeListbox.getSelectedItemText());
}
-
+
private void activeWizardStep(int step) {
- if(wizCreator!=null) {
+ if (wizCreator != null) {
wizCreator.activeStep(step);
}
}
-
@UiHandler("goBackButtonFirstStep")
- void onGoBackButtonFirstStep(ClickEvent e){
+ void onGoBackButtonFirstStep(ClickEvent e) {
// swap forms
formFirstStep.setVisible(true);
@@ -933,23 +1041,22 @@ public class CreateDatasetForm extends Composite{
}
-
@UiHandler("goBackButtonSecondStep")
- void onGoBackButton(ClickEvent e){
+ void onGoBackButton(ClickEvent e) {
// swap forms
- if(isWorkspaceRequest){
+ if (isWorkspaceRequest) {
boolean hideManageRes = hideManageResources();
int stepActive = -1;
- if(hideManageRes) {
+ if (hideManageRes) {
stepActive = 1;
- }else {
+ } else {
stepActive = 2;
}
formFirstStep.setVisible(hideManageRes);
formSecondStep.setVisible(!hideManageRes);
activeWizardStep(stepActive);
- }else{
+ } else {
formFirstStep.setVisible(true);
formSecondStep.setVisible(false);
@@ -960,7 +1067,7 @@ public class CreateDatasetForm extends Composite{
}
@UiHandler("continueThirdStep")
- void onContinueThirdStep(ClickEvent e){
+ void onContinueThirdStep(ClickEvent e) {
// swap forms
formSecondStep.setVisible(false);
@@ -969,16 +1076,15 @@ public class CreateDatasetForm extends Composite{
}
-
@UiHandler("createButton")
- void createDatasetEvent(ClickEvent e){
+ void createDatasetEvent(ClickEvent e) {
String errorMessage = areProfileDataValid();
- if(errorMessage != null){
- alertOnCreate("Please check the inserted values and the mandatory fields [" + errorMessage +"]", AlertType.ERROR, true);
- }
- else{
+ if (errorMessage != null) {
+ alertOnCreate("Please check the inserted values and the mandatory fields [" + errorMessage + "]", false,
+ AlertType.ERROR, true);
+ } else {
String title = titleTextBox.getValue().trim();
String description = descriptionTextarea.getText().trim();
@@ -992,11 +1098,11 @@ public class CreateDatasetForm extends Composite{
String chosenOrganizationTitle = organizationsListbox.getSelectedItemText();
Set tags = new HashSet(tagsPanel.getTags());
- //we need to retrieve the organization's name from this title
+ // we need to retrieve the organization's name from this title
List orgs = receivedBean.getOrganizationList();
String chosenOrganization = null;
for (OrganizationBean organizationBean : orgs) {
- if(chosenOrganizationTitle.equals(organizationBean.getTitle())){
+ if (chosenOrganizationTitle.equals(organizationBean.getTitle())) {
chosenOrganization = organizationBean.getName();
break;
}
@@ -1010,7 +1116,7 @@ public class CreateDatasetForm extends Composite{
for (int i = 0; i < items; i++) {
String groupTitle = groupsListbox.getItemText(i);
String groupName = groupsListbox.getValue(i);
- if(groupsListbox.isItemSelected(i)){
+ if (groupsListbox.isItemSelected(i)) {
groups.add(new OrganizationBean(groupTitle, groupName, false));
}
}
@@ -1019,45 +1125,47 @@ public class CreateDatasetForm extends Composite{
// prepare custom fields
for (MetaDataField metaField : listOfMetadataFields) {
-
+
for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) {
-
+
List valuesForField = field.getFieldCurrentValue();
- if(!valuesForField.isEmpty()){
+ if (!valuesForField.isEmpty()) {
String key = field.getFieldNameQualified();
List valuesForThisField = null;
- if(customFieldsMap.containsKey(key))
+ if (customFieldsMap.containsKey(key))
valuesForThisField = customFieldsMap.get(key);
else
valuesForThisField = new ArrayList();
-
+
valuesForThisField.addAll(valuesForField);
customFieldsMap.put(key, valuesForThisField);
-
+
// get also tag/group if it is the case for this field
List tagsField = field.getTagFromThisField();
- if(tagsField != null)
+ if (tagsField != null)
tags.addAll(tagsField);
-
+
List groupsTitle = field.getGroupTitleFromThisGroup();
- if(groupsTitle != null){
+ if (groupsTitle != null) {
for (String groupTitle : groupsTitle) {
- if(field.isGroupToForce())
- groupsToForceCreation.add(new OrganizationBean(groupTitle, groupTitle, false, field.isPropagateUp()));
+ if (field.isGroupToForce())
+ groupsToForceCreation.add(
+ new OrganizationBean(groupTitle, groupTitle, false, field.isPropagateUp()));
else
- groups.add(new OrganizationBean(groupTitle, groupTitle, false, field.isPropagateUp()));
+ groups.add(
+ new OrganizationBean(groupTitle, groupTitle, false, field.isPropagateUp()));
}
}
}
}
}
- for(CustomFieldEntry customEntry : customFieldEntriesList){
+ for (CustomFieldEntry customEntry : customFieldEntriesList) {
String key = customEntry.getKey();
String value = customEntry.getValue();
- if(value != null && !value.isEmpty()){
+ if (value != null && !value.isEmpty()) {
List valuesForThisField = null;
- if(customFieldsMap.containsKey(key))
+ if (customFieldsMap.containsKey(key))
valuesForThisField = customFieldsMap.get(key);
else
valuesForThisField = new ArrayList();
@@ -1081,16 +1189,15 @@ public class CreateDatasetForm extends Composite{
receivedBean.setSelectedOrganization(chosenOrganization);
receivedBean.setGroups(groups);
receivedBean.setGroupsForceCreation(groupsToForceCreation);
-
-
- if(resourcesSelectByWEMainPanel != null) {
+
+ if (resourcesSelectByWEMainPanel != null) {
receivedBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish());
}
-
+
receivedBean.setCustomFields(customFieldsMap);
// alert
- alertOnCreate(TRYING_TO_CREATE_PRODUCT, AlertType.INFO, false);
+ alertOnCreate(TRYING_TO_CREATE_PRODUCT, true, AlertType.INFO, false);
// invoke the create method
createButton.setEnabled(false);
@@ -1100,19 +1207,19 @@ public class CreateDatasetForm extends Composite{
@Override
public void onSuccess(final DatasetBean createdDatasetBean) {
-
- GWT.log("Created the dataset: "+createdDatasetBean);
-
- if(createdDatasetBean != null){
-
+
+ GWT.log("Created the dataset: " + createdDatasetBean);
+
+ if (createdDatasetBean != null) {
+
final String datasetUrl = createdDatasetBean.getSource();
- alertOnCreate(PRODUCT_CREATED_OK, AlertType.SUCCESS, false);
-
+ alertOnCreate(PRODUCT_CREATED_OK, false, AlertType.SUCCESS, false);
+
try {
- // disable dataset fields
+ // disable dataset fields
disableDatasetFields();
- }catch (Exception e) {
+ } catch (Exception e) {
// TODO: handle exception
}
@@ -1120,87 +1227,92 @@ public class CreateDatasetForm extends Composite{
resetButton.setEnabled(false);
// show the go to dataset button
-
+
goToDatasetButtonPanel.setVisible(true);
goToDatasetButton.setVisible(true);
- goToDatasetButton.setText(
- datasetUrl.length() > 100 ?
- datasetUrl.substring(0, 100) + "..." : datasetUrl
- );
- // goToDatasetButton.setHref(datasetUrl);
+
+ String title = createdDatasetBean.getTitle();
+ String link = "(click here) ";
+ link += title.length() > 90 ? title.substring(0, 90) + "..." : title;
+
+ goToDatasetButton.setTitle("Go to the item: " + title);
+
+ goToDatasetButton.setText(link);
goToDatasetButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.open(datasetUrl, "_blank", "");
- //Window.Location.assign(datasetUrl);
+ // Window.Location.assign(datasetUrl);
}
});
-
-
+
// set hidden the create button
createButton.setVisible(false);
// if we are in the "general case" we need to show a form for adding resources
- if(!isWorkspaceRequest) {
+ if (!isWorkspaceRequest) {
try {
// show the add resources button
addResourcesButton.setVisible(true);
-
+
addResourcesButton.addClickHandler(new ClickHandler() {
-
+
@Override
public void onClick(ClickEvent event) {
-
+
// remove content of the main panel
createDatasetMainPanel.clear();
-
+
// TabPanelException
tabPanel = new TabPanel(Tabs.ABOVE);
tabPanel.setWidth("100%");
-
+
// add the form
- resourceForm = new AddResourceToDataset(eventBus, createdDatasetBean.getId(), createdDatasetBean.getSelectedOrganization(), owner, datasetUrl);
-
+ resourceForm = new AddResourceToDataset(eventBus, createdDatasetBean.getId(),
+ createdDatasetBean.getTitle(),
+ createdDatasetBean.getSelectedOrganization(), owner, datasetUrl);
+
// tab for the form
Tab formContainer = new Tab();
formContainer.add(resourceForm);
formContainer.setHeading("Add New Resource");
tabPanel.add(formContainer);
-
+
// tab for the added resources
Tab addedResources = new Tab();
addedResources.add(new AddedResourcesSummary(eventBus));
addedResources.setHeading("Added Resource");
tabPanel.add(addedResources);
-
+
// add tabs to resources panel
tabPanel.selectTab(0);
-
+
// form container
AddResourceContainer container = new AddResourceContainer(datasetUrl);
container.add(tabPanel);
-
+
// add the new content of the main panel
createDatasetMainPanel.add(container);
}
});
- }catch (Exception e2) {
- //silent
+ } catch (Exception e2) {
+ // silent
}
}
- }else{
+ } else {
- alertOnCreate(ERROR_PRODUCT_CREATION, AlertType.ERROR, true);
+ alertOnCreate(ERROR_PRODUCT_CREATION, false, AlertType.ERROR, true);
}
}
@Override
public void onFailure(Throwable caught) {
- alertOnCreate(ERROR_PRODUCT_CREATION + " Error message is : " + caught.getMessage(), AlertType.ERROR, true);
+ alertOnCreate(ERROR_PRODUCT_CREATION + " Error message is : " + caught.getMessage(), false,
+ AlertType.ERROR, true);
}
});
}
@@ -1215,152 +1327,81 @@ public class CreateDatasetForm extends Composite{
tagsPanel.prepareIcon(popupOpenedIds);
// licenses
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.LICENSES_INFO_ID_POPUP,
- InfoIconsLabels.LICENSES_INFO_TEXT,
- InfoIconsLabels.LICENSES_INFO_CAPTION,
- infoIconLicenses,
- popoverLicenses,
- focusPanelLicenses,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.LICENSES_INFO_ID_POPUP,
+ InfoIconsLabels.LICENSES_INFO_TEXT, InfoIconsLabels.LICENSES_INFO_CAPTION, infoIconLicenses,
+ popoverLicenses, focusPanelLicenses, popupOpenedIds);
// visibility
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.VISIBILITY_INFO_ID_POPUP,
- InfoIconsLabels.VISIBILITY_INFO_TEXT,
- InfoIconsLabels.VISIBILITY_INFO_CAPTION,
- infoIconVisibility,
- popoverVisibility,
- focusPanelVisibility,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.VISIBILITY_INFO_ID_POPUP,
+ InfoIconsLabels.VISIBILITY_INFO_TEXT, InfoIconsLabels.VISIBILITY_INFO_CAPTION, infoIconVisibility,
+ popoverVisibility, focusPanelVisibility, popupOpenedIds);
// author
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.AUTHOR_INFO_ID_POPUP,
- InfoIconsLabels.AUTHOR_INFO_TEXT,
- InfoIconsLabels.AUTHOR_INFO_CAPTION,
- infoIconAuthor,
- popoverAuthor,
- focusPanelAuthor,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.AUTHOR_INFO_ID_POPUP,
+ InfoIconsLabels.AUTHOR_INFO_TEXT, InfoIconsLabels.AUTHOR_INFO_CAPTION, infoIconAuthor, popoverAuthor,
+ focusPanelAuthor, popupOpenedIds);
// author's email
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.AUTHOR_EMAIL_INFO_ID_POPUP,
- InfoIconsLabels.AUTHOR_EMAIL_INFO_TEXT,
- InfoIconsLabels.AUTHOR_EMAIL_INFO_CAPTION,
- infoIconAuthorEmail,
- popoverAuthorEmail,
- focusPanelAuthorEmail,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.AUTHOR_EMAIL_INFO_ID_POPUP,
+ InfoIconsLabels.AUTHOR_EMAIL_INFO_TEXT, InfoIconsLabels.AUTHOR_EMAIL_INFO_CAPTION, infoIconAuthorEmail,
+ popoverAuthorEmail, focusPanelAuthorEmail, popupOpenedIds);
// maintainer
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.MAINTAINER_INFO_ID_POPUP,
- InfoIconsLabels.MAINTAINER_INFO_TEXT,
- InfoIconsLabels.MAINTAINER_INFO_CAPTION,
- infoIconMaintainer,
- popoverMaintainer,
- focusPanelMaintainer,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.MAINTAINER_INFO_ID_POPUP,
+ InfoIconsLabels.MAINTAINER_INFO_TEXT, InfoIconsLabels.MAINTAINER_INFO_CAPTION, infoIconMaintainer,
+ popoverMaintainer, focusPanelMaintainer, popupOpenedIds);
// maintainer's email
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.MAINTAINER_EMAIL_INFO_ID_POPUP,
- InfoIconsLabels.MAINTAINER_EMAIL_INFO_TEXT,
- InfoIconsLabels.MAINTAINER_EMAIL_INFO_CAPTION,
- infoIconMaintainerEmail,
- popoverMaintainerEmail,
- focusPanelMaintainerEmail,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.MAINTAINER_EMAIL_INFO_ID_POPUP,
+ InfoIconsLabels.MAINTAINER_EMAIL_INFO_TEXT, InfoIconsLabels.MAINTAINER_EMAIL_INFO_CAPTION,
+ infoIconMaintainerEmail, popoverMaintainerEmail, focusPanelMaintainerEmail, popupOpenedIds);
// profiles (or types)
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.PROFILES_INFO_ID_POPUP,
- InfoIconsLabels.PROFILES_INFO_TEXT,
- InfoIconsLabels.PROFILES_INFO_CAPTION,
- infoIconTypes,
- popoverTypes,
- focusPanelTypes,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.PROFILES_INFO_ID_POPUP,
+ InfoIconsLabels.PROFILES_INFO_TEXT, InfoIconsLabels.PROFILES_INFO_CAPTION, infoIconTypes, popoverTypes,
+ focusPanelTypes, popupOpenedIds);
// custom fields
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.CUSTOM_FIELDS_INFO_ID_POPUP,
- InfoIconsLabels.CUSTOM_FIELDS_INFO_TEXT,
- InfoIconsLabels.CUSTOM_FIELDS_INFO_CAPTION,
- infoIconCustomFields,
- popoverCustomFields,
- focusPanelCustomFields,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.CUSTOM_FIELDS_INFO_ID_POPUP,
+ InfoIconsLabels.CUSTOM_FIELDS_INFO_TEXT, InfoIconsLabels.CUSTOM_FIELDS_INFO_CAPTION,
+ infoIconCustomFields, popoverCustomFields, focusPanelCustomFields, popupOpenedIds);
// resources field
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.RESOURCES_INFO_ID_POPUP,
- InfoIconsLabels.RESOURCES_INFO_TEXT,
- InfoIconsLabels.RESOURCES_INFO_CAPTION,
- infoIconResources,
- popoverResources,
- focusPanelResources,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.RESOURCES_INFO_ID_POPUP,
+ InfoIconsLabels.RESOURCES_INFO_TEXT, InfoIconsLabels.RESOURCES_INFO_CAPTION, infoIconResources,
+ popoverResources, focusPanelResources, popupOpenedIds);
// title
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.TITLE_INFO_ID_POPUP,
- InfoIconsLabels.TITLE_INFO_TEXT,
- InfoIconsLabels.TITLE_INFO_CAPTION,
- infoIconTitle,
- popoverTitle,
- focusPanelTitle,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.TITLE_INFO_ID_POPUP,
+ InfoIconsLabels.TITLE_INFO_TEXT, InfoIconsLabels.TITLE_INFO_CAPTION, infoIconTitle, popoverTitle,
+ focusPanelTitle, popupOpenedIds);
// description
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.DESCRIPTION_INFO_ID_POPUP,
- InfoIconsLabels.DESCRIPTION_INFO_TEXT,
- InfoIconsLabels.DESCRIPTION_INFO_CAPTION,
- infoIconDescription,
- popoverDescription,
- focusPanelDescription,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.DESCRIPTION_INFO_ID_POPUP,
+ InfoIconsLabels.DESCRIPTION_INFO_TEXT, InfoIconsLabels.DESCRIPTION_INFO_CAPTION, infoIconDescription,
+ popoverDescription, focusPanelDescription, popupOpenedIds);
// groups
- InfoIconsLabels.preparePopupPanelAndPopover(
- InfoIconsLabels.GROUPS_INFO_ID_POPUP,
- InfoIconsLabels.GROUPS_INFO_TEXT,
- InfoIconsLabels.GROUPS_INFO_CAPTION,
- infoIconGroups,
- popoverGroups,
- focusPanelGroups,
- popupOpenedIds
- );
+ InfoIconsLabels.preparePopupPanelAndPopover(InfoIconsLabels.GROUPS_INFO_ID_POPUP,
+ InfoIconsLabels.GROUPS_INFO_TEXT, InfoIconsLabels.GROUPS_INFO_CAPTION, infoIconGroups, popoverGroups,
+ focusPanelGroups, popupOpenedIds);
}
/**
* Test if profile data are valid
+ *
* @return
*/
private String areProfileDataValid() {
for (MetaDataField metaField : listOfMetadataFields) {
-
+
for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) {
field.removeError();
-
+
String error = field.isFieldValueValid();
- if(error != null){
+ if (error != null) {
field.showError();
return field.getFieldNameOriginal() + " is not valid. Suggestion: " + error;
}
@@ -1372,10 +1413,11 @@ public class CreateDatasetForm extends Composite{
/**
* On continue show alert box and enable buttons
+ *
* @param text
* @param type
*/
- private void alertOnContinue(String text, AlertType type){
+ private void alertOnContinue(String text, AlertType type) {
onContinueAlertBlock.setText(text);
onContinueAlertBlock.setType(type);
@@ -1399,10 +1441,22 @@ public class CreateDatasetForm extends Composite{
/**
* On continue show alert box and enable buttons
+ *
* @param text
* @param type
*/
- private void alertOnCreate(String text, AlertType type, boolean hideAfterAWhile){
+ private void alertOnCreate(String text, boolean showSpinner, AlertType type, boolean hideAfterAWhile) {
+
+ onCreateAlertBlock.clear();
+
+ try {
+ onCreateAlertBlock.remove(iconSpinner);
+ }catch (Exception e) {
+ }
+
+ if (showSpinner) {
+ onCreateAlertBlock.add(iconSpinner);
+ }
onCreateAlertBlock.setText(text);
onCreateAlertBlock.setType(type);
@@ -1410,7 +1464,7 @@ public class CreateDatasetForm extends Composite{
createButton.setEnabled(true);
goBackButtonSecondStep.setEnabled(true);
- if(hideAfterAWhile){
+ if (hideAfterAWhile) {
// hide after some seconds
Timer t = new Timer() {
@@ -1427,6 +1481,7 @@ public class CreateDatasetForm extends Composite{
/**
* Validate data
+ *
* @return true on success, false otherwise
*/
private String validateDataOnContinue() {
@@ -1440,58 +1495,57 @@ public class CreateDatasetForm extends Composite{
tagsPanel.setGroupPanelType(ControlGroupType.NONE);
String title = titleTextBox.getText().trim();
- if(title.isEmpty()){
+ if (title.isEmpty()) {
productTitleGroup.setType(ControlGroupType.ERROR);
return "Missing title";
}
-
- if(title.length()<2) {
+
+ if (title.length() < 2) {
productTitleGroup.setType(ControlGroupType.ERROR);
return "The field title is too short";
}
// better check for the title
- //String[] splittedTitle = title.split(" ");
+ // String[] splittedTitle = title.split(" ");
- /* No check, see #20828
- for (String word : splittedTitle) {
- String replaced = word.replaceAll(REGEX_TITLE_PRODUCT_SUBWORD, "");
- if(!replaced.equals(word)){
- productTitleGroup.setType(ControlGroupType.ERROR);
- return "Please note not all characters are allowed for the title";
- }
- }*/
+ /*
+ * No check, see #20828 for (String word : splittedTitle) { String replaced =
+ * word.replaceAll(REGEX_TITLE_PRODUCT_SUBWORD, ""); if(!replaced.equals(word)){
+ * productTitleGroup.setType(ControlGroupType.ERROR); return
+ * "Please note not all characters are allowed for the title"; } }
+ */
// email reg expression
String maintainerMail = maintainerEmailTextbox.getText();
- if(!maintainerMail.isEmpty() && !maintainerMail.matches(REGEX_MAIL)){
+ if (!maintainerMail.isEmpty() && !maintainerMail.matches(REGEX_MAIL)) {
maintainerControlGroup.setType(ControlGroupType.ERROR);
return "Not valid maintainer email";
}
// check if version is a number
- try{
+ try {
int number = Integer.valueOf(versionTextbox.getText().trim());
- if(number <= 0)
+ if (number <= 0)
throw new Exception();
- }catch(Exception e){
+ } catch (Exception e) {
versionControlGroup.setType(ControlGroupType.ERROR);
return "Version must be a natural number greater than zero";
}
- // check if metadata profile is different from none and its mandatory fields have been fulfilled
- if(checkSelectedMetaDataProfile()){
+ // check if metadata profile is different from none and its mandatory fields
+ // have been fulfilled
+ if (checkSelectedMetaDataProfile()) {
metadataTypesControlGroup.setType(ControlGroupType.ERROR);
return "You must select a Type different frome none";
}
- if(organizationsListbox.getSelectedItemText() == null){
+ if (organizationsListbox.getSelectedItemText() == null) {
organizationsGroup.setType(ControlGroupType.ERROR);
return "You must select an organization in which you want to publish";
}
// at least one tag..
- if(tagsPanel.getTags().isEmpty()){
+ if (tagsPanel.getTags().isEmpty()) {
tagsPanel.setGroupPanelType(ControlGroupType.ERROR);
return "Please add at least one meaningful tag for the item";
}
@@ -1500,15 +1554,18 @@ public class CreateDatasetForm extends Composite{
}
/**
- * Checks if a metadata profile has been chosen and its fields have been fulfilled
+ * Checks if a metadata profile has been chosen and its fields have been
+ * fulfilled
+ *
* @return
*/
private boolean checkSelectedMetaDataProfile() {
- return metadataTypeListbox.getSelectedItemText().equals(NONE_PROFILE) && metadataTypeListbox.getItemCount() != 1;
+ return metadataTypeListbox.getSelectedItemText().equals(NONE_PROFILE)
+ && metadataTypeListbox.getItemCount() != 1;
}
@UiHandler("resetButton")
- void resetFormEvent(ClickEvent e){
+ void resetFormEvent(ClickEvent e) {
// reset main fields
titleTextBox.setText("");
@@ -1519,7 +1576,7 @@ public class CreateDatasetForm extends Composite{
tagsPanel.removeTags();
// unselect all groups
- for(int i = 0; i < groupsListbox.getItemCount(); i++)
+ for (int i = 0; i < groupsListbox.getItemCount(); i++)
groupsListbox.setItemSelected(i, false);
// delete custom fields
@@ -1530,7 +1587,8 @@ public class CreateDatasetForm extends Composite{
}
/**
- * Disable dataset editable fields once the dataset has been successfully created.
+ * Disable dataset editable fields once the dataset has been successfully
+ * created.
*/
protected void disableDatasetFields() {
@@ -1547,7 +1605,7 @@ public class CreateDatasetForm extends Composite{
metadataTypeListbox.setEnabled(false);
groupsListbox.setEnabled(false);
- for(CustomFieldEntry ce: customFieldEntriesList)
+ for (CustomFieldEntry ce : customFieldEntriesList)
ce.freeze();
// disable profile fields
@@ -1555,21 +1613,22 @@ public class CreateDatasetForm extends Composite{
for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) {
field.freeze();
}
-
+
}
// freeze table of resources
- if(resourcesSelectByWEMainPanel != null)
+ if (resourcesSelectByWEMainPanel != null)
resourcesSelectByWEMainPanel.freeze();
}
/**
* change alert block behavior.
+ *
* @param textToShow
* @param type
* @param visible
*/
- private void setAlertBlock(String textToShow, AlertType type, boolean visible){
+ private void setAlertBlock(String textToShow, AlertType type, boolean visible) {
infoBlock.setText(textToShow);
infoBlock.setType(type);
@@ -1578,7 +1637,7 @@ public class CreateDatasetForm extends Composite{
}
@UiHandler("licenseListbox")
- void onSelectedLicenseChange(ChangeEvent c){
+ void onSelectedLicenseChange(ChangeEvent c) {
showLicenseUrl();
@@ -1587,44 +1646,44 @@ public class CreateDatasetForm extends Composite{
/**
* The body of the onSelectedLicenseChange
*/
- private void showLicenseUrl(){
+ private void showLicenseUrl() {
String selectedLicense = licenseListbox.getSelectedItemText();
int index = -1;
- if((index = licenseBean.indexOf(new LicenseBean(selectedLicense, null))) >= 0){
+ if ((index = licenseBean.indexOf(new LicenseBean(selectedLicense, null))) >= 0) {
LicenseBean foundLicense = licenseBean.get(index);
licenseUrlAnchor.setText(foundLicense.getUrl());
licenseUrlAnchor.setHref(foundLicense.getUrl());
licenseUrlAnchor.setVisible(true);
unavailableUrl.setVisible(false);
- }else{
+ } else {
licenseUrlAnchor.setVisible(false);
unavailableUrl.setVisible(true);
}
}
-
/**
* Hide the groups that are already listed in the profiles page
+ *
* @param profiles
*/
private void hideGroupsAlreadyInProfile(List profiles) {
List groupsToHide = new ArrayList();
- for(MetaDataProfileBean profile: profiles)
+ for (MetaDataProfileBean profile : profiles)
groupsToHide.add(profile.getType());
SelectElement se = groupsListbox.getElement().cast();
int hiddenElements = 0;
for (int i = 0; i < groupsListbox.getItemCount(); i++) {
- if(groupsToHide.contains(groupsListbox.getItemText(i))){
+ if (groupsToHide.contains(groupsListbox.getItemText(i))) {
se.getOptions().getItem(i).getStyle().setProperty("display", "none");
hiddenElements++;
}
}
- if(hiddenElements == groupsListbox.getItemCount())
+ if (hiddenElements == groupsListbox.getItemCount())
groupsControlGroup.setVisible(false);
else
groupsControlGroup.setVisible(true);
@@ -1633,12 +1692,14 @@ public class CreateDatasetForm extends Composite{
/**
* Check if resource(s) are missing
+ *
* @return
*/
- private boolean hideManageResources(){
+ private boolean hideManageResources() {
- return receivedBean.getResourceRoot() == null || receivedBean.getResourceRoot().isFolder() && (receivedBean.getResourceRoot().getChildrenSize() == null ||
- receivedBean.getResourceRoot().getChildrenSize()==0);
+ return receivedBean.getResourceRoot() == null || receivedBean.getResourceRoot().isFolder()
+ && (receivedBean.getResourceRoot().getChildrenSize() == null
+ || receivedBean.getResourceRoot().getChildrenSize() == 0);
}
}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java
index 9f64db7..3378aff 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java
@@ -58,20 +58,19 @@ public class AddResourceToDataset extends Composite{
@UiField ControlGroup urlControlGroup;
@UiField ControlGroup nameControlGroup;
- public AddResourceToDataset(HandlerManager eventBus, String datasetId, String datasetOrg, String owner, final String datasetUrl) {
+ public AddResourceToDataset(HandlerManager eventBus, String datasetId, String datasetTitle, String datasetOrg, String owner, final String datasetUrl) {
initWidget(uiBinder.createAndBindUi(this));
-
// save bus
this.eventBus = eventBus;
-
// save dataset id (it is needed when we will add resources)
this.datasetId = datasetId;
-
this.datasetOrg = datasetOrg;
- goToDatasetButton.setText(
- (datasetUrl.length() > 100 ?
- datasetUrl.substring(0, 100) + "..." : datasetUrl)
- );
+
+ String title = datasetTitle;
+ String link = "";
+ link += title.length() > 90 ? title.substring(0, 90) + "..." : title;
+ goToDatasetButton.setTitle("Go to the item: "+title);
+ goToDatasetButton.setText(link);
// goToDatasetButton.setHref(datasetUrl);
goToDatasetButton.addClickHandler(new ClickHandler() {
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 c1f3732..745c2b6 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
@@ -431,57 +431,12 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
toCreate.setId(datasetId);
// retrieve the url
- String datasetUrl = utils.getUnencryptedUrlFromDatasetIdOrName(datasetId);
- toCreate.setSource(datasetUrl);
-
- // add also this information as custom field
- /**
- * TODO NEEDED TO BE CHECK
- *
- * OLD CODE NOT NEEDED. NOW IT IS PERFORMED BY gCAT
- Map> addField = new HashMap>();
- addField.put(ITEM_URL_FIELD, Arrays.asList(datasetUrl));
- utils.patchProductCustomFields(datasetId, userApiKey, addField, false);
+ //String datasetUrl = utils.getUnencryptedUrlFromDatasetIdOrName(datasetId);
+ //toCreate.setSource(datasetUrl);
- */
-
- //TODO SHOULD BE NOTIFIED by gCAT
-
- // start a thread that will associate this dataset with the group
-// if(/*toCreate.getChosenType() != null ||*/ toCreate.getGroups() != null){
-//
-// AssociationToGroupAndNotifyThread threadAssociationToGroup =
-// new AssociationToGroupAndNotifyThread(
-// toCreate.getGroups(),
-// toCreate.getGroupsForceCreation(),
-// null, //toCreate.getChosenType(), TODO
-// datasetUrl,
-// datasetId,
-// toCreate.getTitle(),
-// GenericUtils.getCurrentUser(getThreadLocalRequest()).getFullname(),
-// userName,
-// utils,
-// organizationNameOrId,
-// getThreadLocalRequest()
-// );
-// threadAssociationToGroup.start();
-//
-// }
-//
-// // launch notification thread
-// WritePostCatalogueManagerThread threadWritePost =
-// new WritePostCatalogueManagerThread(
-// userName,
-// scope,
-// toCreate.getTitle(),
-// datasetUrl,
-// false, // send notification to other people
-// toCreate.getTags(),
-// GenericUtils.getCurrentUser(getThreadLocalRequest()).getFullname(),
-// GenericUtils.getCurrentClientUrl(getThreadLocalRequest())
-// );
-// threadWritePost.start();
-
+ //#23491 Building the go to the item to "Catalogue Portlet URL" (instead of URI Resolver URL)
+ String catalogueURL = utils.getPortletUrl();
+ toCreate.setSource(String.format("%s?path=/dataset/%s", catalogueURL,datasetId));
return toCreate;
}else{
logger.error("Failed to create the dataset");