integrating with Workspace Explorer and updating Manage Resources

This commit is contained in:
Francesco Mangiacrapa 2021-03-05 17:58:56 +01:00
parent beddee26b5
commit d2846cd9f4
14 changed files with 729 additions and 219 deletions

View File

@ -121,14 +121,14 @@
<version>[2.0.0, 3.0.0-SNAPSHOT)</version> <version>[2.0.0, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-wrapper</artifactId> <artifactId>storagehub-client-wrapper</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version> <version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.dvos</groupId> <groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId> <artifactId>usermanagement-core</artifactId>
@ -149,6 +149,11 @@
<scope>provided</scope> <scope>provided</scope>
<!-- put at provided for deploying --> <!-- put at provided for deploying -->
</dependency> </dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-explorer</artifactId>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId> <artifactId>gcube-widgets</artifactId>

View File

@ -6,17 +6,24 @@
<!-- Other module inherits --> <!-- Other module inherits -->
<inherits name="com.github.gwtbootstrap.Bootstrap" /> <inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- Responsive design --> <!-- Responsive design -->
<set-property name="bootstrap.responsiveDesign" value="true" /> <set-property name="bootstrap.responsiveDesign"
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' /> value="true" />
<inherits
name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' /> <inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
<inherits name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' /> <inherits
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' /> name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
<inherits
<inherits name='com.google.gwt.json.JSON'/> name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name='com.google.gwt.json.JSON' />
<inherits <inherits
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' /> name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
<inherits
name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
<!-- Specify the app entry point class. --> <!-- Specify the app entry point class. -->
<entry-point <entry-point
class='org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher' /> class='org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher' />

View File

@ -4,9 +4,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidget.GeoJsonAreaSelectionDialog; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidget.GeoJsonAreaSelectionDialog;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection.TwinColumnSelectionMainPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.SelectResourceByWEMainPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.DataTypeWrapper; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.DataTypeWrapper;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
@ -51,6 +51,8 @@ public class CKanMetadataPublisher implements EntryPoint {
// startTwinColumn(); // startTwinColumn();
//testSpatialWidget(); //testSpatialWidget();
testManageResources();
} }
@ -256,9 +258,7 @@ public class CKanMetadataPublisher implements EntryPoint {
// test resources // test resources
@SuppressWarnings("unused") @SuppressWarnings("unused")
private void startTwinColumn() { private void testManageResources() {
TwinColumnSelectionMainPanel resourcesTwinPanel;
Modal m = new Modal(); Modal m = new Modal();
m.setTitle("Title ......"); m.setTitle("Title ......");
@ -268,26 +268,14 @@ public class CKanMetadataPublisher implements EntryPoint {
r.setFolder(true); r.setFolder(true);
r.setName("Root"); r.setName("Root");
r.setParent(null); r.setParent(null);
r.setChildrenSize(5);
r.setOriginalIdInWorkspace("4ab50488-67d7-4664-9a0f-88a1de043399");
List<ResourceElementBean> children = new ArrayList<ResourceElementBean>(); List<ResourceElementBean> children = new ArrayList<ResourceElementBean>();
SelectResourceByWEMainPanel resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel(r);
// random strings m.add(resourcesSelectByWEMainPanel);
for (int i = 0; i < 10; i++) {
ResourceElementBean child = new ResourceElementBean();
child.setFolder(false);
child.setName("BLUE_ECONOMY_WP6_TECHNO_ECONOMIC_ANALYSIS_MODEL.CITE.PPTX" + i);
child.setEditableName("BLUE_ECONOMY_WP6_TECHNO_ECONOMIC_ANALYSIS_MODEL.CITE.PPTX" + i);
child.setParent(r);
child.setFullPath("/" + "BLUE_ECONOMY_WP6_TECHNO_ECONOMIC_ANALYSIS_MODEL.CITE.PPTX" + + i);
children.add(child);
}
r.setChildren(children);
// create random childs
resourcesTwinPanel = new TwinColumnSelectionMainPanel(r);
m.add(resourcesTwinPanel);
m.show(); m.show();
} }

View File

@ -153,8 +153,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE); cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
// set page size // set page size
int size = initialBean.isFolder() ? initialBean.getChildren().size() : 1; //int size = initialBean.isFolder() ? initialBean.getChildren().size() : 1;
cellListLeft.setPageSize(size); cellListLeft.setPageSize(0);
// Add a selection model so we can select cells. // Add a selection model so we can select cells.
selectionModelLeft = new MultiSelectionModel<ResourceElementBean>(ResourceElementBean.KEY_PROVIDER); selectionModelLeft = new MultiSelectionModel<ResourceElementBean>(ResourceElementBean.KEY_PROVIDER);
@ -191,8 +191,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
GWT.log("Clicked on element " + pathBean.resourceFolder.getName()); GWT.log("Clicked on element " + pathBean.resourceFolder.getName());
//breadcrumbsUpdater(); //breadcrumbsUpdater();
ResourceElementBean folder = pathBean.resourceFolder; ResourceElementBean folder = pathBean.resourceFolder;
Collections.sort(folder.getChildren()); /*Collections.sort(folder.getChildren());
dataProviderLeft.setList(folder.getChildren()); dataProviderLeft.setList(folder.getChildren());*/
dataProviderLeft.refresh(); dataProviderLeft.refresh();
} }
@ -202,10 +202,10 @@ public class TwinColumnSelectionMainPanel extends Composite{
breadcrumbs.add(navElem); breadcrumbs.add(navElem);
//breadcrumbsUpdater(); //breadcrumbsUpdater();
Collections.sort(selectedBean.getChildren()); /*Collections.sort(selectedBean.getChildren());
GWT.log("Children " + selectedBean.getChildren()); GWT.log("Children " + selectedBean.getChildren());
dataProviderLeft.setList(selectedBean.getChildren()); dataProviderLeft.setList(selectedBean.getChildren());
cellListLeft.setPageSize(selectedBean.getChildren().size()); cellListLeft.setPageSize(selectedBean.getChildren().size());*/
dataProviderLeft.refresh(); dataProviderLeft.refresh();
} }
selectionModelLeft.setSelected(selectedBean, false); selectionModelLeft.setSelected(selectedBean, false);
@ -218,8 +218,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
// set the list into the provider // set the list into the provider
if(initialBean.isFolder()){ if(initialBean.isFolder()){
Collections.sort(this.initialBean.getChildren()); /*Collections.sort(this.initialBean.getChildren());
dataProviderLeft.setList(this.initialBean.getChildren()); dataProviderLeft.setList(this.initialBean.getChildren());*/
}else }else
dataProviderLeft.setList(Arrays.asList(this.initialBean)); dataProviderLeft.setList(Arrays.asList(this.initialBean));
@ -239,8 +239,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
//breadcrumbsUpdater(); //breadcrumbsUpdater();
// set back the root content list // set back the root content list
dataProviderLeft.setList(initialBean.getChildren()); /*dataProviderLeft.setList(initialBean.getChildren());
cellListLeft.setPageSize(initialBean.getChildren().size()); cellListLeft.setPageSize(initialBean.getChildren().size());*/
dataProviderLeft.refresh(); dataProviderLeft.refresh();
} }
@ -511,7 +511,7 @@ public class TwinColumnSelectionMainPanel extends Composite{
} }
} }
toReturn.setChildren(children); /*toReturn.setChildren(children);*/
return toReturn; return toReturn;
} }

View File

@ -15,7 +15,6 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCre
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEventHandler; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEventHandler;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEvent; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEvent;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEventHandler; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEventHandler;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection.TwinColumnSelectionMainPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.CategoryPanel; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.CategoryPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.CustomFieldEntry; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.CustomFieldEntry;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton;
@ -24,6 +23,7 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.Ad
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.AddedResourcesSummary; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.AddedResourcesSummary;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.tags.TagsPanel; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.tags.TagsPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.SelectResourceByWEMainPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean;
@ -205,7 +205,10 @@ public class CreateDatasetForm extends Composite{
private boolean isWorkspaceRequest = false; private boolean isWorkspaceRequest = false;
// resource table // resource table
private TwinColumnSelectionMainPanel resourcesTwinPanel; //private TwinColumnSelectionMainPanel resourcesTwinPanel;
// resource table
private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel;
// List of opened popup'ids // List of opened popup'ids
private List<String> popupOpenedIds = new ArrayList<String>(); private List<String> popupOpenedIds = new ArrayList<String>();
@ -361,7 +364,8 @@ public class CreateDatasetForm extends Composite{
alertNoResources.setType(AlertType.WARNING); alertNoResources.setType(AlertType.WARNING);
alertNoResources.setVisible(true); alertNoResources.setVisible(true);
}else }else
resourcesTwinPanel = new TwinColumnSelectionMainPanel(bean.getResourceRoot()); //resourcesSelectByWEMainPanel = new TwinColumnSelectionMainPanel(bean.getResourceRoot());
resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel(bean.getResourceRoot());
} }
// set organizations // set organizations
@ -856,7 +860,7 @@ public class CreateDatasetForm extends Composite{
// add the resources to the container panel // add the resources to the container panel
if(workspaceResourcesContainer.getWidget() == null){ if(workspaceResourcesContainer.getWidget() == null){
workspaceResourcesContainer.getElement().getStyle().setMarginLeft(20, Unit.PX); workspaceResourcesContainer.getElement().getStyle().setMarginLeft(20, Unit.PX);
workspaceResourcesContainer.add(resourcesTwinPanel); workspaceResourcesContainer.add(resourcesSelectByWEMainPanel);
} }
}else{ }else{
@ -1022,8 +1026,11 @@ public class CreateDatasetForm extends Composite{
receivedBean.setSelectedOrganization(chosenOrganization); receivedBean.setSelectedOrganization(chosenOrganization);
receivedBean.setGroups(groups); receivedBean.setGroups(groups);
receivedBean.setGroupsForceCreation(groupsToForceCreation); receivedBean.setGroupsForceCreation(groupsToForceCreation);
if(resourcesTwinPanel != null)
receivedBean.setResourceRoot(resourcesTwinPanel.getResourcesToPublish());
if(resourcesSelectByWEMainPanel != null)
receivedBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish());
receivedBean.setCustomFields(customFieldsMap); receivedBean.setCustomFields(customFieldsMap);
// alert // alert
@ -1496,8 +1503,8 @@ public class CreateDatasetForm extends Composite{
} }
// freeze table of resources // freeze table of resources
if(resourcesTwinPanel != null) if(resourcesSelectByWEMainPanel != null)
resourcesTwinPanel.freeze(); resourcesSelectByWEMainPanel.freeze();
} }
/** /**
@ -1574,8 +1581,8 @@ public class CreateDatasetForm extends Composite{
*/ */
private boolean hideManageResources(){ private boolean hideManageResources(){
return receivedBean.getResourceRoot() == null || receivedBean.getResourceRoot().isFolder() && (receivedBean.getResourceRoot().getChildren() == null || return receivedBean.getResourceRoot() == null || receivedBean.getResourceRoot().isFolder() && (receivedBean.getResourceRoot().getChildrenSize() == null ||
receivedBean.getResourceRoot().getChildren().isEmpty()); receivedBean.getResourceRoot().getChildrenSize()==0);
} }
} }

View File

@ -0,0 +1,192 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace;
import java.util.HashMap;
import java.util.Map;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesBExplorerPanel;
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectBNotification.WorskpaceExplorerSelectBNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import com.github.gwtbootstrap.client.ui.Button;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class SelectResourceByWEMainPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Mar 5, 2021
*/
public class SelectResourceByWEMainPanel extends Composite {
/** The ui binder. */
private static SelectResourceByWEMainPanelUiBinder uiBinder = GWT.create(SelectResourceByWEMainPanelUiBinder.class);
private static boolean frozen = false;
private final ResourceElementBean initialBean;
@UiField
VerticalPanel wsContainer;
@UiField
VerticalPanel selectResourcesContainer;
@UiField
Button buttSelectResource;
private Item selectedWEItem;
Map<String, SelectResourceWidget> mapSelectedResources = new HashMap<String, SelectResourceWidget>();
/**
* The Interface SelectResourceByWEMainPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Mar 5, 2021
*/
interface SelectResourceByWEMainPanelUiBinder extends UiBinder<Widget, SelectResourceByWEMainPanel> {
}
/**
* Instantiates a new select resource by WE main panel.
*/
public SelectResourceByWEMainPanel(ResourceElementBean initialBean) {
initWidget(uiBinder.createAndBindUi(this));
this.frozen = false;
this.initialBean = initialBean;
WorkspaceResourcesExplorerPanel rp = null;
DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,
DISPLAY_FIELD.OWNER };
try {
String wsRootId = initialBean.isFolder() ? initialBean.getOriginalIdInWorkspace()
: initialBean.getParent().getOriginalIdInWorkspace();
// WorkspaceResourcesBExplorerPanel(String folderId, boolean showOnlyFolders,
// List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo,
// DISPLAY_FIELD sortByColumn) throws Exception {
WorkspaceResourcesBExplorerPanel workspaceExplorerPanel = new WorkspaceResourcesBExplorerPanel(wsRootId,
false);
WorskpaceExplorerSelectBNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectBNotificationListener() {
@Override
public void onSelectedItem(Item item) {
GWT.log("Listener Selected Item " + item);
selectedWEItem = item;
}
@Override
public void onFailed(Throwable throwable) {
// Log.error(throwable.getLocalizedMessage());
throwable.printStackTrace();
}
@Override
public void onAborted() {
}
@Override
public void onNotValidSelection() {
selectedWEItem = null;
}
@Override
public void onBreadcrumbChanged(Item item) {
GWT.log("Breadcrumb Changed: " + item);
}
};
workspaceExplorerPanel.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
wsContainer.add(workspaceExplorerPanel);
} catch (Exception e) {
e.printStackTrace();
}
if(!initialBean.isFolder()) {
addSelectResource(initialBean.getOriginalIdInWorkspace(), initialBean.getName(),initialBean.getFullPath());
}
buttSelectResource.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(selectedWEItem!=null) {
addSelectResource(selectedWEItem.getId(), selectedWEItem.getName(), selectedWEItem.getPath());
}
}
});
}
public void addSelectResource(String wsItemId, String name, String path) {
SelectResourceWidget selWidg = mapSelectedResources.get(wsItemId);
if (selWidg != null) {
Window.alert("Item '" + name + "' already selected");
return;
}
ResourceElementBean rb = new ResourceElementBean();
rb.setOriginalIdInWorkspace(wsItemId);
rb.setName(name);
rb.setFullPath(path);
rb.setEditableName(name);
selWidg = new SelectResourceWidget(rb);
mapSelectedResources.put(wsItemId, selWidg);
selectResourcesContainer.add(selWidg);
}
public ResourceElementBean getResourcesToPublish() {
// TODO Auto-generated method stub
Window.alert("getResourcesToPublish() must be implemented");
/*List<ResourceElementBean> current = dataProviderRight.getList();
ResourceElementBean toReturn = new ResourceElementBean();
List<ResourceElementBean> children = new ArrayList<ResourceElementBean>();
for (ResourceElementBean resource : current) {
if(resource.isToBeAdded() && !resource.isFolder()){ // be sure ...
ResourceElementBean beanWithoutChildren = new ResourceElementBean(resource);
beanWithoutChildren.setName(resource.getEditableName());
children.add(beanWithoutChildren);
}
}
toReturn.setToPublish(children);
return toReturn;*/
return null;
}
public void freeze() {
// TODO Auto-generated method stub
Window.alert("freeze() must be implemented");
}
}

View File

@ -0,0 +1,26 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel width="90%">
<g:VerticalPanel>
<b:Accordion>
<b:AccordionGroup heading="Pick Resources"
defaultOpen="true">
<g:VerticalPanel ui:field="wsContainer">
</g:VerticalPanel>
<b:Button ui:field="buttSelectResource">Select Resource</b:Button>
</b:AccordionGroup>
</b:Accordion>
</g:VerticalPanel>
<g:HTMLPanel>
<b:PageHeader subtext="Resources">Selected</b:PageHeader>
<g:VerticalPanel ui:field="selectResourcesContainer"></g:VerticalPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,45 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import com.github.gwtbootstrap.client.ui.Button;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
public class SelectResourceWidget extends Composite {
private static SelectResourceWidgetUiBinder uiBinder = GWT.create(SelectResourceWidgetUiBinder.class);
interface SelectResourceWidgetUiBinder extends UiBinder<Widget, SelectResourceWidget> {
}
public SelectResourceWidget() {
initWidget(uiBinder.createAndBindUi(this));
}
@UiField
Button buttonDelete;
@UiField
Button buttonEdit;
@UiField
Label fieldName;
private ResourceElementBean resourceBean;
public SelectResourceWidget(ResourceElementBean rb) {
initWidget(uiBinder.createAndBindUi(this));
this.resourceBean = rb;
this.fieldName.setText(rb.getEditableName());
}
}

View File

@ -0,0 +1,17 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
<g:HorizontalPanel>
<b:Button ui:field="buttonDelete" icon="TRASH" />
<b:Button ui:field="buttonEdit" icon="PENCIL" />
<b:Label ui:field="fieldName"></b:Label>
</g:HorizontalPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -264,7 +264,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
// if the request comes from the workspace // if the request comes from the workspace
if(folderId != null && !folderId.isEmpty()){ if(folderId != null && !folderId.isEmpty()){
Workspace workspace = getWorkspaceFromStorageHub(); Workspace workspace = getWorkspaceFromStorageHub();
WorkspaceUtils.handleWorkspaceResources(folderId, userName, bean, workspace); WorkspaceUtils.toWorkspaceResource(folderId, userName, bean, workspace);
} }
}catch(Exception e){ }catch(Exception e){
@ -299,7 +299,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
if(folderId != null && !folderId.isEmpty()){ if(folderId != null && !folderId.isEmpty()){
Workspace workspace = getWorkspaceFromStorageHub(); Workspace workspace = getWorkspaceFromStorageHub();
WorkspaceUtils.handleWorkspaceResources(folderId, userName, bean, workspace); WorkspaceUtils.toWorkspaceResource(folderId, userName, bean, workspace);
} }
}catch(Exception e){ }catch(Exception e){
logger.error("Error while building bean into dev mode", e); logger.error("Error while building bean into dev mode", e);

View File

@ -99,65 +99,69 @@ public class WorkspaceUtils {
} }
/** /**
* This method receives a folder id within the user's workspace and set the list of resources in the dataset bean to be returned. * This method receives an item-id within the user's workspace and setit in the dataset bean to be returned.
* * revisited by Francesco
* @param folderId the folder id *
* @param wsItemId the ws item id
* @param userName the user name * @param userName the user name
* @param bean the bean * @param bean the bean
* @param workspace the workspace * @param workspace the workspace
* @throws Exception the exception * @throws Exception the exception
*/ */
public static void handleWorkspaceResources(String folderId, String userName, public static void toWorkspaceResource(String wsItemId, String userName,
DatasetBean bean, Workspace workspace) throws Exception { DatasetBean bean, Workspace workspace) throws Exception {
WorkspaceItem originalFolderOrFile = workspace.getItem(folderId); WorkspaceItem originalFolderOrFile = workspace.getItem(wsItemId);
logger.debug("Item retrieved is " + originalFolderOrFile); logger.debug("Item retrieved is " + originalFolderOrFile);
String title = originalFolderOrFile.getTitle() != null && !originalFolderOrFile.getTitle().isEmpty() String title = originalFolderOrFile.getTitle() != null && !originalFolderOrFile.getTitle().isEmpty()
? originalFolderOrFile.getTitle() ? originalFolderOrFile.getTitle()
: originalFolderOrFile.getName(); : originalFolderOrFile.getName();
title = title.replaceAll(STRIP_NOT_ALPHANUMERIC, " "); title = title.replaceAll(STRIP_NOT_ALPHANUMERIC, " ");
bean.setTitle(title);
ResourceElementBean resourceEB = new ResourceElementBean();
resourceEB.setOriginalIdInWorkspace(wsItemId);
resourceEB.setName(originalFolderOrFile.getName());
resourceEB.setDescription(originalFolderOrFile.getDescription());
resourceEB.setFolder(originalFolderOrFile.isFolder());
resourceEB.setEditableName(originalFolderOrFile.getName());
if(!originalFolderOrFile.isFolder()){ //in case of folder
if(originalFolderOrFile.isFolder()) {
ResourceElementBean resource = new ResourceElementBean(); // loading gcube properties
resource.setDescription(originalFolderOrFile.getDescription());
resource.setFolder(false);
resource.setEditableName(originalFolderOrFile.getName());
resource.setName(originalFolderOrFile.getName());
resource.setOriginalIdInWorkspace(folderId);
bean.setResourceRoot(resource);
bean.setTitle(title);
bean.setDescription(originalFolderOrFile.getDescription());
}else{
String onlyAlphanumericTitle = title;
bean.setTitle(onlyAlphanumericTitle);
bean.setDescription(originalFolderOrFile.getDescription());
// Create the folder in the catalogue
Map<String, String> folderItems = getGcubeItemProperties(originalFolderOrFile); Map<String, String> folderItems = getGcubeItemProperties(originalFolderOrFile);
if(folderItems != null){ if(folderItems != null && folderItems.size()>0){
// transform this properties // transform this properties
Map<String, List<String>> tempItems = new HashMap<String, List<String>>(folderItems.size()); Map<String, List<String>> tempItems = new HashMap<String, List<String>>(folderItems.size());
Iterator<Entry<String, String>> iterator = folderItems.entrySet().iterator(); Iterator<Entry<String, String>> iterator = folderItems.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry<java.lang.String, java.lang.String> entry = (Map.Entry<java.lang.String, java.lang.String>) iterator Map.Entry<java.lang.String, java.lang.String> entry = (Map.Entry<java.lang.String, java.lang.String>) iterator.next();
.next();
tempItems.put(entry.getKey(), Arrays.asList(entry.getValue())); tempItems.put(entry.getKey(), Arrays.asList(entry.getValue()));
} }
//setting properties as custom fields
bean.setCustomFields(tempItems); bean.setCustomFields(tempItems);
} }
// set them into the bean String pathSeparator = "/";
bean.setResourceRoot(WorkspaceUtils.getTreeFromFolder(folderId, workspace)); String fullPathBase = originalFolderOrFile.getPath();
fullPathBase = fullPathBase.endsWith(pathSeparator) ? fullPathBase : fullPathBase + pathSeparator;
resourceEB.setFullPath(originalFolderOrFile.getPath().replace(fullPathBase, ""));
resourceEB.setChildrenSize(workspace.getChildren(originalFolderOrFile.getId()).size());
//WorkspaceUtils.extractEditableNameFromPath(resourceEB, pathSeparator);
} }
//setting parent id
ResourceElementBean theParent = new ResourceElementBean();
theParent.setOriginalIdInWorkspace(originalFolderOrFile.getParentId());
resourceEB.setParent(theParent);
bean.setResourceRoot(resourceEB);
} }
/** Gets the gcube item properties. /** Gets the gcube item properties.
@ -222,99 +226,98 @@ public class WorkspaceUtils {
} }
/** // /**
* Returns a tree object. // * Returns ResourceElementBean corresponding to workspaceFolderId
* // *
* @param workspaceFolderId the workspace folder id // * @param workspaceFolderId the workspace folder id
* @param workspace the workspace // * @param workspace the workspace
* @return ResourceElementBean a tree object // * @return ResourceElementBean a tree object
* @throws Exception the exception // * @throws Exception the exception
*/ // */
public static ResourceElementBean getTreeFromFolder(String workspaceFolderId, Workspace workspace) throws Exception{ // public static ResourceElementBean toResourceEBFromFolder(String workspaceFolderId, Workspace workspace) throws Exception{
//
// ResourceElementBean rootElem = new ResourceElementBean();
// String pathSeparator = "/";
//
// //String pathSeparator = ws.getPathSeparator();
//
// WorkspaceItem initialItem = workspace.getItem(workspaceFolderId);
// String fullPathBase = initialItem.getPath();
// fullPathBase = fullPathBase.endsWith(pathSeparator) ? fullPathBase : fullPathBase + pathSeparator;
// rootElem.setFolder(initialItem.isFolder());
// rootElem.setFullPath(initialItem.getPath().replace(fullPathBase, ""));
// rootElem.setName(initialItem.getName());
// rootElem.setOriginalIdInWorkspace(initialItem.getId());
// rootElem.setDescription(initialItem.getDescription());
// extractEditableNameFromPath(rootElem, pathSeparator);
//
// // recursive visiting
//// if(initialItem.isFolder())
//// visit(rootElem, initialItem, workspace, fullPathBase, pathSeparator);
//
// logger.debug("Tree that is going to be returned is " + rootElem);
// return rootElem;
// }
ResourceElementBean rootElem = new ResourceElementBean(); // /**
String pathSeparator = "/"; // * Recursive visit of a workspace item.
// *
//String pathSeparator = ws.getPathSeparator(); // * @param parent the parent
// * @param initialItemWS the initial item WS
// * @param workspace the ws
WorkspaceItem initialItem = workspace.getItem(workspaceFolderId); // * @param fullPathBase the full path base
String fullPathBase = initialItem.getPath(); // * @param pathSeparator the path separator
fullPathBase = fullPathBase.endsWith(pathSeparator) ? fullPathBase : fullPathBase + pathSeparator; // * @throws Exception the exception
rootElem.setFolder(initialItem.isFolder()); // */
rootElem.setFullPath(initialItem.getPath().replace(fullPathBase, "")); // private static void visit(ResourceElementBean parent, WorkspaceItem initialItemWS, Workspace workspace, String fullPathBase, String pathSeparator) throws Exception {
rootElem.setName(initialItem.getName()); // //List<? extends WorkspaceItem> children = initialItemWS.getChildren();
rootElem.setOriginalIdInWorkspace(initialItem.getId()); //
rootElem.setDescription(initialItem.getDescription()); // List<? extends WorkspaceItem> children = workspace.getChildren(initialItemWS.getId());
extractEditableNameFromPath(rootElem, pathSeparator); //
// ArrayList<ResourceElementBean> childrenInTree = new ArrayList<ResourceElementBean>(children.size());
// for (WorkspaceItem item : children) {
// // logger.debug("Path BEFORE REPLACE is " + item.getPath());
// // logger.debug("Path AFTER REPLACE is " + item.getPath().replace(fullPathBase, ""));
// // logger.debug("Name is " + item.getName());
// // logger.debug("id is " + item.getId());
// ResourceElementBean elem = new ResourceElementBean();
// elem.setFolder(item.isFolder());
// elem.setOriginalIdInWorkspace(item.getId());
// elem.setFullPath(item.getPath().replace(fullPathBase, ""));
// elem.setParent(parent);
// elem.setName(item.getName());
// elem.setDescription(item.getDescription());
// extractEditableNameFromPath(elem, pathSeparator);
// childrenInTree.add(elem);
// logger.trace("Elem is " + elem);
// if(item.isFolder())
// visit(elem, item, workspace, fullPathBase, pathSeparator);
// }
// // add these list as child of the rootElem
// parent.setChildren(childrenInTree);
// }
// recursive visiting // /**
if(initialItem.isFolder()) // * Replaces the "/" char with a custom one and return an editable name for the user.
visit(rootElem, initialItem, workspace, fullPathBase, pathSeparator); // *
// * @param rootElem the root elem
logger.debug("Tree that is going to be returned is " + rootElem); // * @param pathSeparatorInWs the path separator in ws
return rootElem; // */
} // public static void extractEditableNameFromPath(ResourceElementBean rootElem, String pathSeparatorInWs) {
//
/** // if(rootElem == null)
* Recursive visit of a workspace item. // return;
* //
* @param parent the parent // String elemName = rootElem.getName();
* @param initialItemWS the initial item WS // String fullPath = rootElem.getFullPath();
* @param workspace the ws // logger.info("Element original is " + rootElem);
* @param fullPathBase the full path base //
* @param pathSeparator the path separator // int lastIndex = rootElem.getFullPath().lastIndexOf(elemName);
* @throws Exception the exception // fullPath = rootElem.getFullPath().substring(0, lastIndex);
*/ // fullPath = fullPath.replaceAll(pathSeparatorInWs, RESOURCES_NAME_SEPARATOR) + elemName;
private static void visit(ResourceElementBean parent, WorkspaceItem initialItemWS, Workspace workspace, String fullPathBase, String pathSeparator) throws Exception { // rootElem.setEditableName(fullPath);
//List<? extends WorkspaceItem> children = initialItemWS.getChildren(); // logger.info("Editable name for resource name: "+rootElem.getName()+", is: " + rootElem.getEditableName());
// }
List<? extends WorkspaceItem> children = workspace.getChildren(initialItemWS.getId());
ArrayList<ResourceElementBean> childrenInTree = new ArrayList<ResourceElementBean>(children.size());
for (WorkspaceItem item : children) {
// logger.debug("Path BEFORE REPLACE is " + item.getPath());
// logger.debug("Path AFTER REPLACE is " + item.getPath().replace(fullPathBase, ""));
// logger.debug("Name is " + item.getName());
// logger.debug("id is " + item.getId());
ResourceElementBean elem = new ResourceElementBean();
elem.setFolder(item.isFolder());
elem.setOriginalIdInWorkspace(item.getId());
elem.setFullPath(item.getPath().replace(fullPathBase, ""));
elem.setParent(parent);
elem.setName(item.getName());
elem.setDescription(item.getDescription());
extractEditableNameFromPath(elem, pathSeparator);
childrenInTree.add(elem);
logger.trace("Elem is " + elem);
if(item.isFolder())
visit(elem, item, workspace, fullPathBase, pathSeparator);
}
// add these list as child of the rootElem
parent.setChildren(childrenInTree);
}
/**
* Replaces the "/" char with a custom one and return an editable name for the user.
*
* @param rootElem the root elem
* @param pathSeparatorInWs the path separator in ws
*/
private static void extractEditableNameFromPath(ResourceElementBean rootElem, String pathSeparatorInWs) {
if(rootElem == null)
return;
String elemName = rootElem.getName();
String fullPath = rootElem.getFullPath();
logger.info("Element original is " + rootElem);
int lastIndex = rootElem.getFullPath().lastIndexOf(elemName);
fullPath = rootElem.getFullPath().substring(0, lastIndex);
fullPath = fullPath.replaceAll(pathSeparatorInWs, RESOURCES_NAME_SEPARATOR) + elemName;
rootElem.setEditableName(fullPath);
logger.info("Editable name for resource name: "+rootElem.getName()+", is: " + rootElem.getEditableName());
}
/** /**
@ -334,7 +337,7 @@ public class WorkspaceUtils {
ResourceElementBean rootResource = bean.getResourceRoot(); ResourceElementBean rootResource = bean.getResourceRoot();
// retrieve the children // retrieve the children
List<ResourceElementBean> resourcesToAdd = rootResource.getChildren(); List<ResourceElementBean> resourcesToAdd = rootResource.getToPublish();
// copy only the selected ones // copy only the selected ones
for(ResourceElementBean resource : resourcesToAdd){ for(ResourceElementBean resource : resourcesToAdd){

View File

@ -6,29 +6,62 @@ import java.util.List;
import com.google.gwt.view.client.ProvidesKey; import com.google.gwt.view.client.ProvidesKey;
// TODO: Auto-generated Javadoc
/** /**
* A resource element bean. Contains part of the logic used into the TwinColumn widget * A resource element bean. Contains part of the logic used into the TwinColumn widget
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*
* @author revisited by Francesco Mangiacrapa
*/ */
public class ResourceElementBean implements Comparable<ResourceElementBean>, Serializable{ public class ResourceElementBean implements Comparable<ResourceElementBean>, Serializable{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -1230871392599580669L; private static final long serialVersionUID = -1230871392599580669L;
/** The name. */
private String name; private String name;
/** The editable name. */
private String editableName; private String editableName;
/** The to be added. */
private boolean toBeAdded; private boolean toBeAdded;
/** The is folder. */
private boolean isFolder; private boolean isFolder;
/** The full path. */
private String fullPath; private String fullPath;
/** The original id in workspace. */
private String originalIdInWorkspace; private String originalIdInWorkspace;
/** The mime type. */
private String mimeType; private String mimeType;
/** The url. */
private String url; private String url;
/** The description. */
private String description; private String description;
/** The organization name dataset parent. */
private String organizationNameDatasetParent; // the organization name in which the parent dataset was created private String organizationNameDatasetParent; // the organization name in which the parent dataset was created
/** The parent. */
private ResourceElementBean parent; private ResourceElementBean parent;
private List<ResourceElementBean> children;
/** The children size. */
private Integer childrenSize;
/** The to publish. */
private List<ResourceElementBean> toPublish; //Resources that must be published
/** The next id. */
// to generate the GWT identifiers // to generate the GWT identifiers
private static int nextId = 0; private static int nextId = 0;
/** The identifier GWT. */
// identifier of this instance // identifier of this instance
private int identifierGWT; private int identifierGWT;
@ -43,8 +76,9 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
}; };
/** /**
* Copy constructor * Copy constructor.
* @param another *
* @param another the another
*/ */
public ResourceElementBean(ResourceElementBean another) { public ResourceElementBean(ResourceElementBean another) {
this.name = another.name; this.name = another.name;
@ -59,7 +93,7 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
} }
/** /**
* Default constructor * Default constructor.
*/ */
public ResourceElementBean(){ public ResourceElementBean(){
super(); super();
@ -68,43 +102,47 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
} }
/** /**
* @param identifier * Instantiates a new resource element bean.
* @param parentFolder *
* @param name * @param parent the parent
* @param movedToRight * @param name the name
* @param isFolder * @param isFolder the is folder
* @param childrenSize the children size
* @param fullPath the full path
*/ */
public ResourceElementBean( public ResourceElementBean(
ResourceElementBean parent, ResourceElementBean parent,
String name, String name,
boolean isFolder, boolean isFolder,
List<ResourceElementBean> children, Integer childrenSize,
String fullPath) { String fullPath) {
this.identifierGWT = nextId; this.identifierGWT = nextId;
nextId++; nextId++;
this.parent = parent; this.parent = parent;
this.name = name; this.name = name;
this.isFolder = isFolder; this.isFolder = isFolder;
this.children = children; this.childrenSize = childrenSize;
this.fullPath = fullPath; this.fullPath = fullPath;
} }
/** /**
* @param name * Instantiates a new resource element bean.
* @param toBeAdded *
* @param isFolder * @param name the name
* @param parent * @param toBeAdded the to be added
* @param children * @param isFolder the is folder
* @param fullPath * @param parent the parent
* @param originalIdInWorkspace * @param childrenSize the children size
* @param mimeType * @param fullPath the full path
* @param url * @param originalIdInWorkspace the original id in workspace
* @param description * @param mimeType the mime type
* @param organizationNameDatasetParent * @param url the url
* @param description the description
* @param organizationNameDatasetParent the organization name dataset parent
*/ */
public ResourceElementBean(String name, boolean toBeAdded, public ResourceElementBean(String name, boolean toBeAdded,
boolean isFolder, ResourceElementBean parent, boolean isFolder, ResourceElementBean parent,
List<ResourceElementBean> children, String fullPath, Integer childrenSize, String fullPath,
String originalIdInWorkspace, String mimeType, String url, String originalIdInWorkspace, String mimeType, String url,
String description, String organizationNameDatasetParent) { String description, String organizationNameDatasetParent) {
super(); super();
@ -114,7 +152,7 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
this.toBeAdded = toBeAdded; this.toBeAdded = toBeAdded;
this.isFolder = isFolder; this.isFolder = isFolder;
this.parent = parent; this.parent = parent;
this.children = children; this.childrenSize = childrenSize;
this.fullPath = fullPath; this.fullPath = fullPath;
this.originalIdInWorkspace = originalIdInWorkspace; this.originalIdInWorkspace = originalIdInWorkspace;
this.mimeType = mimeType; this.mimeType = mimeType;
@ -123,103 +161,247 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
this.organizationNameDatasetParent = organizationNameDatasetParent; this.organizationNameDatasetParent = organizationNameDatasetParent;
} }
/**
* Gets the parent.
*
* @return the parent
*/
public ResourceElementBean getParent() { public ResourceElementBean getParent() {
return parent; return parent;
} }
/**
* Sets the parent.
*
* @param parent the new parent
*/
public void setParent(ResourceElementBean parent) { public void setParent(ResourceElementBean parent) {
this.parent = parent; this.parent = parent;
} }
/**
* Gets the name.
*
* @return the name
*/
public String getName() { public String getName() {
return name; return name;
} }
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/**
* Checks if is to be added.
*
* @return true, if is to be added
*/
public boolean isToBeAdded() { public boolean isToBeAdded() {
return toBeAdded; return toBeAdded;
} }
/**
* Sets the to be added.
*
* @param toBeAdded the new to be added
*/
public void setToBeAdded(boolean toBeAdded) { public void setToBeAdded(boolean toBeAdded) {
this.toBeAdded = toBeAdded; this.toBeAdded = toBeAdded;
} }
/**
* Gets the mime type.
*
* @return the mime type
*/
public String getMimeType() { public String getMimeType() {
return mimeType; return mimeType;
} }
/**
* Sets the mime type.
*
* @param mimeType the new mime type
*/
public void setMimeType(String mimeType) { public void setMimeType(String mimeType) {
this.mimeType = mimeType; this.mimeType = mimeType;
} }
/**
* Gets the url.
*
* @return the url
*/
public String getUrl() { public String getUrl() {
return url; return url;
} }
/**
* Sets the url.
*
* @param url the new url
*/
public void setUrl(String url) { public void setUrl(String url) {
this.url = url; this.url = url;
} }
/**
* Gets the description.
*
* @return the description
*/
public String getDescription() { public String getDescription() {
return description; return description;
} }
/**
* Sets the description.
*
* @param description the new description
*/
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
/**
* Gets the organization name dataset parent.
*
* @return the organization name dataset parent
*/
public String getOrganizationNameDatasetParent() { public String getOrganizationNameDatasetParent() {
return organizationNameDatasetParent; return organizationNameDatasetParent;
} }
/**
* Sets the organization name dataset parent.
*
* @param organizationNameDatasetParent the new organization name dataset parent
*/
public void setOrganizationNameDatasetParent( public void setOrganizationNameDatasetParent(
String organizationNameDatasetParent) { String organizationNameDatasetParent) {
this.organizationNameDatasetParent = organizationNameDatasetParent; this.organizationNameDatasetParent = organizationNameDatasetParent;
} }
/**
* Checks if is folder.
*
* @return true, if is folder
*/
public boolean isFolder() { public boolean isFolder() {
return isFolder; return isFolder;
} }
/**
* Sets the folder.
*
* @param isFolder the new folder
*/
public void setFolder(boolean isFolder) { public void setFolder(boolean isFolder) {
this.isFolder = isFolder; this.isFolder = isFolder;
} }
public List<ResourceElementBean> getChildren() { /**
return children; * Gets the children size.
*
* @return the children size
*/
public Integer getChildrenSize() {
return childrenSize;
} }
public void setChildren(List<ResourceElementBean> children) { /**
this.children = children; * Sets the children size.
*
* @param size the new children size
*/
public void setChildrenSize(Integer size) {
this.childrenSize = size;
} }
/**
* Gets the full path.
*
* @return the full path
*/
public String getFullPath() { public String getFullPath() {
return fullPath; return fullPath;
} }
/**
* Sets the full path.
*
* @param fullPath the new full path
*/
public void setFullPath(String fullPath) { public void setFullPath(String fullPath) {
this.fullPath = fullPath; this.fullPath = fullPath;
} }
/**
* Gets the original id in workspace.
*
* @return the original id in workspace
*/
public String getOriginalIdInWorkspace() { public String getOriginalIdInWorkspace() {
return originalIdInWorkspace; return originalIdInWorkspace;
} }
/**
* Sets the original id in workspace.
*
* @param originalIdInWorkspace the new original id in workspace
*/
public void setOriginalIdInWorkspace(String originalIdInWorkspace) { public void setOriginalIdInWorkspace(String originalIdInWorkspace) {
this.originalIdInWorkspace = originalIdInWorkspace; this.originalIdInWorkspace = originalIdInWorkspace;
} }
/**
* Gets the editable name.
*
* @return the editable name
*/
public String getEditableName() { public String getEditableName() {
return editableName; return editableName;
} }
/**
* Sets the editable name.
*
* @param newName the new editable name
*/
public void setEditableName(String newName) { public void setEditableName(String newName) {
this.editableName = newName; this.editableName = newName;
} }
/**
* Gets the to publish.
*
* @return the to publish
*/
public List<ResourceElementBean> getToPublish() {
return toPublish;
}
/**
* Sets the to publish.
*
* @param toPublish the new to publish
*/
public void setToPublish(List<ResourceElementBean> toPublish) {
this.toPublish = toPublish;
}
/**
* Equals.
*
* @param o the o
* @return true, if successful
*/
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
boolean toReturn = false; boolean toReturn = false;
@ -230,23 +412,54 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
return toReturn; return toReturn;
} }
/**
* Compare to.
*
* @param o the o
* @return the int
*/
@Override @Override
public int compareTo(ResourceElementBean o) { public int compareTo(ResourceElementBean o) {
int toReturn = (o == null || o.fullPath == null) ? -1 : -o.fullPath.compareTo(fullPath); int toReturn = (o == null || o.fullPath == null) ? -1 : -o.fullPath.compareTo(fullPath);
return toReturn; return toReturn;
} }
/**
* To string.
*
* @return the string
*/
@Override @Override
public String toString() { public String toString() {
return "ResourceElementBean [identifierGWT=" + identifierGWT StringBuilder builder = new StringBuilder();
+ ", name=" + name + ", editableName=" + editableName builder.append("ResourceElementBean [name=");
+ ", toBeAdded=" + toBeAdded + ", isFolder=" + isFolder builder.append(name);
+ ", fullPath=" + fullPath + ", originalIdInWorkspace=" builder.append(", editableName=");
+ originalIdInWorkspace + ", mimeType=" + mimeType + ", url=" builder.append(editableName);
+ url + ", description=" + description builder.append(", toBeAdded=");
+ ", organizationNameDatasetParent=" builder.append(toBeAdded);
+ organizationNameDatasetParent + ", parent=" + parent builder.append(", isFolder=");
+ ", children number=" + (children == null ? 0 : children.size()) + "]"; builder.append(isFolder);
builder.append(", fullPath=");
builder.append(fullPath);
builder.append(", originalIdInWorkspace=");
builder.append(originalIdInWorkspace);
builder.append(", mimeType=");
builder.append(mimeType);
builder.append(", url=");
builder.append(url);
builder.append(", description=");
builder.append(description);
builder.append(", organizationNameDatasetParent=");
builder.append(organizationNameDatasetParent);
builder.append(", parent=");
builder.append(parent);
builder.append(", childrenSize=");
builder.append(childrenSize);
builder.append(", identifierGWT=");
builder.append(identifierGWT);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -6,17 +6,24 @@
<!-- Other module inherits --> <!-- Other module inherits -->
<inherits name="com.github.gwtbootstrap.Bootstrap" /> <inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- Responsive design --> <!-- Responsive design -->
<set-property name="bootstrap.responsiveDesign" value="true" /> <set-property name="bootstrap.responsiveDesign"
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' /> value="true" />
<inherits
name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' /> <inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' /> <inherits
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' /> name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
<inherits
<inherits name='com.google.gwt.json.JSON'/> name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name='com.google.gwt.json.JSON' />
<inherits <inherits
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' /> name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
<inherits
name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
<!-- Specify the app entry point class. --> <!-- Specify the app entry point class. -->
<entry-point <entry-point
class='org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher' /> class='org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher' />

View File

@ -93,7 +93,7 @@ public class TestPublishingWidget {
if(folderId != null && !folderId.isEmpty()){ if(folderId != null && !folderId.isEmpty()){
StorageHubWrapper storageHubWrapper = new StorageHubWrapper(scope, token, false, false, true); StorageHubWrapper storageHubWrapper = new StorageHubWrapper(scope, token, false, false, true);
WorkspaceUtils.handleWorkspaceResources(folderId, userName, bean, storageHubWrapper.getWorkspace()); WorkspaceUtils.toWorkspaceResource(folderId, userName, bean, storageHubWrapper.getWorkspace());
} }
}catch(Exception e){ }catch(Exception e){
LOG.error("Error while building bean into dev mode", e); LOG.error("Error while building bean into dev mode", e);