Resources selected from workspace are now copied just before dataset creation. Added support for new metadata reader library and types. When the act of publishing starts from ws, the resource table is always shown.
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@131303 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
43bd1566c8
commit
73c34f634c
|
@ -20,6 +20,7 @@
|
|||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="${webappDirectory}/WEB-INF/classes" path="src/main/resources">
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client;
|
|||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.CreateDatasetForm;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
|
@ -17,17 +18,19 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
public void onModuleLoad() {
|
||||
|
||||
// remove comment to the below line for testing the widget
|
||||
//startExample();
|
||||
startExample();
|
||||
|
||||
}
|
||||
|
||||
private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void startExample() {
|
||||
|
||||
String idFolderWorkspace = "d3a37eb9-1589-4c95-a9d0-c473a02d4f0f";
|
||||
String owner = "costantino.perciante";
|
||||
HandlerManager eventBus = new HandlerManager(null);
|
||||
RootPanel.get("ckan-metadata-publisher-div").add(new CreateDatasetForm(idFolderWorkspace ,owner, eventBus ));
|
||||
RootPanel.get("ckan-metadata-publisher-div").add(new CreateDatasetForm(idFolderWorkspace ,owner, eventBus));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,9 @@ public interface CKanPublisherService extends RemoteService {
|
|||
/**
|
||||
* Retrieve a partially filled bean given a folder id and its owner.
|
||||
* @param folderId
|
||||
* @param owner
|
||||
* @return @return a DatasetMetadataBean on success, <b>null</b> on error.
|
||||
*/
|
||||
DatasetMetadataBean getDatasetBean(String folderId, String owner);
|
||||
DatasetMetadataBean getDatasetBean(String folderId);
|
||||
|
||||
/**
|
||||
* Try to create such dataset starting from the information contained into the toCreate bean.
|
||||
|
@ -50,17 +49,15 @@ public interface CKanPublisherService extends RemoteService {
|
|||
* Add this resource to the dataset whose id is datasetId
|
||||
* @param resource
|
||||
* @param datasetId
|
||||
* @param owner of the dataset
|
||||
*/
|
||||
ResourceBeanWrapper addResourceToDataset(ResourceBeanWrapper resource, String datasetId, String owner);
|
||||
ResourceBeanWrapper addResourceToDataset(ResourceBeanWrapper resource, String datasetId);
|
||||
|
||||
/**
|
||||
* Delete this resource from the dataset with id datasetId
|
||||
* @param resource
|
||||
* @param datasetId
|
||||
* @param owner of the dataset
|
||||
* @return <b>true</b> on success, false otherwise
|
||||
*/
|
||||
boolean deleteResourceFromDataset(ResourceBeanWrapper resource, String owner);
|
||||
boolean deleteResourceFromDataset(ResourceBeanWrapper resource);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,10 +25,9 @@ public interface CKanPublisherServiceAsync {
|
|||
/**
|
||||
* Retrieve a partially filled bean given a folder id and its owner.
|
||||
* @param folderId
|
||||
* @param owner
|
||||
* @return @return a DatasetMetadataBean on success, <b>null</b> on error.
|
||||
*/
|
||||
void getDatasetBean(String folderId, String owner,
|
||||
void getDatasetBean(String folderId,
|
||||
AsyncCallback<DatasetMetadataBean> callback);
|
||||
|
||||
/**
|
||||
|
@ -44,20 +43,17 @@ public interface CKanPublisherServiceAsync {
|
|||
* Add this resource to the dataset whose id is datasetId
|
||||
* @param resource
|
||||
* @param datasetId
|
||||
* @param owner of the dataset
|
||||
* @param callback
|
||||
*/
|
||||
void addResourceToDataset(ResourceBeanWrapper resource, String datasetId, String owner,
|
||||
void addResourceToDataset(ResourceBeanWrapper resource, String datasetId,
|
||||
AsyncCallback<ResourceBeanWrapper> callback);
|
||||
|
||||
/**
|
||||
* Delete this resource from the dataset with id datasetId
|
||||
* @param resource
|
||||
* @param owner of the dataset
|
||||
* @return <b>true</b> on success, false otherwise
|
||||
*/
|
||||
void deleteResourceFromDataset(ResourceBeanWrapper resource,
|
||||
String owner, AsyncCallback<Boolean> callback);
|
||||
void deleteResourceFromDataset(ResourceBeanWrapper resource, AsyncCallback<Boolean> callback);
|
||||
|
||||
/**
|
||||
* Retrieve the list of profiles for a given organization name .
|
||||
|
|
|
@ -45,10 +45,6 @@ public class AddResourceToDataset extends Composite{
|
|||
// the dataset organization
|
||||
private String datasetOrg;
|
||||
|
||||
// the owner
|
||||
private String owner;
|
||||
|
||||
//Create a remote service proxy to talk to the server-side ckan service.
|
||||
private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class);
|
||||
|
||||
@UiField TextBox resourceUrlTextBox;
|
||||
|
@ -69,9 +65,6 @@ public class AddResourceToDataset extends Composite{
|
|||
|
||||
this.datasetOrg = datasetOrg;
|
||||
|
||||
// the owner of the dataset/files
|
||||
this.owner = owner;
|
||||
|
||||
goToDatasetButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -103,14 +96,13 @@ public class AddResourceToDataset extends Composite{
|
|||
null,
|
||||
true,
|
||||
null,
|
||||
owner,
|
||||
datasetOrg);
|
||||
|
||||
// disable add button
|
||||
addResourceButton.setEnabled(false);
|
||||
|
||||
// try to create
|
||||
ckanServices.addResourceToDataset(resource, datasetId, owner, new AsyncCallback<ResourceBeanWrapper>() {
|
||||
ckanServices.addResourceToDataset(resource, datasetId, new AsyncCallback<ResourceBeanWrapper>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResourceBeanWrapper result) {
|
||||
|
|
|
@ -48,20 +48,14 @@ public class AddedResourcesSummary extends Composite{
|
|||
// list of added resources (beans)
|
||||
List<ResourceBeanWrapper> addedResources;
|
||||
|
||||
// the owner
|
||||
private String owner;
|
||||
|
||||
@UiField VerticalPanel addResourcesPanel;
|
||||
|
||||
public AddedResourcesSummary(HandlerManager eventBus, String owner) {
|
||||
public AddedResourcesSummary(HandlerManager eventBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
// save bus
|
||||
this.eventBus = eventBus;
|
||||
|
||||
// save owner
|
||||
this.owner = owner;
|
||||
|
||||
// bind on add resource event
|
||||
bind();
|
||||
|
||||
|
@ -139,7 +133,7 @@ public class AddedResourcesSummary extends Composite{
|
|||
final Widget widget = addResourcesPanel.getWidget(i);
|
||||
|
||||
// remote call to remove it from the dataset
|
||||
ckanServices.deleteResourceFromDataset(toDelete, owner, new AsyncCallback<Boolean>() {
|
||||
ckanServices.deleteResourceFromDataset(toDelete, new AsyncCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
|
|
|
@ -115,12 +115,11 @@ public class CreateDatasetForm extends Composite{
|
|||
@UiField Form formSecondStep;
|
||||
@UiField Form formThirdStep;
|
||||
@UiField Button continueButton;
|
||||
@UiField Button goBackButtonFirstOrSecondStep;
|
||||
@UiField Button goBackButtonSecondStep;
|
||||
@UiField Paragraph selectedProfile;
|
||||
@UiField Button goToDatasetButton;
|
||||
@UiField Button addResourcesButton;
|
||||
@UiField CheckBox addResourcesCheckBox;
|
||||
@UiField ControlGroup resourcesControlGroup;
|
||||
@UiField SimplePanel workspaceResourcesContainer;
|
||||
@UiField Button continueThirdStep;
|
||||
@UiField Button goBackButtonFirstStep;
|
||||
|
@ -213,7 +212,7 @@ public class CreateDatasetForm extends Composite{
|
|||
}
|
||||
|
||||
/**
|
||||
* Invoked when the workspace is used.
|
||||
* Invoked when the workspace is used
|
||||
* @param idFolderWorkspace
|
||||
* @param owner
|
||||
*/
|
||||
|
@ -257,7 +256,7 @@ public class CreateDatasetForm extends Composite{
|
|||
setAlertBlock("Retrieving information, please wait...", AlertType.INFO, true);
|
||||
|
||||
// get back the licenses and the metadata information
|
||||
ckanServices.getDatasetBean(idFolderWorkspace, owner, new AsyncCallback<DatasetMetadataBean>() {
|
||||
ckanServices.getDatasetBean(idFolderWorkspace, new AsyncCallback<DatasetMetadataBean>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -313,16 +312,15 @@ public class CreateDatasetForm extends Composite{
|
|||
if(isWorkspaceRequest){
|
||||
|
||||
// enable manage resources checkbox
|
||||
resourcesControlGroup.setVisible(true);
|
||||
addResourcesCheckBox.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
|
||||
resourcesTable = new ResourcesTable(bean.getResources());
|
||||
|
||||
// if there are not resources, for now just checked it ( and hide so that the step will be skipped) TODO
|
||||
if(bean.getResources() == null || bean.getResources().isEmpty()){
|
||||
|
||||
resourcesControlGroup.setVisible(false);
|
||||
alertNoResources.setType(AlertType.WARNING);
|
||||
alertNoResources.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -605,7 +603,6 @@ public class CreateDatasetForm extends Composite{
|
|||
if(errorMsg == null){
|
||||
// check what to do
|
||||
if(isWorkspaceRequest){
|
||||
if(!addResourcesCheckBox.getValue()){
|
||||
|
||||
// we need to show the page to handle resources one by one from the workspace
|
||||
formFirstStep.setVisible(false);
|
||||
|
@ -616,12 +613,6 @@ public class CreateDatasetForm extends Composite{
|
|||
if(workspaceResourcesContainer.getWidget() == null)
|
||||
workspaceResourcesContainer.add(resourcesTable);
|
||||
|
||||
}else{
|
||||
|
||||
// resources will be added automatically and we can show the page of the profiles
|
||||
formFirstStep.setVisible(false);
|
||||
formThirdStep.setVisible(true);
|
||||
}
|
||||
}else{
|
||||
|
||||
// this is not a workspace request
|
||||
|
@ -653,11 +644,11 @@ public class CreateDatasetForm extends Composite{
|
|||
}
|
||||
|
||||
|
||||
@UiHandler("goBackButtonFirstOrSecondStep")
|
||||
@UiHandler("goBackButtonSecondStep")
|
||||
void onGoBackButton(ClickEvent e){
|
||||
|
||||
// swap forms
|
||||
if(isWorkspaceRequest && !addResourcesCheckBox.getValue()){
|
||||
if(isWorkspaceRequest){
|
||||
formFirstStep.setVisible(false);
|
||||
formSecondStep.setVisible(true);
|
||||
}else{
|
||||
|
@ -748,7 +739,7 @@ public class CreateDatasetForm extends Composite{
|
|||
|
||||
// invoke the create method
|
||||
createButton.setEnabled(false);
|
||||
goBackButtonFirstOrSecondStep.setEnabled(false);
|
||||
goBackButtonSecondStep.setEnabled(false);
|
||||
|
||||
ckanServices.createCKanDataset(receivedBean, isWorkspaceRequest, new AsyncCallback<DatasetMetadataBean>() {
|
||||
|
||||
|
@ -817,7 +808,7 @@ public class CreateDatasetForm extends Composite{
|
|||
|
||||
// tab for the added resources
|
||||
Tab addedResources = new Tab();
|
||||
addedResources.add(new AddedResourcesSummary(eventBus, owner));
|
||||
addedResources.add(new AddedResourcesSummary(eventBus));
|
||||
addedResources.setHeading("Added Resource");
|
||||
tabPanel.add(addedResources);
|
||||
|
||||
|
@ -1011,7 +1002,7 @@ public class CreateDatasetForm extends Composite{
|
|||
onCreateAlertBlock.setType(type);
|
||||
onCreateAlertBlock.setVisible(true);
|
||||
createButton.setEnabled(true);
|
||||
goBackButtonFirstOrSecondStep.setEnabled(true);
|
||||
goBackButtonSecondStep.setEnabled(true);
|
||||
|
||||
// hide after some seconds
|
||||
Timer t = new Timer() {
|
||||
|
|
|
@ -271,30 +271,6 @@
|
|||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<!-- If the user checks this box, the resources will be automatically
|
||||
added, otherwise he has to manage them -->
|
||||
<b:ControlGroup ui:field="resourcesControlGroup"
|
||||
visible="false">
|
||||
<b:ControlLabel for="resourcesAddCheckBox"
|
||||
title="Automatically add all resources to product">Product
|
||||
Resources:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:CheckBox b:id="resourcesAddCheckBox" width="60%"
|
||||
title="Automatically add the folder content to the product as resource"
|
||||
checked="true" ui:field="addResourcesCheckBox">
|
||||
<b>Add folder content as resources</b>
|
||||
</b:CheckBox>
|
||||
<span style="float:right; width:5%; color: #aaaaaa;">
|
||||
<b:Popover ui:field="popoverResources" html="true"
|
||||
animation="true" placement="LEFT">
|
||||
<g:FocusPanel ui:field="focusPanelResources">
|
||||
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconResources" />
|
||||
</g:FocusPanel>
|
||||
</b:Popover>
|
||||
</span>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<!-- Alert block on continue -->
|
||||
<b:AlertBlock animation="true" visible="false"
|
||||
ui:field="alertNoResources"
|
||||
|
@ -320,6 +296,30 @@
|
|||
<b:Legend styleName="{style.legend-style}">
|
||||
Manage Resources
|
||||
</b:Legend>
|
||||
|
||||
<!-- If the user checks this box, the resources will be automatically
|
||||
added, otherwise he has to manage them -->
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="resourcesAddCheckBox"
|
||||
title="Automatically add all resources to product">Product
|
||||
Resources:</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:CheckBox b:id="resourcesAddCheckBox" width="60%"
|
||||
title="Automatically add the folder content to the product as resource"
|
||||
checked="true" ui:field="addResourcesCheckBox">
|
||||
<b>Add folder content as resources</b>
|
||||
</b:CheckBox>
|
||||
<span style="float:right; width:5%; color: #aaaaaa;">
|
||||
<b:Popover ui:field="popoverResources" html="true"
|
||||
animation="true" placement="LEFT">
|
||||
<g:FocusPanel ui:field="focusPanelResources">
|
||||
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconResources" />
|
||||
</g:FocusPanel>
|
||||
</b:Popover>
|
||||
</span>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<g:SimplePanel ui:field="workspaceResourcesContainer"
|
||||
visible="true"></g:SimplePanel>
|
||||
|
||||
|
@ -381,7 +381,7 @@
|
|||
<b:Button title="Create product" ui:field="createButton"
|
||||
type="PRIMARY" block="true">Create</b:Button>
|
||||
|
||||
<b:Button title="Go Back" ui:field="goBackButtonFirstOrSecondStep"
|
||||
<b:Button title="Go Back" ui:field="goBackButtonSecondStep"
|
||||
block="true">Go
|
||||
Back</b:Button>
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@ import com.github.gwtbootstrap.client.ui.Controls;
|
|||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.datetimepicker.client.ui.DateTimeBox;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.SpanElement;
|
||||
|
@ -53,7 +55,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
@UiField Icon infoIcon;
|
||||
@UiField FocusPanel focusPanelIconContainer;
|
||||
|
||||
// the element that holds the value (it could be a checkbox, textbox or listbox)
|
||||
// the element that holds the value (it could be a checkbox, textbox or listbox, textarea, calendar)
|
||||
private Widget holder;
|
||||
|
||||
// the field this object represents
|
||||
|
@ -62,7 +64,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
// the dialog box for this metadata
|
||||
private GcubeDialogExtended dialog;
|
||||
|
||||
// save event bus referene
|
||||
// save event bus reference
|
||||
private HandlerManager eventBus;
|
||||
|
||||
public MetaDataFieldSkeleton(MetadataFieldWrapper field, HandlerManager eventBus) {
|
||||
|
@ -88,18 +90,47 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
if(!field.getMandatory())
|
||||
mandatorySymbol.getStyle().setDisplay(Display.NONE);
|
||||
|
||||
if(field.getIsBoolean()){
|
||||
switch(field.getType()){
|
||||
|
||||
case Boolean :
|
||||
|
||||
// its a checkbox
|
||||
holder = new CheckBox();
|
||||
|
||||
if(field.getDefaulValue() != null)
|
||||
((CheckBox)holder).setValue(Boolean.valueOf(field.getDefaulValue()));
|
||||
break;
|
||||
|
||||
// add to the elementPanel
|
||||
elementPanel.add(holder);
|
||||
case Text:
|
||||
|
||||
}else{
|
||||
holder = new TextArea();
|
||||
|
||||
if(field.getDefaulValue() != null)
|
||||
((TextArea)holder).setText(field.getDefaulValue());
|
||||
|
||||
break;
|
||||
|
||||
case Date:
|
||||
|
||||
holder = new DateTimeBox();
|
||||
|
||||
if(field.getDefaulValue() != null)
|
||||
((DateTimeBox)holder).setFormat(field.getValidator());
|
||||
else // the default one
|
||||
((DateTimeBox)holder).setFormat("yyyy/mm/dd hh:ii");
|
||||
|
||||
break;
|
||||
|
||||
case Number:
|
||||
|
||||
holder = new TextBox();
|
||||
|
||||
if(field.getDefaulValue() != null)
|
||||
((TextBox)holder).setText(field.getDefaulValue());
|
||||
|
||||
break;
|
||||
|
||||
case String:
|
||||
|
||||
// it could be a listbox or a textbox according to the vocabulary fields
|
||||
if(field.getVocabulary() == null || field.getVocabulary().isEmpty()){
|
||||
|
@ -110,10 +141,6 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
if(field.getDefaulValue() != null)
|
||||
((TextBox)holder).setText(field.getDefaulValue());
|
||||
|
||||
// add to the elementPanel
|
||||
elementPanel.add(holder);
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
// listbox
|
||||
|
@ -139,15 +166,20 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
if(field.getDefaulValue() != null)
|
||||
((ListBox)holder).setSelectedValue(field.getDefaulValue());
|
||||
|
||||
// check if multiple selection is allowed TODO
|
||||
boolean isMultipleSelection = false; //field.isMultipleSelection();
|
||||
((ListBox)holder).setMultipleSelect(isMultipleSelection);
|
||||
// check if multiple selection is allowed
|
||||
((ListBox)holder).setMultipleSelect(field.isMultiSelection());
|
||||
|
||||
// add to the elementPanel
|
||||
elementPanel.add(holder);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default: return;
|
||||
|
||||
}
|
||||
|
||||
// add to the elementPanel
|
||||
elementPanel.add(holder);
|
||||
|
||||
// set holder width
|
||||
if(holder.getClass().equals(ListBox.class))
|
||||
holder.setWidth("96%");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<!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">
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:b2="urn:import:com.github.gwtbootstrap.datetimepicker.client.ui">
|
||||
|
||||
<ui:style>
|
||||
.note-container {
|
||||
|
|
|
@ -12,10 +12,11 @@ import org.gcube.application.framework.core.session.SessionManager;
|
|||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.catalogue.WorkspaceCatalogue;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.CKanUtils;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.CkanUtilsFactory;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.models.ResourceBean;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.utils.ApplicationProfileScopePerUrlReader;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils.Utils;
|
||||
|
@ -53,8 +54,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
private static final String CKAN_LICENSES_KEY = "ckanLicenses"; // licenses
|
||||
private static final String CKAN_ORGANIZATIONS_PUBLISH_KEY = "ckanOrganizationsPublish"; // here he can publish
|
||||
private static final String CKAN_PROFILES_KEY = "ckanProfiles"; // product profiles
|
||||
private final static String CLIENT_PORTLET_URL = "currentClientUrlPortlet"; // set by the ckan portlet in session according
|
||||
// the user's current url location
|
||||
private final static String SCOPE_CLIENT_PORTLET_URL = "currentClientUrlPortletScope"; // set by the ckan portlet in session according the user's current url location
|
||||
|
||||
/**
|
||||
* Retrieve an instance of the library for the scope
|
||||
|
@ -96,7 +96,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
*/
|
||||
public String getDevelopmentUser() {
|
||||
String user = TEST_USER;
|
||||
//user = "costantino.perciante";
|
||||
user = "costantino.perciante";
|
||||
return user;
|
||||
}
|
||||
|
||||
|
@ -204,24 +204,21 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
* @return
|
||||
*/
|
||||
private String findLicenseIdByLicense(String chosenLicense) {
|
||||
return getCkanUtilsObj(null).findLicenseIdByLicense(chosenLicense);
|
||||
String scope = (String)getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL);
|
||||
return getCkanUtilsObj(scope).findLicenseIdByLicenseTitle(chosenLicense);
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO this method will be changed because the list of license can vary according the scope
|
||||
public LicensesBean getLicenses() {
|
||||
|
||||
logger.info("Request for CKAN licenses for scope ");
|
||||
|
||||
ASLSession session = getASLSession();
|
||||
String username = session.getUsername();
|
||||
logger.debug("User in session is " + username);
|
||||
|
||||
// get http session
|
||||
HttpSession httpSession = getThreadLocalRequest().getSession();
|
||||
String currentUrl = (String)httpSession.getAttribute(CLIENT_PORTLET_URL);
|
||||
String scope = (String)httpSession.getAttribute(SCOPE_CLIENT_PORTLET_URL);
|
||||
|
||||
String scope = new ApplicationProfileScopePerUrlReader().getScopePerUrl(currentUrl);
|
||||
logger.info("Request for CKAN licenses for scope " + scope);
|
||||
|
||||
// get key per scope
|
||||
String keyPerScope = Utils.concatenateSessionKeyScope(CKAN_LICENSES_KEY, scope);
|
||||
|
@ -237,7 +234,6 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
List<String> urls = new ArrayList<String>();
|
||||
for (CkanLicense license : titlesLicenses) {
|
||||
titles.add(license.getTitle());
|
||||
|
||||
String url = (license.getUrl() != null && !license.getUrl().isEmpty()) ? license.getUrl() : "";
|
||||
urls.add(url);
|
||||
}
|
||||
|
@ -250,76 +246,54 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
}
|
||||
|
||||
@Override
|
||||
public DatasetMetadataBean getDatasetBean(String folderId, String owner){
|
||||
public DatasetMetadataBean getDatasetBean(String folderId){
|
||||
|
||||
DatasetMetadataBean bean = null;
|
||||
|
||||
logger.info("DatasetBean request for " + folderId + " and " + owner);
|
||||
|
||||
ASLSession aslSession = getASLSession();
|
||||
String user = aslSession.getUsername();
|
||||
String userName = aslSession.getUsername();
|
||||
|
||||
logger.info("DatasetBean request for " + folderId + " and " + userName);
|
||||
|
||||
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
||||
String currentUrl = (String)httpSession.getAttribute(CLIENT_PORTLET_URL);
|
||||
String scope = new ApplicationProfileScopePerUrlReader().getScopePerUrl(currentUrl);
|
||||
String scope = (String)httpSession.getAttribute(SCOPE_CLIENT_PORTLET_URL);
|
||||
|
||||
logger.debug("Scope recovered from session is " + scope);
|
||||
|
||||
if(isWithinPortal()){
|
||||
try{
|
||||
|
||||
// check if session expired
|
||||
if(user.equals(TEST_USER)){
|
||||
if(userName.equals(TEST_USER)){
|
||||
logger.debug("SESSION EXPIRED");
|
||||
return null;
|
||||
}
|
||||
|
||||
logger.debug("Request dataset metadata bean for folder with id " + folderId
|
||||
+ " whose owner is " + owner);
|
||||
+ " whose owner is " + userName);
|
||||
// get usermanager (liferay)
|
||||
UserManager liferUserManager = new LiferayUserManager();
|
||||
GCubeUser userOwner = liferUserManager.getUserByUsername(owner);
|
||||
GCubeUser userOwner = liferUserManager.getUserByUsername(userName);
|
||||
|
||||
// build bean
|
||||
logger.debug("Building bean");
|
||||
bean = new DatasetMetadataBean();
|
||||
|
||||
bean.setId(folderId);
|
||||
bean.setOwnerIdentifier(owner);
|
||||
bean.setOwnerIdentifier(userName);
|
||||
bean.setVersion(1);
|
||||
bean.setAuthorName(userOwner.getFirstName());
|
||||
bean.setAuthorSurname(userOwner.getLastName());
|
||||
bean.setAuthorEmail(userOwner.getEmail());
|
||||
bean.setMaintainer(userOwner.getFullname());
|
||||
bean.setMaintainerEmail(userOwner.getEmail());
|
||||
bean.setOrganizationList(getUserOrganizationsListAdmin(owner, scope));
|
||||
bean.setOrganizationList(getUserOrganizationsListAdmin(userName, scope));
|
||||
|
||||
// if the request comes from the workspace
|
||||
if(folderId != null && !folderId.isEmpty()){
|
||||
|
||||
Workspace ws = HomeLibrary
|
||||
.getHomeManagerFactory()
|
||||
.getHomeManager()
|
||||
.getHome(owner).getWorkspace();
|
||||
handleWorkspaceResources(folderId, userName, bean);
|
||||
|
||||
WorkspaceItem retrievedItem = ws.getItem(folderId);
|
||||
|
||||
// set some info
|
||||
String onlyAlphanumeric = retrievedItem.getName().replaceAll("[^A-Za-z0-9]", "");
|
||||
bean.setTitle(onlyAlphanumeric);
|
||||
bean.setDescription(retrievedItem.getDescription());
|
||||
|
||||
// retrieve gcube items of the folder
|
||||
Map<String, String> folderItems = Utils.getGcubeItemProperties(retrievedItem);
|
||||
bean.setCustomFields(folderItems);
|
||||
|
||||
// check the resources within the folder (skip subdirectories)
|
||||
List<String> childrenIds = new ArrayList<String>();
|
||||
|
||||
for (WorkspaceItem file : retrievedItem.getChildren()) {
|
||||
if(!file.isFolder()) // ok, it's a file
|
||||
childrenIds.add(file.getId());
|
||||
}
|
||||
|
||||
List<ResourceBeanWrapper> listOfResources = Utils.getWorkspaceResourcesInformation(childrenIds, ws, user);
|
||||
bean.setResources(listOfResources);
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
|
@ -340,31 +314,13 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
bean.setAuthorEmail("costantino.perciante@isti.cnr.it");
|
||||
bean.setMaintainer("Costantino Perciante");
|
||||
bean.setMaintainerEmail("costantino.perciante@isti.cnr.it");
|
||||
bean.setOrganizationList(getUserOrganizationsListAdmin(owner, TEST_SCOPE));
|
||||
bean.setOwnerIdentifier(owner);
|
||||
bean.setOrganizationList(getUserOrganizationsListAdmin(userName, TEST_SCOPE));
|
||||
bean.setOwnerIdentifier(userName);
|
||||
|
||||
if(folderId != null && !folderId.isEmpty()){
|
||||
|
||||
Workspace ws = HomeLibrary
|
||||
.getHomeManagerFactory()
|
||||
.getHomeManager()
|
||||
.getHome(owner).getWorkspace();
|
||||
handleWorkspaceResources(folderId, userName, bean);
|
||||
|
||||
WorkspaceItem retrievedItem = ws.getItem(folderId);
|
||||
|
||||
// retrieve gcube items of the folder
|
||||
Map<String, String> folderItems = Utils.getGcubeItemProperties(retrievedItem);
|
||||
bean.setCustomFields(folderItems);
|
||||
|
||||
// check the resources within the folder (skip subdirectories)
|
||||
List<String> childrenIds = new ArrayList<String>();
|
||||
|
||||
for (WorkspaceItem file : retrievedItem.getChildren()) {
|
||||
if(!file.isFolder()) // ok, it's a file
|
||||
childrenIds.add(file.getId());
|
||||
}
|
||||
List<ResourceBeanWrapper> listOfResources = Utils.getWorkspaceResourcesInformation(childrenIds, ws, user);
|
||||
bean.setResources(listOfResources);
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
|
@ -375,19 +331,110 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param owner
|
||||
* @param bean
|
||||
* @param userName
|
||||
* @throws Exception
|
||||
*/
|
||||
private void handleWorkspaceResources(String folderId, String userName,
|
||||
DatasetMetadataBean bean) throws Exception {
|
||||
|
||||
// get workspace
|
||||
Workspace ws = HomeLibrary
|
||||
.getHomeManagerFactory()
|
||||
.getHomeManager()
|
||||
.getHome(userName).getWorkspace();
|
||||
|
||||
WorkspaceItem originalFolder = ws.getItem(folderId);
|
||||
|
||||
// set some info
|
||||
String onlyAlphanumeric = originalFolder.getName().replaceAll("[^A-Za-z0-9]", ""); // that is, remove characters different than A-Z,a-z,0-9
|
||||
bean.setTitle(onlyAlphanumeric);
|
||||
bean.setDescription(originalFolder.getDescription());
|
||||
|
||||
// Create the folder in the catalogue
|
||||
Map<String, String> folderItems = Utils.getGcubeItemProperties(originalFolder);
|
||||
bean.setCustomFields(folderItems);
|
||||
|
||||
// check the resources within the folder (skip subdirectories for now TODO)
|
||||
List<String> childrenIds = new ArrayList<String>();
|
||||
|
||||
for (WorkspaceItem file : originalFolder.getChildren()) {
|
||||
if(!file.isFolder()){
|
||||
|
||||
childrenIds.add(file.getId());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
List<ResourceBeanWrapper> listOfResources = Utils.getWorkspaceResourcesInformation(childrenIds, ws, userName);
|
||||
bean.setResources(listOfResources);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy into the .catalogue area folder the checked resources
|
||||
* @param resourcesToAdd
|
||||
* @param folderId
|
||||
* @param userName
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
private List<ResourceBean> copyResourcesToUserCatalogueArea(
|
||||
List<ResourceBeanWrapper> resourcesToAdd, String folderId, String userName, DatasetMetadataBean bean) throws Exception{
|
||||
|
||||
// in to the .catalogue area of the user's workspace
|
||||
Workspace ws = HomeLibrary
|
||||
.getHomeManagerFactory()
|
||||
.getHomeManager()
|
||||
.getHome(userName).getWorkspace();
|
||||
|
||||
WorkspaceItem originalFolder = ws.getItem(folderId);
|
||||
|
||||
// Retrieve the catalogue of the user
|
||||
WorkspaceCatalogue userCatalogue = ws.getCatalogue();
|
||||
|
||||
// Create the folder in the catalogue
|
||||
WorkspaceItem copiedFolder = userCatalogue.addWorkspaceItem(originalFolder.getPath(), null); // add to .catalogue root
|
||||
|
||||
List<ResourceBean> resources = new ArrayList<ResourceBean>();
|
||||
|
||||
// copy only the selected ones
|
||||
for(ResourceBeanWrapper resourceBeanWrapper : resourcesToAdd){
|
||||
|
||||
if (resourceBeanWrapper.isToBeAdded()) {
|
||||
|
||||
// ok it is a file, so copy it into the copiedFolder
|
||||
WorkspaceItem copiedFile = userCatalogue.addWorkspaceItem(resourceBeanWrapper.getId(), copiedFolder.getId());
|
||||
resources.add(new ResourceBean(
|
||||
copiedFile.getPublicLink(true),
|
||||
copiedFile.getName(),
|
||||
copiedFile.getDescription(),
|
||||
copiedFile.getId(),
|
||||
userName,
|
||||
null, // to be set
|
||||
((FolderItem)copiedFile).getMimeType()));
|
||||
}
|
||||
}
|
||||
|
||||
return resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetMetadataBean createCKanDataset(DatasetMetadataBean toCreate, boolean isWorkspaceRequest) {
|
||||
|
||||
logger.debug("Request for creating a dataset with these information " + toCreate);
|
||||
|
||||
ASLSession aslSession = getASLSession();
|
||||
String user = aslSession.getUsername();
|
||||
|
||||
String userName = aslSession.getUsername();
|
||||
|
||||
try{
|
||||
|
||||
// check if session expired
|
||||
if(user.equals(TEST_USER)){
|
||||
if(userName.equals(TEST_USER)){
|
||||
logger.debug("SESSION EXPIRED");
|
||||
return null;
|
||||
}
|
||||
|
@ -407,31 +454,16 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
boolean setPublic = toCreate.getVisibility();
|
||||
|
||||
// get the list of resources and convert to ResourceBean
|
||||
List<ResourceBean> resources = new ArrayList<ResourceBean>();
|
||||
List<ResourceBean> resources = null;
|
||||
List<ResourceBeanWrapper> resourcesToAdd = toCreate.getResources();
|
||||
|
||||
if(resourcesToAdd != null && !resourcesToAdd.isEmpty())
|
||||
for (ResourceBeanWrapper resourceBeanWrapper : resourcesToAdd) {
|
||||
// we need to copy such resource in the .catalogue area of the user's ws
|
||||
if(resourcesToAdd != null && !resourcesToAdd.isEmpty()){
|
||||
|
||||
if(resourceBeanWrapper.isToBeAdded()){
|
||||
resources.add(new ResourceBean(
|
||||
resourceBeanWrapper.getUrl(),
|
||||
resourceBeanWrapper.getName(),
|
||||
resourceBeanWrapper.getDescription(),
|
||||
resourceBeanWrapper.getId(),
|
||||
resourceBeanWrapper.getOwner(),
|
||||
null,
|
||||
resourceBeanWrapper.getMimeType()));
|
||||
resources = copyResourcesToUserCatalogueArea(resourcesToAdd, toCreate.getId(), userName, toCreate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// TODO this code must be checked against Auth 2.0
|
||||
// The ckan instance in which we will publish is the expressed by the organization name (scope)
|
||||
// This means that if we are in root (e.g. /gcube) and the user choose to publish into vreY
|
||||
// the ckan in which we will publish is the one in scope vreY
|
||||
logger.debug("The user wants to publish in organization with name " + organizationNameOrId + " and current scope name is " + aslSession.getScopeName());
|
||||
String scope = Utils.retrieveScopeFromOrganizationName(organizationNameOrId);
|
||||
CKanUtils utils = getCkanUtilsObj(scope);
|
||||
|
@ -447,7 +479,6 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
|
||||
// retrieve the url
|
||||
String datasetUrl = utils.getPortletUrl() + "?path=" + utils.getUrlFromDatasetIdOrName(getUserCKanTokenFromSession(scope), datasetId, true);
|
||||
|
||||
toCreate.setSource(datasetUrl);
|
||||
return toCreate;
|
||||
|
||||
|
@ -465,10 +496,14 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResourceBeanWrapper addResourceToDataset(ResourceBeanWrapper resource, String datasetId, String owner) {
|
||||
public ResourceBeanWrapper addResourceToDataset(ResourceBeanWrapper resource, String datasetId) {
|
||||
|
||||
|
||||
ASLSession session = getASLSession();
|
||||
String username = session.getUsername();
|
||||
|
||||
logger.debug("Incoming request for creating new resource for dataset with id " + datasetId + " and organization name of the dataset is " + resource.getOrganizationNameDatasetParent());
|
||||
logger.debug("Owner is " + owner + " and resource is " + resource);
|
||||
logger.debug("Owner is " + username + " and resource is " + resource);
|
||||
|
||||
if(!isWithinPortal()){
|
||||
|
||||
|
@ -477,9 +512,6 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
|
||||
}else{
|
||||
|
||||
ASLSession session = getASLSession();
|
||||
String username = session.getUsername();
|
||||
|
||||
if(username.equals(TEST_USER)){
|
||||
|
||||
logger.warn("SESSION EXPIRED! ");
|
||||
|
@ -493,7 +525,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
resource.getName(),
|
||||
resource.getDescription(),
|
||||
null,
|
||||
owner,
|
||||
username,
|
||||
datasetId,
|
||||
null);
|
||||
|
||||
|
@ -517,8 +549,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteResourceFromDataset(ResourceBeanWrapper resource,
|
||||
String owner) {
|
||||
public boolean deleteResourceFromDataset(ResourceBeanWrapper resource) {
|
||||
|
||||
logger.debug("Request for deleting resource " + resource);
|
||||
boolean deleted = false;
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataFormat;
|
|||
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataValidator;
|
||||
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataVocabulary;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.server.CKANPublisherServicesImpl;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DataType;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.MetaDataTypeWrapper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.MetadataFieldWrapper;
|
||||
|
@ -91,7 +92,6 @@ public class Utils {
|
|||
newResource.setName(item.getName());
|
||||
newResource.setToBeAdded(true); // default is true
|
||||
newResource.setMimeType(((FolderItem)item).getMimeType());
|
||||
newResource.setOwner(username);
|
||||
toReturn.add(newResource);
|
||||
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ public class Utils {
|
|||
MetadataFieldWrapper wrapperObj = new MetadataFieldWrapper();
|
||||
wrapperObj.setDefaulValue(metadataField.getDefaulValue());
|
||||
wrapperObj.setFieldName(metadataField.getFieldName());
|
||||
wrapperObj.setIsBoolean(metadataField.getIsBoolean());
|
||||
wrapperObj.setType(DataType.valueOf(metadataField.getDataType().toString()));
|
||||
wrapperObj.setMandatory(metadataField.getMandatory());
|
||||
wrapperObj.setNote(metadataField.getNote());
|
||||
|
||||
|
@ -371,6 +371,9 @@ public class Utils {
|
|||
if(vocabulary != null)
|
||||
wrapperObj.setVocabulary(vocabulary.getVocabularyFields());
|
||||
|
||||
// multi selection?
|
||||
wrapperObj.setMultiSelection(metadataField.getVocabulary().isMultiSelection());
|
||||
|
||||
// add to the list
|
||||
wrapperList.add(wrapperObj);
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared;
|
||||
|
||||
/**
|
||||
* The Enum DataType.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Sep 12, 2016
|
||||
*/
|
||||
public enum DataType {
|
||||
|
||||
String,
|
||||
Date,
|
||||
Text,
|
||||
Boolean,
|
||||
Number;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
}
|
|
@ -13,10 +13,11 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
private static final long serialVersionUID = -8476731365884466698L;
|
||||
private String fieldName;
|
||||
private Boolean mandatory = false;
|
||||
private Boolean isBoolean = false;
|
||||
private DataType type;
|
||||
private String defaulValue;
|
||||
private String note;
|
||||
private List<String> vocabulary;
|
||||
private boolean multiSelection;
|
||||
private String validator;
|
||||
|
||||
/**
|
||||
|
@ -31,20 +32,20 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
*
|
||||
* @param fieldName the field name
|
||||
* @param mandatory the mandatory
|
||||
* @param isBoolean the is boolean
|
||||
* @param DataType the type
|
||||
* @param defaulValue the defaul value
|
||||
* @param note the note
|
||||
* @param vocabulary the vocabulary
|
||||
* @param validator the validator
|
||||
*/
|
||||
public MetadataFieldWrapper(
|
||||
String fieldName, Boolean mandatory, Boolean isBoolean,
|
||||
String defaulValue, String note, List<String> vocabulary,
|
||||
String validator) {
|
||||
String fieldName, Boolean mandatory, DataType type,
|
||||
String defaulValue, String note, List<String> vocabulary,
|
||||
String validator) {
|
||||
super();
|
||||
this.fieldName = fieldName;
|
||||
this.mandatory = mandatory;
|
||||
this.isBoolean = isBoolean;
|
||||
this.type = type;
|
||||
this.defaulValue = defaulValue;
|
||||
this.note = note;
|
||||
this.vocabulary = vocabulary;
|
||||
|
@ -71,16 +72,6 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
return mandatory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the checks if is boolean.
|
||||
*
|
||||
* @return the isBoolean
|
||||
*/
|
||||
public Boolean getIsBoolean() {
|
||||
|
||||
return isBoolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the defaul value.
|
||||
*
|
||||
|
@ -141,16 +132,6 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
this.mandatory = mandatory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the checks if is boolean.
|
||||
*
|
||||
* @param isBoolean the isBoolean to set
|
||||
*/
|
||||
public void setIsBoolean(Boolean isBoolean) {
|
||||
|
||||
this.isBoolean = isBoolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the defaul value.
|
||||
*
|
||||
|
@ -191,15 +172,29 @@ public class MetadataFieldWrapper implements Serializable{
|
|||
this.validator = validator;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public DataType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(DataType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isMultiSelection() {
|
||||
return multiSelection;
|
||||
}
|
||||
|
||||
public void setMultiSelection(boolean multiSelection) {
|
||||
this.multiSelection = multiSelection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MetadataFieldWrapper [fieldName=" + fieldName + ", mandatory="
|
||||
+ mandatory + ", isBoolean=" + isBoolean + ", defaulValue="
|
||||
+ defaulValue + ", note=" + note + ", vocabulary=" + vocabulary
|
||||
+ ", validator=" + validator + "]";
|
||||
+ mandatory + ", type=" + type + ", defaulValue=" + defaulValue
|
||||
+ ", note=" + note + ", vocabulary=" + vocabulary
|
||||
+ ", multiSelection=" + multiSelection + ", validator="
|
||||
+ validator + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A dataset's resource bean
|
||||
|
@ -15,8 +16,8 @@ public class ResourceBeanWrapper implements Serializable{
|
|||
private String id;
|
||||
private boolean toBeAdded;
|
||||
private String mimeType;
|
||||
private String owner;
|
||||
private String organizationNameDatasetParent; // the organization name in which the parent dataset was created
|
||||
private List<ResourceBeanWrapper> subResources; // a list of sub resources TODO
|
||||
|
||||
public ResourceBeanWrapper(){
|
||||
super();
|
||||
|
@ -29,10 +30,9 @@ public class ResourceBeanWrapper implements Serializable{
|
|||
* @param id
|
||||
* @param toBeAdded
|
||||
* @param mimeType
|
||||
* @param owner
|
||||
*/
|
||||
public ResourceBeanWrapper(String url, String name, String description,
|
||||
String id, boolean toBeAdded, String mimeType, String owner, String organizationNameDatasetParent) {
|
||||
String id, boolean toBeAdded, String mimeType, String organizationNameDatasetParent) {
|
||||
super();
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
|
@ -40,7 +40,6 @@ public class ResourceBeanWrapper implements Serializable{
|
|||
this.id = id;
|
||||
this.toBeAdded = toBeAdded;
|
||||
this.mimeType = mimeType;
|
||||
this.owner = owner;
|
||||
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
||||
}
|
||||
|
||||
|
@ -128,20 +127,6 @@ public class ResourceBeanWrapper implements Serializable{
|
|||
this.mimeType = mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the owner
|
||||
*/
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param owner the owner to set
|
||||
*/
|
||||
public void setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the organizationNameDatasetParent
|
||||
*/
|
||||
|
@ -157,15 +142,22 @@ public class ResourceBeanWrapper implements Serializable{
|
|||
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
|
||||
public List<ResourceBeanWrapper> getSubResources() {
|
||||
return subResources;
|
||||
}
|
||||
|
||||
public void setSubResources(List<ResourceBeanWrapper> subResources) {
|
||||
this.subResources = subResources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResourceBeanWrapper [url=" + url + ", name=" + name
|
||||
+ ", description=" + description + ", id=" + id
|
||||
+ ", toBeAdded=" + toBeAdded + ", mimeType=" + mimeType
|
||||
+ ", owner=" + owner + ", organizationNameDatasetParent="
|
||||
+ organizationNameDatasetParent + "]";
|
||||
+ ", organizationNameDatasetParent="
|
||||
+ organizationNameDatasetParent + ", subResources="
|
||||
+ subResources + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
<!-- Responsive design -->
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
|
|
Loading…
Reference in New Issue