#19988 Integrated with 'checkEnvironment'. Moved to 1.1.0-SNAPSHOT
This commit is contained in:
parent
347ab5f764
commit
de81ad01f6
|
@ -4,6 +4,12 @@
|
|||
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.0-SNAPSHOT] - 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**
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -15,7 +15,7 @@
|
|||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>ckan2zenodo-publisher-widget</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.2</version>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
||||
<description>
|
||||
gCube Ckan2Zenodo Publisher widget allows to publish D4Science catalogue's items on Zenodo
|
||||
|
@ -44,7 +44,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<version>3.6.3-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -44,4 +44,12 @@ public interface CkanToZenodoPublisherService extends RemoteService {
|
|||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
|
|
|
@ -37,5 +37,7 @@ public interface CkanToZenodoPublisherServiceAsync {
|
|||
|
||||
void readFieldsDescriptions(AsyncCallback<Map<String, String>> callback);
|
||||
|
||||
void checkZenodoEnvironment(AsyncCallback<Boolean> callback);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ 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.TransformationException;
|
||||
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.ZenodoDeposition;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherService;
|
||||
|
@ -51,7 +52,7 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
|||
*/
|
||||
@Override
|
||||
public String publishOnZenodo(ZenodoItem zenodoItem) throws Exception {
|
||||
|
||||
LOG.info("publishOnZenodo called");
|
||||
try {
|
||||
|
||||
if(isOutFromPortal()) {
|
||||
|
@ -59,7 +60,6 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
|||
PortalUtils.getCurrentToken(this.getThreadLocalRequest(), true);
|
||||
}
|
||||
|
||||
|
||||
Ckan2Zenodo client = new Ckan2ZenodoImpl();
|
||||
// Get the item representation
|
||||
CkanItemDescriptor itemDescr = client.read(zenodoItem.getName());
|
||||
|
@ -154,7 +154,7 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
|||
*/
|
||||
@Override
|
||||
public ZenodoItem convertToZenodoItem(CatalogueItem item) throws Exception {
|
||||
|
||||
LOG.info("convertToZenodoItem called");
|
||||
try {
|
||||
|
||||
if(isOutFromPortal()) {
|
||||
|
@ -223,7 +223,7 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
|||
*/
|
||||
@Override
|
||||
public Map<String, String> readFieldsDescriptions() throws Exception {
|
||||
|
||||
LOG.info("readFieldsDescriptions called");
|
||||
try {
|
||||
|
||||
if(isOutFromPortal()) {
|
||||
|
@ -242,6 +242,31 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkZenodoEnvironment() {
|
||||
LOG.info("checkZenodoEnvironment called");
|
||||
boolean isZenodoConfigured = false;
|
||||
|
||||
try {
|
||||
|
||||
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.
|
||||
*
|
||||
|
@ -275,4 +300,5 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue