Compare commits
58 Commits
|
@ -1,9 +1,11 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.1.4] - 2023-12-21
|
||||||
|
|
||||||
|
- Fixing `publication_date` issue [#26166]
|
||||||
|
|
||||||
|
## [v1.1.3] - 2023-07-25
|
||||||
|
|
||||||
|
- Fixing `null` issue, recompiling this component [#25275]
|
||||||
|
|
||||||
|
## [v1.1.2] - 2022-10-27
|
||||||
|
|
||||||
|
**Enhancements**
|
||||||
|
|
||||||
|
- [#24038] Moved to GWT 2.9.0
|
||||||
|
- Moved to maven-portal-bom 3.6.4
|
||||||
|
|
||||||
|
## [v1.1.0] - 2021-10-05
|
||||||
|
|
||||||
|
**New Features**
|
||||||
|
[#19988] Integrated with `checkEnvironment` reporting the status of "Upload to Zenodo" facility
|
||||||
|
Moved to `maven-portal-bom` 3.6.3
|
||||||
|
|
||||||
|
## [v1.0.2] - 2021-04-26
|
||||||
|
|
||||||
|
**Bug fixes**
|
||||||
|
[#21263] manage empty mapping for creators/contributors
|
||||||
|
|
||||||
|
**Enhancements**
|
||||||
|
[#21153] ported to maven-portal-bom 3.6.1
|
||||||
|
Improved modal height
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.0.1] - 2021-03-09
|
||||||
|
|
||||||
|
[#20935] just to include new range 1.x, 2.0 of ckan2zenodo-library
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.0.0] - 2020-08-26
|
||||||
|
|
||||||
|
#### New Features
|
||||||
|
|
||||||
|
[#19528] Ckan GUI to always allow zenodo publishing
|
||||||
|
|
||||||
|
|
||||||
|
## [v0.0.1] - 2019-12-06
|
||||||
|
|
||||||
|
[#18236] First Release
|
35
pom.xml
35
pom.xml
|
@ -7,15 +7,14 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-parent</artifactId>
|
<artifactId>maven-parent</artifactId>
|
||||||
<groupId>org.gcube.tools</groupId>
|
<groupId>org.gcube.tools</groupId>
|
||||||
<version>1.1.0</version>
|
<version>1.2.0</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>ckan2zenodo-publisher-widget</artifactId>
|
<artifactId>ckan2zenodo-publisher-widget</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>0.1.0</version>
|
<version>1.1.4</version>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
gCube Ckan2Zenodo Publisher widget allows to publish D4Science catalogue's items on Zenodo
|
gCube Ckan2Zenodo Publisher widget allows to publish D4Science catalogue's items on Zenodo
|
||||||
|
@ -31,10 +30,10 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- Convenience property to set the GWT version -->
|
||||||
<gwtVersion>2.7.0</gwtVersion>
|
<gwtVersion>2.10.0</gwtVersion>
|
||||||
|
|
||||||
<!-- GWT needs at least java 1.6 -->
|
<!-- GWT needs at least java 1.6 -->
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -44,7 +43,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>3.6.4</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -58,6 +57,18 @@
|
||||||
<version>${gwtVersion}</version>
|
<version>${gwtVersion}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-servlet</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-dev</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.gwtbootstrap</groupId>
|
<groupId>com.github.gwtbootstrap</groupId>
|
||||||
<artifactId>gwt-bootstrap</artifactId>
|
<artifactId>gwt-bootstrap</artifactId>
|
||||||
|
@ -71,7 +82,8 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.data.publishing</groupId>
|
<groupId>org.gcube.data.publishing</groupId>
|
||||||
<artifactId>ckan2zenodo-library</artifactId>
|
<artifactId>ckan2zenodo-library</artifactId>
|
||||||
<version>[0.0.1, 1.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
|
@ -118,6 +130,15 @@
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- REQUIRED FOR JDK_11 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.4</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.LoaderIcon;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.LoaderIcon;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ZenodoError;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ZenodoError;
|
||||||
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.DOI_dv;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Alert;
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
@ -30,6 +31,8 @@ import com.google.gwt.json.client.JSONParser;
|
||||||
import com.google.gwt.json.client.JSONValue;
|
import com.google.gwt.json.client.JSONValue;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
@ -97,10 +100,30 @@ public class CkanToZendoPublisherWidget {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ZenodoItem result) {
|
public void onSuccess(ZenodoItem result) {
|
||||||
|
GWT.log("Zenodo item returned is: "+result);
|
||||||
loader.setVisible(false);
|
loader.setVisible(false);
|
||||||
modal.remove(loader);
|
modal.remove(loader);
|
||||||
manager = new Ckan2ZenodoViewManager();
|
manager = new Ckan2ZenodoViewManager();
|
||||||
basicTabPanel = manager.viewForPublishing(result);
|
basicTabPanel = manager.viewForPublishing(result);
|
||||||
|
//In case of error on translating it shows an alert
|
||||||
|
GWT.log("Translate Error is: "+result.getTranslateError());
|
||||||
|
if(result.getTranslateError()!=null) {
|
||||||
|
Alert alert = new Alert(result.getTranslateError().getError());
|
||||||
|
alert.setClose(true);
|
||||||
|
switch (result.getTranslateError().getErrorType()) {
|
||||||
|
case INFO:
|
||||||
|
alert.setType(AlertType.INFO);
|
||||||
|
break;
|
||||||
|
case WARN:
|
||||||
|
alert.setType(AlertType.WARNING);
|
||||||
|
break;
|
||||||
|
case ERROR:
|
||||||
|
default:
|
||||||
|
alert.setType(AlertType.ERROR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
modal.add(alert);
|
||||||
|
}
|
||||||
modal.add(basicTabPanel);
|
modal.add(basicTabPanel);
|
||||||
buttonPublish.setEnabled(true);
|
buttonPublish.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +167,7 @@ public class CkanToZendoPublisherWidget {
|
||||||
//Submit publish on zenodo.
|
//Submit publish on zenodo.
|
||||||
ZenodoItem zenodoItem = manager.getZenodoItemFromFieldsForm();
|
ZenodoItem zenodoItem = manager.getZenodoItemFromFieldsForm();
|
||||||
GWT.log("Publishing file: "+zenodoItem.getFiles());
|
GWT.log("Publishing file: "+zenodoItem.getFiles());
|
||||||
ckanToZenodoService.publishOnZenodo(zenodoItem, new AsyncCallback<String>() {
|
ckanToZenodoService.publishOnZenodo(zenodoItem, new AsyncCallback<DOI_dv>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -160,7 +183,7 @@ public class CkanToZendoPublisherWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String doi) {
|
public void onSuccess(DOI_dv doi_dv) {
|
||||||
buttonPublish.setEnabled(false);
|
buttonPublish.setEnabled(false);
|
||||||
basicTabPanel.getElement().getStyle().setOpacity(1.0);
|
basicTabPanel.getElement().getStyle().setOpacity(1.0);
|
||||||
try {
|
try {
|
||||||
|
@ -170,15 +193,27 @@ public class CkanToZendoPublisherWidget {
|
||||||
}
|
}
|
||||||
String msg = "The item has been uploaded to Zenodo correctly";
|
String msg = "The item has been uploaded to Zenodo correctly";
|
||||||
|
|
||||||
if(doi!=null)
|
|
||||||
msg+=" "+doi;
|
|
||||||
|
|
||||||
Alert infoLabel = new Alert();
|
Alert infoLabel = new Alert();
|
||||||
infoLabel.setClose(false);
|
infoLabel.setClose(false);
|
||||||
infoLabel.setType(AlertType.INFO);
|
infoLabel.setType(AlertType.INFO);
|
||||||
infoLabel.setText(msg);
|
infoLabel.setText(msg);
|
||||||
|
|
||||||
showResults(Arrays.asList(infoLabel.asWidget()));
|
Modal modal = new Modal(true, true);
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
modal.setTitle("Item uploaded to Zenodo!");
|
||||||
|
modal.add(infoLabel);
|
||||||
|
if(doi_dv!=null) {
|
||||||
|
FlowPanel dF = new FlowPanel();
|
||||||
|
dF.add(new HTML("DOI: "+doi_dv.getDoi()));
|
||||||
|
FlowPanel dFU = new FlowPanel();
|
||||||
|
dFU.add(new HTML("DOI URL: <a href='"+doi_dv.getDoi_url()+"' target='_blank'>"+doi_dv.getDoi_url()+"</a>"));
|
||||||
|
modal.add(dF);
|
||||||
|
modal.add(dFU);
|
||||||
|
}
|
||||||
|
|
||||||
|
modal.show();
|
||||||
|
|
||||||
|
//showResults(Arrays.asList(infoLabel.asWidget()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -221,14 +256,18 @@ public class CkanToZendoPublisherWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONValue theMessage = theErrorJSON.get("message");
|
JSONValue theMessage = theErrorJSON.get("message");
|
||||||
return "Error reported from Zenodo: " + theMessage.toString();
|
String theErrors = null;
|
||||||
|
try {
|
||||||
|
JSONValue theError = theErrorJSON.get("errors");
|
||||||
|
theErrors = theError.toString();
|
||||||
|
}catch (Exception e) {
|
||||||
|
//silent
|
||||||
|
}
|
||||||
|
String toReport = "Message reported from Zenodo: " + theMessage.toString();
|
||||||
|
if(theErrors!=null)
|
||||||
|
toReport+= " Errors: "+theErrors;
|
||||||
|
|
||||||
// //GWT.log("array: "+array.toString());
|
return toReport;
|
||||||
// JSONObject theErrorValue = (JSONObject) array.get(0);
|
|
||||||
// //GWT.log("theErrorValue: "+theErrorValue.toString());
|
|
||||||
// JSONValue theMessage = theErrorValue.get("message");
|
|
||||||
// //GWT.log("message: "+message.toString());
|
|
||||||
// return "Error reported from Zenodo: " + theMessage.toString();
|
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
return message;
|
return message;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
||||||
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.DOI_dv;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
@ -34,7 +35,7 @@ public interface CkanToZenodoPublisherService extends RemoteService {
|
||||||
* @return the DOI of published Zenodo Item
|
* @return the DOI of published Zenodo Item
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
String publishOnZenodo(ZenodoItem zenodoItem) throws Exception;
|
DOI_dv publishOnZenodo(ZenodoItem zenodoItem) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read fields descriptions.
|
* Read fields descriptions.
|
||||||
|
@ -44,4 +45,12 @@ public interface CkanToZenodoPublisherService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
Map<String, String> readFieldsDescriptions() throws Exception;
|
Map<String, String> readFieldsDescriptions() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check zenodo environment.
|
||||||
|
*
|
||||||
|
* @return the true is Zenodo environment is configured in the operating scope,
|
||||||
|
* false otherwise
|
||||||
|
*/
|
||||||
|
Boolean checkZenodoEnvironment();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
||||||
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.DOI_dv;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -33,9 +34,11 @@ public interface CkanToZenodoPublisherServiceAsync {
|
||||||
|
|
||||||
void convertToZenodoItem(CatalogueItem item, AsyncCallback<ZenodoItem> callback);
|
void convertToZenodoItem(CatalogueItem item, AsyncCallback<ZenodoItem> callback);
|
||||||
|
|
||||||
void publishOnZenodo(ZenodoItem zenodoItem, AsyncCallback<String> callback);
|
void publishOnZenodo(ZenodoItem zenodoItem, AsyncCallback<DOI_dv> callback);
|
||||||
|
|
||||||
void readFieldsDescriptions(AsyncCallback<Map<String, String>> callback);
|
void readFieldsDescriptions(AsyncCallback<Map<String, String>> callback);
|
||||||
|
|
||||||
|
void checkZenodoEnvironment(AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.authors;
|
package org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.authors;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.events.RemoveCreatorEvent;
|
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.ui.utils.InfoTextAndLabels;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FieldUtil;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FieldUtil;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
|
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;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||||
|
@ -24,6 +27,7 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class CreatorView.
|
* The Class CreatorView.
|
||||||
*
|
*
|
||||||
|
@ -76,22 +80,28 @@ public class CreatorView extends Composite {
|
||||||
|
|
||||||
private ZenodoAuthor author;
|
private ZenodoAuthor author;
|
||||||
|
|
||||||
|
private boolean isMandatoryField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new creator view.
|
* Instantiates a new creator view.
|
||||||
*
|
*
|
||||||
* @param author the author
|
* @param author the author
|
||||||
* @param userRole the user role
|
* @param userRole the user role
|
||||||
|
* @param isMandatoryField the is mandatory field
|
||||||
*/
|
*/
|
||||||
public CreatorView(ZenodoAuthor author, String userRole) {
|
public CreatorView(ZenodoAuthor author, String userRole, Boolean isMandatoryField) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
GWT.log("Creating CreatorView for author: "+author+", userRole: "+userRole);
|
||||||
this.userRole = userRole;
|
this.userRole = userRole;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
|
this.isMandatoryField = isMandatoryField == null? false:isMandatoryField;
|
||||||
|
|
||||||
|
String fieldLabel = isMandatoryField?"<font color='red'>*</font>":"";
|
||||||
if(this.userRole!=null) {
|
if(this.userRole!=null) {
|
||||||
field_cl_author.add(new HTML("<font color='red'>*</font> "+userRole));
|
field_cl_author.add(new HTML(fieldLabel+" "+userRole));
|
||||||
remove_author.setText("Remove "+userRole);
|
remove_author.setText("Remove "+userRole);
|
||||||
}else { //default role is Author
|
}else { //default role is Author
|
||||||
field_cl_author.add(new HTML("<font color='red'>*</font> Author"));
|
field_cl_author.add(new HTML(fieldLabel+" Author"));
|
||||||
remove_author.setText("Remove Author");
|
remove_author.setText("Remove Author");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,17 +113,31 @@ public class CreatorView extends Composite {
|
||||||
if(this.author.getType()!=null) {
|
if(this.author.getType()!=null) {
|
||||||
controls_author_type.setVisible(true);
|
controls_author_type.setVisible(true);
|
||||||
FieldUtil.addValuesToListBox(field_author_type, this.author.getType().getSelectableValues());
|
FieldUtil.addValuesToListBox(field_author_type, this.author.getType().getSelectableValues());
|
||||||
FieldUtil.selectValueToListBox(field_author_type, Arrays.asList(this.author.getType().getSelectedValues().get(0)));
|
|
||||||
|
List<String> listSelectedValues = this.author.getType().getSelectedValues();
|
||||||
|
|
||||||
|
if(listSelectedValues==null || listSelectedValues.isEmpty()) {
|
||||||
|
//if no type is selected (e.g. when no contributor is returned), selecting the first value of selectable values
|
||||||
|
listSelectedValues = Arrays.asList(this.author.getType().getSelectableValues().get(0));
|
||||||
|
}else
|
||||||
|
//selecting the first value of selected values
|
||||||
|
listSelectedValues = Arrays.asList(this.author.getType().getSelectedValues().get(0));
|
||||||
|
|
||||||
|
FieldUtil.selectValueToListBox(field_author_type, listSelectedValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(userRole.toLowerCase().startsWith("creator")) {
|
if(this.userRole!=null) {
|
||||||
|
String userRoleToLowerCase = userRole.toLowerCase();
|
||||||
|
|
||||||
|
if(userRoleToLowerCase.startsWith(ZenodoCreator.USER_ROLE.toLowerCase())) {
|
||||||
InfoTextAndLabels.addTooltipForFieldKey("creators", field_cl_author);
|
InfoTextAndLabels.addTooltipForFieldKey("creators", field_cl_author);
|
||||||
}else if(userRole.toLowerCase().startsWith("contributor")) {
|
}else if(userRoleToLowerCase.startsWith(ZenodoContributor.USER_ROLE.toLowerCase())) {
|
||||||
InfoTextAndLabels.addTooltipForFieldKey("contributors", field_cl_author);
|
InfoTextAndLabels.addTooltipForFieldKey("contributors", field_cl_author);
|
||||||
}else {
|
}else {
|
||||||
InfoTextAndLabels.addTooltipForFieldKey("authors", field_cl_author);
|
InfoTextAndLabels.addTooltipForFieldKey("authors", field_cl_author);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GWT.log("Created creator view with author: "+this.author);
|
GWT.log("Created creator view with author: "+this.author);
|
||||||
}
|
}
|
||||||
|
@ -125,9 +149,10 @@ public class CreatorView extends Composite {
|
||||||
* @param author the author
|
* @param author the author
|
||||||
* @param userRole the user role
|
* @param userRole the user role
|
||||||
* @param eventBus the event bus
|
* @param eventBus the event bus
|
||||||
|
* @param isFieldMandatory the is field mandatory
|
||||||
*/
|
*/
|
||||||
public CreatorView(ZenodoAuthor author, String userRole, HandlerManager eventBus) {
|
public CreatorView(ZenodoAuthor author, String userRole, HandlerManager eventBus, Boolean isFieldMandatory) {
|
||||||
this(author, userRole);
|
this(author, userRole, isFieldMandatory);
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
remove_author.addClickHandler(new ClickHandler() {
|
remove_author.addClickHandler(new ClickHandler() {
|
||||||
|
@ -149,6 +174,16 @@ public class CreatorView extends Composite {
|
||||||
remove_author.setVisible(visible);
|
remove_author.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is mandatory field.
|
||||||
|
*
|
||||||
|
* @return true, if is mandatory field
|
||||||
|
*/
|
||||||
|
public boolean isMandatoryField() {
|
||||||
|
return isMandatoryField;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the field name.
|
* Gets the field name.
|
||||||
*
|
*
|
||||||
|
@ -230,6 +265,11 @@ public class CreatorView extends Composite {
|
||||||
return author;
|
return author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the field author type.
|
||||||
|
*
|
||||||
|
* @return the field author type
|
||||||
|
*/
|
||||||
public ListBox getField_author_type() {
|
public ListBox getField_author_type() {
|
||||||
return field_author_type;
|
return field_author_type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,15 +64,20 @@ public class CreatorsFormView extends Composite implements FormValidator{
|
||||||
|
|
||||||
private SerializableEnum<String> contributorTypeValues;
|
private SerializableEnum<String> contributorTypeValues;
|
||||||
|
|
||||||
|
//Used as defaultRole in case of empty listAuthors
|
||||||
|
private Class theAuthorType;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new creators form view.
|
* Instantiates a new creators form view.
|
||||||
*
|
*
|
||||||
* @param listAuthors the list authors
|
* @param listAuthors the list authors
|
||||||
*/
|
*/
|
||||||
public CreatorsFormView(List<? extends ZenodoAuthor> listAuthors) {
|
public CreatorsFormView(List<? extends ZenodoAuthor> listAuthors, Class theAuthorType, SerializableEnum<String> contributorTypeValues) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.listAuthors = listAuthors;
|
this.listAuthors = listAuthors;
|
||||||
|
this.theAuthorType = theAuthorType;
|
||||||
|
this.contributorTypeValues = contributorTypeValues;
|
||||||
|
|
||||||
button_add_author.addClickHandler(new ClickHandler() {
|
button_add_author.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@ -105,21 +110,24 @@ public class CreatorsFormView extends Composite implements FormValidator{
|
||||||
*/
|
*/
|
||||||
private void addAuthorsToView() {
|
private void addAuthorsToView() {
|
||||||
|
|
||||||
|
GWT.log("Adding listAuthors: "+listAuthors);
|
||||||
|
|
||||||
if(listCreatorView==null)
|
if(listCreatorView==null)
|
||||||
listCreatorView = new ArrayList<CreatorView>();
|
listCreatorView = new ArrayList<CreatorView>();
|
||||||
|
|
||||||
if(listAuthors!=null && listAuthors.size()>0) {
|
if(listAuthors!=null && listAuthors.size()>0) {
|
||||||
userRole = "Author";
|
userRole = ZenodoAuthor.USER_ROLE;
|
||||||
|
|
||||||
for (ZenodoAuthor creator : listAuthors) {
|
for (ZenodoAuthor creator : listAuthors) {
|
||||||
GWT.log("Author class is "+creator.getClass());
|
GWT.log("Author class is "+creator.getClass());
|
||||||
if (creator instanceof ZenodoContributor) {
|
if (creator instanceof ZenodoContributor) {
|
||||||
userRole = "Contributor";
|
userRole = ZenodoContributor.USER_ROLE;
|
||||||
|
//overriding contributors types as defined into mapping
|
||||||
contributorTypeValues = new SerializableEnum<String>(Arrays.asList(creator.getType().getSelectableValues().get(0)), creator.getType().getSelectableValues());
|
contributorTypeValues = new SerializableEnum<String>(Arrays.asList(creator.getType().getSelectableValues().get(0)), creator.getType().getSelectableValues());
|
||||||
}else if(creator instanceof ZenodoCreator) {
|
}else if(creator instanceof ZenodoCreator) {
|
||||||
userRole = "Creator";
|
userRole = ZenodoCreator.USER_ROLE;
|
||||||
}
|
}
|
||||||
CreatorView view = new CreatorView(creator, userRole, eventBus);
|
CreatorView view = new CreatorView(creator, userRole, eventBus, true);
|
||||||
listCreatorView.add(view);
|
listCreatorView.add(view);
|
||||||
fieldset_authors.add(view);
|
fieldset_authors.add(view);
|
||||||
}
|
}
|
||||||
|
@ -146,18 +154,32 @@ public class CreatorsFormView extends Composite implements FormValidator{
|
||||||
* Adds the empty creator.
|
* Adds the empty creator.
|
||||||
*/
|
*/
|
||||||
private void addEmptyCreator() {
|
private void addEmptyCreator() {
|
||||||
|
GWT.log("adding empty creator");
|
||||||
|
|
||||||
if(listCreatorView==null)
|
if(listCreatorView==null)
|
||||||
listCreatorView = new ArrayList<CreatorView>();
|
listCreatorView = new ArrayList<CreatorView>();
|
||||||
|
|
||||||
ZenodoAuthor author = null;
|
ZenodoAuthor author = null;
|
||||||
if(userRole.compareToIgnoreCase("Contributor")==0) {
|
|
||||||
author = new ZenodoContributor();
|
|
||||||
((ZenodoContributor) author).setType(contributorTypeValues);
|
if(userRole == null) {
|
||||||
|
if (theAuthorType.equals(ZenodoCreator.class)) {
|
||||||
|
userRole = ZenodoCreator.USER_ROLE;
|
||||||
|
}else if(theAuthorType.equals(ZenodoContributor.class)) {
|
||||||
|
userRole = ZenodoContributor.USER_ROLE;
|
||||||
|
}else
|
||||||
|
userRole = ZenodoCreator.USER_ROLE;
|
||||||
|
|
||||||
|
GWT.log("Empty list assigned the userRole: "+userRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(userRole.compareToIgnoreCase(ZenodoContributor.USER_ROLE)==0) {
|
||||||
|
author = new ZenodoContributor();
|
||||||
|
((ZenodoContributor) author).setType(contributorTypeValues);
|
||||||
|
}else
|
||||||
|
author = new ZenodoCreator();
|
||||||
|
|
||||||
CreatorView view = new CreatorView(author, userRole, eventBus);
|
CreatorView view = new CreatorView(author, userRole, eventBus,false);
|
||||||
listCreatorView.add(view);
|
listCreatorView.add(view);
|
||||||
fieldset_authors.add(view);
|
fieldset_authors.add(view);
|
||||||
|
|
||||||
|
@ -185,11 +207,14 @@ public class CreatorsFormView extends Composite implements FormValidator{
|
||||||
*/
|
*/
|
||||||
public List<? extends ZenodoAuthor> readListOfCreatorsFromView(){
|
public List<? extends ZenodoAuthor> readListOfCreatorsFromView(){
|
||||||
|
|
||||||
List<ZenodoAuthor> listAuthors = new ArrayList<>(listCreatorView.size());
|
List<ZenodoAuthor> listAuthors = new ArrayList<>();
|
||||||
|
|
||||||
for (CreatorView creatorView : listCreatorView) {
|
for (CreatorView creatorView : listCreatorView) {
|
||||||
ZenodoAuthor author = creatorView.getAuthor();
|
ZenodoAuthor author = creatorView.getAuthor();
|
||||||
GWT.log("Read ZenodoAuthor: "+author);
|
GWT.log("Read ZenodoAuthor: "+author);
|
||||||
|
boolean isValid = FieldUtil.isValidValue(creatorView.getField_name().getValue());
|
||||||
|
if(isValid) {
|
||||||
|
GWT.log("The fielName is valid going to add it to list of Authors");
|
||||||
author.setName(creatorView.getField_name().getValue());
|
author.setName(creatorView.getField_name().getValue());
|
||||||
author.setAffiliation(creatorView.getField_affiliation().getValue());
|
author.setAffiliation(creatorView.getField_affiliation().getValue());
|
||||||
author.setOrcid(creatorView.getField_orcid().getValue());
|
author.setOrcid(creatorView.getField_orcid().getValue());
|
||||||
|
@ -199,8 +224,11 @@ public class CreatorsFormView extends Composite implements FormValidator{
|
||||||
}
|
}
|
||||||
|
|
||||||
listAuthors.add(author);
|
listAuthors.add(author);
|
||||||
|
}else
|
||||||
|
GWT.log("The fielName is null or empty skpping he/she from list of Authors");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GWT.log("returning list of authors: "+listAuthors);
|
||||||
return listAuthors;
|
return listAuthors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,12 +251,15 @@ public class CreatorsFormView extends Composite implements FormValidator{
|
||||||
for (CreatorView creatorView : listCreatorView) {
|
for (CreatorView creatorView : listCreatorView) {
|
||||||
ControlGroup cgAuthor = creatorView.getControlGroup_Author();
|
ControlGroup cgAuthor = creatorView.getControlGroup_Author();
|
||||||
FieldUtil.setControlGroup(cgAuthor, ControlGroupType.NONE);
|
FieldUtil.setControlGroup(cgAuthor, ControlGroupType.NONE);
|
||||||
|
|
||||||
|
if(creatorView.isMandatoryField()) {
|
||||||
String value = FieldUtil.getTextValue(creatorView.getField_name());
|
String value = FieldUtil.getTextValue(creatorView.getField_name());
|
||||||
boolean isValid = FieldUtil.isValidValue(value);
|
boolean isValid = FieldUtil.isValidValue(value);
|
||||||
if(!isValid) {
|
if(!isValid) {
|
||||||
FieldUtil.setControlGroup(cgAuthor, ControlGroupType.ERROR);
|
FieldUtil.setControlGroup(cgAuthor, ControlGroupType.ERROR);
|
||||||
return "The field "+userRole+" Name is required";
|
return "The field "+userRole+" Name is required";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
String affiliation = FieldUtil.getTextValue(creatorView.getField_affiliation());
|
String affiliation = FieldUtil.getTextValue(creatorView.getField_affiliation());
|
||||||
|
|
|
@ -259,6 +259,8 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
InfoTextAndLabels.addTooltipForFieldKey("description", cl_description);
|
InfoTextAndLabels.addTooltipForFieldKey("description", cl_description);
|
||||||
field_doi.setValue(zenodoItem.getDoi());
|
field_doi.setValue(zenodoItem.getDoi());
|
||||||
|
|
||||||
|
GWT.log("Filling form with: "+zenodoItem.getMetadata());
|
||||||
|
|
||||||
ZenodoMetadata zMeta = zenodoItem.getMetadata();
|
ZenodoMetadata zMeta = zenodoItem.getMetadata();
|
||||||
if (zMeta != null) {
|
if (zMeta != null) {
|
||||||
|
|
||||||
|
@ -327,20 +329,19 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
InfoTextAndLabels.addTooltipForFieldKey("access_conditions", cl_access_conditions);
|
InfoTextAndLabels.addTooltipForFieldKey("access_conditions", cl_access_conditions);
|
||||||
|
|
||||||
// License
|
// License
|
||||||
if (zMeta.getLicenses() != null) {
|
if (zMeta.getLicenseIDs() != null) {
|
||||||
List<String> listLicensesIds = null;
|
//List<String> listLicensesIds = null;
|
||||||
List<String> selectedLicensesId = FieldUtil.toZenodoIds(zMeta.getLicenses().getSelectedValues());
|
List<String> selectedLicensesId = FieldUtil.toZenodoIds(zMeta.getLicenseIDs());
|
||||||
if(zMeta.getLicenses().getSelectableValues()!=null) {
|
if(selectedLicensesId!=null) {
|
||||||
listLicensesIds = FieldUtil.toZenodoIds(zMeta.getLicenses().getSelectableValues());
|
FieldUtil.addValuesToListBox(field_license, selectedLicensesId);
|
||||||
FieldUtil.addValuesToListBox(field_license, listLicensesIds);
|
|
||||||
field_license.setEnabled(true);
|
field_license.setEnabled(true);
|
||||||
}else {
|
}else {
|
||||||
//Exception case on missing list of selectable license ids
|
//Exception case on missing list of selectable license ids
|
||||||
FieldUtil.addValuesToListBox(field_license, selectedLicensesId);
|
//FieldUtil.addValuesToListBox(field_license, selectedLicensesId);
|
||||||
field_license.setEnabled(false); //only one license id is available
|
field_license.setEnabled(false); //only one license id is available
|
||||||
|
|
||||||
}
|
}
|
||||||
FieldUtil.selectValueToListBox(field_license, selectedLicensesId);
|
//FieldUtil.selectValueToListBox(field_license, selectedLicensesId);
|
||||||
}else
|
}else
|
||||||
field_license.setEnabled(false);
|
field_license.setEnabled(false);
|
||||||
|
|
||||||
|
@ -360,13 +361,24 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
listOfContributorsView = new ArrayList<CreatorsFormView>();
|
listOfContributorsView = new ArrayList<CreatorsFormView>();
|
||||||
|
|
||||||
// ADDING AUTHORS
|
// ADDING AUTHORS
|
||||||
GWT.log("Adding creators: " + zenodoItem.getMetadata().getCreators());
|
try {
|
||||||
CreatorsFormView authorView = new CreatorsFormView(zenodoItem.getMetadata().getCreators());
|
List<? extends ZenodoAuthor> authors = zenodoItem.getMetadata().getCreators();
|
||||||
|
GWT.log("Adding creators: " + authors);
|
||||||
|
CreatorsFormView authorView = new CreatorsFormView(authors, ZenodoCreator.class, zenodoItem.getMetadata().getContributorsTypes());
|
||||||
listOfCreatorsView.add(authorView);
|
listOfCreatorsView.add(authorView);
|
||||||
|
}catch (Exception e) {
|
||||||
|
//silent
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
GWT.log("Adding contributors: " + zenodoItem.getMetadata().getContributors());
|
try {
|
||||||
CreatorsFormView contributorView = new CreatorsFormView(zenodoItem.getMetadata().getContributors());
|
List<? extends ZenodoAuthor> contributors = zenodoItem.getMetadata().getContributors();
|
||||||
|
GWT.log("Adding contributors: " + contributors);
|
||||||
|
CreatorsFormView contributorView = new CreatorsFormView(contributors, ZenodoContributor.class, zenodoItem.getMetadata().getContributorsTypes());
|
||||||
listOfContributorsView.add(contributorView);
|
listOfContributorsView.add(contributorView);
|
||||||
|
}catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
for (CreatorsFormView cfv : listOfCreatorsView) {
|
for (CreatorsFormView cfv : listOfCreatorsView) {
|
||||||
fieldset_basic_informations.add(cfv);
|
fieldset_basic_informations.add(cfv);
|
||||||
|
@ -543,6 +555,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
*/
|
*/
|
||||||
public List<ZenodoCreator> getListOfCreators() {
|
public List<ZenodoCreator> getListOfCreators() {
|
||||||
List<ZenodoCreator> listOfCreators = new ArrayList<>();
|
List<ZenodoCreator> listOfCreators = new ArrayList<>();
|
||||||
|
if(listOfCreatorsView==null) {
|
||||||
|
return listOfCreators;
|
||||||
|
}
|
||||||
for (CreatorsFormView cfv : listOfCreatorsView) {
|
for (CreatorsFormView cfv : listOfCreatorsView) {
|
||||||
List<? extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView();
|
List<? extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView();
|
||||||
for (ZenodoAuthor zenodoAuthor : listOfUsers) {
|
for (ZenodoAuthor zenodoAuthor : listOfUsers) {
|
||||||
|
@ -559,11 +574,15 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
*/
|
*/
|
||||||
public List<ZenodoContributor> getListOfContributors() {
|
public List<ZenodoContributor> getListOfContributors() {
|
||||||
List<ZenodoContributor> listOfContributors = new ArrayList<>();
|
List<ZenodoContributor> listOfContributors = new ArrayList<>();
|
||||||
|
if(listOfContributorsView==null) {
|
||||||
|
return listOfContributors;
|
||||||
|
}
|
||||||
for (CreatorsFormView cfv : listOfContributorsView) {
|
for (CreatorsFormView cfv : listOfContributorsView) {
|
||||||
List<? extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView();
|
List<? extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView();
|
||||||
for (ZenodoAuthor zenodoAuthor : listOfUsers) {
|
for (ZenodoAuthor zenodoAuthor : listOfUsers) {
|
||||||
listOfContributors.add((ZenodoContributor) zenodoAuthor);
|
listOfContributors.add((ZenodoContributor) zenodoAuthor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return listOfContributors;
|
return listOfContributors;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
|
||||||
import com.google.gwt.user.client.ui.Label;
|
import com.google.gwt.user.client.ui.Label;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.basicinformation.BasicInformationView;
|
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.SerializableEnum;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseBean;
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
|
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.ZenodoCreator;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
|
||||||
|
@ -124,6 +123,9 @@ public class Ckan2ZenodoViewManager {
|
||||||
meta.setDescription(basicForm.getField_description().getValue());
|
meta.setDescription(basicForm.getField_description().getValue());
|
||||||
meta.setKeywords(basicForm.getTags()); // these are the keywords
|
meta.setKeywords(basicForm.getTags()); // these are the keywords
|
||||||
|
|
||||||
|
//Setting publication date fxing #26166
|
||||||
|
meta.setPublication_date(basicForm.getField_publication_date().getValue());
|
||||||
|
|
||||||
List<ZenodoCreator> creators = basicForm.getListOfCreators();
|
List<ZenodoCreator> creators = basicForm.getListOfCreators();
|
||||||
GWT.log("Read creators from FORM: "+creators);
|
GWT.log("Read creators from FORM: "+creators);
|
||||||
meta.setCreators(creators);
|
meta.setCreators(creators);
|
||||||
|
@ -162,8 +164,11 @@ public class Ckan2ZenodoViewManager {
|
||||||
//license
|
//license
|
||||||
String licenseId = basicForm.getField_license().getSelectedValue();
|
String licenseId = basicForm.getField_license().getSelectedValue();
|
||||||
if(licenseId!=null) {
|
if(licenseId!=null) {
|
||||||
LicenseBean licenseBean = new LicenseBean(licenseId, null, null);
|
//LicenseDTO licenseBean = new LicenseDTO(licenseId, null, null);
|
||||||
meta.setLicenses(new SerializableEnum<LicenseBean>(Arrays.asList(licenseBean),null));
|
List<String> licenses = new ArrayList<String>();
|
||||||
|
licenses.add(licenseId);
|
||||||
|
meta.setLicenseIDs(licenses);
|
||||||
|
//meta.setLicenses(Arrays.asList(licenseBean));
|
||||||
}
|
}
|
||||||
|
|
||||||
//embargo date
|
//embargo date
|
||||||
|
|
|
@ -3,9 +3,6 @@ package org.gcube.portlets.widgets.ckan2zenodopublisher.client.view;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ZenodoLicense;
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseBean;
|
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
@ -98,17 +95,18 @@ public class FieldUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To zenodo ids.
|
* To zenodo ids.
|
||||||
|
* TODO Must passed an object License
|
||||||
*
|
*
|
||||||
* @param listLicenses the list licenses
|
* @param listLicenses the list licenses
|
||||||
* @return the list
|
* @return the list
|
||||||
*/
|
*/
|
||||||
public static List<String> toZenodoIds(List<LicenseBean> listLicenses){
|
public static List<String> toZenodoIds(List<String> listLicenses){
|
||||||
if(listLicenses==null)
|
if(listLicenses==null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<String> licenses = new ArrayList<String>(listLicenses.size());
|
List<String> licenses = new ArrayList<String>(listLicenses.size());
|
||||||
for (ZenodoLicense zenodoLicense : listLicenses) {
|
for (String zenodoLicense : listLicenses) {
|
||||||
licenses.add(zenodoLicense.getId());
|
licenses.add(zenodoLicense);
|
||||||
}
|
}
|
||||||
|
|
||||||
return licenses;
|
return licenses;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
.ckan2zenodo-modal-style {
|
.ckan2zenodo-modal-style {
|
||||||
width: 1200px !important;
|
width: 1200px !important;
|
||||||
margin-left: -600px !important;
|
margin-left: -600px !important;
|
||||||
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ckan2zenodo-modal-style input, textarea {
|
.ckan2zenodo-modal-style input, textarea {
|
||||||
|
@ -16,16 +17,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ckan2zenodo-modal-style .modal-body {
|
.ckan2zenodo-modal-style .modal-body {
|
||||||
height: 800px;
|
height: 600px;
|
||||||
max-height: 800px;
|
max-height: 600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ckan2zenodo-modal-style .form-horizontal {
|
.ckan2zenodo-modal-style .form-horizontal {
|
||||||
height: 645px;
|
height: 95%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ckan2zenodo-modal-style .nav-tabs {
|
.ckan2zenodo-modal-style .nav-tabs {
|
||||||
height: 645px;
|
height: 95%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ckan2zenodo-modal-style .pager {
|
.ckan2zenodo-modal-style .pager {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.widgets.ckan2zenodopublisher.server;
|
package org.gcube.portlets.widgets.ckan2zenodopublisher.server;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -13,16 +14,19 @@ import org.gcube.data.publishing.ckan2zenodo.model.CkanItemDescriptor;
|
||||||
import org.gcube.data.publishing.ckan2zenodo.model.CkanResource;
|
import org.gcube.data.publishing.ckan2zenodo.model.CkanResource;
|
||||||
import org.gcube.data.publishing.ckan2zenodo.model.faults.ConfigurationException;
|
import org.gcube.data.publishing.ckan2zenodo.model.faults.ConfigurationException;
|
||||||
import org.gcube.data.publishing.ckan2zenodo.model.faults.GcatException;
|
import org.gcube.data.publishing.ckan2zenodo.model.faults.GcatException;
|
||||||
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.TransformationException;
|
||||||
import org.gcube.data.publishing.ckan2zenodo.model.faults.ZenodoException;
|
import org.gcube.data.publishing.ckan2zenodo.model.faults.ZenodoException;
|
||||||
|
import org.gcube.data.publishing.ckan2zenodo.model.report.EnvironmentReport;
|
||||||
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata;
|
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.DepositionMetadata;
|
||||||
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
|
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.configuration.ZenodoFieldsDescriptionsReader;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.configuration.ZenodoFieldsDescriptionsReader;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter.ItemToZenodoConverter;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter.ItemToZenodoConverter;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
||||||
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ItemTranslateError;
|
||||||
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ItemTranslateError.ERROR_TYPE;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ZenodoError;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ZenodoError;
|
||||||
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.DOI_dv;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoFile;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoMetadata;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoMetadata;
|
||||||
|
@ -44,13 +48,16 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
|
|
||||||
private static Logger LOG = LoggerFactory.getLogger(CkanToZenodoPublisherServiceImpl.class);
|
private static Logger LOG = LoggerFactory.getLogger(CkanToZenodoPublisherServiceImpl.class);
|
||||||
|
|
||||||
|
/*
|
||||||
/* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService#publishOnZenodo(org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoItem)
|
*
|
||||||
|
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.
|
||||||
|
* CkanToZenodoPublisherService#publishOnZenodo(org.gcube.portlets.widgets.
|
||||||
|
* ckan2zenodopublisher.shared.wrapped.ZenodoItem)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String publishOnZenodo(ZenodoItem zenodoItem) throws Exception {
|
public DOI_dv publishOnZenodo(ZenodoItem zenodoItem) throws Exception {
|
||||||
|
LOG.info("publishOnZenodo called");
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (isOutFromPortal()) {
|
if (isOutFromPortal()) {
|
||||||
|
@ -58,8 +65,20 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
PortalUtils.getCurrentToken(this.getThreadLocalRequest(), true);
|
PortalUtils.getCurrentToken(this.getThreadLocalRequest(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG.debug("publishOnZenodo called with metadata: "+zenodoItem.getMetadata());
|
||||||
|
|
||||||
|
Ckan2Zenodo client = new Ckan2ZenodoImpl();
|
||||||
|
// Get the item representation
|
||||||
|
CkanItemDescriptor itemDescr = client.read(zenodoItem.getName());
|
||||||
|
// Get a preview of the deposition to be published
|
||||||
|
ZenodoDeposition zenodoDepositionPreview = null;
|
||||||
|
try {
|
||||||
|
zenodoDepositionPreview = client.translate(itemDescr);
|
||||||
|
} catch (ConfigurationException e) {
|
||||||
|
LOG.info("Using forceTranslation for: " + itemDescr.getItemUrl());
|
||||||
|
zenodoDepositionPreview = client.forceTranslation(itemDescr);
|
||||||
|
}
|
||||||
|
|
||||||
ZenodoDeposition zenodoDepositionPreview=loadItemPreviewFromService(zenodoItem.getName());
|
|
||||||
// (EVENTUALLY) UPDATING BASIC INFO CHANGED BY FORM ON CLIENT-SIDE
|
// (EVENTUALLY) UPDATING BASIC INFO CHANGED BY FORM ON CLIENT-SIDE
|
||||||
// Basic info
|
// Basic info
|
||||||
zenodoDepositionPreview.setTitle(zenodoItem.getTitle());
|
zenodoDepositionPreview.setTitle(zenodoItem.getTitle());
|
||||||
|
@ -67,7 +86,8 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
// Updating Deposition Metadata potentially changed on client-side
|
// Updating Deposition Metadata potentially changed on client-side
|
||||||
ZenodoMetadata metadata = zenodoItem.getMetadata();
|
ZenodoMetadata metadata = zenodoItem.getMetadata();
|
||||||
DepositionMetadata depositionMetadata = zenodoDepositionPreview.getMetadata();
|
DepositionMetadata depositionMetadata = zenodoDepositionPreview.getMetadata();
|
||||||
depositionMetadata = ItemToZenodoConverter.updateMetadataInfoOfDepositionMetadata(metadata, depositionMetadata);
|
depositionMetadata = ItemToZenodoConverter.updateMetadataInfoOfDepositionMetadata(metadata,
|
||||||
|
depositionMetadata);
|
||||||
zenodoDepositionPreview.setMetadata(depositionMetadata);
|
zenodoDepositionPreview.setMetadata(depositionMetadata);
|
||||||
|
|
||||||
// Loading Filtered resources according to VRE policies
|
// Loading Filtered resources according to VRE policies
|
||||||
|
@ -81,7 +101,8 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
for (CkanResource ckanResource : filteredResources) {
|
for (CkanResource ckanResource : filteredResources) {
|
||||||
if (zf.getId().compareTo(ckanResource.getId()) == 0 && zf.getIsAlreadyPublished() == false) {
|
if (zf.getId().compareTo(ckanResource.getId()) == 0 && zf.getIsAlreadyPublished() == false) {
|
||||||
if (CkanToZenodoUtil.isNotEmpty(zf.getFilename())) {
|
if (CkanToZenodoUtil.isNotEmpty(zf.getFilename())) {
|
||||||
ckanResource.setName(zf.getFilename()); //only the filename can be changed on clien-side
|
ckanResource.setName(zf.getFilename()); // only the filename can be changed on
|
||||||
|
// clien-side
|
||||||
toUpload.add(ckanResource);
|
toUpload.add(ckanResource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,14 +112,24 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
|
|
||||||
// Actually publish to zenodo :
|
// Actually publish to zenodo :
|
||||||
// Step 1 : metadata
|
// Step 1 : metadata
|
||||||
Ckan2Zenodo client= new Ckan2ZenodoImpl();
|
client = new Ckan2ZenodoImpl();
|
||||||
LOG.debug("Calling updatedMetadta for: "+zenodoDepositionPreview);
|
LOG.debug("Calling updatedMetadata for: " + zenodoDepositionPreview);
|
||||||
|
|
||||||
|
//fixing issue #26166
|
||||||
|
Date thePublicationDate = zenodoDepositionPreview.getMetadata().getPublication_date();
|
||||||
|
LOG.debug("Publication_Date before update is: " + thePublicationDate);
|
||||||
|
|
||||||
zenodoDepositionPreview = client.updatedMetadata(zenodoDepositionPreview);
|
zenodoDepositionPreview = client.updatedMetadata(zenodoDepositionPreview);
|
||||||
|
|
||||||
// Step 2 : publish Resources
|
// Step 2 : publish Resources
|
||||||
if (toUpload.size() > 0) {
|
if (toUpload.size() > 0) {
|
||||||
LOG.debug("Trying to publish the set of CKAN resources: " + toUpload.toString());
|
LOG.debug("Trying to publish the set of CKAN resources: " + toUpload.toString());
|
||||||
|
|
||||||
|
//fixing issue #26166
|
||||||
|
zenodoDepositionPreview.getMetadata().setPublication_date(thePublicationDate);
|
||||||
|
LOG.debug("Publication_Date before uploadFiles is: " + zenodoDepositionPreview.getMetadata().getPublication_date());
|
||||||
Future<ZenodoDeposition> future_Dep = client.uploadFiles(toUpload, zenodoDepositionPreview);
|
Future<ZenodoDeposition> future_Dep = client.uploadFiles(toUpload, zenodoDepositionPreview);
|
||||||
|
|
||||||
while (!future_Dep.isDone()) {
|
while (!future_Dep.isDone()) {
|
||||||
LOG.debug("Waiting for completed future computation (publishing of resources on Zenodo)...");
|
LOG.debug("Waiting for completed future computation (publishing of resources on Zenodo)...");
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
@ -108,10 +139,15 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
|
|
||||||
// Get the item representation
|
// Get the item representation
|
||||||
CkanItemDescriptor item = client.read(zenodoItem.getName());
|
CkanItemDescriptor item = client.read(zenodoItem.getName());
|
||||||
|
|
||||||
|
//fixing issue #26166
|
||||||
|
LOG.debug("Publication_Date before publish is: " + thePublicationDate);
|
||||||
|
zenodoDepositionPreview.getMetadata().setPublication_date(thePublicationDate);
|
||||||
|
|
||||||
// Finalize
|
// Finalize
|
||||||
LOG.debug("Calling publish on Zenodo for: " + zenodoDepositionPreview);
|
LOG.debug("Calling publish on Zenodo for: " + zenodoDepositionPreview);
|
||||||
zenodoDepositionPreview = client.publish(zenodoDepositionPreview, item);
|
zenodoDepositionPreview = client.publish(zenodoDepositionPreview, item);
|
||||||
return zenodoDepositionPreview.getDoi();
|
return new DOI_dv(zenodoDepositionPreview.getDoi(), zenodoDepositionPreview.getDoi_url());
|
||||||
|
|
||||||
// throw new ZenodoException();
|
// throw new ZenodoException();
|
||||||
|
|
||||||
|
@ -121,7 +157,8 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
String clientError = String.format("%s", error);
|
String clientError = String.format("%s", error);
|
||||||
throw new Exception(clientError);
|
throw new Exception(clientError);
|
||||||
} catch (ZenodoException e) {
|
} catch (ZenodoException e) {
|
||||||
String error = ZenodoException.class.getName()+" during upload to Zenodo the catalogue item: "+zenodoItem.getName();
|
String error = ZenodoException.class.getName() + " during upload to Zenodo the catalogue item: "
|
||||||
|
+ zenodoItem.getName();
|
||||||
LOG.error(error, e);
|
LOG.error(error, e);
|
||||||
// String clientError = String.format("%s", e.getRemoteMessage());
|
// String clientError = String.format("%s", e.getRemoteMessage());
|
||||||
ZenodoError zenodoError = new ZenodoError(e);
|
ZenodoError zenodoError = new ZenodoError(e);
|
||||||
|
@ -137,12 +174,16 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService#convertToZenodoItem(org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.
|
||||||
|
* CkanToZenodoPublisherService#convertToZenodoItem(org.gcube.portlets.widgets.
|
||||||
|
* ckan2zenodopublisher.shared.CatalogueItem)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ZenodoItem convertToZenodoItem(CatalogueItem item) throws Exception {
|
public ZenodoItem convertToZenodoItem(CatalogueItem item) throws Exception {
|
||||||
|
LOG.info("convertToZenodoItem called");
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (isOutFromPortal()) {
|
if (isOutFromPortal()) {
|
||||||
|
@ -150,30 +191,50 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
PortalUtils.getCurrentToken(this.getThreadLocalRequest(), true);
|
PortalUtils.getCurrentToken(this.getThreadLocalRequest(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ckan2Zenodo client = new Ckan2ZenodoImpl();
|
||||||
|
// Get the item representation
|
||||||
|
CkanItemDescriptor itemDescr = client.read(item.getItemId());
|
||||||
// Get a preview of the deposition to be published
|
// Get a preview of the deposition to be published
|
||||||
ZenodoDeposition zdPreview=loadItemPreviewFromService(item.getItemId());
|
ZenodoDeposition zdDeposition = null;
|
||||||
|
ItemTranslateError itemTrError = null;
|
||||||
|
try {
|
||||||
|
zdDeposition = client.translate(itemDescr);
|
||||||
|
} catch (ConfigurationException | TransformationException e) {
|
||||||
|
LOG.info(ConfigurationException.class.getSimpleName() + " thrown, trying to use forceTranslation for: "
|
||||||
|
+ itemDescr.getName());
|
||||||
|
itemTrError = new ItemTranslateError(e.getMessage(), ERROR_TYPE.INFO);
|
||||||
|
zdDeposition = client.forceTranslation(itemDescr);
|
||||||
|
}
|
||||||
|
|
||||||
//Loading Filtered resources according to VRE policies
|
|
||||||
List<CkanResource> filteredResources = loadFilterResources(item.getItemId());
|
List<CkanResource> filteredResources = loadFilterResources(item.getItemId());
|
||||||
LOG.debug("Loaded filtered resources: " + filteredResources);
|
LOG.debug("Loaded filtered resources: " + filteredResources);
|
||||||
|
|
||||||
// Converting ZenodoDeposition to ZenodoItem
|
// Converting ZenodoDeposition to ZenodoItem
|
||||||
ZenodoItem zenodoItem = ItemToZenodoConverter.toZenodoItem(zdPreview);
|
ZenodoItem zenodoItem = ItemToZenodoConverter.toZenodoItem(zdDeposition);
|
||||||
|
|
||||||
|
// Adding ItemTranslateError eventually occurred by calling client.translate
|
||||||
|
zenodoItem.setTranslateError(itemTrError);
|
||||||
|
|
||||||
// Adding the filtered resources
|
// Adding the filtered resources
|
||||||
List<ZenodoFile> resources = ItemToZenodoConverter.toZenodoFiles(filteredResources, false);
|
List<ZenodoFile> resources = ItemToZenodoConverter.toZenodoFiles(filteredResources, false);
|
||||||
zenodoItem.addFiles(resources);
|
zenodoItem.addFiles(resources);
|
||||||
|
|
||||||
//I'M SETTING THE ID BECAUSE THE NAME IS NULL INTO BEAN PASSED FROM PORTLET SIDE
|
// I'M SETTING THE ID BECAUSE THE NAME IS NULL INTO BEAN PASSED FROM PORTLET
|
||||||
|
// SIDE
|
||||||
// TODO I'M WAITING FOR itemName retrieved from ckan2zenodo library
|
// TODO I'M WAITING FOR itemName retrieved from ckan2zenodo library
|
||||||
zenodoItem.setName(item.getItemId());
|
zenodoItem.setName(item.getItemId());
|
||||||
|
|
||||||
|
LOG.debug("zenodoItem getLicenses as list: " + zenodoItem.getMetadata().getLicenseIDs());
|
||||||
|
//LOG.debug("setting licenses at null");
|
||||||
|
//zenodoItem.getMetadata().setLicenseIDs(null);
|
||||||
|
|
||||||
LOG.debug("Returning item: " + zenodoItem);
|
LOG.debug("Returning item: " + zenodoItem);
|
||||||
|
|
||||||
return zenodoItem;
|
return zenodoItem;
|
||||||
|
|
||||||
} catch (ZenodoException e) {
|
} catch (ZenodoException e) {
|
||||||
String error = ZenodoException.class.getName()+" on converting the catalogue item with id: "+item.getItemId();
|
String error = ZenodoException.class.getName() + " on converting the catalogue item with id: "
|
||||||
|
+ item.getItemId();
|
||||||
LOG.error(error, e);
|
LOG.error(error, e);
|
||||||
// String clientError = String.format("%s. %s", error, e.getRemoteMessage());
|
// String clientError = String.format("%s. %s", error, e.getRemoteMessage());
|
||||||
ZenodoError zenodoError = new ZenodoError(e);
|
ZenodoError zenodoError = new ZenodoError(e);
|
||||||
|
@ -190,12 +251,16 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService#convertToZenodoItem(org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.gcube.portlets.widgets.ckan2zenodopublisher.client.
|
||||||
|
* CkanToZenodoPublisherService#convertToZenodoItem(org.gcube.portlets.widgets.
|
||||||
|
* ckan2zenodopublisher.shared.CatalogueItem)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> readFieldsDescriptions() throws Exception {
|
public Map<String, String> readFieldsDescriptions() throws Exception {
|
||||||
|
LOG.info("readFieldsDescriptions called");
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (isOutFromPortal()) {
|
if (isOutFromPortal()) {
|
||||||
|
@ -214,28 +279,30 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean checkZenodoEnvironment() {
|
||||||
|
LOG.info("checkZenodoEnvironment called");
|
||||||
|
boolean isZenodoConfigured = false;
|
||||||
|
|
||||||
/**
|
try {
|
||||||
* Load item preview from service.
|
|
||||||
*
|
|
||||||
* @param itemName the item name
|
|
||||||
* @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= new Ckan2ZenodoImpl();
|
|
||||||
// Get the item representation
|
|
||||||
CkanItemDescriptor itemDescr=client.read(itemName);
|
|
||||||
//Get a preview of the deposition to be published
|
|
||||||
return client.translate(itemDescr);
|
|
||||||
|
|
||||||
|
if (isOutFromPortal()) {
|
||||||
|
PortalUtils.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
PortalUtils.getCurrentToken(this.getThreadLocalRequest(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG.info("readFieldsDescriptions called");
|
||||||
|
Ckan2Zenodo client = new Ckan2ZenodoImpl();
|
||||||
|
EnvironmentReport report = client.checkEnvironment();
|
||||||
|
LOG.info("EnvironmentReport returned: " + report);
|
||||||
|
isZenodoConfigured = report.isok();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error occurred during checkEnvironment: ", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.info("Is Zenodo Environment configured? " + isZenodoConfigured);
|
||||||
|
return isZenodoConfigured;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load filter resources.
|
* Load filter resources.
|
||||||
|
@ -246,7 +313,8 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
* @throws ConfigurationException the configuration exception
|
* @throws ConfigurationException the configuration exception
|
||||||
* @throws TransformationException the transformation exception
|
* @throws TransformationException the transformation exception
|
||||||
*/
|
*/
|
||||||
private List<CkanResource> loadFilterResources(String itemName) throws GcatException, ConfigurationException, TransformationException {
|
private List<CkanResource> loadFilterResources(String itemName)
|
||||||
|
throws GcatException, ConfigurationException, TransformationException {
|
||||||
|
|
||||||
Ckan2Zenodo client = new Ckan2ZenodoImpl();
|
Ckan2Zenodo client = new Ckan2ZenodoImpl();
|
||||||
// Get the item representation
|
// Get the item representation
|
||||||
|
@ -264,10 +332,10 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
try {
|
try {
|
||||||
UserLocalServiceUtil.getService();
|
UserLocalServiceUtil.getService();
|
||||||
return false;
|
return false;
|
||||||
}
|
} catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
|
||||||
catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
|
|
||||||
LOG.debug("Development Mode ON");
|
LOG.debug("Development Mode ON");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ZenodoLicense;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,20 +47,6 @@ public class CkanToZenodoUtil {
|
||||||
return new SerializableEnum<String>(selectedValues, values);
|
return new SerializableEnum<String>(selectedValues, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To serializable enum.
|
|
||||||
*
|
|
||||||
* @param <E> the element type
|
|
||||||
* @param selectedLicense the selected license
|
|
||||||
* @param allLicenses the all licenses
|
|
||||||
* @return the serializable enum
|
|
||||||
*/
|
|
||||||
public static <E extends ZenodoLicense> SerializableEnum<E> toSerializableEnum(List<E> selectedLicense, List<E> allLicenses) {
|
|
||||||
|
|
||||||
return new SerializableEnum<E>(selectedLicense, allLicenses);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is not empty.
|
* Checks if is not empty.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter;
|
package org.gcube.portlets.widgets.ckan2zenodopublisher.server.converter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -23,7 +22,6 @@ import org.gcube.data.publishing.ckan2zenodo.model.zenodo.Subject;
|
||||||
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
|
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoUtil;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.LicenseBean;
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoAuthor;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCommunity;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoCommunity;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoContributor;
|
||||||
|
@ -37,8 +35,6 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped.ZenodoSubj
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ItemToZenodoConverter.
|
* The Class ItemToZenodoConverter.
|
||||||
*
|
*
|
||||||
|
@ -49,6 +45,7 @@ import org.slf4j.LoggerFactory;
|
||||||
public class ItemToZenodoConverter {
|
public class ItemToZenodoConverter {
|
||||||
|
|
||||||
private static Logger LOG = LoggerFactory.getLogger(ItemToZenodoConverter.class);
|
private static Logger LOG = LoggerFactory.getLogger(ItemToZenodoConverter.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **
|
* **
|
||||||
*
|
*
|
||||||
|
@ -59,7 +56,6 @@ public class ItemToZenodoConverter {
|
||||||
* @return the zenodo item
|
* @return the zenodo item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To zenodo item.
|
* To zenodo item.
|
||||||
*
|
*
|
||||||
|
@ -97,7 +93,6 @@ public class ItemToZenodoConverter {
|
||||||
return zi;
|
return zi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the files.
|
* Adds the files.
|
||||||
*
|
*
|
||||||
|
@ -137,8 +132,6 @@ public class ItemToZenodoConverter {
|
||||||
return listOfFiles;
|
return listOfFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To zenodo file.
|
* To zenodo file.
|
||||||
*
|
*
|
||||||
|
@ -160,7 +153,6 @@ public class ItemToZenodoConverter {
|
||||||
return zf;
|
return zf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To zenodo file.
|
* To zenodo file.
|
||||||
*
|
*
|
||||||
|
@ -185,7 +177,6 @@ public class ItemToZenodoConverter {
|
||||||
return zf;
|
return zf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To zenodo metadata.
|
* To zenodo metadata.
|
||||||
*
|
*
|
||||||
|
@ -201,6 +192,9 @@ public class ItemToZenodoConverter {
|
||||||
zm.setAccess_conditions(depositionMetadata.getAccess_conditions());
|
zm.setAccess_conditions(depositionMetadata.getAccess_conditions());
|
||||||
zm.setDescription(depositionMetadata.getDescription());
|
zm.setDescription(depositionMetadata.getDescription());
|
||||||
|
|
||||||
|
// fixing bug #26165 on publication_date = null
|
||||||
|
zm.setPublication_date(depositionMetadata.getPublication_date());
|
||||||
|
|
||||||
// Access Type
|
// Access Type
|
||||||
AccessRights[] accessRight = null;
|
AccessRights[] accessRight = null;
|
||||||
if (depositionMetadata.getAccess_right() != null) {
|
if (depositionMetadata.getAccess_right() != null) {
|
||||||
|
@ -235,11 +229,14 @@ public class ItemToZenodoConverter {
|
||||||
zm.setImage_type(CkanToZenodoUtil.toSerializableEnum(imageType, ImageType.values()));
|
zm.setImage_type(CkanToZenodoUtil.toSerializableEnum(imageType, ImageType.values()));
|
||||||
|
|
||||||
// Licenses
|
// Licenses
|
||||||
List<LicenseBean> selectedLicenses = null;
|
List<String> selectedLicenses = null;
|
||||||
if (depositionMetadata.getLicense() != null) {
|
if (depositionMetadata.getLicense() != null) {
|
||||||
selectedLicenses = Arrays.asList(new LicenseBean(depositionMetadata.getLicense(),depositionMetadata.getLicense(), null));
|
selectedLicenses = new ArrayList<String>();
|
||||||
|
selectedLicenses.add(depositionMetadata.getLicense()); // NEED TO ADD ALL LICENSES
|
||||||
|
}
|
||||||
|
if (selectedLicenses != null) {
|
||||||
|
zm.setLicenseIDs(selectedLicenses);
|
||||||
}
|
}
|
||||||
zm.setLicenses(CkanToZenodoUtil.toSerializableEnum(selectedLicenses, null)); //NEED TO ADD ALL LICENSES
|
|
||||||
|
|
||||||
if (depositionMetadata.getEmbargo_date() != null) {
|
if (depositionMetadata.getEmbargo_date() != null) {
|
||||||
|
|
||||||
|
@ -254,7 +251,12 @@ public class ItemToZenodoConverter {
|
||||||
zm.setConference_session_part(depositionMetadata.getConference_session_part());
|
zm.setConference_session_part(depositionMetadata.getConference_session_part());
|
||||||
zm.setConference_title(depositionMetadata.getConference_title());
|
zm.setConference_title(depositionMetadata.getConference_title());
|
||||||
zm.setConference_url(depositionMetadata.getConference_url());
|
zm.setConference_url(depositionMetadata.getConference_url());
|
||||||
|
|
||||||
zm.setContributors(toZenodoContributors(depositionMetadata.getContributors()));
|
zm.setContributors(toZenodoContributors(depositionMetadata.getContributors()));
|
||||||
|
|
||||||
|
// to manage empty or null contributors from mapping
|
||||||
|
zm.setContributorsTypes(CkanToZenodoUtil.toSerializableEnum(null, Contributor.Type.values()));
|
||||||
|
|
||||||
zm.setCreators(toZenodoCreators(depositionMetadata.getCreators()));
|
zm.setCreators(toZenodoCreators(depositionMetadata.getCreators()));
|
||||||
zm.setDates(toZenodoDateIntervals(depositionMetadata.getDates()));
|
zm.setDates(toZenodoDateIntervals(depositionMetadata.getDates()));
|
||||||
zm.setEmbargo_date(depositionMetadata.getEmbargo_date());
|
zm.setEmbargo_date(depositionMetadata.getEmbargo_date());
|
||||||
|
@ -269,7 +271,6 @@ public class ItemToZenodoConverter {
|
||||||
return zm;
|
return zm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To zenodo subjects.
|
* To zenodo subjects.
|
||||||
*
|
*
|
||||||
|
@ -311,7 +312,6 @@ public class ItemToZenodoConverter {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To zenodo date intervals.
|
* To zenodo date intervals.
|
||||||
*
|
*
|
||||||
|
@ -331,7 +331,8 @@ public class ItemToZenodoConverter {
|
||||||
types = CkanToZenodoUtil.toSerializableEnum(rel, DateInterval.Type.values());
|
types = CkanToZenodoUtil.toSerializableEnum(rel, DateInterval.Type.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
list.add(new ZenodoDateInterval(dateInterval.getStart(), dateInterval.getEnd(), types, dateInterval.getDescription()));
|
list.add(new ZenodoDateInterval(dateInterval.getStart(), dateInterval.getEnd(), types,
|
||||||
|
dateInterval.getDescription()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -410,7 +411,6 @@ public class ItemToZenodoConverter {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To service file deposition.
|
* To service file deposition.
|
||||||
*
|
*
|
||||||
|
@ -434,7 +434,6 @@ public class ItemToZenodoConverter {
|
||||||
return fileDep;
|
return fileDep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update metadata info of deposition metadata.
|
* Update metadata info of deposition metadata.
|
||||||
*
|
*
|
||||||
|
@ -442,7 +441,15 @@ public class ItemToZenodoConverter {
|
||||||
* @param depositionMetadata the deposition metadata
|
* @param depositionMetadata the deposition metadata
|
||||||
* @return the deposition metadata
|
* @return the deposition metadata
|
||||||
*/
|
*/
|
||||||
public static DepositionMetadata updateMetadataInfoOfDepositionMetadata(ZenodoMetadata metadata, DepositionMetadata depositionMetadata) {
|
public static DepositionMetadata updateMetadataInfoOfDepositionMetadata(ZenodoMetadata metadata,
|
||||||
|
DepositionMetadata depositionMetadata) {
|
||||||
|
|
||||||
|
// description
|
||||||
|
String description = metadata.getDescription();
|
||||||
|
LOG.debug("Read description: " + description);
|
||||||
|
if (description != null) {
|
||||||
|
depositionMetadata.setDescription(description);
|
||||||
|
}
|
||||||
|
|
||||||
// upload type
|
// upload type
|
||||||
SerializableEnum<String> uploadType = metadata.getUpload_type();
|
SerializableEnum<String> uploadType = metadata.getUpload_type();
|
||||||
|
@ -513,13 +520,13 @@ public class ItemToZenodoConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// license
|
// license
|
||||||
SerializableEnum<LicenseBean> licenses = metadata.getLicenses();
|
List<String> licenses = metadata.getLicenseIDs();
|
||||||
LOG.debug("Read licenses: " + licenses);
|
LOG.debug("Read licenses: " + licenses);
|
||||||
if(licenses!=null) {
|
if (licenses != null && licenses.size() > 0) {
|
||||||
try {
|
try {
|
||||||
LicenseBean lB = licenses.getSelectedValues().get(0);
|
String lB = licenses.get(0);
|
||||||
LOG.debug("Set license: " + lB);
|
LOG.debug("Set license: " + lB);
|
||||||
depositionMetadata.setLicense(lB.getId());
|
depositionMetadata.setLicense(lB);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Set license error: ", e);
|
LOG.warn("Set license error: ", e);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +563,6 @@ public class ItemToZenodoConverter {
|
||||||
return depositionMetadata;
|
return depositionMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To creators.
|
* To creators.
|
||||||
*
|
*
|
||||||
|
@ -626,6 +632,4 @@ public class ItemToZenodoConverter {
|
||||||
return listOfContributors;
|
return listOfContributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ItemTranslateError.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
|
||||||
|
* Jul 6, 2020
|
||||||
|
*/
|
||||||
|
public class ItemTranslateError implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 6350511079411561892L;
|
||||||
|
|
||||||
|
private String error;
|
||||||
|
|
||||||
|
private ERROR_TYPE errorType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum ERROR_TYPE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
|
||||||
|
* Jul 6, 2020
|
||||||
|
*/
|
||||||
|
public static enum ERROR_TYPE {
|
||||||
|
INFO, WARN, ERROR
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new zenodo translate error.
|
||||||
|
*/
|
||||||
|
public ItemTranslateError() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new zenodo translate error.
|
||||||
|
*
|
||||||
|
* @param error the error
|
||||||
|
* @param errorType the error type
|
||||||
|
*/
|
||||||
|
public ItemTranslateError(String error, ERROR_TYPE errorType) {
|
||||||
|
super();
|
||||||
|
this.error = error;
|
||||||
|
this.errorType = errorType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError(String error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ERROR_TYPE getErrorType() {
|
||||||
|
if(error==null)
|
||||||
|
return ERROR_TYPE.ERROR;
|
||||||
|
|
||||||
|
return errorType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorType(ERROR_TYPE errorType) {
|
||||||
|
this.errorType = errorType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ItemTranslateError [error=" + error + ", errorType=" + errorType + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,34 +0,0 @@
|
||||||
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Interface ZenodoLicense.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
|
||||||
*
|
|
||||||
* Jan 21, 2020
|
|
||||||
*/
|
|
||||||
public interface ZenodoLicense {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the id.
|
|
||||||
*
|
|
||||||
* @return the id
|
|
||||||
*/
|
|
||||||
String getId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the title.
|
|
||||||
*
|
|
||||||
* @return the title
|
|
||||||
*/
|
|
||||||
String getTitle();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the url.
|
|
||||||
*
|
|
||||||
* @return the url
|
|
||||||
*/
|
|
||||||
String getUrl();
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class DOI_dv.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jul 28, 2023
|
||||||
|
*/
|
||||||
|
public class DOI_dv implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String doi;
|
||||||
|
private String doi_url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new DO I dv.
|
||||||
|
*/
|
||||||
|
public DOI_dv() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new DO I dv.
|
||||||
|
*
|
||||||
|
* @param doi the doi
|
||||||
|
* @param doi_url the doi url
|
||||||
|
*/
|
||||||
|
public DOI_dv(String doi, String doi_url) {
|
||||||
|
super();
|
||||||
|
this.doi = doi;
|
||||||
|
this.doi_url = doi_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the doi.
|
||||||
|
*
|
||||||
|
* @return the doi
|
||||||
|
*/
|
||||||
|
public String getDoi() {
|
||||||
|
return doi;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the doi url.
|
||||||
|
*
|
||||||
|
* @return the doi url
|
||||||
|
*/
|
||||||
|
public String getDoi_url() {
|
||||||
|
return doi_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the doi.
|
||||||
|
*
|
||||||
|
* @param doi the new doi
|
||||||
|
*/
|
||||||
|
public void setDoi(String doi) {
|
||||||
|
this.doi = doi;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the doi url.
|
||||||
|
*
|
||||||
|
* @param doi_url the new doi url
|
||||||
|
*/
|
||||||
|
public void setDoi_url(String doi_url) {
|
||||||
|
this.doi_url = doi_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("DOI_dv [doi=");
|
||||||
|
builder.append(doi);
|
||||||
|
builder.append(", doi_url=");
|
||||||
|
builder.append(doi_url);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,98 +0,0 @@
|
||||||
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ZenodoLicense;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A license bean like the ckan's one.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
|
||||||
*
|
|
||||||
* Jan 13, 2020
|
|
||||||
*/
|
|
||||||
public class LicenseBean implements Serializable, ZenodoLicense{
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 6618784269251750489L;
|
|
||||||
private String id;
|
|
||||||
private String title;
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new license bean.
|
|
||||||
*/
|
|
||||||
public LicenseBean() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new license bean.
|
|
||||||
*
|
|
||||||
* @param id the id
|
|
||||||
* @param title the title
|
|
||||||
* @param url the url
|
|
||||||
*/
|
|
||||||
public LicenseBean(String id, String title, String url) {
|
|
||||||
super();
|
|
||||||
this.id = id;
|
|
||||||
this.title = title;
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
return obj.getClass().equals(this.getClass()) && ((LicenseBean)obj).getTitle().equals(this.title);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("LicenseBean [id=");
|
|
||||||
builder.append(id);
|
|
||||||
builder.append(", title=");
|
|
||||||
builder.append(title);
|
|
||||||
builder.append(", url=");
|
|
||||||
builder.append(url);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
//package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
|
||||||
|
//
|
||||||
|
//import java.io.Serializable;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * A license bean like the ckan's one.
|
||||||
|
// *
|
||||||
|
// * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
// *
|
||||||
|
// * Jan 13, 2020
|
||||||
|
// */
|
||||||
|
//public class LicenseDTO implements Serializable {
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// *
|
||||||
|
// */
|
||||||
|
// private static final long serialVersionUID = 8796338619448833841L;
|
||||||
|
// private String id;
|
||||||
|
// private String title;
|
||||||
|
// private String url;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Instantiates a new license bean.
|
||||||
|
// */
|
||||||
|
// public LicenseDTO() {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public LicenseDTO(String id, String title, String url) {
|
||||||
|
// this.id = id;
|
||||||
|
// this.title = title;
|
||||||
|
// this.url = url;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getId() {
|
||||||
|
// return id;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getTitle() {
|
||||||
|
// return title;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getUrl() {
|
||||||
|
// return url;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setId(String id) {
|
||||||
|
// this.id = id;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setTitle(String title) {
|
||||||
|
// this.title = title;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setUrl(String url) {
|
||||||
|
// this.url = url;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// StringBuilder builder = new StringBuilder();
|
||||||
|
// builder.append("LicenseDTO [id=");
|
||||||
|
// builder.append(id);
|
||||||
|
// builder.append(", title=");
|
||||||
|
// builder.append(title);
|
||||||
|
// builder.append(", url=");
|
||||||
|
// builder.append(url);
|
||||||
|
// builder.append("]");
|
||||||
|
// return builder.toString();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -11,6 +11,9 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
*/
|
*/
|
||||||
public interface ZenodoAuthor {
|
public interface ZenodoAuthor {
|
||||||
|
|
||||||
|
|
||||||
|
public static final String USER_ROLE = "Author";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name.
|
* Gets the name.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
|
package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +12,7 @@ import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
*
|
*
|
||||||
* Jan 15, 2020
|
* Jan 15, 2020
|
||||||
*/
|
*/
|
||||||
public class ZenodoContributor extends ZenodoCreator{
|
public class ZenodoContributor extends ZenodoCreator implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -19,6 +21,8 @@ public class ZenodoContributor extends ZenodoCreator{
|
||||||
|
|
||||||
private SerializableEnum<String> type;
|
private SerializableEnum<String> type;
|
||||||
|
|
||||||
|
public static final String USER_ROLE = "Contributor";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new zenodo contributor.
|
* Instantiates a new zenodo contributor.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,6 +24,8 @@ public class ZenodoCreator implements ZenodoAuthor, Serializable{
|
||||||
private String orcid;
|
private String orcid;
|
||||||
private String gnd;
|
private String gnd;
|
||||||
|
|
||||||
|
public static final String USER_ROLE = "Creator";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new zenodo creator.
|
* Instantiates a new zenodo creator.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class ZenodoDateInterval implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Instantiates a new zenodo date interval.
|
* Instantiates a new zenodo date interval.
|
||||||
*/
|
*/
|
||||||
ZenodoDateInterval() {
|
public ZenodoDateInterval() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,19 +5,20 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.ItemTranslateError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ZenodoItem.
|
* The Class ZenodoItem.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
|
||||||
*
|
* Jul 6, 2020
|
||||||
* Dec 9, 2019
|
|
||||||
*/
|
*/
|
||||||
public class ZenodoItem implements Serializable {
|
public class ZenodoItem implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3623554371253293861L;
|
private static final long serialVersionUID = 4007154127458109015L;
|
||||||
|
|
||||||
private Date created;
|
private Date created;
|
||||||
private String doi;
|
private String doi;
|
||||||
|
@ -33,6 +34,8 @@ public class ZenodoItem implements Serializable {
|
||||||
private String title;
|
private String title;
|
||||||
private String name; // this is the dataset name
|
private String name; // this is the dataset name
|
||||||
|
|
||||||
|
private ItemTranslateError translateError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new zenodo item.
|
* Instantiates a new zenodo item.
|
||||||
*/
|
*/
|
||||||
|
@ -71,7 +74,6 @@ public class ZenodoItem implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the files.
|
* Sets the files.
|
||||||
*
|
*
|
||||||
|
@ -292,42 +294,32 @@ public class ZenodoItem implements Serializable {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/* (non-Javadoc)
|
* Gets the translate error.
|
||||||
* @see java.lang.Object#toString()
|
*
|
||||||
|
* @return the translate error
|
||||||
*/
|
*/
|
||||||
|
public ItemTranslateError getTranslateError() {
|
||||||
|
return translateError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the translate error.
|
||||||
|
*
|
||||||
|
* @param translateError the new translate error
|
||||||
|
*/
|
||||||
|
public void setTranslateError(ItemTranslateError translateError) {
|
||||||
|
this.translateError = translateError;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
return "ZenodoItem [created=" + created + ", doi=" + doi + ", files=" + files + ", id=" + id + ", metadata="
|
||||||
builder.append("ZenodoItem [created=");
|
+ metadata + ", modified=" + modified + ", owner=" + owner + ", record_id=" + record_id
|
||||||
builder.append(created);
|
+ ", record_url=" + record_url + ", state=" + state + ", submitted=" + submitted + ", title=" + title
|
||||||
builder.append(", doi=");
|
+ ", name=" + name + ", translateError=" + translateError + "]";
|
||||||
builder.append(doi);
|
|
||||||
builder.append(", files=");
|
|
||||||
builder.append(files);
|
|
||||||
builder.append(", id=");
|
|
||||||
builder.append(id);
|
|
||||||
builder.append(", metadata=");
|
|
||||||
builder.append(metadata);
|
|
||||||
builder.append(", modified=");
|
|
||||||
builder.append(modified);
|
|
||||||
builder.append(", owner=");
|
|
||||||
builder.append(owner);
|
|
||||||
builder.append(", record_id=");
|
|
||||||
builder.append(record_id);
|
|
||||||
builder.append(", record_url=");
|
|
||||||
builder.append(record_url);
|
|
||||||
builder.append(", state=");
|
|
||||||
builder.append(state);
|
|
||||||
builder.append(", submitted=");
|
|
||||||
builder.append(submitted);
|
|
||||||
builder.append(", title=");
|
|
||||||
builder.append(title);
|
|
||||||
builder.append(", name=");
|
|
||||||
builder.append(name);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
//package org.gcube.portlets.widgets.ckan2zenodopublisher.shared.wrapped;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * The Interface ZenodoLicense.
|
||||||
|
// *
|
||||||
|
// * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
// *
|
||||||
|
// * Jan 21, 2020
|
||||||
|
// */
|
||||||
|
//public interface ZenodoLicense {
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the id.
|
||||||
|
// *
|
||||||
|
// * @return the id
|
||||||
|
// */
|
||||||
|
// String getId();
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the title.
|
||||||
|
// *
|
||||||
|
// * @return the title
|
||||||
|
// */
|
||||||
|
// String getTitle();
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets the url.
|
||||||
|
// *
|
||||||
|
// * @return the url
|
||||||
|
// */
|
||||||
|
// String getUrl();
|
||||||
|
//
|
||||||
|
//}
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.SerializableEnum;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ZenodoMetadata.
|
* The Class ZenodoMetadata.
|
||||||
*
|
*
|
||||||
|
@ -27,6 +26,9 @@ public class ZenodoMetadata implements Serializable{
|
||||||
|
|
||||||
private SerializableEnum<String> image_type;
|
private SerializableEnum<String> image_type;
|
||||||
|
|
||||||
|
// to manage empty list or null contributors
|
||||||
|
private SerializableEnum<String> contributorsTypes;
|
||||||
|
|
||||||
private Date publication_date;
|
private Date publication_date;
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@ -75,14 +77,15 @@ public class ZenodoMetadata implements Serializable{
|
||||||
private List<ZenodoDateInterval> dates;
|
private List<ZenodoDateInterval> dates;
|
||||||
private String method; // TODO html
|
private String method; // TODO html
|
||||||
|
|
||||||
private SerializableEnum<LicenseBean> licenses;
|
// private SerializableEnum<String> licenseIDs;
|
||||||
|
|
||||||
|
private List<String> licenseIDs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new zenodo metadata.
|
* Instantiates a new zenodo metadata.
|
||||||
*/
|
*/
|
||||||
public ZenodoMetadata(){}
|
public ZenodoMetadata() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the upload type.
|
* Gets the upload type.
|
||||||
|
@ -93,7 +96,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return upload_type;
|
return upload_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the upload type.
|
* Sets the upload type.
|
||||||
*
|
*
|
||||||
|
@ -103,6 +105,23 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.upload_type = upload_type;
|
this.upload_type = upload_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the contributors types.
|
||||||
|
*
|
||||||
|
* @return the contributors types
|
||||||
|
*/
|
||||||
|
public SerializableEnum<String> getContributorsTypes() {
|
||||||
|
return contributorsTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the contributors types.
|
||||||
|
*
|
||||||
|
* @param contributorsTypes the new contributors types
|
||||||
|
*/
|
||||||
|
public void setContributorsTypes(SerializableEnum<String> contributorsTypes) {
|
||||||
|
this.contributorsTypes = contributorsTypes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the publication type.
|
* Gets the publication type.
|
||||||
|
@ -113,7 +132,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return publication_type;
|
return publication_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the publication type.
|
* Sets the publication type.
|
||||||
*
|
*
|
||||||
|
@ -123,7 +141,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.publication_type = publication_type;
|
this.publication_type = publication_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the image type.
|
* Gets the image type.
|
||||||
*
|
*
|
||||||
|
@ -133,7 +150,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return image_type;
|
return image_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the image type.
|
* Sets the image type.
|
||||||
*
|
*
|
||||||
|
@ -143,7 +159,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.image_type = image_type;
|
this.image_type = image_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the publication date.
|
* Gets the publication date.
|
||||||
*
|
*
|
||||||
|
@ -153,7 +168,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return publication_date;
|
return publication_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the publication date.
|
* Sets the publication date.
|
||||||
*
|
*
|
||||||
|
@ -163,7 +177,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.publication_date = publication_date;
|
this.publication_date = publication_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the title.
|
* Gets the title.
|
||||||
*
|
*
|
||||||
|
@ -173,7 +186,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the title.
|
* Sets the title.
|
||||||
*
|
*
|
||||||
|
@ -183,7 +195,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the creators.
|
* Gets the creators.
|
||||||
*
|
*
|
||||||
|
@ -193,7 +204,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return creators;
|
return creators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the creators.
|
* Sets the creators.
|
||||||
*
|
*
|
||||||
|
@ -203,7 +213,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.creators = creators;
|
this.creators = creators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the description.
|
* Gets the description.
|
||||||
*
|
*
|
||||||
|
@ -213,7 +222,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the description.
|
* Sets the description.
|
||||||
*
|
*
|
||||||
|
@ -223,7 +231,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the access right.
|
* Gets the access right.
|
||||||
*
|
*
|
||||||
|
@ -233,7 +240,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return access_right;
|
return access_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the access right.
|
* Sets the access right.
|
||||||
*
|
*
|
||||||
|
@ -243,7 +249,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.access_right = access_right;
|
this.access_right = access_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the embargo date.
|
* Gets the embargo date.
|
||||||
*
|
*
|
||||||
|
@ -253,7 +258,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return embargo_date;
|
return embargo_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the embargo date.
|
* Sets the embargo date.
|
||||||
*
|
*
|
||||||
|
@ -263,7 +267,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.embargo_date = embargo_date;
|
this.embargo_date = embargo_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the access conditions.
|
* Gets the access conditions.
|
||||||
*
|
*
|
||||||
|
@ -273,7 +276,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return access_conditions;
|
return access_conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the access conditions.
|
* Sets the access conditions.
|
||||||
*
|
*
|
||||||
|
@ -283,7 +285,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.access_conditions = access_conditions;
|
this.access_conditions = access_conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the doi.
|
* Gets the doi.
|
||||||
*
|
*
|
||||||
|
@ -293,7 +294,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return doi;
|
return doi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the doi.
|
* Sets the doi.
|
||||||
*
|
*
|
||||||
|
@ -303,7 +303,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.doi = doi;
|
this.doi = doi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the preserve doi.
|
* Gets the preserve doi.
|
||||||
*
|
*
|
||||||
|
@ -313,7 +312,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return preserve_doi;
|
return preserve_doi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the preserve doi.
|
* Sets the preserve doi.
|
||||||
*
|
*
|
||||||
|
@ -323,7 +321,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.preserve_doi = preserve_doi;
|
this.preserve_doi = preserve_doi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the keywords.
|
* Gets the keywords.
|
||||||
*
|
*
|
||||||
|
@ -333,7 +330,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return keywords;
|
return keywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the keywords.
|
* Sets the keywords.
|
||||||
*
|
*
|
||||||
|
@ -343,7 +339,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.keywords = keywords;
|
this.keywords = keywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the notes.
|
* Gets the notes.
|
||||||
*
|
*
|
||||||
|
@ -353,7 +348,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return notes;
|
return notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the notes.
|
* Sets the notes.
|
||||||
*
|
*
|
||||||
|
@ -363,7 +357,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.notes = notes;
|
this.notes = notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the related identifiers.
|
* Gets the related identifiers.
|
||||||
*
|
*
|
||||||
|
@ -373,7 +366,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return related_identifiers;
|
return related_identifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the related identifiers.
|
* Sets the related identifiers.
|
||||||
*
|
*
|
||||||
|
@ -383,7 +375,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.related_identifiers = related_identifiers;
|
this.related_identifiers = related_identifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the contributors.
|
* Gets the contributors.
|
||||||
*
|
*
|
||||||
|
@ -393,7 +384,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return contributors;
|
return contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the contributors.
|
* Sets the contributors.
|
||||||
*
|
*
|
||||||
|
@ -403,7 +393,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.contributors = contributors;
|
this.contributors = contributors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the references.
|
* Gets the references.
|
||||||
*
|
*
|
||||||
|
@ -413,7 +402,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return references;
|
return references;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the references.
|
* Sets the references.
|
||||||
*
|
*
|
||||||
|
@ -423,7 +411,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.references = references;
|
this.references = references;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the communities.
|
* Gets the communities.
|
||||||
*
|
*
|
||||||
|
@ -433,7 +420,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return communities;
|
return communities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the communities.
|
* Sets the communities.
|
||||||
*
|
*
|
||||||
|
@ -443,7 +429,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.communities = communities;
|
this.communities = communities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the grants.
|
* Gets the grants.
|
||||||
*
|
*
|
||||||
|
@ -453,7 +438,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return grants;
|
return grants;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the grants.
|
* Sets the grants.
|
||||||
*
|
*
|
||||||
|
@ -463,7 +447,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.grants = grants;
|
this.grants = grants;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the journal title.
|
* Gets the journal title.
|
||||||
*
|
*
|
||||||
|
@ -473,7 +456,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return journal_title;
|
return journal_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the journal title.
|
* Sets the journal title.
|
||||||
*
|
*
|
||||||
|
@ -483,7 +465,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.journal_title = journal_title;
|
this.journal_title = journal_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the journal volume.
|
* Gets the journal volume.
|
||||||
*
|
*
|
||||||
|
@ -493,7 +474,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return journal_volume;
|
return journal_volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the journal volume.
|
* Sets the journal volume.
|
||||||
*
|
*
|
||||||
|
@ -503,7 +483,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.journal_volume = journal_volume;
|
this.journal_volume = journal_volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the journal issue.
|
* Gets the journal issue.
|
||||||
*
|
*
|
||||||
|
@ -513,7 +492,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return journal_issue;
|
return journal_issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the journal issue.
|
* Sets the journal issue.
|
||||||
*
|
*
|
||||||
|
@ -523,7 +501,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.journal_issue = journal_issue;
|
this.journal_issue = journal_issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the journal pages.
|
* Gets the journal pages.
|
||||||
*
|
*
|
||||||
|
@ -533,7 +510,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return journal_pages;
|
return journal_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the journal pages.
|
* Sets the journal pages.
|
||||||
*
|
*
|
||||||
|
@ -543,7 +519,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.journal_pages = journal_pages;
|
this.journal_pages = journal_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conference title.
|
* Gets the conference title.
|
||||||
*
|
*
|
||||||
|
@ -553,7 +528,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return conference_title;
|
return conference_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the conference title.
|
* Sets the conference title.
|
||||||
*
|
*
|
||||||
|
@ -563,7 +537,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.conference_title = conference_title;
|
this.conference_title = conference_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conference acronym.
|
* Gets the conference acronym.
|
||||||
*
|
*
|
||||||
|
@ -573,7 +546,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return conference_acronym;
|
return conference_acronym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the conference acronym.
|
* Sets the conference acronym.
|
||||||
*
|
*
|
||||||
|
@ -583,7 +555,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.conference_acronym = conference_acronym;
|
this.conference_acronym = conference_acronym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conference dates.
|
* Gets the conference dates.
|
||||||
*
|
*
|
||||||
|
@ -593,7 +564,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return conference_dates;
|
return conference_dates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the conference dates.
|
* Sets the conference dates.
|
||||||
*
|
*
|
||||||
|
@ -603,7 +573,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.conference_dates = conference_dates;
|
this.conference_dates = conference_dates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conference place.
|
* Gets the conference place.
|
||||||
*
|
*
|
||||||
|
@ -613,7 +582,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return conference_place;
|
return conference_place;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the conference place.
|
* Sets the conference place.
|
||||||
*
|
*
|
||||||
|
@ -623,7 +591,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.conference_place = conference_place;
|
this.conference_place = conference_place;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conference url.
|
* Gets the conference url.
|
||||||
*
|
*
|
||||||
|
@ -633,7 +600,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return conference_url;
|
return conference_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the conference url.
|
* Sets the conference url.
|
||||||
*
|
*
|
||||||
|
@ -643,7 +609,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.conference_url = conference_url;
|
this.conference_url = conference_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conference session.
|
* Gets the conference session.
|
||||||
*
|
*
|
||||||
|
@ -653,7 +618,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return conference_session;
|
return conference_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the conference session.
|
* Sets the conference session.
|
||||||
*
|
*
|
||||||
|
@ -663,7 +627,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.conference_session = conference_session;
|
this.conference_session = conference_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conference session part.
|
* Gets the conference session part.
|
||||||
*
|
*
|
||||||
|
@ -673,7 +636,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return conference_session_part;
|
return conference_session_part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the conference session part.
|
* Sets the conference session part.
|
||||||
*
|
*
|
||||||
|
@ -683,7 +645,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.conference_session_part = conference_session_part;
|
this.conference_session_part = conference_session_part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the imprint publisher.
|
* Gets the imprint publisher.
|
||||||
*
|
*
|
||||||
|
@ -693,7 +654,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return imprint_publisher;
|
return imprint_publisher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the imprint publisher.
|
* Sets the imprint publisher.
|
||||||
*
|
*
|
||||||
|
@ -703,7 +663,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.imprint_publisher = imprint_publisher;
|
this.imprint_publisher = imprint_publisher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the imprint isbn.
|
* Gets the imprint isbn.
|
||||||
*
|
*
|
||||||
|
@ -713,7 +672,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return imprint_isbn;
|
return imprint_isbn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the imprint isbn.
|
* Sets the imprint isbn.
|
||||||
*
|
*
|
||||||
|
@ -723,7 +681,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.imprint_isbn = imprint_isbn;
|
this.imprint_isbn = imprint_isbn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the imprint place.
|
* Gets the imprint place.
|
||||||
*
|
*
|
||||||
|
@ -733,7 +690,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return imprint_place;
|
return imprint_place;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the imprint place.
|
* Sets the imprint place.
|
||||||
*
|
*
|
||||||
|
@ -743,7 +699,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.imprint_place = imprint_place;
|
this.imprint_place = imprint_place;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the partof title.
|
* Gets the partof title.
|
||||||
*
|
*
|
||||||
|
@ -753,7 +708,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return partof_title;
|
return partof_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the partof title.
|
* Sets the partof title.
|
||||||
*
|
*
|
||||||
|
@ -763,7 +717,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.partof_title = partof_title;
|
this.partof_title = partof_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the partof pages.
|
* Gets the partof pages.
|
||||||
*
|
*
|
||||||
|
@ -773,7 +726,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return partof_pages;
|
return partof_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the partof pages.
|
* Sets the partof pages.
|
||||||
*
|
*
|
||||||
|
@ -783,7 +735,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.partof_pages = partof_pages;
|
this.partof_pages = partof_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the thesis supervisors.
|
* Gets the thesis supervisors.
|
||||||
*
|
*
|
||||||
|
@ -793,7 +744,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return thesis_supervisors;
|
return thesis_supervisors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the thesis supervisors.
|
* Sets the thesis supervisors.
|
||||||
*
|
*
|
||||||
|
@ -803,7 +753,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.thesis_supervisors = thesis_supervisors;
|
this.thesis_supervisors = thesis_supervisors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the thesis university.
|
* Gets the thesis university.
|
||||||
*
|
*
|
||||||
|
@ -813,7 +762,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return thesis_university;
|
return thesis_university;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the thesis university.
|
* Sets the thesis university.
|
||||||
*
|
*
|
||||||
|
@ -823,7 +771,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.thesis_university = thesis_university;
|
this.thesis_university = thesis_university;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the subjects.
|
* Gets the subjects.
|
||||||
*
|
*
|
||||||
|
@ -833,7 +780,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return subjects;
|
return subjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the subjects.
|
* Sets the subjects.
|
||||||
*
|
*
|
||||||
|
@ -843,7 +789,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.subjects = subjects;
|
this.subjects = subjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the version.
|
* Gets the version.
|
||||||
*
|
*
|
||||||
|
@ -853,7 +798,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the version.
|
* Sets the version.
|
||||||
*
|
*
|
||||||
|
@ -863,7 +807,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the language.
|
* Gets the language.
|
||||||
*
|
*
|
||||||
|
@ -873,7 +816,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the language.
|
* Sets the language.
|
||||||
*
|
*
|
||||||
|
@ -883,7 +825,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.language = language;
|
this.language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the locations.
|
* Gets the locations.
|
||||||
*
|
*
|
||||||
|
@ -893,7 +834,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return locations;
|
return locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the locations.
|
* Sets the locations.
|
||||||
*
|
*
|
||||||
|
@ -903,7 +843,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.locations = locations;
|
this.locations = locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the dates.
|
* Gets the dates.
|
||||||
*
|
*
|
||||||
|
@ -913,7 +852,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return dates;
|
return dates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the dates.
|
* Sets the dates.
|
||||||
*
|
*
|
||||||
|
@ -923,7 +861,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
this.dates = dates;
|
this.dates = dates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the method.
|
* Gets the method.
|
||||||
*
|
*
|
||||||
|
@ -933,7 +870,6 @@ public class ZenodoMetadata implements Serializable{
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the method.
|
* Sets the method.
|
||||||
*
|
*
|
||||||
|
@ -944,24 +880,28 @@ public class ZenodoMetadata implements Serializable{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the licenses.
|
* Sets the license IDs.
|
||||||
*
|
*
|
||||||
* @param licenses the new licenses
|
* @param licensesIDs the new license IDs
|
||||||
*/
|
*/
|
||||||
public void setLicenses(SerializableEnum<LicenseBean> licenses) {
|
public void setLicenseIDs(List<String> licensesIDs) {
|
||||||
this.licenses = licenses;
|
this.licenseIDs = licensesIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the licenses.
|
* Gets the license IDs.
|
||||||
*
|
*
|
||||||
* @return the licenses
|
* @return the license IDs
|
||||||
*/
|
*/
|
||||||
public SerializableEnum<LicenseBean> getLicenses() {
|
public List<String> getLicenseIDs() {
|
||||||
return licenses;
|
return licenseIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -1051,8 +991,8 @@ public class ZenodoMetadata implements Serializable{
|
||||||
builder.append(dates);
|
builder.append(dates);
|
||||||
builder.append(", method=");
|
builder.append(", method=");
|
||||||
builder.append(method);
|
builder.append(method);
|
||||||
builder.append(", licenses=");
|
builder.append(", licenseIDs=");
|
||||||
builder.append(licenses);
|
builder.append(licenseIDs);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,101 @@
|
||||||
package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
|
package org.gcube.portlets.widgets.ckan2zenodopublisher.client;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.time.Instant;
|
||||||
import java.util.regex.Pattern;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.ws.rs.client.Entity;
|
||||||
|
|
||||||
|
import org.gcube.data.publishing.ckan2zenodo.Fixer;
|
||||||
|
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.ZenodoDeposition;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
|
||||||
public class Tester {
|
public class Tester {
|
||||||
|
|
||||||
public static String expression = "^\\/dataset(\\?([a-zA-Z0-9_.-]*.+))*";
|
public static String expression = "^\\/dataset(\\?([a-zA-Z0-9_.-]*.+))*";
|
||||||
public static String toMatch = "/dataset?systemtype=E39_Actor&groups=huma_num___nakala";
|
public static String toMatch = "/dataset?systemtype=E39_Actor&groups=huma_num___nakala";
|
||||||
|
|
||||||
|
private static ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
static {
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
|
||||||
|
mapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false);
|
||||||
|
mapper.setSerializationInclusion(Include.NON_NULL);
|
||||||
|
// mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// Pattern p = Pattern.compile(expression);
|
||||||
|
// Matcher m = p.matcher(toMatch);
|
||||||
|
// boolean b = m.matches();
|
||||||
|
//
|
||||||
|
// System.out.println(b);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Pattern p = Pattern.compile(expression);
|
|
||||||
Matcher m = p.matcher(toMatch);
|
|
||||||
boolean b = m.matches();
|
|
||||||
|
|
||||||
System.out.println(b);
|
//ObjectMapper mapper = new ObjectMapper();
|
||||||
|
ZenodoDeposition zed = new ZenodoDeposition();
|
||||||
|
DepositionMetadata metadata = new DepositionMetadata();
|
||||||
|
metadata.setPublication_date(Date.from(Instant.now()));
|
||||||
|
//zed.setMetadata(metadata);
|
||||||
|
|
||||||
|
String serialized;
|
||||||
|
try {
|
||||||
|
System.out.println("init json: "+mapper.writeValueAsString(metadata));
|
||||||
|
|
||||||
|
serialized = "{\"metadata\":"+Fixer.fixIncoming(mapper.writeValueAsString(metadata))+"}";
|
||||||
|
System.out.println("serialized: "+serialized);
|
||||||
|
|
||||||
|
Entity<String> JSON = Entity.json(serialized);
|
||||||
|
System.out.println("JSON: "+JSON);
|
||||||
|
ZenodoDeposition object = mapper.readValue(Fixer.fixIncoming(serialized), ZenodoDeposition.class);
|
||||||
|
System.out.println("ZenodoDeposition: "+object);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//System.out.println(metadata.getPublication_date());
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// updateMetadata(metadata);
|
||||||
|
// } catch (ZenodoException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ZenodoDeposition updateMetadata(DepositionMetadata meta) throws ZenodoException {
|
||||||
|
try{
|
||||||
|
String serialized="{\"metadata\":"+Fixer.fixIncoming(mapper.writeValueAsString(meta))+"}";
|
||||||
|
System.out.println("serialized: "+serialized);
|
||||||
|
try {
|
||||||
|
// Response resp = getWebClient().target(credentials.getBaseUrl()).
|
||||||
|
// path(DEPOSITION_BASE_URL).path(depositionId+"").
|
||||||
|
// queryParam(ACCESS_TOKEN, credentials.getKey()).request(CONTENT_TYPE)
|
||||||
|
// .put(Entity.json(serialized));
|
||||||
|
// return check(resp,ZenodoDeposition.class);
|
||||||
|
|
||||||
|
Entity<String> JSON = Entity.json(serialized);
|
||||||
|
System.out.println("JSON: "+JSON);
|
||||||
|
return mapper.readValue(Fixer.fixIncoming(serialized), ZenodoDeposition.class);
|
||||||
|
}catch(Throwable t) {
|
||||||
|
System.out.println("Error while tryin to update "+serialized);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}catch(JsonProcessingException e) {
|
||||||
|
System.out.println("Error while parsing "+meta + " " +e);
|
||||||
|
throw new ZenodoException("Internal error.",e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue