integrating with Workspace Explorer and updating Manage Resources
This commit is contained in:
parent
beddee26b5
commit
d2846cd9f4
9
pom.xml
9
pom.xml
|
@ -121,14 +121,14 @@
|
|||
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>storagehub-client-wrapper</artifactId>
|
||||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
|
@ -149,6 +149,11 @@
|
|||
<scope>provided</scope>
|
||||
<!-- put at provided for deploying -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>workspace-explorer</artifactId>
|
||||
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
|
|
|
@ -6,17 +6,24 @@
|
|||
<!-- Other module inherits -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<!-- Responsive design -->
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<set-property name="bootstrap.responsiveDesign"
|
||||
value="true" />
|
||||
<inherits
|
||||
name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
|
||||
<inherits name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON'/>
|
||||
<inherits
|
||||
name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher' />
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
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.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.metadata.DataTypeWrapper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
||||
|
@ -51,6 +51,8 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
// startTwinColumn();
|
||||
|
||||
//testSpatialWidget();
|
||||
|
||||
testManageResources();
|
||||
|
||||
}
|
||||
|
||||
|
@ -256,9 +258,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
|
||||
// test resources
|
||||
@SuppressWarnings("unused")
|
||||
private void startTwinColumn() {
|
||||
|
||||
TwinColumnSelectionMainPanel resourcesTwinPanel;
|
||||
private void testManageResources() {
|
||||
|
||||
Modal m = new Modal();
|
||||
m.setTitle("Title ......");
|
||||
|
@ -268,26 +268,14 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
r.setFolder(true);
|
||||
r.setName("Root");
|
||||
r.setParent(null);
|
||||
r.setChildrenSize(5);
|
||||
r.setOriginalIdInWorkspace("4ab50488-67d7-4664-9a0f-88a1de043399");
|
||||
|
||||
List<ResourceElementBean> children = new ArrayList<ResourceElementBean>();
|
||||
|
||||
SelectResourceByWEMainPanel resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel(r);
|
||||
|
||||
// random strings
|
||||
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.add(resourcesSelectByWEMainPanel);
|
||||
m.show();
|
||||
|
||||
}
|
||||
|
|
|
@ -153,8 +153,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
|
||||
|
||||
// set page size
|
||||
int size = initialBean.isFolder() ? initialBean.getChildren().size() : 1;
|
||||
cellListLeft.setPageSize(size);
|
||||
//int size = initialBean.isFolder() ? initialBean.getChildren().size() : 1;
|
||||
cellListLeft.setPageSize(0);
|
||||
|
||||
// Add a selection model so we can select cells.
|
||||
selectionModelLeft = new MultiSelectionModel<ResourceElementBean>(ResourceElementBean.KEY_PROVIDER);
|
||||
|
@ -191,8 +191,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
GWT.log("Clicked on element " + pathBean.resourceFolder.getName());
|
||||
//breadcrumbsUpdater();
|
||||
ResourceElementBean folder = pathBean.resourceFolder;
|
||||
Collections.sort(folder.getChildren());
|
||||
dataProviderLeft.setList(folder.getChildren());
|
||||
/*Collections.sort(folder.getChildren());
|
||||
dataProviderLeft.setList(folder.getChildren());*/
|
||||
dataProviderLeft.refresh();
|
||||
|
||||
}
|
||||
|
@ -202,10 +202,10 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
breadcrumbs.add(navElem);
|
||||
//breadcrumbsUpdater();
|
||||
|
||||
Collections.sort(selectedBean.getChildren());
|
||||
/*Collections.sort(selectedBean.getChildren());
|
||||
GWT.log("Children " + selectedBean.getChildren());
|
||||
dataProviderLeft.setList(selectedBean.getChildren());
|
||||
cellListLeft.setPageSize(selectedBean.getChildren().size());
|
||||
cellListLeft.setPageSize(selectedBean.getChildren().size());*/
|
||||
dataProviderLeft.refresh();
|
||||
}
|
||||
selectionModelLeft.setSelected(selectedBean, false);
|
||||
|
@ -218,8 +218,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
|
||||
// set the list into the provider
|
||||
if(initialBean.isFolder()){
|
||||
Collections.sort(this.initialBean.getChildren());
|
||||
dataProviderLeft.setList(this.initialBean.getChildren());
|
||||
/*Collections.sort(this.initialBean.getChildren());
|
||||
dataProviderLeft.setList(this.initialBean.getChildren());*/
|
||||
}else
|
||||
dataProviderLeft.setList(Arrays.asList(this.initialBean));
|
||||
|
||||
|
@ -239,8 +239,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
//breadcrumbsUpdater();
|
||||
|
||||
// set back the root content list
|
||||
dataProviderLeft.setList(initialBean.getChildren());
|
||||
cellListLeft.setPageSize(initialBean.getChildren().size());
|
||||
/*dataProviderLeft.setList(initialBean.getChildren());
|
||||
cellListLeft.setPageSize(initialBean.getChildren().size());*/
|
||||
dataProviderLeft.refresh();
|
||||
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
}
|
||||
}
|
||||
|
||||
toReturn.setChildren(children);
|
||||
/*toReturn.setChildren(children);*/
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.DeleteCustomFieldEvent;
|
||||
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.CustomFieldEntry;
|
||||
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.tags.TagsPanel;
|
||||
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.OrganizationBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean;
|
||||
|
@ -205,7 +205,10 @@ public class CreateDatasetForm extends Composite{
|
|||
private boolean isWorkspaceRequest = false;
|
||||
|
||||
// resource table
|
||||
private TwinColumnSelectionMainPanel resourcesTwinPanel;
|
||||
//private TwinColumnSelectionMainPanel resourcesTwinPanel;
|
||||
|
||||
// resource table
|
||||
private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel;
|
||||
|
||||
// List of opened popup'ids
|
||||
private List<String> popupOpenedIds = new ArrayList<String>();
|
||||
|
@ -361,7 +364,8 @@ public class CreateDatasetForm extends Composite{
|
|||
alertNoResources.setType(AlertType.WARNING);
|
||||
alertNoResources.setVisible(true);
|
||||
}else
|
||||
resourcesTwinPanel = new TwinColumnSelectionMainPanel(bean.getResourceRoot());
|
||||
//resourcesSelectByWEMainPanel = new TwinColumnSelectionMainPanel(bean.getResourceRoot());
|
||||
resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel(bean.getResourceRoot());
|
||||
}
|
||||
|
||||
// set organizations
|
||||
|
@ -856,7 +860,7 @@ public class CreateDatasetForm extends Composite{
|
|||
// add the resources to the container panel
|
||||
if(workspaceResourcesContainer.getWidget() == null){
|
||||
workspaceResourcesContainer.getElement().getStyle().setMarginLeft(20, Unit.PX);
|
||||
workspaceResourcesContainer.add(resourcesTwinPanel);
|
||||
workspaceResourcesContainer.add(resourcesSelectByWEMainPanel);
|
||||
}
|
||||
|
||||
}else{
|
||||
|
@ -1022,8 +1026,11 @@ public class CreateDatasetForm extends Composite{
|
|||
receivedBean.setSelectedOrganization(chosenOrganization);
|
||||
receivedBean.setGroups(groups);
|
||||
receivedBean.setGroupsForceCreation(groupsToForceCreation);
|
||||
if(resourcesTwinPanel != null)
|
||||
receivedBean.setResourceRoot(resourcesTwinPanel.getResourcesToPublish());
|
||||
|
||||
|
||||
if(resourcesSelectByWEMainPanel != null)
|
||||
receivedBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish());
|
||||
|
||||
receivedBean.setCustomFields(customFieldsMap);
|
||||
|
||||
// alert
|
||||
|
@ -1496,8 +1503,8 @@ public class CreateDatasetForm extends Composite{
|
|||
}
|
||||
|
||||
// freeze table of resources
|
||||
if(resourcesTwinPanel != null)
|
||||
resourcesTwinPanel.freeze();
|
||||
if(resourcesSelectByWEMainPanel != null)
|
||||
resourcesSelectByWEMainPanel.freeze();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1574,8 +1581,8 @@ public class CreateDatasetForm extends Composite{
|
|||
*/
|
||||
private boolean hideManageResources(){
|
||||
|
||||
return receivedBean.getResourceRoot() == null || receivedBean.getResourceRoot().isFolder() && (receivedBean.getResourceRoot().getChildren() == null ||
|
||||
receivedBean.getResourceRoot().getChildren().isEmpty());
|
||||
return receivedBean.getResourceRoot() == null || receivedBean.getResourceRoot().isFolder() && (receivedBean.getResourceRoot().getChildrenSize() == null ||
|
||||
receivedBean.getResourceRoot().getChildrenSize()==0);
|
||||
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
|
@ -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>
|
|
@ -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());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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>
|
|
@ -264,7 +264,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
// if the request comes from the workspace
|
||||
if(folderId != null && !folderId.isEmpty()){
|
||||
Workspace workspace = getWorkspaceFromStorageHub();
|
||||
WorkspaceUtils.handleWorkspaceResources(folderId, userName, bean, workspace);
|
||||
WorkspaceUtils.toWorkspaceResource(folderId, userName, bean, workspace);
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
|
@ -299,7 +299,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
|
||||
if(folderId != null && !folderId.isEmpty()){
|
||||
Workspace workspace = getWorkspaceFromStorageHub();
|
||||
WorkspaceUtils.handleWorkspaceResources(folderId, userName, bean, workspace);
|
||||
WorkspaceUtils.toWorkspaceResource(folderId, userName, bean, workspace);
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("Error while building bean into dev mode", e);
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* This method receives an item-id within the user's workspace and setit in the dataset bean to be returned.
|
||||
* revisited by Francesco
|
||||
*
|
||||
* @param wsItemId the ws item id
|
||||
* @param userName the user name
|
||||
* @param bean the bean
|
||||
* @param workspace the workspace
|
||||
* @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 {
|
||||
|
||||
|
||||
WorkspaceItem originalFolderOrFile = workspace.getItem(folderId);
|
||||
WorkspaceItem originalFolderOrFile = workspace.getItem(wsItemId);
|
||||
|
||||
logger.debug("Item retrieved is " + originalFolderOrFile);
|
||||
|
||||
String title = originalFolderOrFile.getTitle() != null && !originalFolderOrFile.getTitle().isEmpty()
|
||||
? originalFolderOrFile.getTitle()
|
||||
: originalFolderOrFile.getName();
|
||||
|
||||
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();
|
||||
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
|
||||
// loading gcube properties
|
||||
Map<String, String> folderItems = getGcubeItemProperties(originalFolderOrFile);
|
||||
|
||||
if(folderItems != null){
|
||||
if(folderItems != null && folderItems.size()>0){
|
||||
// transform this properties
|
||||
Map<String, List<String>> tempItems = new HashMap<String, List<String>>(folderItems.size());
|
||||
|
||||
Iterator<Entry<String, String>> iterator = folderItems.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<java.lang.String, java.lang.String> entry = (Map.Entry<java.lang.String, java.lang.String>) iterator
|
||||
.next();
|
||||
Map.Entry<java.lang.String, java.lang.String> entry = (Map.Entry<java.lang.String, java.lang.String>) iterator.next();
|
||||
tempItems.put(entry.getKey(), Arrays.asList(entry.getValue()));
|
||||
}
|
||||
//setting properties as custom fields
|
||||
bean.setCustomFields(tempItems);
|
||||
}
|
||||
|
||||
// set them into the bean
|
||||
bean.setResourceRoot(WorkspaceUtils.getTreeFromFolder(folderId, workspace));
|
||||
|
||||
String pathSeparator = "/";
|
||||
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.
|
||||
|
@ -222,99 +226,98 @@ public class WorkspaceUtils {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a tree object.
|
||||
*
|
||||
* @param workspaceFolderId the workspace folder id
|
||||
* @param workspace the workspace
|
||||
* @return ResourceElementBean a tree object
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static ResourceElementBean getTreeFromFolder(String workspaceFolderId, Workspace workspace) throws Exception{
|
||||
// /**
|
||||
// * Returns ResourceElementBean corresponding to workspaceFolderId
|
||||
// *
|
||||
// * @param workspaceFolderId the workspace folder id
|
||||
// * @param workspace the workspace
|
||||
// * @return ResourceElementBean a tree object
|
||||
// * @throws Exception the 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 = "/";
|
||||
|
||||
//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 visit of a workspace item.
|
||||
// *
|
||||
// * @param parent the parent
|
||||
// * @param initialItemWS the initial item WS
|
||||
// * @param workspace the ws
|
||||
// * @param fullPathBase the full path base
|
||||
// * @param pathSeparator the path separator
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// private static void visit(ResourceElementBean parent, WorkspaceItem initialItemWS, Workspace workspace, String fullPathBase, String pathSeparator) throws Exception {
|
||||
// //List<? extends WorkspaceItem> children = initialItemWS.getChildren();
|
||||
//
|
||||
// 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);
|
||||
// }
|
||||
|
||||
// recursive visiting
|
||||
if(initialItem.isFolder())
|
||||
visit(rootElem, initialItem, workspace, fullPathBase, pathSeparator);
|
||||
|
||||
logger.debug("Tree that is going to be returned is " + rootElem);
|
||||
return rootElem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive visit of a workspace item.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param initialItemWS the initial item WS
|
||||
* @param workspace the ws
|
||||
* @param fullPathBase the full path base
|
||||
* @param pathSeparator the path separator
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private static void visit(ResourceElementBean parent, WorkspaceItem initialItemWS, Workspace workspace, String fullPathBase, String pathSeparator) throws Exception {
|
||||
//List<? extends WorkspaceItem> children = initialItemWS.getChildren();
|
||||
|
||||
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());
|
||||
}
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// public 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();
|
||||
|
||||
// retrieve the children
|
||||
List<ResourceElementBean> resourcesToAdd = rootResource.getChildren();
|
||||
List<ResourceElementBean> resourcesToAdd = rootResource.getToPublish();
|
||||
|
||||
// copy only the selected ones
|
||||
for(ResourceElementBean resource : resourcesToAdd){
|
||||
|
|
|
@ -6,29 +6,62 @@ import java.util.List;
|
|||
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
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*
|
||||
* @author revisited by Francesco Mangiacrapa
|
||||
*/
|
||||
public class ResourceElementBean implements Comparable<ResourceElementBean>, Serializable{
|
||||
|
||||
/** The Constant serialVersionUID. */
|
||||
private static final long serialVersionUID = -1230871392599580669L;
|
||||
|
||||
/** The name. */
|
||||
private String name;
|
||||
|
||||
/** The editable name. */
|
||||
private String editableName;
|
||||
|
||||
/** The to be added. */
|
||||
private boolean toBeAdded;
|
||||
|
||||
/** The is folder. */
|
||||
private boolean isFolder;
|
||||
|
||||
/** The full path. */
|
||||
private String fullPath;
|
||||
|
||||
/** The original id in workspace. */
|
||||
private String originalIdInWorkspace;
|
||||
|
||||
/** The mime type. */
|
||||
private String mimeType;
|
||||
|
||||
/** The url. */
|
||||
private String url;
|
||||
|
||||
/** The description. */
|
||||
private String description;
|
||||
|
||||
/** The organization name dataset parent. */
|
||||
private String organizationNameDatasetParent; // the organization name in which the parent dataset was created
|
||||
|
||||
/** The 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
|
||||
private static int nextId = 0;
|
||||
|
||||
/** The identifier GWT. */
|
||||
// identifier of this instance
|
||||
private int identifierGWT;
|
||||
|
||||
|
@ -43,8 +76,9 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
|||
};
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
* @param another
|
||||
* Copy constructor.
|
||||
*
|
||||
* @param another the another
|
||||
*/
|
||||
public ResourceElementBean(ResourceElementBean another) {
|
||||
this.name = another.name;
|
||||
|
@ -59,7 +93,7 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
|||
}
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* Default constructor.
|
||||
*/
|
||||
public ResourceElementBean(){
|
||||
super();
|
||||
|
@ -68,43 +102,47 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
|||
}
|
||||
|
||||
/**
|
||||
* @param identifier
|
||||
* @param parentFolder
|
||||
* @param name
|
||||
* @param movedToRight
|
||||
* @param isFolder
|
||||
* Instantiates a new resource element bean.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param name the name
|
||||
* @param isFolder the is folder
|
||||
* @param childrenSize the children size
|
||||
* @param fullPath the full path
|
||||
*/
|
||||
public ResourceElementBean(
|
||||
ResourceElementBean parent,
|
||||
String name,
|
||||
boolean isFolder,
|
||||
List<ResourceElementBean> children,
|
||||
Integer childrenSize,
|
||||
String fullPath) {
|
||||
this.identifierGWT = nextId;
|
||||
nextId++;
|
||||
this.parent = parent;
|
||||
this.name = name;
|
||||
this.isFolder = isFolder;
|
||||
this.children = children;
|
||||
this.childrenSize = childrenSize;
|
||||
this.fullPath = fullPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param toBeAdded
|
||||
* @param isFolder
|
||||
* @param parent
|
||||
* @param children
|
||||
* @param fullPath
|
||||
* @param originalIdInWorkspace
|
||||
* @param mimeType
|
||||
* @param url
|
||||
* @param description
|
||||
* @param organizationNameDatasetParent
|
||||
* Instantiates a new resource element bean.
|
||||
*
|
||||
* @param name the name
|
||||
* @param toBeAdded the to be added
|
||||
* @param isFolder the is folder
|
||||
* @param parent the parent
|
||||
* @param childrenSize the children size
|
||||
* @param fullPath the full path
|
||||
* @param originalIdInWorkspace the original id in workspace
|
||||
* @param mimeType the mime type
|
||||
* @param url the url
|
||||
* @param description the description
|
||||
* @param organizationNameDatasetParent the organization name dataset parent
|
||||
*/
|
||||
public ResourceElementBean(String name, boolean toBeAdded,
|
||||
boolean isFolder, ResourceElementBean parent,
|
||||
List<ResourceElementBean> children, String fullPath,
|
||||
Integer childrenSize, String fullPath,
|
||||
String originalIdInWorkspace, String mimeType, String url,
|
||||
String description, String organizationNameDatasetParent) {
|
||||
super();
|
||||
|
@ -114,7 +152,7 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
|||
this.toBeAdded = toBeAdded;
|
||||
this.isFolder = isFolder;
|
||||
this.parent = parent;
|
||||
this.children = children;
|
||||
this.childrenSize = childrenSize;
|
||||
this.fullPath = fullPath;
|
||||
this.originalIdInWorkspace = originalIdInWorkspace;
|
||||
this.mimeType = mimeType;
|
||||
|
@ -123,103 +161,247 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
|||
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parent.
|
||||
*
|
||||
* @return the parent
|
||||
*/
|
||||
public ResourceElementBean getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parent.
|
||||
*
|
||||
* @param parent the new parent
|
||||
*/
|
||||
public void setParent(ResourceElementBean parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name the new name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is to be added.
|
||||
*
|
||||
* @return true, if is to be added
|
||||
*/
|
||||
public boolean isToBeAdded() {
|
||||
return toBeAdded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the to be added.
|
||||
*
|
||||
* @param toBeAdded the new to be added
|
||||
*/
|
||||
public void setToBeAdded(boolean toBeAdded) {
|
||||
this.toBeAdded = toBeAdded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mime type.
|
||||
*
|
||||
* @return the mime type
|
||||
*/
|
||||
public String getMimeType() {
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the mime type.
|
||||
*
|
||||
* @param mimeType the new mime type
|
||||
*/
|
||||
public void setMimeType(String mimeType) {
|
||||
this.mimeType = mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the url.
|
||||
*
|
||||
* @return the url
|
||||
*/
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the url.
|
||||
*
|
||||
* @param url the new url
|
||||
*/
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the description.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the description.
|
||||
*
|
||||
* @param description the new description
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the organization name dataset parent.
|
||||
*
|
||||
* @return the organization name dataset parent
|
||||
*/
|
||||
public String getOrganizationNameDatasetParent() {
|
||||
return organizationNameDatasetParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the organization name dataset parent.
|
||||
*
|
||||
* @param organizationNameDatasetParent the new organization name dataset parent
|
||||
*/
|
||||
public void setOrganizationNameDatasetParent(
|
||||
String organizationNameDatasetParent) {
|
||||
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is folder.
|
||||
*
|
||||
* @return true, if is folder
|
||||
*/
|
||||
public boolean isFolder() {
|
||||
return isFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the folder.
|
||||
*
|
||||
* @param isFolder the new folder
|
||||
*/
|
||||
public void setFolder(boolean 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() {
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the full path.
|
||||
*
|
||||
* @param fullPath the new full path
|
||||
*/
|
||||
public void setFullPath(String fullPath) {
|
||||
this.fullPath = fullPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the original id in workspace.
|
||||
*
|
||||
* @return the original id in workspace
|
||||
*/
|
||||
public String getOriginalIdInWorkspace() {
|
||||
return originalIdInWorkspace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the original id in workspace.
|
||||
*
|
||||
* @param originalIdInWorkspace the new original id in workspace
|
||||
*/
|
||||
public void setOriginalIdInWorkspace(String originalIdInWorkspace) {
|
||||
this.originalIdInWorkspace = originalIdInWorkspace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the editable name.
|
||||
*
|
||||
* @return the editable name
|
||||
*/
|
||||
public String getEditableName() {
|
||||
return editableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the editable name.
|
||||
*
|
||||
* @param newName the new editable name
|
||||
*/
|
||||
public void setEditableName(String 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
|
||||
public boolean equals(Object o) {
|
||||
boolean toReturn = false;
|
||||
|
@ -230,23 +412,54 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare to.
|
||||
*
|
||||
* @param o the o
|
||||
* @return the int
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(ResourceElementBean o) {
|
||||
int toReturn = (o == null || o.fullPath == null) ? -1 : -o.fullPath.compareTo(fullPath);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResourceElementBean [identifierGWT=" + identifierGWT
|
||||
+ ", name=" + name + ", editableName=" + editableName
|
||||
+ ", toBeAdded=" + toBeAdded + ", isFolder=" + isFolder
|
||||
+ ", fullPath=" + fullPath + ", originalIdInWorkspace="
|
||||
+ originalIdInWorkspace + ", mimeType=" + mimeType + ", url="
|
||||
+ url + ", description=" + description
|
||||
+ ", organizationNameDatasetParent="
|
||||
+ organizationNameDatasetParent + ", parent=" + parent
|
||||
+ ", children number=" + (children == null ? 0 : children.size()) + "]";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ResourceElementBean [name=");
|
||||
builder.append(name);
|
||||
builder.append(", editableName=");
|
||||
builder.append(editableName);
|
||||
builder.append(", toBeAdded=");
|
||||
builder.append(toBeAdded);
|
||||
builder.append(", isFolder=");
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,17 +6,24 @@
|
|||
<!-- Other module inherits -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<!-- Responsive design -->
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<set-property name="bootstrap.responsiveDesign"
|
||||
value="true" />
|
||||
<inherits
|
||||
name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
|
||||
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON'/>
|
||||
<inherits
|
||||
name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanMetadataPublisher' />
|
||||
|
|
|
@ -93,7 +93,7 @@ public class TestPublishingWidget {
|
|||
|
||||
if(folderId != null && !folderId.isEmpty()){
|
||||
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){
|
||||
LOG.error("Error while building bean into dev mode", e);
|
||||
|
|
Loading…
Reference in New Issue