diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 4e4a3ad..a5c7673 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,9 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/pom.xml b/pom.xml
index 0723b3c..2a552a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,10 +31,10 @@
- 2.8.2
+ 2.7.0
- 1.8
+ 1.7
1.8
UTF-8
@@ -48,13 +48,6 @@
pom
import
-
- com.google.gwt
- gwt
- ${gwtVersion}
- pom
- import
-
@@ -69,17 +62,17 @@
com.github.gwtbootstrap
gwt-bootstrap
+
+ org.gcube.portlets.widgets
+ switch-button-widget
+ [1.0.0, 2.0.0-SNAPSHOT)
+ compile
+
org.gcube.data.publishing
ckan2zenodo-library
[0.0.1-SNAPSHOT, 1.0.0-SNAPSHOT)
-
- org.gcube.portlets.widgets
- switch-button-widget
- [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
- compile
-
com.liferay.portal
portal-service
@@ -162,6 +155,7 @@
org.apache.maven.plugins
maven-assembly-plugin
+ 2.2
descriptor.xml
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/CkanToZenodoPublisher.gwt.xml b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/CkanToZenodoPublisher.gwt.xml
index c8c742b..5bb72a3 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/CkanToZenodoPublisher.gwt.xml
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/CkanToZenodoPublisher.gwt.xml
@@ -8,11 +8,9 @@
+
-
-
-
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/CkanToZendoPublisherWidget.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/CkanToZendoPublisherWidget.java
index 8a37c67..c7aff7e 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/CkanToZendoPublisherWidget.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/CkanToZendoPublisherWidget.java
@@ -29,23 +29,17 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
*/
public class CkanToZendoPublisherWidget {
- private final CkanToZenodoPublisherServiceAsync ckanToZenodoService = CkanToZenodoPublisherServiceAsync.Util
- .getInstance();
+ private CkanToZenodoPublisherServiceAsync ckanToZenodoService;
private Button buttonPublish = new Button("Publish on Zenodo");
private Ckan2ZenodoViewManager manager = null;
- /**
- * Instantiates a new ckan to zendo publisher widget.
- */
- public CkanToZendoPublisherWidget() {
+
+ public CkanToZendoPublisherWidget() {
+ ckanToZenodoService = CkanToZenodoPublisherServiceAsync.Util.getInstance();
}
- /**
- * Publish on zenodo.
- *
- * @param item the item
- */
+
public void publishOnZenodo(final CatalogueItem item) {
final Modal modal = new Modal(true);
@@ -145,27 +139,4 @@ public class CkanToZendoPublisherWidget {
modal.show();
}
- /**
- * Submit publish on zenodo.
- */
- private void submitPublishOnZenodo() {
-
- ZenodoItem zenodoItem = manager.getZenodoItemFromFieldsForm();
-
- GWT.log("Publishing file: "+zenodoItem.getFiles());
-
- ckanToZenodoService.publishOnZenodo(zenodoItem, new AsyncCallback() {
-
- @Override
- public void onFailure(Throwable caught) {
- Window.alert(caught.getMessage());
- }
-
- @Override
- public void onSuccess(String result) {
- Window.alert(result);
- }
- });
- }
-
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/CkanToZenodoPublisher.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/CkanToZenodoPublisher.java
index aeee526..22adb1b 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/CkanToZenodoPublisher.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/CkanToZenodoPublisher.java
@@ -1,29 +1,29 @@
-package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
-
-import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
-
-/**
- * Entry point classes define onModuleLoad()
.
- */
-public class CkanToZenodoPublisher implements EntryPoint {
- /**
- * The message displayed to the user when the server cannot be reached or
- * returns an error.
- */
- private static final String SERVER_ERROR = "An error occurred while "
- + "attempting to contact the server. Please check your network "
- + "connection and try again.";
-
- /**
- * Create a remote service proxy to talk to the server-side Greeting service.
- */
- private final CkanToZenodoPublisherServiceAsync greetingService = GWT.create(CkanToZenodoPublisherService.class);
-
- /**
- * This is the entry point method.
- */
- public void onModuleLoad() {
-
- }
-}
+//package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
+//
+//import com.google.gwt.core.client.EntryPoint;
+//import com.google.gwt.core.client.GWT;
+//
+///**
+// * Entry point classes define onModuleLoad()
.
+// */
+//public class CkanToZenodoPublisher implements EntryPoint {
+// /**
+// * The message displayed to the user when the server cannot be reached or
+// * returns an error.
+// */
+// private static final String SERVER_ERROR = "An error occurred while "
+// + "attempting to contact the server. Please check your network "
+// + "connection and try again.";
+//
+// /**
+// * Create a remote service proxy to talk to the server-side Greeting service.
+// */
+// private final CkanToZenodoPublisherServiceAsync greetingService = GWT.create(CkanToZenodoPublisherService.class);
+//
+// /**
+// * This is the entry point method.
+// */
+// public void onModuleLoad() {
+//
+// }
+//}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorView.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorView.java
index 71fa2ef..14e25ed 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorView.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorView.java
@@ -1,9 +1,17 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.authors;
+import java.util.Arrays;
+
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.events.RemoveCreatorEvent;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.utils.InfoTextAndLabels;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FieldUtil;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ControlGroup;
+import com.github.gwtbootstrap.client.ui.ControlLabel;
+import com.github.gwtbootstrap.client.ui.Controls;
+import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -12,13 +20,30 @@ import com.google.gwt.event.shared.HandlerManager;
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.HTML;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
+/**
+ * The Class CreatorView.
+ *
+ * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
+ *
+ * Jan 15, 2020
+ */
public class CreatorView extends Composite {
private static CreatorViewUiBinder uiBinder = GWT.create(CreatorViewUiBinder.class);
+ /**
+ * The Interface CreatorViewUiBinder.
+ *
+ * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
+ *
+ * Jan 15, 2020
+ */
interface CreatorViewUiBinder extends UiBinder {
}
@@ -36,17 +61,66 @@ public class CreatorView extends Composite {
@UiField
ControlGroup cg_authors;
+
+ @UiField
+ ListBox field_author_type;
+
+ @UiField
+ HorizontalPanel controls_author_type;
+
+ @UiField
+ ControlLabel field_cl_author;
+
private HandlerManager eventBus;
-
- public CreatorView() {
- initWidget(uiBinder.createAndBindUi(this));
- }
- public CreatorView(final HandlerManager eventBus) {
- this();
+ private String userRole; //Can be: Creator, Contributor etc..
+
+ private ZenodoAuthor author;
+
+ /**
+ * Instantiates a new creator view.
+ *
+ * @param author the author
+ * @param userRole the user role
+ */
+ public CreatorView(ZenodoAuthor author, String userRole) {
+ initWidget(uiBinder.createAndBindUi(this));
+ this.userRole = userRole;
+ this.author = author;
+
+ if(this.userRole!=null) {
+ field_cl_author.add(new HTML("* "+userRole));
+ }else { //default role is Author
+ field_cl_author.add(new HTML("* Author"));
+ }
+
+ if(this.author!=null) {
+ setField_name(InfoTextAndLabels.validValue(author.getName()));
+ setField_affiliation(InfoTextAndLabels.validValue(author.getAffiliation()));
+ setField_orcid(InfoTextAndLabels.validValue(author.getOrcid()));
+
+ if(this.author.getType()!=null) {
+ controls_author_type.setVisible(true);
+ FieldUtil.addValuesToListBox(field_author_type, this.author.getType().getSelectableValues());
+ FieldUtil.selectValueToListBox(field_author_type, Arrays.asList(this.author.getType().getSelectedValues().get(0)));
+ }
+ }
+ }
+
+
+ /**
+ * Instantiates a new creator view.
+ *
+ * @param author the author
+ * @param userRole the user role
+ * @param eventBus the event bus
+ */
+ public CreatorView(ZenodoAuthor author, String userRole, HandlerManager eventBus) {
+ this(author, userRole);
this.eventBus = eventBus;
+
remove_author.addClickHandler(new ClickHandler() {
@Override
@@ -66,32 +140,85 @@ public class CreatorView extends Composite {
remove_author.setVisible(visible);
}
+ /**
+ * Gets the field name.
+ *
+ * @return the field name
+ */
public TextBox getField_name() {
return field_name;
}
+ /**
+ * Sets the field name.
+ *
+ * @param field_name the new field name
+ */
public void setField_name(String field_name) {
this.field_name.setValue(field_name);
}
+ /**
+ * Gets the field affiliation.
+ *
+ * @return the field affiliation
+ */
public TextBox getField_affiliation() {
return field_affiliation;
}
+ /**
+ * Sets the field affiliation.
+ *
+ * @param field_affiliation the new field affiliation
+ */
public void setField_affiliation(String field_affiliation) {
this.field_affiliation.setValue(field_affiliation);
}
+ /**
+ * Gets the field orcid.
+ *
+ * @return the field orcid
+ */
public TextBox getField_orcid() {
return field_orcid;
}
+ /**
+ * Sets the field orcid.
+ *
+ * @param field_orcid the new field orcid
+ */
public void setField_orcid(String field_orcid) {
this.field_orcid.setValue(field_orcid);
}
+ /**
+ * Gets the control group author.
+ *
+ * @return the control group author
+ */
public ControlGroup getControlGroup_Author() {
return cg_authors;
}
+
+ /**
+ * Gets the user role.
+ *
+ * @return the user role
+ */
+ public String getUserRole() {
+ return userRole;
+ }
+
+ /**
+ * Gets the author.
+ *
+ * @return the author
+ */
+ public ZenodoAuthor getAuthor() {
+ return author;
+ }
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorView.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorView.ui.xml
index 6a66678..7636901 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorView.ui.xml
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorView.ui.xml
@@ -6,22 +6,32 @@
.important {
font-weight: bold;
}
+ .custom-width{
+ width: 625px !important;
+ }
-
- *
- Author
+
-
+
-
+
+
+
+
+
+
+
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorsFormView.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorsFormView.java
index b539e06..61287df 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorsFormView.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/authors/CreatorsFormView.java
@@ -8,6 +8,9 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.client.events.RemoveCreat
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.utils.InfoTextAndLabels;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FieldUtil;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCreator;
import com.github.gwtbootstrap.client.ui.Button;
@@ -55,13 +58,21 @@ public class CreatorsFormView extends Composite implements FormValidator{
private List listCreatorView;
+ private String userRole;
+
+ private List extends ZenodoAuthor> listAuthors;
+
+ private SerializableEnum contributorTypeValues;
+
+
/**
* Instantiates a new creators form view.
*
- * @param listCreators the list creators
+ * @param listAuthors the list authors
*/
- public CreatorsFormView(List listCreators) {
+ public CreatorsFormView(List extends ZenodoAuthor> listAuthors) {
initWidget(uiBinder.createAndBindUi(this));
+ this.listAuthors = listAuthors;
button_add_author.addClickHandler(new ClickHandler() {
@@ -85,27 +96,37 @@ public class CreatorsFormView extends Composite implements FormValidator{
}
});
- addCreatorsToView(listCreators);
+ addAuthorsToView();
}
-
+
/**
- * Adds the creators to view.
- * @param listCreators
+ * Adds the authors to view.
*/
- private void addCreatorsToView(List listCreators) {
+ private void addAuthorsToView() {
+
if(listCreatorView==null)
listCreatorView = new ArrayList();
- if(listCreators!=null && listCreators.size()>0) {
- for (ZenodoCreator creator : listCreators) {
- CreatorView view = new CreatorView(eventBus);
- view.setField_name(InfoTextAndLabels.validValue(creator.getName()));
- view.setField_affiliation(InfoTextAndLabels.validValue(creator.getAffiliation()));
- view.setField_orcid(InfoTextAndLabels.validValue(creator.getOrcid()));
+ if(listAuthors!=null && listAuthors.size()>0) {
+ userRole = "Author";
+
+ for (ZenodoAuthor creator : listAuthors) {
+ GWT.log("author is "+creator.getClass());
+ if (creator instanceof ZenodoContributor) {
+ GWT.log("author is a ZenodoContributor");
+ userRole = "Contributor";
+ contributorTypeValues = creator.getType();
+ }else if(creator instanceof ZenodoCreator) {
+ userRole = "Creator";
+ }
+ CreatorView view = new CreatorView(creator, userRole, eventBus);
listCreatorView.add(view);
fieldset_authors.add(view);
}
+
+ button_add_author.setText("Add another "+userRole);
+
setRemovableCreators();
}else {
//ADDING EMPTY CREATOR
@@ -113,16 +134,31 @@ public class CreatorsFormView extends Composite implements FormValidator{
}
}
+ /**
+ * Gets the list creator view.
+ *
+ * @return the list creator view
+ */
public List getListCreatorView() {
return listCreatorView;
}
+ /**
+ * Adds the empty creator.
+ */
private void addEmptyCreator() {
if(listCreatorView==null)
listCreatorView = new ArrayList();
- CreatorView view = new CreatorView(eventBus);
+ ZenodoAuthor author = null;
+ if(userRole.compareToIgnoreCase("Contributor")==0) {
+ author = new ZenodoContributor();
+ ((ZenodoContributor) author).setType(contributorTypeValues);
+ }
+
+
+ CreatorView view = new CreatorView(author, userRole, eventBus);
listCreatorView.add(view);
fieldset_authors.add(view);
@@ -130,6 +166,9 @@ public class CreatorsFormView extends Composite implements FormValidator{
}
+ /**
+ * Sets the removable creators.
+ */
private void setRemovableCreators() {
for (int i=0; i
*/
- public List readListOfCreatorsFromView(){
- List listCreators = new ArrayList(listCreatorView.size());
+ public List extends ZenodoAuthor> readListOfCreatorsFromView(){
+
+ List listAuthors = new ArrayList<>(listCreatorView.size());
+
for (CreatorView creatorView : listCreatorView) {
- listCreators.add(new ZenodoCreator(creatorView.getField_name().getValue(), creatorView.getField_affiliation().getValue(), creatorView.getField_affiliation().getValue(), null));
+ ZenodoAuthor author = creatorView.getAuthor();
+ author.setName(creatorView.getField_name().getValue());
+ author.setAffiliation(creatorView.getField_affiliation().getValue());
+ author.setOrcid(creatorView.getField_orcid().getValue());
+ listAuthors.add(author);
}
- return listCreators;
+ return listAuthors;
}
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator#isValidForm()
+ */
@Override
public boolean isValidForm() {
return validateFormFields()==null;
}
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator#validateFormFields()
+ */
@Override
public String validateFormFields() {
@@ -171,7 +222,7 @@ public class CreatorsFormView extends Composite implements FormValidator{
boolean isValid = FieldUtil.isValidValue(value);
if(!isValid) {
FieldUtil.setControlGroup(cgAuthor, ControlGroupType.ERROR);
- return "The Author Name is required";
+ return "The Name is required";
}
/*
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/basicinformation/BasicInformationView.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/basicinformation/BasicInformationView.java
index 4042c36..69fd331 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/basicinformation/BasicInformationView.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/basicinformation/BasicInformationView.java
@@ -2,12 +2,15 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.basicinformati
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.authors.CreatorsFormView;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.tags.TagsPanel;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FieldUtil;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCreator;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoMetadata;
@@ -36,7 +39,8 @@ public class BasicInformationView extends Composite implements FormValidator {
/** The ui binder. */
private static BasicInformationViewUiBinder uiBinder = GWT.create(BasicInformationViewUiBinder.class);
- private CreatorsFormView creatorsView;
+ private List listOfCreatorsView;
+ private List listOfContributorsView;
/**
* The Interface CreateTaskConfigurationViewUiBinder.
@@ -88,6 +92,8 @@ public class BasicInformationView extends Composite implements FormValidator {
private ZenodoItem zenodoItem;
+
+
/**
* Because this class has a default constructor, it can be used as a binder
* template. In other words, it can be used in other *.ui.xml files as follows:
@@ -167,27 +173,27 @@ public class BasicInformationView extends Composite implements FormValidator {
//Upload type
if(zMeta.getUpload_type()!=null) {
- addValuesToListBox(field_upload_type, zMeta.getUpload_type().getSelectableValues());
- selectValueToListBox(field_upload_type, zMeta.getUpload_type().getSelectedValues());
+ FieldUtil.addValuesToListBox(field_upload_type, zMeta.getUpload_type().getSelectableValues());
+ FieldUtil.selectValueToListBox(field_upload_type, zMeta.getUpload_type().getSelectedValues());
}else
field_upload_type.setEnabled(false);
//Publication Type
if(zMeta.getPublication_type()!=null) {
- addValuesToListBox(field_publication_type, zMeta.getPublication_type().getSelectableValues());
- selectValueToListBox(field_publication_type, zMeta.getPublication_type().getSelectedValues());
+ FieldUtil.addValuesToListBox(field_publication_type, zMeta.getPublication_type().getSelectableValues());
+ FieldUtil.selectValueToListBox(field_publication_type, zMeta.getPublication_type().getSelectedValues());
}else
field_publication_type.setEnabled(false);
if(zMeta.getAccess_right()!=null) {
- addValuesToListBox(field_access_right, zMeta.getAccess_right().getSelectableValues());
- selectValueToListBox(field_access_right, zMeta.getAccess_right().getSelectedValues());
+ FieldUtil.addValuesToListBox(field_access_right, zMeta.getAccess_right().getSelectableValues());
+ FieldUtil.selectValueToListBox(field_access_right, zMeta.getAccess_right().getSelectedValues());
}else
field_access_right.setEnabled(false);
if(zMeta.getLicense()!=null) {
- addValuesToListBox(field_license, Arrays.asList(zMeta.getLicense().getId()));
- selectValueToListBox(field_license, Arrays.asList(zMeta.getLicense().getId()));
+ FieldUtil.addValuesToListBox(field_license, Arrays.asList(zMeta.getLicense().getId()));
+ FieldUtil.selectValueToListBox(field_license, Arrays.asList(zMeta.getLicense().getId()));
}
field_license.setEnabled(false); //because is not changeable
@@ -196,10 +202,28 @@ public class BasicInformationView extends Composite implements FormValidator {
the_tags_panel.addTagElement(keyword);
}
}
+
+ if(listOfCreatorsView==null)
+ listOfCreatorsView = new ArrayList();
+
+ if(listOfContributorsView==null)
+ listOfContributorsView = new ArrayList();
// ADDING AUTHORS
- creatorsView = new CreatorsFormView(zenodoItem.getMetadata().getCreators());
- fieldset_basic_informations.add(creatorsView);
+ CreatorsFormView authorView = new CreatorsFormView(zenodoItem.getMetadata().getCreators());
+ listOfCreatorsView.add(authorView);
+
+ CreatorsFormView contributorView = new CreatorsFormView(zenodoItem.getMetadata().getContributors());
+ listOfContributorsView.add(contributorView);
+
+ for (CreatorsFormView cfv : listOfCreatorsView) {
+ fieldset_basic_informations.add(cfv);
+ }
+
+ for (CreatorsFormView cfv : listOfContributorsView) {
+ fieldset_basic_informations.add(cfv);
+ }
+
}
// if(zenodoItem.getFiles()!=null) {
@@ -210,43 +234,43 @@ public class BasicInformationView extends Composite implements FormValidator {
// }
}
- /**
- * Adds the values to list box.
- *
- * @param list the list
- * @param listValues the list values
- */
- private void addValuesToListBox(ListBox list, List listValues) {
- if (listValues == null)
- return;
-
- for (int i = 0; i < listValues.size(); i++) {
- list.addItem(listValues.get(i), listValues.get(i));
- }
- }
-
- /**
- * Select value to list box.
- *
- * @param list the list
- * @param values the values
- */
- private void selectValueToListBox(ListBox list, List values) {
- GWT.log("Selecting value: "+values);
- String selectValue = null;
- if (values == null || values.isEmpty()) {
- selectValue = null;
- } else {
- selectValue = values.get(0);
- }
-
- try {
- if (list.getItemCount() > 0)
- list.setSelectedValue(selectValue);
- } catch (Exception e) {
- GWT.log("error: " + e);
- }
- }
+// /**
+// * Adds the values to list box.
+// *
+// * @param list the list
+// * @param listValues the list values
+// */
+// private void addValuesToListBox(ListBox list, List listValues) {
+// if (listValues == null)
+// return;
+//
+// for (int i = 0; i < listValues.size(); i++) {
+// list.addItem(listValues.get(i), listValues.get(i));
+// }
+// }
+//
+// /**
+// * Select value to list box.
+// *
+// * @param list the list
+// * @param values the values
+// */
+// private void selectValueToListBox(ListBox list, List values) {
+// GWT.log("Selecting value: "+values);
+// String selectValue = null;
+// if (values == null || values.isEmpty()) {
+// selectValue = null;
+// } else {
+// selectValue = values.get(0);
+// }
+//
+// try {
+// if (list.getItemCount() > 0)
+// list.setSelectedValue(selectValue);
+// } catch (Exception e) {
+// GWT.log("error: " + e);
+// }
+// }
// private void addFileForPublishing(ZenodoFile file) {
// PublishFileView pv = new PublishFileView();
@@ -367,16 +391,26 @@ public class BasicInformationView extends Composite implements FormValidator {
}
}
- //Validating Authors
- if(creatorsView!=null) {
- String error = creatorsView.validateFormFields();
+ //Validating Creators
+ for (CreatorsFormView cfv : listOfCreatorsView) {
+ String error = cfv.validateFormFields();
if(error!=null) {
error_alert.setVisible(true);
error_alert.setText(error);
return error;
}
}
-
+
+ //Validating Contributors
+ for (CreatorsFormView cfv : listOfContributorsView) {
+ String error = cfv.validateFormFields();
+ if(error!=null) {
+ error_alert.setVisible(true);
+ error_alert.setText(error);
+ return error;
+ }
+ }
+
return null;
}
@@ -401,60 +435,152 @@ public class BasicInformationView extends Composite implements FormValidator {
return box.getText();
}
- public CreatorsFormView getCreatorsView() {
- return creatorsView;
+ /**
+ * Gets the list of contributors view.
+ *
+ * @return the list of contributors view
+ */
+ public List getListOfContributorsView() {
+ return listOfContributorsView;
+ }
+
+ /**
+ * Gets the list of creators view.
+ *
+ * @return the list of creators view
+ */
+ public List getListOfCreatorsView() {
+ return listOfCreatorsView;
+ }
+
+ /**
+ * Gets the list of authors.
+ *
+ * @return the list of authors
+ */
+ public List getListOfCreators() {
+ List listOfCreators = new ArrayList<>();
+ for (CreatorsFormView cfv : listOfCreatorsView) {
+ List extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView();
+ for (ZenodoAuthor zenodoAuthor : listOfUsers) {
+ listOfCreators.add((ZenodoCreator) zenodoAuthor);
+ }
+ }
+ return listOfCreators;
}
/**
- * Gets the list of creators.
+ * Gets the list of contributors.
*
- * @return the list of creators
+ * @return the list of contributors
*/
- public List getListOfCreators() {
- return creatorsView.readListOfCreatorsFromView();
+ public List getListOfContributors() {
+ List listOfContributors = new ArrayList<>();
+ for (CreatorsFormView cfv : listOfContributorsView) {
+ List extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView();
+ for (ZenodoAuthor zenodoAuthor : listOfUsers) {
+ listOfContributors.add((ZenodoContributor) zenodoAuthor);
+ }
+ }
+ return listOfContributors;
}
+ /**
+ * Gets the field title.
+ *
+ * @return the field title
+ */
public TextBox getField_title() {
return field_title;
}
+ /**
+ * Gets the field doi.
+ *
+ * @return the field doi
+ */
public TextBox getField_doi() {
return field_doi;
}
+ /**
+ * Gets the fieldset basic informations.
+ *
+ * @return the fieldset basic informations
+ */
public Fieldset getFieldset_basic_informations() {
return fieldset_basic_informations;
}
+ /**
+ * Gets the field description.
+ *
+ * @return the field description
+ */
public TextArea getField_description() {
return field_description;
}
+ /**
+ * Gets the field upload type.
+ *
+ * @return the field upload type
+ */
public ListBox getField_upload_type() {
return field_upload_type;
}
+ /**
+ * Gets the field access right.
+ *
+ * @return the field access right
+ */
public ListBox getField_access_right() {
return field_access_right;
}
+ /**
+ * Gets the field license.
+ *
+ * @return the field license
+ */
public ListBox getField_license() {
return field_license;
}
+ /**
+ * Gets the field publication type.
+ *
+ * @return the field publication type
+ */
public ListBox getField_publication_type() {
return field_publication_type;
}
+ /**
+ * Gets the field publication date.
+ *
+ * @return the field publication date
+ */
public DateBox getField_publication_date() {
return field_publication_date;
}
+ /**
+ * Gets the error alert.
+ *
+ * @return the error alert
+ */
public Alert getError_alert() {
return error_alert;
}
+ /**
+ * Gets the tags.
+ *
+ * @return the tags
+ */
public List getTags() {
return the_tags_panel.getTags();
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/publishfile/PublishFileView.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/publishfile/PublishFileView.java
index 8ef1bd3..928d9ed 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/publishfile/PublishFileView.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/publishfile/PublishFileView.java
@@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.publishfile;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
import org.gcube.portlets.widgets.switchbutton.client.SwitchButton;
+import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
@@ -28,6 +29,9 @@ public class PublishFileView extends Composite {
@UiField
TextBox field_file_name;
+
+ @UiField
+ Label field_label_info;
private ZenodoFile file;
@@ -77,6 +81,23 @@ public class PublishFileView extends Composite {
return switchButton;
}
+
+ /**
+ * Hide switch button.
+ *
+ * @param bool the bool
+ * @param msg the msg
+ */
+ public void hideSwitchButton(boolean bool, String msg) {
+ if(bool) {
+ switchButton.setVisible(false);
+ }else {
+ switchButton.setVisible(true);
+ }
+
+ field_label_info.setText(msg);
+ }
+
/**
* Gets the field file name.
*
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/publishfile/PublishFileView.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/publishfile/PublishFileView.ui.xml
index 3f9d6ad..43e81f3 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/publishfile/PublishFileView.ui.xml
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/ui/publishfile/PublishFileView.ui.xml
@@ -25,7 +25,7 @@
- Publish
+ Publish
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/Ckan2ZenodoViewManager.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/Ckan2ZenodoViewManager.java
index 632894b..5ea8176 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/Ckan2ZenodoViewManager.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/Ckan2ZenodoViewManager.java
@@ -5,9 +5,10 @@ import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
-import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.authors.CreatorView;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.basicinformation.BasicInformationView;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCreator;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
@@ -121,8 +122,12 @@ public class Ckan2ZenodoViewManager {
ZenodoMetadata meta = zenodoItem.getMetadata();
meta.setDescription(basicForm.getField_description().getValue());
meta.setKeywords(basicForm.getTags()); // these are the keywords
+
List creators = basicForm.getListOfCreators();
meta.setCreators(creators);
+
+ List contributors = basicForm.getListOfContributors();
+ meta.setContributors(contributors);
// upload type
String uploadType = basicForm.getField_upload_type().getSelectedValue();
@@ -143,7 +148,7 @@ public class Ckan2ZenodoViewManager {
// Updating list of file for publishing
List publishingFile = getListFileToPublish();
- zenodoItem.setFiles(publishingFile);
+ zenodoItem.addFiles(publishingFile);
return zenodoItem;
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/FieldUtil.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/FieldUtil.java
index 83d439f..a215bea 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/FieldUtil.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/FieldUtil.java
@@ -1,6 +1,9 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.client.view;
+import java.util.List;
+
import com.github.gwtbootstrap.client.ui.ControlGroup;
+import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
import com.google.gwt.core.client.GWT;
@@ -72,4 +75,45 @@ public class FieldUtil {
return box.getText();
}
+
+ /**
+ * Adds the values to list box.
+ *
+ * @param list the list
+ * @param listValues the list values
+ */
+ public static void addValuesToListBox(ListBox list, List listValues) {
+ if (listValues == null)
+ return;
+
+ for (int i = 0; i < listValues.size(); i++) {
+ list.addItem(listValues.get(i), listValues.get(i));
+ }
+ }
+
+
+ /**
+ * Select value to list box.
+ *
+ * @param list the list
+ * @param values the values
+ */
+ public static void selectValueToListBox(ListBox list, List values) {
+ GWT.log("Selecting value: "+values);
+ String selectValue = null;
+ if (values == null || values.isEmpty()) {
+ selectValue = null;
+ } else {
+ selectValue = values.get(0);
+ }
+
+ try {
+ if (list.getItemCount() > 0)
+ list.setSelectedValue(selectValue);
+ } catch (Exception e) {
+ GWT.log("error: " + e);
+ }
+ }
+
+
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/PublishFileViewManager.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/PublishFileViewManager.java
index 512d140..699ad2c 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/PublishFileViewManager.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/client/view/PublishFileViewManager.java
@@ -35,6 +35,10 @@ public class PublishFileViewManager {
PublishFileView pv = new PublishFileView(file);
pv.getField_file_name().setValue(file.getFilename());
pv.getSwitchButton().setValue(true);
+
+ if(file.getIsAlreadyPublished()) {
+ pv.hideSwitchButton(true, "File already published on Zenodo");
+ }
return pv;
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/server/CkanToZenodoPublisherServiceImpl.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/server/CkanToZenodoPublisherServiceImpl.java
index 7f0c465..71a9729 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/server/CkanToZenodoPublisherServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/server/CkanToZenodoPublisherServiceImpl.java
@@ -1,9 +1,13 @@
package org.gcube.portlets.widgets.ckan2zenodopublisher.server;
-import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.gcube.data.publishing.ckan2zenodo.Ckan2Zenodo;
+import org.gcube.data.publishing.ckan2zenodo.Ckan2ZenodoImpl;
import org.gcube.data.publishing.ckan2zenodo.model.CkanItemDescriptor;
import org.gcube.data.publishing.ckan2zenodo.model.CkanResource;
import org.gcube.data.publishing.ckan2zenodo.model.faults.ConfigurationException;
@@ -12,7 +16,6 @@ import org.gcube.data.publishing.ckan2zenodo.model.faults.InvalidItemException;
import org.gcube.data.publishing.ckan2zenodo.model.faults.TransformationException;
import org.gcube.data.publishing.ckan2zenodo.model.faults.ZenodoException;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata;
-import org.gcube.data.publishing.ckan2zenodo.model.zenodo.FileDeposition;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZendoPublisherWidgetConstant;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService;
@@ -29,6 +32,10 @@ import com.liferay.portal.service.UserLocalServiceUtil;
/**
* The server side implementation of the RPC service.
+ *
+ * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
+ *
+ * Jan 15, 2020
*/
@SuppressWarnings("serial")
public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet implements CkanToZenodoPublisherService {
@@ -36,6 +43,9 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
private static Logger LOG = LoggerFactory.getLogger(CkanToZenodoPublisherServiceImpl.class);
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService#publishOnZenodo(org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem)
+ */
@Override
public String publishOnZenodo(ZenodoItem zenodoItem) throws Exception {
@@ -46,48 +56,61 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
PortalUtils.getCurrentToken(this.getThreadLocalRequest(), true);
}
- ZenodoDeposition zdPreview=loadItemPreviewFromService(zenodoItem.getName());
-
- //(EVENTUALLY) UPDATING INFO CHANGED BY FORM ON CLIENT-SIDE
+ ZenodoDeposition zenodoDepositionPreview=loadItemPreviewFromService(zenodoItem.getName());
+ //(EVENTUALLY) UPDATING BASIC INFO CHANGED BY FORM ON CLIENT-SIDE
//Basic info
- zdPreview.setTitle(zenodoItem.getTitle());
- //Files
- if(zenodoItem.getFiles()!=null) {
- ArrayList listOfFiles = new ArrayList(zenodoItem.getFiles().size());
- for (ZenodoFile zf : zenodoItem.getFiles()) {
- FileDeposition fileDepos = ItemToZenodoConverter.toServiceFileDeposition(zf);
- listOfFiles.add(fileDepos);
- }
- zdPreview.setFiles(listOfFiles);
- }
+ zenodoDepositionPreview.setTitle(zenodoItem.getTitle());
//Updating Deposition Metadata potentially changed on client-side
ZenodoMetadata metadata = zenodoItem.getMetadata();
- DepositionMetadata depositionMetadata = zdPreview.getMetadata();
+ DepositionMetadata depositionMetadata = zenodoDepositionPreview.getMetadata();
depositionMetadata = ItemToZenodoConverter.updateMetadataInfoOfDepositionMetadata(metadata, depositionMetadata);
- zdPreview.setMetadata(depositionMetadata);
+ zenodoDepositionPreview.setMetadata(depositionMetadata);
- //Ckan2ZenodoImpl.publish(item.getItemName());
- //Eventually update values
- //zdPreview.getMetadata().setAccess_conditions("Ask me");
+ //Loading Filtered resources according to VRE policies
+ List filteredResources = loadFilterResources(zenodoItem.getName());
+
+ HashSet toUpload = new HashSet();
+ //Adding for publishing only the resources selected on clien-side
+ if(zenodoItem.getFiles()!=null) {
+ for (ZenodoFile zf : zenodoItem.getFiles()) {
+ for (CkanResource ckanResource : filteredResources) {
+ if(zf.getId().compareTo(ckanResource.getId())==0 && zf.getIsAlreadyPublished()==false) {
+ toUpload.add(ckanResource);
+ }
+ }
+ }
+ }
+
//Actually publish to zenodo :
// Step 1 : metadata
-// Ckan2Zenodo client= Ckan2Zenodo.get();
-// CkanItemDescriptor item=client.read(zenodoItem.getName());
-// zdPreview = client.updatedMetadata(zdPreview);
+ Ckan2Zenodo client= new Ckan2ZenodoImpl();
+ zenodoDepositionPreview = client.updatedMetadata(zenodoDepositionPreview);
//Step 2 : publish Resources
-// Future future_Dep=client.uploadFiles(Collections.singleton(toFilter.get(0)), zdPreview);
-// ZenodoDeposition preview = future_Dep.get();
-
- //Finalize
+ if(toUpload.size()>0) {
+ LOG.debug("Trying to publish the set of CKAN resources: "+toUpload.toString());
+ Future future_Dep=client.uploadFiles(toUpload, zenodoDepositionPreview);
+ while(!future_Dep.isDone()) {
+ LOG.debug("Waiting for completed future computation (publishing of resources on Zenodo)...");
+ Thread.sleep(2000);
+ }
+ zenodoDepositionPreview = future_Dep.get(180,TimeUnit.SECONDS);
+ }
// Get the item representation
+ CkanItemDescriptor item=client.read(zenodoItem.getName());
+
+ //Finalize
+ client.publish(zenodoDepositionPreview, item);
+ return zenodoDepositionPreview.toString();
+
+ }catch (TimeoutException e) {
+ String error = "I'm waiting too time for publishing on Zenodo the catalogue item: "+zenodoItem.getName()+". Check by yourself the result later";
+ LOG.error(error, e);
+ String clientError = String.format("%s", error);
+ throw new Exception(clientError);
- //client.publish(zdPreview, item);
-
- return zdPreview.toString();
-
} catch (Exception e) {
String error = "Error when publishing on Zenodo the catalogue item: "+zenodoItem.getName();
LOG.error(error, e);
@@ -97,6 +120,9 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
}
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService#convertToZenodoItem(org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem)
+ */
@Override
public ZenodoItem convertToZenodoItem(CatalogueItem item) throws Exception {
@@ -109,12 +135,18 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
//Get a preview of the deposition to be published
ZenodoDeposition zdPreview=loadItemPreviewFromService(item.getItemName());
-
- //Filter resources according to VRE policies
- //List toFilterFiles=client.filterResources(itemDescr);
- //zdPreview.setFiles(toFilterFiles);
+ //Loading Filtered resources according to VRE policies
+ List filteredResources = loadFilterResources(item.getItemName());
+ LOG.debug("Loaded filtered resources: "+filteredResources);
+
+ //Converting ZenodoDeposition to ZenodoItem
ZenodoItem zenodoItem = ItemToZenodoConverter.toZenodoItem(zdPreview);
+
+ //Adding the filtered resources
+ List resources = ItemToZenodoConverter.toZenodoFiles(filteredResources, false);
+ zenodoItem.addFiles(resources);
+
zenodoItem.setName(item.getItemName());
LOG.debug("Returning item: "+zenodoItem);
return zenodoItem;
@@ -152,31 +184,45 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
* Load item preview from service.
*
* @param itemName the item name
- * @return
- * @throws GcatException
- * @throws TransformationException
- * @throws ConfigurationException
- * @throws ZenodoException
- * @throws InvalidItemException
+ * @return the zenodo deposition
+ * @throws GcatException the gcat exception
+ * @throws InvalidItemException the invalid item exception
+ * @throws ZenodoException the zenodo exception
+ * @throws ConfigurationException the configuration exception
+ * @throws TransformationException the transformation exception
*/
private ZenodoDeposition loadItemPreviewFromService(String itemName) throws GcatException, InvalidItemException, ZenodoException, ConfigurationException, TransformationException {
- Ckan2Zenodo client= Ckan2Zenodo.get();
-
+ Ckan2Zenodo client= new Ckan2ZenodoImpl();
// Get the item representation
CkanItemDescriptor itemDescr=client.read(itemName);
-
//Get a preview of the deposition to be published
- ZenodoDeposition zenodoDeposition = client.translate(itemDescr);
+ return client.translate(itemDescr);
+
+ }
+
+
+ /**
+ * Load filter resources.
+ *
+ * @param itemName the item name
+ * @return the list
+ * @throws GcatException the gcat exception
+ * @throws ConfigurationException the configuration exception
+ * @throws TransformationException the transformation exception
+ */
+ private List loadFilterResources(String itemName) throws GcatException, ConfigurationException, TransformationException {
+ Ckan2Zenodo client= new Ckan2ZenodoImpl();
+ // Get the item representation
+ CkanItemDescriptor itemDescr=client.read(itemName);
//Filter resources according to VRE policies
- List toFilter=client.filterResources(itemDescr);
-
- return zenodoDeposition;
+ return client.filterResources(itemDescr);
}
/**
- * Online or in development mode?
+ * Online or in development mode?.
+ *
* @return true if you're running into the portal, false if in development
*/
private boolean isOutFromPortal() {
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/server/converter/ItemToZenodoConverter.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/server/converter/ItemToZenodoConverter.java
index 77d5534..564aa11 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/server/converter/ItemToZenodoConverter.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/server/converter/ItemToZenodoConverter.java
@@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter;
import java.util.ArrayList;
import java.util.List;
+import org.gcube.data.publishing.ckan2zenodo.model.CkanResource;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Community;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Contributor;
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Creator;
@@ -72,13 +73,9 @@ public class ItemToZenodoConverter {
zi.setDoi(zenodoDeposition.getDoi());
zi.setCreated(zenodoDeposition.getCreated());
- if(zenodoDeposition.getFiles()!=null) {
- List listOfFiles = new ArrayList(zenodoDeposition.getFiles().size());
- for (FileDeposition fileDeposition : zenodoDeposition.getFiles()) {
- listOfFiles.add(toZenodoFile(fileDeposition));
- }
- zi.setFiles(listOfFiles);
- }
+ //Add files already published in the deposition
+ List files = toZenodoFiles(zenodoDeposition.getFiles(),true);
+ zi.addFiles(files);
zi.setModified(zenodoDeposition.getModified());
zi.setOwner(zenodoDeposition.getOwner());
@@ -95,13 +92,56 @@ public class ItemToZenodoConverter {
return zi;
}
+
+ /**
+ * Adds the files.
+ *
+ * @param files the files
+ * @param filesAlreadyPublished the files already published
+ * @return the list
+ */
+ private static List toZenodoFiles(ArrayList files, boolean filesAlreadyPublished) {
+
+ if(files==null)
+ return null;
+
+ List listOfFiles = new ArrayList(files.size());
+ for (FileDeposition fileDeposition : files) {
+ listOfFiles.add(toZenodoFile(fileDeposition, filesAlreadyPublished));
+ }
+
+ return listOfFiles;
+ }
+
+ /**
+ * To zenodo files.
+ *
+ * @param filteredResources the filtered resources
+ * @param filesAlreadyPublished the files already published
+ * @return the list
+ */
+ public static List toZenodoFiles(List filteredResources, boolean filesAlreadyPublished) {
+ if(filteredResources==null)
+ return null;
+
+ List listOfFiles = new ArrayList(filteredResources.size());
+ for (CkanResource ckanResource : filteredResources) {
+ listOfFiles.add(toZenodoFile(ckanResource,filesAlreadyPublished));
+ }
+
+ return listOfFiles;
+ }
+
+
+
/**
* To zenodo file.
*
* @param fileDeposition the file deposition
+ * @param fileAlreadyPublished the file already published
* @return the zenodo file
*/
- public static ZenodoFile toZenodoFile(FileDeposition fileDeposition) {
+ public static ZenodoFile toZenodoFile(FileDeposition fileDeposition, boolean fileAlreadyPublished) {
if(fileDeposition==null)
return null;
@@ -109,11 +149,38 @@ public class ItemToZenodoConverter {
ZenodoFile zf = new ZenodoFile();
zf.setId(fileDeposition.getId());
zf.setFilename(fileDeposition.getFilename());
- zf.setFilesize(fileDeposition.getFilesize());
+ zf.setFilesize(fileDeposition.getFilesize()+"");
zf.setChecksum(fileDeposition.getChecksum());
+ zf.setIsAlreadyPublished(fileAlreadyPublished);
return zf;
}
+
+ /**
+ * To zenodo file.
+ *
+ * @param ckanResource the ckan resource
+ * @param fileAlreadyPublished the file already published
+ * @return the zenodo file
+ */
+ public static ZenodoFile toZenodoFile(CkanResource ckanResource, boolean fileAlreadyPublished) {
+
+ if(ckanResource==null)
+ return null;
+
+ ZenodoFile zf = new ZenodoFile();
+ zf.setId(ckanResource.getId());
+ zf.setFilename(ckanResource.getName());
+ zf.setFilesize(ckanResource.getSize());
+ zf.setChecksum(null);
+ zf.setMimeType(ckanResource.getMimetype());
+ zf.setFormat(ckanResource.getFormat());
+ zf.setDescription(ckanResource.getDescription());
+ zf.setIsAlreadyPublished(fileAlreadyPublished);
+ return zf;
+ }
+
+
/**
* To zenodo metadata.
*
@@ -303,7 +370,7 @@ public class ItemToZenodoConverter {
List list = new ArrayList(creators.size());
for (Creator contr : creators) {
- ZenodoContributor zc = new ZenodoContributor();
+ ZenodoCreator zc = new ZenodoCreator();
zc.setAffiliation(contr.getAffiliation());
zc.setGnd(contr.getGnd());
zc.setName(contr.getName());
@@ -315,102 +382,6 @@ public class ItemToZenodoConverter {
}
-// /**
-// * **
-// *
-// *
-// * TO SERVICE.
-// *
-// * @param zenodoItem the zenodo item
-// * @param zenodoDeposition the zenodo deposition
-// * @return the zenodo deposition
-// */
-//
-// /**
-// * To service zenodo deposition.
-// *
-// * @param zenodoItem the zenodo item
-// */
-// public static ZenodoDeposition toServiceZenodoDeposition(ZenodoItem zenodoItem, ZenodoDeposition zenodoDeposition) {
-//
-// if(zenodoItem==null)
-// return zenodoDeposition;
-//
-// //zenodoDeposition.setId(zenodoItem.getId());
-// //zenodoDeposition.setDoi(zenodoItem.getDoi());
-// //zenodoDeposition.setCreated(zenodoItem.getCreated());
-//
-// zenodoDeposition.setTitle(zenodoItem.getTitle());
-//
-// if(zenodoItem.getFiles()!=null) {
-// ArrayList listOfFiles = new ArrayList(zenodoItem.getFiles().size());
-// for (ZenodoFile zf : zenodoItem.getFiles()) {
-// listOfFiles.add(toServiceZenodoDeposition(zf));
-// }
-// zenodoDeposition.setFiles(listOfFiles);
-// }
-//
-// //zenodoDeposition.setModified(zenodoItem.getModified());
-// //zenodoDeposition.setOwner(zenodoItem.getOwner());
-// //zenodoDeposition.setRecord_id(zenodoItem.getRecord_id());
-//// try {
-//// zenodoDeposition.setRecord_url(zenodoItem.getRecord_url()!=null?new URL(zenodoItem.getRecord_url()):null);
-//// } catch (MalformedURLException e) {
-//// LOG.warn(e.getMessage());
-//// }
-//
-//// zenodoDeposition.setState(zenodoItem.getState());
-//// zenodoDeposition.setSubmitted(zenodoItem.getSubmitted());
-// //zenodoDeposition.setMetadata(toServiceZenodoMetadata(zenodoItem.getMetadata(),zenodoDeposition.getMetadata()));
-//
-// return zenodoDeposition;
-//
-// }
-//
-
-// /**
-// * To service zenodo metadata.
-// *
-// * @param zenodoMetadata the zenodo metadata
-// * @param depositionMetadata the deposition metadata
-// * @return the deposition metadata
-// */
-// public static DepositionMetadata toServiceZenodoMetadata(ZenodoMetadata zenodoMetadata, DepositionMetadata depositionMetadata){
-//
-// if(zenodoMetadata==null)
-// return null;
-//
-// depositionMetadata.setAccess_conditions(depositionMetadata.getAccess_conditions());
-// depositionMetadata.setDescription(depositionMetadata.getDescription());
-//
-// if(depositionMetadata.getAccess_right()!=null) {
-// AccessRights[] ar = { depositionMetadata.getAccess_right() };
-// SerializableEnum sEnum = CkanToZenodoUtil.toSerializableEnum(ar, AccessRights.values());
-// depositionMetadata.setAccess_right(sEnum);
-// }
-//
-// depositionMetadata.setCommunities(toZenodoCommunities(depositionMetadata.getCommunities()));
-// depositionMetadata.setConference_acronym(depositionMetadata.getConference_acronym());
-// depositionMetadata.setConference_dates(depositionMetadata.getConference_dates());
-// depositionMetadata.setConference_place(depositionMetadata.getConference_place());
-// depositionMetadata.setConference_session(depositionMetadata.getConference_session());
-// depositionMetadata.setConference_session_part(depositionMetadata.getConference_session_part());
-// depositionMetadata.setConference_title(depositionMetadata.getConference_title());
-// depositionMetadata.setConference_url(depositionMetadata.getConference_url());
-// depositionMetadata.setContributors(toZenodoContributors(depositionMetadata.getContributors()));
-// depositionMetadata.setCreators(toZenodoCreators(depositionMetadata.getCreators()));
-// depositionMetadata.setDates(toZenodDateIntervals(depositionMetadata.getDates()));
-// depositionMetadata.setRelated_identifiers(toRelatedIdentifiers(depositionMetadata.getRelated_identifiers()));
-// depositionMetadata.setSubjects(toZenodoSubjects(depositionMetadata.getSubjects()));
-// depositionMetadata.setThesis_supervisors(toZenodoCreators(depositionMetadata.getThesis_supervisors()));
-// depositionMetadata.setThesis_university(depositionMetadata.getThesis_university());
-// depositionMetadata.setTitle(depositionMetadata.getTitle());
-// depositionMetadata.setVersion(depositionMetadata.getVersion());
-// return zm;
-// }
-
-
-
/**
* To service file deposition.
*
@@ -425,7 +396,11 @@ public class ItemToZenodoConverter {
FileDeposition fileDep = new FileDeposition();
fileDep.setId(zenodoFile.getId());
fileDep.setFilename(zenodoFile.getFilename());
- fileDep.setFilesize(zenodoFile.getFilesize());
+ try {
+ fileDep.setFilesize(Integer.parseInt(zenodoFile.getFilesize()));
+ }catch (Exception e) {
+ // TODO: handle exception
+ }
fileDep.setChecksum(zenodoFile.getChecksum());
return fileDep;
}
@@ -472,4 +447,6 @@ public class ItemToZenodoConverter {
return depositionMetadata;
}
+
+
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoAuthor.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoAuthor.java
new file mode 100644
index 0000000..c0f1001
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoAuthor.java
@@ -0,0 +1,70 @@
+package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
+
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
+
+/**
+ * The Interface ZenodoAuthor.
+ *
+ * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
+ *
+ * Jan 15, 2020
+ */
+public interface ZenodoAuthor {
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName();
+
+ /**
+ * Gets the affiliation.
+ *
+ * @return the affiliation
+ */
+ public String getAffiliation();
+
+ /**
+ * Gets the orcid.
+ *
+ * @return the orcid
+ */
+ public String getOrcid();
+
+ /**
+ * Gets the gnd.
+ *
+ * @return the gnd
+ */
+ public String getGnd();
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public SerializableEnum getType();
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name);
+
+ /**
+ * Sets the affiliation.
+ *
+ * @param affiliation the new affiliation
+ */
+ public void setAffiliation(String affiliation);
+
+ /**
+ * Sets the orcid.
+ *
+ * @param orcid the new orcid
+ */
+ public void setOrcid(String orcid);
+
+}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoContributor.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoContributor.java
index 1746daf..efb4b5f 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoContributor.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoContributor.java
@@ -8,7 +8,7 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
- * Dec 10, 2019
+ * Jan 15, 2020
*/
public class ZenodoContributor extends ZenodoCreator{
@@ -39,11 +39,19 @@ public class ZenodoContributor extends ZenodoCreator{
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCreator#getType()
+ */
public SerializableEnum getType() {
return type;
}
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
public void setType(SerializableEnum type) {
this.type = type;
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoCreator.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoCreator.java
index 884c9d5..58e930d 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoCreator.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoCreator.java
@@ -2,14 +2,17 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
import java.io.Serializable;
+import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
+
+
/**
* The Class ZenodoCreator.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
- * Dec 10, 2019
+ * Jan 15, 2020
*/
-public class ZenodoCreator implements Serializable{
+public class ZenodoCreator implements ZenodoAuthor, Serializable{
/**
@@ -21,9 +24,20 @@ public class ZenodoCreator implements Serializable{
private String orcid;
private String gnd;
+ /**
+ * Instantiates a new zenodo creator.
+ */
public ZenodoCreator(){}
+ /**
+ * Instantiates a new zenodo creator.
+ *
+ * @param name the name
+ * @param affiliation the affiliation
+ * @param orcid the orcid
+ * @param gnd the gnd
+ */
public ZenodoCreator(String name, String affiliation, String orcid, String gnd) {
super();
this.name = name;
@@ -34,38 +48,81 @@ public class ZenodoCreator implements Serializable{
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor#getName()
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
public void setName(String name) {
this.name = name;
}
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor#getAffiliation()
+ */
public String getAffiliation() {
return affiliation;
}
+ /**
+ * Sets the affiliation.
+ *
+ * @param affiliation the new affiliation
+ */
public void setAffiliation(String affiliation) {
this.affiliation = affiliation;
}
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor#getOrcid()
+ */
public String getOrcid() {
return orcid;
}
+ /**
+ * Sets the orcid.
+ *
+ * @param orcid the new orcid
+ */
public void setOrcid(String orcid) {
this.orcid = orcid;
}
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor#getGnd()
+ */
public String getGnd() {
return gnd;
}
+ /**
+ * Sets the gnd.
+ *
+ * @param gnd the new gnd
+ */
public void setGnd(String gnd) {
this.gnd = gnd;
}
+
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor#getType()
+ */
+ @Override
+ public SerializableEnum getType() {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoFile.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoFile.java
index 2908bac..69f653b 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoFile.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoFile.java
@@ -15,19 +15,31 @@ public class ZenodoFile implements Serializable{
/**
*
*/
- private static final long serialVersionUID = -844797695117716597L;
+ private static final long serialVersionUID = 761497963654566281L;
private String id;
private String filename;
- private Integer filesize;
+ private String description;
+ private String filesize;
private String checksum;
+ private String mimeType;
+ private String format;
+
+
+ private Boolean isAlreadyPublished = false; //Used by Portlet to check if the file is already published on Zenodo
public ZenodoFile(){}
- public ZenodoFile(String id, String filename, Integer filesize, String checksum) {
+ public ZenodoFile(String id, String filename, String description, String filesize, String checksum, String mimeType,
+ String format, Boolean isAlreadyPublished) {
+ super();
this.id = id;
this.filename = filename;
+ this.description = description;
this.filesize = filesize;
this.checksum = checksum;
+ this.mimeType = mimeType;
+ this.format = format;
+ this.isAlreadyPublished = isAlreadyPublished;
}
public String getId() {
@@ -46,11 +58,19 @@ public class ZenodoFile implements Serializable{
this.filename = filename;
}
- public Integer getFilesize() {
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFilesize() {
return filesize;
}
- public void setFilesize(Integer filesize) {
+ public void setFilesize(String filesize) {
this.filesize = filesize;
}
@@ -62,6 +82,30 @@ public class ZenodoFile implements Serializable{
this.checksum = checksum;
}
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ public Boolean getIsAlreadyPublished() {
+ return isAlreadyPublished;
+ }
+
+ public void setIsAlreadyPublished(Boolean isAlreadyPublished) {
+ this.isAlreadyPublished = isAlreadyPublished;
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@@ -69,10 +113,18 @@ public class ZenodoFile implements Serializable{
builder.append(id);
builder.append(", filename=");
builder.append(filename);
+ builder.append(", description=");
+ builder.append(description);
builder.append(", filesize=");
builder.append(filesize);
builder.append(", checksum=");
builder.append(checksum);
+ builder.append(", mimeType=");
+ builder.append(mimeType);
+ builder.append(", format=");
+ builder.append(format);
+ builder.append(", isAlreadyPublished=");
+ builder.append(isAlreadyPublished);
builder.append("]");
return builder.toString();
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoItem.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoItem.java
index d217fef..fae5be1 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoItem.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoItem.java
@@ -57,12 +57,17 @@ public class ZenodoItem implements Serializable {
}
/**
- * Sets the files.
+ * Adds the files.
*
- * @param files the new files
+ * @param files the files
*/
- public void setFiles(List files) {
- this.files = files;
+ public void addFiles(List files) {
+
+ if(this.files==null) {
+ this.files = files;
+ }else {
+ this.files.addAll(files);
+ }
}
/**
@@ -272,6 +277,9 @@ public class ZenodoItem implements Serializable {
this.name = name;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
diff --git a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoMetadata.java b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoMetadata.java
index 305cb80..ec2aee7 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoMetadata.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckan2zenodopublisher/shared/wrapped/ZenodoMetadata.java
@@ -21,7 +21,11 @@ public class ZenodoMetadata implements Serializable{
private Date publication_date;
private String title;
+
private List creators;
+ private List contributors;
+ private List thesis_supervisors;
+
private String description; // TODO HTML
private SerializableEnum access_right;
@@ -35,7 +39,6 @@ public class ZenodoMetadata implements Serializable{
private List related_identifiers;
- private List contributors;
private List references;
private List communities;
private List grants;
@@ -55,7 +58,7 @@ public class ZenodoMetadata implements Serializable{
private String imprint_place;
private String partof_title;
private String partof_pages;
- private List thesis_supervisors;
+
private String thesis_university;
private List subjects;
private String version;
@@ -63,6 +66,7 @@ public class ZenodoMetadata implements Serializable{
private List locations;
private List dates;
private String method; //TODO html
+
private LicenseBean license; //TODO html
@@ -71,8 +75,6 @@ public class ZenodoMetadata implements Serializable{
public SerializableEnum getUpload_type() {
- if(upload_type==null)
- return new SerializableEnum<>();
return upload_type;
}
@@ -122,7 +124,7 @@ public class ZenodoMetadata implements Serializable{
}
- public List getCreators() {
+ public List extends ZenodoAuthor> getCreators() {
return creators;
}
@@ -222,7 +224,7 @@ public class ZenodoMetadata implements Serializable{
}
- public List getContributors() {
+ public List extends ZenodoAuthor> getContributors() {
return contributors;
}
diff --git a/src/main/resources/org/gcube/portlets/widgets/ckan2zenodopublisher/CkanToZenodoPublisher.gwt.xml b/src/main/resources/org/gcube/portlets/widgets/ckan2zenodopublisher/CkanToZenodoPublisher.gwt.xml
index c8c742b..5bb72a3 100644
--- a/src/main/resources/org/gcube/portlets/widgets/ckan2zenodopublisher/CkanToZenodoPublisher.gwt.xml
+++ b/src/main/resources/org/gcube/portlets/widgets/ckan2zenodopublisher/CkanToZenodoPublisher.gwt.xml
@@ -8,11 +8,9 @@
+
-
-
-