Added possibility to exclude publish/export of a software version

This commit is contained in:
Luca Frosini 2023-01-10 10:53:40 +01:00
parent 9b8730f077
commit 83bb2c0e8e
4 changed files with 358 additions and 104 deletions

View File

@ -45,6 +45,8 @@ public class SoftwareVersion {
public static final String CODE_LOCATION_PROPERTY_NAME = "code_location";
public static final String CONCEPT_DOI_URL_PROPERTY_NAME = "concept_doi_url";
public static final String DOI_URL_PROPERTY_NAME = "doi_url";
public static final String PUBLISH_PROPERTY_NAME = SoftwareConcept.PUBLISH_PROPERTY_NAME;
public static final String EXPORT_PROPERTY_NAME = SoftwareConcept.EXPORT_PROPERTY_NAME;
public static final String METADATA_PROPERTY_NAME = "metadata";
@JsonIgnore
@ -84,9 +86,12 @@ public class SoftwareVersion {
@JsonProperty(DOI_URL_PROPERTY_NAME)
protected URL doiURL;
// @JsonProperty(UPDATE_PROPERTY_NAME)
// protected Boolean update;
@JsonProperty(PUBLISH_PROPERTY_NAME)
protected Boolean publish;
@JsonProperty(EXPORT_PROPERTY_NAME)
protected Boolean export;
@JsonProperty(METADATA_PROPERTY_NAME)
protected JsonNode metadata;
@ -293,25 +298,45 @@ public class SoftwareVersion {
}
}
// @JsonIgnore
// public Boolean getUpdate() {
// if(update!=null) {
// return update;
// }
// return softwareConcept.getDefaultUpdate();
// }
//
// @JsonGetter(UPDATE_PROPERTY_NAME)
// @JsonInclude(Include.NON_NULL)
// public Boolean getUpdateForSerialization() {
// return update;
// }
//
// @JsonSetter(UPDATE_PROPERTY_NAME)
// public void setUpdate(Boolean update) {
// this.update = update;
// }
@JsonIgnore
public Boolean getPublish() {
if(publish!=null) {
return publish;
}
return true;
}
@JsonGetter(PUBLISH_PROPERTY_NAME)
@JsonInclude(Include.NON_NULL)
public Boolean getPublishForSerialization() {
return publish;
}
@JsonSetter(PUBLISH_PROPERTY_NAME)
public void setPublish(Boolean publish) {
this.publish = publish;
}
@JsonIgnore
public Boolean getExport() {
if(export!=null) {
return export;
}
return true;
}
@JsonGetter(EXPORT_PROPERTY_NAME)
@JsonInclude(Include.NON_NULL)
public Boolean getExportForSerialization() {
return export;
}
@JsonSetter(EXPORT_PROPERTY_NAME)
public void setExport(Boolean export) {
this.export = export;
}
@JsonIgnore
protected ObjectNode parseObjectNode(ObjectNode objectNode) {
Iterator<String> iterator = objectNode.fieldNames();

View File

@ -8,6 +8,7 @@ import java.nio.file.Files;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
import org.gcube.common.software.model.ElaborationType;
import org.gcube.common.software.model.SoftwareConcept;
import org.gcube.common.software.model.SoftwareVersion;
import org.gcube.common.software.process.export.SoftwareVersionExporter;
@ -30,31 +31,37 @@ public class BibLaTeXSoftwareVersionExporter extends SoftwareVersionExporter {
SoftwareConcept softwareConcept = softwareVersion.getSoftwareConcept();
String name = softwareConcept.getName();
switch (softwareConcept.getExport()) {
case ALL:
generate();
break;
case UPDATE_ONLY:
if (softwareVersion.isNewDeposition()) {
ElaborationType export = softwareConcept.getExport();
if(!softwareVersion.getExport()) {
export = ElaborationType.NONE;
}
switch (export) {
case ALL:
generate();
break;
case UPDATE_ONLY:
if (softwareVersion.isNewDeposition()) {
logger.info("Skipping export for {} {}.", name, softwareVersion.getVersion());
return;
}
generate();
break;
case NEW:
if (!softwareVersion.isNewDeposition()) {
logger.info("Skipping export for {} {}.", name, softwareVersion.getVersion());
return;
}
generate();
break;
case NONE:
default:
logger.info("Skipping export for {} {}.", name, softwareVersion.getVersion());
return;
}
generate();
break;
case NEW:
if (!softwareVersion.isNewDeposition()) {
logger.info("Skipping export for {} {}.", name, softwareVersion.getVersion());
return;
}
generate();
break;
case NONE:
default:
logger.info("Skipping export for {} {}.", name, softwareVersion.getVersion());
return;
}
}

View File

@ -397,7 +397,13 @@ public class ZenodoSoftwareVersionPublisher extends SoftwareVersionPublisher {
SoftwareConcept softwareConcept = softwareVersion.getSoftwareConcept();
String name = softwareConcept.getName();
if(softwareConcept.getPublish()==ElaborationType.NONE) {
ElaborationType publish = softwareConcept.getPublish();
if(!softwareVersion.getPublish()) {
publish = ElaborationType.NONE;
}
if(publish==ElaborationType.NONE) {
logger.info("Deposit is disabled for {} {}.",
name , softwareVersion.getVersion());
return;
@ -407,8 +413,8 @@ public class ZenodoSoftwareVersionPublisher extends SoftwareVersionPublisher {
softwareVersion.setNewDeposition(false);
if(softwareConcept.getPublish()==ElaborationType.ALL ||
softwareConcept.getPublish()==ElaborationType.UPDATE_ONLY) {
if(publish==ElaborationType.ALL ||
publish==ElaborationType.UPDATE_ONLY) {
logger.info("Going to update {} {}.",
name , softwareVersion.getVersion());
update();
@ -418,8 +424,8 @@ public class ZenodoSoftwareVersionPublisher extends SoftwareVersionPublisher {
}
}else {
if(softwareConcept.getPublish()==ElaborationType.ALL ||
softwareConcept.getPublish()==ElaborationType.NEW) {
if(publish==ElaborationType.ALL ||
publish==ElaborationType.NEW) {
logger.info("Going to deposit {} {}",
name , softwareVersion.getVersion());

View File

@ -1,6 +1,6 @@
{
"name": "gcat",
"publish": "NONE",
"publish": "ALL",
"export": "ALL",
"short_description": "gCube Catalogue (gCat) Service allows any client to publish on the gCube Catalogue.",
"default_files":
@ -14,7 +14,7 @@
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-catalogue/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
@ -25,8 +25,7 @@
{
"version": "1.0.0",
"date": "2019-01-10",
"files":
[
"files": [
{
"url": "https://nexus.d4science.org/nexus/service/local/repositories/gcube-snapshots/content/org/gcube/data-publishing/gcat/1.0.0-SNAPSHOT/gcat-1.0.0-20190109.172827-2.war",
"desired_name": "{{name}}-v{{version}}.war"
@ -36,13 +35,14 @@
"gcube_release_ticket": null,
"code_location": false,
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1139446"
"doi_url": "https://doi.org/10.5072/zenodo.1139446",
"publish": false,
"export": true
},
{
"version": "1.1.0",
"date": "2019-02-26",
"files":
[
"files": [
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/gcat/1.1.0-4.13.1-177071/gcat-1.1.0-4.13.1-177071-src.zip",
"desired_name": "{{name}}-v{{version}}.zip"
@ -56,13 +56,14 @@
"gcube_release_ticket": "https://support.d4science.org/issues/12988",
"code_location": false,
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1140461"
"doi_url": "https://doi.org/10.5072/zenodo.1140461",
"publish": false,
"export": true
},
{
"version": "1.2.0",
"date": "2019-05-20",
"files":
[
"files": [
{
"url": "https://nexus.d4science.org/nexus/service/local/repositories/gcube-snapshots/content/org/gcube/data-publishing/gcat/1.2.0-SNAPSHOT/gcat-1.2.0-20190520.132914-10.war",
"desired_name": "{{name}}-v{{version}}.war"
@ -72,13 +73,14 @@
"gcube_release_ticket": null,
"code_location": false,
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1140750"
"doi_url": "https://doi.org/10.5072/zenodo.1140750",
"publish": false,
"export": true
},
{
"version": "1.3.0",
"date": "2019-06-27",
"files":
[
"files": [
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/gcat/1.3.0-4.14.0-179505/gcat-1.3.0-4.14.0-179505-src.zip",
"desired_name": "{{name}}-v{{version}}.zip"
@ -92,55 +94,269 @@
"gcube_release_ticket": "https://support.d4science.org/issues/16743",
"code_location": false,
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1143572"
"doi_url": "https://doi.org/10.5072/zenodo.1143572",
"publish": false,
"export": true
},
{
"version": "1.4.0",
"date": "2019-11-20",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "4.15.0",
"gcube_release_ticket": "https://support.d4science.org/issues/17294",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1143583"
"doi_url": "https://doi.org/10.5072/zenodo.1143583",
"publish": false,
"export": true
},
{
"version": "1.4.1",
"date": "2019-12-20",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "4.18.0",
"gcube_release_ticket": "https://support.d4science.org/issues/18335",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1143585"
"doi_url": "https://doi.org/10.5072/zenodo.1143585",
"publish": false,
"export": true
},
{
"version": "1.4.2",
"date": "2020-02-14",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "4.20.0",
"gcube_release_ticket": "https://support.d4science.org/issues/18507",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1143586"
"doi_url": "https://doi.org/10.5072/zenodo.1143586",
"publish": false,
"export": true
},
{
"version": "1.4.3",
"date": "2020-06-16",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "4.23.0",
"gcube_release_ticket": "https://support.d4science.org/issues/19322",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1143587"
"doi_url": "https://doi.org/10.5072/zenodo.1143587",
"publish": false,
"export": true
},
{
"version": "1.4.4",
"date": "2021-02-24",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "5.0.0",
"gcube_release_ticket": "https://support.d4science.org/issues/20648",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1143589"
"doi_url": "https://doi.org/10.5072/zenodo.1143589",
"publish": false,
"export": true
},
{
"version": "1.4.5",
"date": "2021-05-31",
"date": "2021-03-31",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "5.1.0",
"gcube_release_ticket": "https://support.d4science.org/issues/20920",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"doi_url": "https://doi.org/10.5072/zenodo.1143590"
"doi_url": "https://doi.org/10.5072/zenodo.1143590",
"publish": false,
"export": true
},
{
"version": "2.0.0",
"date": "2021-05-04",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "5.2.0",
"gcube_release_ticket": "https://support.d4science.org/issues/19738",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139068",
"doi_url": "https://doi.org/10.5072/zenodo.1139069",
"publish": false,
"export": true
},
{
"version": "2.1.0",
"date": "2022-01-27",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "5.7.0",
"gcube_release_ticket": "https://support.d4science.org/issues/21685/",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139068",
"doi_url": "https://doi.org/10.5072/zenodo.1139070",
"publish": false,
"export": true
},
{
"version": "2.2.0",
"date": "2022-05-12",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "5.11.0",
"gcube_release_ticket": "https://support.d4science.org/issues/22943",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139068",
"doi_url": "https://doi.org/10.5072/zenodo.1139322",
"publish": false,
"export": true
},
{
"version": "2.3.0",
"date": "2022-07-22",
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/data-publishing/{{name}}/{{version}}/{{name}}-{{version}}.war",
"desired_name": "{{name}}-v{{version}}.war"
}
],
"gcube_release_version": "5.13.0",
"gcube_release_ticket": "https://support.d4science.org/issues/23374",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139068",
"doi_url": "https://doi.org/10.5072/zenodo.1139680",
"publish": false,
"export": true
},
{
"version": "2.4.0",
"date": "2022-09-16",
"gcube_release_version": "5.13.1",
"gcube_release_ticket": "https://support.d4science.org/issues/23650",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139068",
"doi_url" : "https://doi.org/10.5072/zenodo.1144798",
"publish": true,
"export": true
},
{
"version": "2.4.1",
"date": "2022-12-07",
"gcube_release_version": "5.14.0",
"gcube_release_ticket": "https://support.d4science.org/issues/23885",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139068",
"doi_url" : "https://doi.org/10.5072/zenodo.1144799",
"publish": true,
"export": true
}
],
"metadata":
@ -158,34 +374,49 @@
"grants":
[
{
"id": "283644"
},
{
"id": "283465"
},
{
"id": "10.13039/501100000780::675680"
},
{
"id": "10.13039/501100000780::818194"
},
{
"id": "10.13039/501100000780::654142"
},
{
"id": "10.13039/501100000780::871042"
},
{
"id": "10.13039/501100000780::823914"
"id": "212488"
},
{
"id": "239019"
},
{
"id": "283465"
},
{
"id": "283644"
},
{
"id": "288754"
},
{
"id": "10.13039/501100000780::654024"
},
{
"id": "10.13039/501100000780::654119"
},
{
"id": "10.13039/501100000780::654142"
},
{
"id": "10.13039/501100000780::654182"
},
{
"id": "10.13039/501100000780::675680"
},
{
"id": "10.13039/501100000780::727610"
},
{
"id": "10.13039/501100000780::731001"
},
{
"id": "10.13039/501100000780::818194"
},
{
"id": "10.13039/501100000780::823914"
},
{
"id": "10.13039/501100000780::824091"
},
{
"id": "10.13039/501100000780::857650"
@ -194,22 +425,7 @@
"id": "10.13039/501100000780::862409"
},
{
"id": "10.13039/501100000780::731001"
},
{
"id": "10.13039/501100000780::654119"
},
{
"id": "212488"
},
{
"id": "10.13039/501100000780::824091"
},
{
"id": "10.13039/501100000780::727610"
},
{
"id": "10.13039/501100000780::654024"
"id": "10.13039/501100000780::871042"
}
],
"keywords":