Upload legacy concessioni as projects

This commit is contained in:
Fabio Sinibaldi 2022-05-10 18:06:39 +02:00
parent f6a4d76a57
commit a77616f189
6 changed files with 721 additions and 181 deletions

View File

@ -54,11 +54,23 @@ public class ProfiledConcessione extends Project {
public static final String TOPIC="topicCategory";
public static final String SUB_TOPIC="subTopic";
public static final String VALUTAZIONE_QUALITA="valutazioneQualita";
public static final String METODO_RACCOLTA="metodoRaccoltaDati";
public static final String SCALA_ACQUISIZIONE="scalaAcquisizione";
}
public static class Relazione{
public static final String RESPONSABILI= "responsabili";
}
public static class Immagini{
public static final String DIDASCALIA= "didascalia";
}
public static class AbstractRelazione{
public static final String ABSTRACT_ITA= "abstractIta";
public static final String ABSTRACT_ENG= "abstractEng";
}
}

View File

@ -10,6 +10,7 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDes
import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.junit.Test;
import javax.jws.soap.SOAPBinding;
import java.io.File;
@ -32,6 +33,7 @@ public abstract class GenericUseCases extends BasicVreTests{
return getClient(getUCID());
}
@Test
public void createNew () throws RemoteException, FileNotFoundException, JsonProcessingException {
String profileID=getUCID();

View File

@ -10,12 +10,20 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
public class FileSets {
public static class RequestBuilder {
RegisterFileSetRequest theRequest=new RegisterFileSetRequest();
public RequestBuilder addAll(Collection<? extends TempFile> toAdd){
if(theRequest.getStreams()==null)
theRequest.setStreams(new ArrayList<TempFile>());
theRequest.getStreams().addAll(toAdd);
return this;
}
public RequestBuilder add(TempFile... f){
if(theRequest.getStreams()==null)
theRequest.setStreams(new ArrayList<TempFile>());

View File

@ -14,7 +14,7 @@ public class GCubeTest {
// testContext = "/pred4s/preprod/preVRE";
// testContext = "/gcube/devsec/devVRE";
testContext = "/gcube/devsec/devVRE";
System.out.println("TEST CONTEXT = "+testContext);

View File

@ -1,201 +1,447 @@
{
"_id": {
"$oid": "613f1cee02ad3d6128abd3d7"
},
"mongo_id": "613f1cee02ad3d6128abd3d7",
"id": 0,
"mongo_id": "6170104295184b186ad0bd9d",
"id": 18,
"recordType": "CONCESSIONE",
"version": "1.0.0",
"licenzaID": "CC-BY",
"licenzaID": "CC0-1.0",
"policy": "OPEN",
"nome": "Mock module",
"folderId": "4dd93a95-811f-47d6-9983-e39cf5de2525",
"lastUpdateTime": "2021-09-13T11:42:06.003",
"lastUpdateUser": null,
"creationTime": "2021-09-13T11:42:06.003",
"creationUser": null,
"report": {
"nome": "Elaiussa Sebaste Excavations",
"folderId": "5ae43087-d90d-4185-b2bb-abc286094da3",
"lastUpdateTime": "2021-07-27T11:56:13.48",
"lastUpdateUser": "NO NAME",
"creationTime": "2021-07-27T11:56:13.48",
"creationUser": "annalisa.falcone",
"report":
{
"objectName": "Publish report",
"errorMessages": [],
"warningMessages": [],
"children": [],
"errorMessages":
[],
"warningMessages":
[],
"children":
[],
"status": "PASSED"
},
"introduzione": "This is my MONGO project",
"descrizioneContenuto": "It contains this and that",
"authors": ["Some one", "Some, oneelse"],
"contributore": "Contrib 1",
"titolari": ["Some one", "Some, oneelse"],
"responsabile": "Someone",
"editore": "Editore",
"fontiFinanziamento": ["Big pharma", "Pentagon"],
"soggetto": ["Research Excavation", "Archeology"],
"risorseCorrelate": null,
"dataInizioProgetto": "2021-09-13T11:42:05.48",
"dataFineProgetto": "2021-09-13T11:42:05.482",
"titolareLicenza": ["Qualcun altro"],
"titolareCopyright": ["Chiedilo in giro"],
"paroleChiaveLibere": ["Robba", "Stuff"],
"paroleChiaveICCD": ["vattelapesca", "somthing something"],
"centroidLat": 40.63000418577982,
"centroidLong": 8.621048885423953,
"relazioneScavo": {
"mongo_id": "613f1d1502ad3d6128abd3de",
"id": 0,
"introduzione": "Le indagini condotte dalla Missione archeologica della Sapienza presso il sito di Elaiussa Sebaste a partire dal 1995 hanno lo scopo di indagare l articolazione e le fasi di occupazione della città antica. Le campagne di scavo, della durata di circa due mesi l anno, vengono condotte in collaborazione con unéquipe di archeologi e restauratori turchi. ",
"descrizioneContenuto": "Relazione di fine scavo e relativo abstract; selezione di immagini rappresentative; posizionamento topografico dell'area indagata, pianta di fine scavo.",
"authors":
[
"Annalisa Polosa (annalisa.polosa@uniroma1) ",
"Asena Kızlarslağnolu (asenakizilarslan@hotmail.com)",
"Massimo Braini (massimo.braini@alice.it)"
],
"contributore": "Annalisa Falcone (annalisa.falcone@beniculturali.it)",
"titolari":
[
"Annalisa Polosa, Sapienza Università di Roma",
"Ministero della Cultura Turco"
],
"responsabile": "Annalisa Polosa",
"editore": "Sapienza Università di Roma",
"fontiFinanziamento":
[
"Grandi Scavi di Ateneo ",
"MAECI",
"Mersin Büyük Şehir Belediyesi "
],
"soggetto":
[
"Research Excavation"
],
"risorseCorrelate":
[
"http://elaiussa.uniroma1.it/"
],
"dataInizioProgetto": "2017-08-05T00:00:00",
"dataFineProgetto": "2017-10-28T00:00:00",
"titolareLicenza":
[
"Annalisa Polosa"
],
"titolareCopyright":
[
"Annalisa Polosa",
"Asena Kızlarslağnolu",
"Massimo Braini"
],
"paroleChiaveLibere":
[
"Elaiussa Sebaste",
"Cilicia"
],
"paroleChiaveICCD":
[
"età romana",
"età bizantina"
],
"centroidLat": 36.4822134617122,
"centroidLong": 34.17519115149149,
"relazioneScavo":
{
"mongo_id": "6170107195184b186ad0bda1",
"id": 96,
"policy": "OPEN",
"licenseID": "CC-BY",
"titolo": "Mock module relazione di scavo",
"creationTime": "2021-09-13T11:42:06.003",
"actualContent": [{
"licenseID": "CC0-1.0",
"titolo": "Elaiussa Sebaste Excavations relazione di scavo",
"creationTime": "2021-07-27T11:56:13.48",
"actualContent":
[
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "application/pdf",
"storageID": "b36cb9de-e209-470b-a4fd-b5585813b35a",
"link": "https://data.dev.d4science.org/shub/E_Q3BiNUhsaGU4N2VlTzY4ei9YQ3V4S1pOZXFla0k2djVrbDcvV25DMTVkQ1ZWeDNGejBTcTBRY1RnT0NLTTNicw=="
}, {
"type": "WorkspaceContent",
"id": 0,
"mimetype": "application/pdf",
"storageID": "19ba1bc8-91ae-46a7-8777-68e1331acda7",
"link": "https://data.dev.d4science.org/shub/E_SENCdzhwTnVxUkpsR1E4RUhzYkw0RzlJem9KSlNZc1VpK1VMWFhYK3NYRFNCZU1LOUJ5YkxTNXFnR2tNNEZmOQ=="
}],
"abstractIta": "semplice sezione abstract",
"abstractEng": "simple abstract section",
"responsabili": ["Some one", "Some, oneelse"],
"soggetto": ["Research Excavation", "Archeology"]
"storageID": "36bfb766-2094-48df-aeec-202d8d740bdf",
"link": "https://data.d4science.org/shub/E_dHVsNFVEU2NkTmh2OUVCbEFucHJNV0M4RDdLUzJHbUx4K3lqSXFWd3g4SnZZVnlobmQycGYveUY5Tzgxb0RVUw==",
"name": "gna_relazione_elaiussa.pdf"
}
],
"responsabili":
[
"Annalisa Polosa"
],
"soggetto":
[
"Research Excavation"
]
},
"immaginiRappresentative": [{
"mongo_id": "613f1cfd02ad3d6128abd3d9",
"abstractRelazione":
{
"mongo_id": null,
"id": 0,
"policy": "OPEN",
"licenseID": "CC0-1.0",
"titolo": "Elaiussa Sebaste Excavations abstract relazione di scavo",
"creationTime": "2021-07-27T11:56:13.48",
"actualContent":
[],
"abstractIta": null,
"abstractEng": null
},
"immaginiRappresentative":
[
{
"mongo_id": "6170109995184b186ad0bda7",
"id": 90,
"policy": "OPEN",
"licenseID": "CC-BY-4.0",
"titolo": "My image number 0",
"creationTime": "2021-09-13T11:42:06.142",
"actualContent": [{
"titolo": null,
"creationTime": "2021-07-27T11:56:13.48",
"actualContent":
[
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "image/png",
"storageID": "6133717f-c527-4c09-9e76-f579ecaa35e9",
"link": "https://data.dev.d4science.org/shub/E_SmtLbC8wTUNLOSsvWkVDQ0Jua3EwSDZXdExTNjJKYVZySFlPSzZ0OGt2UzEydzI5Ymgva3ljNDBwVDExL09KcQ=="
}],
"didascalia": "You can see my image number 0",
"format": "TIFF",
"responsabili": ["Some one", "Some, oneelse"],
"soggetto": ["Research Excavation", "Archeology"]
}, {
"mongo_id": "613f1d0402ad3d6128abd3db",
"id": 0,
"mimetype": "image/jpeg",
"storageID": "fc49bf92-5dea-47a2-8144-59457ca834ed",
"link": "https://data.d4science.org/shub/E_SkdiQWtRNnB3Ly9aNHVtczZpOERKb3NPeTQ4WnplVlY0cHV1Y3YzdUdRb0QyNWk1bzUwRm1OY0hpTHFzVkc5Tg==",
"name": "es17_01.jpg"
}
],
"didascalia": "Vista aerea dell'area pubblica",
"format": null,
"responsabili":
[
"Missione Archeologica a Elaiussa Sebaste"
],
"soggetto":
[
"Research Excavation"
]
},
{
"mongo_id": "617010a995184b186ad0bda9",
"id": 91,
"policy": "OPEN",
"licenseID": "CC-BY-4.0",
"titolo": "My image number 0",
"creationTime": "2021-09-13T11:42:06.142",
"actualContent": [{
"titolo": null,
"creationTime": "2021-07-27T11:56:13.48",
"actualContent":
[
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "image/png",
"storageID": "aee78fe0-1661-4090-8310-cc5809530988",
"link": "https://data.dev.d4science.org/shub/E_b2RXUFBsdTFDdjJ5L1BzUE5xOSt1QktRL1hBMXR0SDNSY09GdXJ5cjB3d0pvTTdXNjRpSURzV0lkVHQwUFh1Rw=="
}],
"didascalia": "You can see my image number 0",
"format": "TIFF",
"responsabili": ["Some one", "Some, oneelse"],
"soggetto": ["Research Excavation", "Archeology"]
}],
"posizionamentoScavo": {
"mongo_id": "613f1d2002ad3d6128abd3e0",
"id": 0,
"mimetype": "image/jpeg",
"storageID": "74fae898-af62-487a-b143-440bd20361da",
"link": "https://data.d4science.org/shub/E_OEtrZFpiamZsOERDc29mQXVndHFRdXYwZm55VTI5OVo2M3ErcnMwc1BJS1NUbE1pVTZKVk9ZUmdhVzMrNTNHSQ==",
"name": "es17_02.jpg"
}
],
"didascalia": "Vista aerea della Basilica delle Grandi Terme",
"format": null,
"responsabili":
[
"Missione Archeologica a Elaiussa Sebaste"
],
"soggetto":
[
"Research Excavation"
]
},
{
"mongo_id": "617010bc95184b186ad0bdab",
"id": 92,
"policy": "OPEN",
"licenseID": "CC-BY-4.0",
"titolo": "Mock module posizionamento scavo",
"creationTime": "2021-09-13T11:42:06.003",
"actualContent": [{
"titolo": null,
"creationTime": "2021-07-27T11:56:13.48",
"actualContent":
[
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "image/jpeg",
"storageID": "77e1d887-fa90-41c2-893b-d174262ad8bb",
"link": "https://data.d4science.org/shub/E_dURmdkN3ZEFqQ2NmUVlxT2ExUGE4UGMwelQ5aTdxVHQwY1ZlMTlKYkxlV1ZWeWZuejdUb2RmNnFWc2FRTlo0OQ==",
"name": "es17_03.jpg"
}
],
"didascalia": "Sepoltura rinvenuta all interno della Basilica delle Grandi Terme",
"format": null,
"responsabili":
[
"Massimo Braini"
],
"soggetto":
[
"Research Excavation"
]
},
{
"mongo_id": "617010cc95184b186ad0bdad",
"id": 93,
"policy": "OPEN",
"licenseID": "CC-BY-4.0",
"titolo": null,
"creationTime": "2021-07-27T11:56:13.48",
"actualContent":
[
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "image/jpeg",
"storageID": "0705b6f1-08e5-46fd-b499-5cd6dfacfb99",
"link": "https://data.d4science.org/shub/E_UE8weXJvcVROY2Rtalg5OE1aYkFzSGp1cmk4eUlIRXBBSTZNM3ZrUkNFTFczMEFZU3RVQWsyVlU5WjJ4cWdNMw==",
"name": "es17_04.jpg"
}
],
"didascalia": "Restituzione 3D della cd. Torre - Faro",
"format": null,
"responsabili":
[
"Massimo Braini"
],
"soggetto":
[
"Research Excavation"
]
}
],
"posizionamentoScavo":
{
"mongo_id": "61701d9595184b186ad0beda",
"id": 95,
"policy": "OPEN",
"licenseID": "CC-BY-4.0",
"titolo": "Elaiussa Sebaste Excavations posizionamento scavo",
"creationTime": "2021-07-27T11:56:13.48",
"actualContent":
[
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "text/plain",
"storageID": "a5fb6a66-ae0e-4c07-8a4b-c43f175e8751",
"link": "https://data.d4science.org/shub/E_RlZMUHYxR1djR0xrUEI4REhuSm1DN2FGU01PeXZVaEF0KzQvejZOMkFTOU1pL0ZqeE5wMDYzNnNVQk10ZEVqMA==",
"name": "elaiussa_epsg4326.cpg"
},
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "application/x-dbf",
"storageID": "22b24ae7-f7ee-47ae-9459-5a43929b693a",
"link": "https://data.d4science.org/shub/E_bnNpazhkeE1LZCtSbDgrV0JyQWc5Y3dQTEZ6VUxCeEN4RTNhYk96MUdTR2tJeElYeEh2N3FyalVmeEhLcCs3MQ==",
"name": "elaiussa_epsg4326.dbf"
},
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "text/plain",
"storageID": "464a0855-c098-4a92-9c48-7a997b4ba397",
"link": "https://data.d4science.org/shub/E_NS9DWWo2VHRjZDJkdkpvejBXZnJkQllNTjdqSWdrUzJwS2FZU29kRXUrRGdzbk5iWnJqbWdyOVRES0ZqVXBPbw==",
"name": "elaiussa_epsg4326.prj"
},
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "text/plain",
"storageID": "2c4533ca-2d1a-4819-a353-d26154a54e9e",
"link": "https://data.d4science.org/shub/E_VmtFeFRiSDNUN28rSC96eWJQZmNCazJ5aEJIZVBRd2ZPUUd0bXpuNzIrVjFxWW1lOXZqT2JPQTFHeHp2VXNLcg==",
"name": "elaiussa_epsg4326.qpj"
},
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "application/x-shapefile",
"storageID": "d1fc3b37-bd48-4e73-8160-e32e86801a3a",
"link": "https://data.dev.d4science.org/shub/E_TEI1dVV6dlVYOEhiR2pmc0FobE5yUnJEdG5sWUV3MElTNXlNWHE3RHVsMmJsQVNwcnBFaUJFaDd1aU4xamEyRw=="
}, {
"storageID": "88e6edbe-4c7e-4f77-b450-6892deeed446",
"link": "https://data.d4science.org/shub/E_NzNNek1abFQrZ2IvZ0xoVnc2Z05wc3hTeEhOU3B3UEZSU0hDTlpUYjJWU1owdzlDTE0ycUVvV0NuK3pNVU5qbA==",
"name": "elaiussa_epsg4326.shp"
},
{
"type": "GeoServerContent",
"id": 0,
"geoserverHostName": "geoserver1.dev.d4science.org",
"geoserverPath": "/srv/geoserver_data/GNA/613f1cee02ad3d6128abd3d7/613f1d2002ad3d6128abd3e0/pos",
"fileNames": ["pos.shp"],
"workspace": "gna_conc_613f1cee02ad3d6128abd3d7",
"store": "pos_store",
"featureType": "pos"
}],
"geoserverHostName": "geona-proto.d4science.org",
"geoserverPath": "/srv/geoserver_data/GNA/6170104295184b186ad0bd9d/61701d9595184b186ad0beda/elaiussa_epsg4326",
"fileNames":
[
"elaiussa_epsg4326.cpg",
"elaiussa_epsg4326.dbf",
"elaiussa_epsg4326.prj",
"elaiussa_epsg4326.qpj",
"elaiussa_epsg4326.shp"
],
"workspace": "gna_conc_6170104295184b186ad0bd9d",
"store": "elaiussa_epsg4326_store",
"featureType": "elaiussa_epsg4326"
}
],
"layerUUID": null,
"layerID": null,
"layerName": "pos",
"wmsLink": "https://geoserver1.dev.d4science.org/geoserver/gna_conc_613f1cee02ad3d6128abd3d7/wms?service=WMS&version=1.1.0&request=GetMap&layers=gna_conc_613f1cee02ad3d6128abd3d7:pos&styles=&bbox=8.620919,40.629750,8.621179,40.630258&srs=EPSG:4326&format=application/openlayers&width=400&height=400",
"workspace": "gna_conc_613f1cee02ad3d6128abd3d7",
"layerName": "elaiussa_epsg4326",
"wmsLink": "https://geona-proto.d4science.org/geoserver/gna_conc_6170104295184b186ad0bd9d/wms?service=WMS&version=1.1.0&request=GetMap&layers=gna_conc_6170104295184b186ad0bd9d:elaiussa_epsg4326&styles=&bbox=34.172259,36.480272,34.178124,36.484155&srs=EPSG:4326&format=application/openlayers&width=400&height=400",
"workspace": "gna_conc_6170104295184b186ad0bd9d",
"abstractSection": "Posizionamento topografico georeferenziato dellarea interessata dalle indagini",
"topicCategory": "Society",
"subTopic": "Archeology",
"bbox": {
"maxLat": 40.630257904721645,
"maxLong": 8.621178639172953,
"minLat": 40.62975046683799,
"minLong": 8.62091913167495
"bbox":
{
"maxLat": 36.4841552675243,
"maxLong": 34.17812371253742,
"minLat": 36.4802716559001,
"minLong": 34.17225859044556
},
"paroleChiaveLibere": ["Robba", "Stuff"],
"paroleChiaveICCD": ["vattelapesca", "somthing something"],
"valutazioneQualita": "Secondo me si",
"metodoRaccoltaDati": "Fattobbene",
"scalaAcquisizione": "1:10000",
"authors": ["Some one", "Some, oneelse"],
"responsabile": "Someone"
"paroleChiaveLibere":
[
"Elaiussa Sebaste",
"Cilicia"
],
"paroleChiaveICCD":
[
"età romana",
"età bizantina"
],
"valutazioneQualita": "accurata",
"metodoRaccoltaDati": "Inquadramento topografico mediante poligonale georiferita, rilievo strumentale mediante prevalentemente stazione totale, rilevo diretto e acquisizioni di dati digitali funzionali allo sviluppo di modellazione tridimensionale.",
"scalaAcquisizione": "1:1",
"authors":
[
"Massimo Braini"
],
"responsabile": "Annalisa Polosa"
},
"pianteFineScavo": [{
"mongo_id": "613f1d3302ad3d6128abd3e3",
"id": 0,
"policy": "RESTRICTED",
"pianteFineScavo":
[
{
"mongo_id": "61701dff95184b186ad0bee0",
"id": 94,
"policy": "OPEN",
"licenseID": "CC-BY-4.0",
"titolo": "Mock module pianta fine scavo",
"creationTime": "2021-09-13T11:42:06.003",
"actualContent": [{
"titolo": "Elaiussa Sebaste Excavations pianta fine scavo",
"creationTime": "2021-07-27T11:56:13.48",
"actualContent":
[
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "text/plain",
"storageID": "2229b43e-a54e-48c2-a58d-cfd857f6ee55",
"link": "https://data.d4science.org/shub/E_UDJDK1VJM2NjcWRocVF0WXR4dmNtczJwZGMxRTFOcEczaWI4NUIxcGM5bCtiUC9CenBjcmZaNVRVcGxvcnE4Ng==",
"name": "es18_generalplan_epsg4326_solo_aree_2017.cpg"
},
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "application/x-dbf",
"storageID": "d1794286-bec2-4386-b202-af6eec004b36",
"link": "https://data.d4science.org/shub/E_d1I5VnlTdlE0ZHlxRjZ4MTViRnlCd0s0OW4vMjlmT2c2dVhtT2d5eVc1TkpWdFFKa0NOall6d0Q3NCtSTzZHRA==",
"name": "es18_generalplan_epsg4326_solo_aree_2017.dbf"
},
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "text/plain",
"storageID": "98f5ad6a-08f0-4d06-8bae-34fbffab4583",
"link": "https://data.d4science.org/shub/E_K1Axanc4Qm5USVY1WmwwRE9JRStVYVN2MVpSMnFXaWxUc2tsaHJITmFXR3J1Sk9IQlJPT1c5Sk9rOUl3S2JYWQ==",
"name": "es18_generalplan_epsg4326_solo_aree_2017.prj"
},
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "text/plain",
"storageID": "1988c622-84f0-470a-94e1-0d8f2e622946",
"link": "https://data.d4science.org/shub/E_VGlqbysyMVlaMXRlQmttSXpscGNKNEVLdnB5MGJYYjZCS0k2SzBvTDJ5K3Nvb0luZHVKR1E0ejNQZHdHMDJWYw==",
"name": "es18_generalplan_epsg4326_solo_aree_2017.qpj"
},
{
"type": "WorkspaceContent",
"id": 0,
"mimetype": "application/x-shapefile",
"storageID": "42518460-60f8-4b1b-a374-f720cec4b795",
"link": "https://data.dev.d4science.org/shub/E_TWxtcHNqN2E1OVNqa2lSa2svN3dJWE9TQlM2dmtoR3NvR2YweHQ4eFBYNUQ4MTdxVnl6SWg2aWl3SXZld21rZg=="
}, {
"type": "WorkspaceContent",
"id": 0,
"mimetype": "application/x-shapefile",
"storageID": "73f44642-ff9f-43b7-a754-5df735ef510f",
"link": "https://data.dev.d4science.org/shub/E_U01hZXRCV3lRVUR0ZmZFUGtnZTJnbm14L240RzJieEJqaWtLYUJmcnVwelNoOWxycXpnbmo0QmRnQU5XMEZBWg=="
}, {
"storageID": "e9252c30-8a6b-4403-8d08-891c43e2a830",
"link": "https://data.d4science.org/shub/E_NzF0eHArcjlYZDRsMjNmWk4yek1FZ0xQUldFNnBpOGR3am1jNER4RFoxLzdUOWFSRFRLNExxaGNGMGxsSnBTVA==",
"name": "es18_generalplan_epsg4326_solo_aree_2017.shp"
},
{
"type": "GeoServerContent",
"id": 0,
"geoserverHostName": "geoserver1.dev.d4science.org",
"geoserverPath": "/srv/geoserver_data/GNA/613f1cee02ad3d6128abd3d7/613f1d3302ad3d6128abd3e3/pianta",
"fileNames": ["pianta.shp", "pianta.shx"],
"workspace": "gna_conc_613f1cee02ad3d6128abd3d7",
"store": "pianta_store",
"featureType": "pianta"
}],
"geoserverHostName": "geona-proto.d4science.org",
"geoserverPath": "/srv/geoserver_data/GNA/6170104295184b186ad0bd9d/61701dff95184b186ad0bee0/es18_generalplan_epsg4326_solo_aree_2017",
"fileNames":
[
"es18_generalplan_epsg4326_solo_aree_2017.cpg",
"es18_generalplan_epsg4326_solo_aree_2017.dbf",
"es18_generalplan_epsg4326_solo_aree_2017.prj",
"es18_generalplan_epsg4326_solo_aree_2017.qpj",
"es18_generalplan_epsg4326_solo_aree_2017.shp"
],
"workspace": "gna_conc_6170104295184b186ad0bd9d",
"store": "es18_generalplan_epsg4326_solo_aree_2017_store",
"featureType": "es18_generalplan_epsg4326_solo_aree_2017"
}
],
"layerUUID": null,
"layerID": null,
"layerName": "pianta",
"wmsLink": "https://geoserver1.dev.d4science.org/geoserver/gna_conc_613f1cee02ad3d6128abd3d7/wms?service=WMS&version=1.1.0&request=GetMap&layers=gna_conc_613f1cee02ad3d6128abd3d7:pianta&styles=&bbox=647502.891667,4470387.347517,647527.486073,4470417.525434&srs=EPSG:4326&format=application/openlayers&width=400&height=400",
"workspace": "gna_conc_613f1cee02ad3d6128abd3d7",
"layerName": "es18_generalplan_epsg4326_solo_aree_2017",
"wmsLink": "https://geona-proto.d4science.org/geoserver/gna_conc_6170104295184b186ad0bd9d/wms?service=WMS&version=1.1.0&request=GetMap&layers=gna_conc_6170104295184b186ad0bd9d:es18_generalplan_epsg4326_solo_aree_2017&styles=&bbox=34.172284,36.481086,34.177920,36.483961&srs=EPSG:4326&format=application/openlayers&width=400&height=400",
"workspace": "gna_conc_6170104295184b186ad0bd9d",
"abstractSection": "Planimetria georeferenziata dell'area indagata al termine delle attività",
"topicCategory": "Society",
"subTopic": "Archeology",
"bbox": {
"maxLat": 4470417.525433567,
"maxLong": 647527.4860734959,
"minLat": 4470387.347516773,
"minLong": 647502.8916670183
"bbox":
{
"maxLat": 36.483961046604634,
"maxLong": 34.17791965087873,
"minLat": 36.481086144812636,
"minLong": 34.1722844286983
},
"paroleChiaveLibere": ["Robba", "Stuff"],
"paroleChiaveICCD": ["vattelapesca", "somthing something"],
"valutazioneQualita": "Secondo me si",
"metodoRaccoltaDati": "Fattobbene",
"scalaAcquisizione": "1:10000",
"authors": ["Some one", "Some, oneelse"],
"responsabile": "Someone"
}],
"genericContent": []
"paroleChiaveLibere":
[
"Elaiussa Sebaste",
"Cilicia"
],
"paroleChiaveICCD":
[
"età romana",
"età bizantina"
],
"valutazioneQualita": "accurata",
"metodoRaccoltaDati": "Inquadramento topografico mediante poligonale georiferita, rilievo strumentale mediante prevalentemente stazione totale, rilevo diretto e acquisizioni di dati digitali funzionali allo sviluppo di modellazione tridimensionale.",
"scalaAcquisizione": "1:1",
"authors":
[
"Massimo Calosi"
],
"responsabile": "Annalisa Polosa"
}
],
"genericContent":
[]
}

View File

@ -1,4 +1,276 @@
package org.gcube.application.cms.usecases;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.custom.gna.concessioni.model.ProfiledConcessione;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.legacy.*;
import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field;
import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import javax.print.Doc;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Consumer;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.statefulMongoConcessioni;
@Slf4j
public class ExportConcessioniAsProfiledDocuments {
public static void main(String[] args) {
// read from imported folder
File dir= new File("/Users/fabioisti/git/gcube-cms-suite/import1632326294149");
String targetContext="/gcube/devsec/devVRE";
Projects<Project> client=projects("profiledConcessioni").build();;
ArrayList<Concessione> found=new ArrayList<>();
for(File elementFolder:dir.listFiles())
for(File jsonFile:elementFolder.listFiles((dir1, name) -> {return name.endsWith(".json");}))
try {
log.info("Reading "+jsonFile.getAbsolutePath());
String json= Files.readFileAsString(jsonFile.getAbsolutePath(), Charset.defaultCharset());
found.add(Serialization.read(json,Concessione.class));
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Loaded "+found.size()+" elements from "+dir.getAbsolutePath());
TokenSetter.set(targetContext);
StorageUtils storage = new StorageUtils();
AtomicLong count = new AtomicLong(0);
AtomicLong warnCount = new AtomicLong(0);
AtomicLong errCount = new AtomicLong(0);
FileSets.RequestBuilder req=null;
for (Concessione c : found) {
try {
log.info("Using {} {}",c.getNome(),c.getMongo_id());
//Copy core fields
Document doc=new Document();
doc.put(ProfiledConcessione.NOME,c.getNome());
doc.put(ProfiledConcessione.INTRODUZIONE,c.getIntroduzione());
doc.put(ProfiledConcessione.DESCRIZIONE_CONTENUTO,c.getDescrizioneContenuto());
doc.put(ProfiledConcessione.AUTHORS,c.getAuthors());
doc.put(ProfiledConcessione.CONTRIBUTORE,c.getContributore());
doc.put(ProfiledConcessione.TITOLARI,c.getTitolari());
doc.put(ProfiledConcessione.RESPONSABILE,c.getResponsabile());
doc.put(ProfiledConcessione.EDITORS,c.getEditore());
doc.put(ProfiledConcessione.FONTI_FINANZIAMENTO,c.getFontiFinanziamento());
doc.put(ProfiledConcessione.SOGGETTO,c.getSoggetto());
doc.put(ProfiledConcessione.RISORSE_CORRELATE,c.getRisorseCorrelate());
doc.put(ProfiledConcessione.DATA_INZIO_PROGETTO,c.getDataInizioProgetto());
doc.put(ProfiledConcessione.DATA_FINE_PROGETTO,c.getDataFineProgetto());
doc.put(ProfiledConcessione.TITOLARE_LICENZA,c.getTitolareLicenza());
doc.put(ProfiledConcessione.TITOLARE_COPYRIGHT,c.getTitolareCopyright());
doc.put(ProfiledConcessione.PAROLE_CHIAVE_LIBERE,c.getParoleChiaveLibere());
doc.put(ProfiledConcessione.PAREOLE_CHIAVE_ICCD,c.getParoleChiaveICCD());
// CREATE Project
Project project = client.createNew(doc);
// Relazione
if(c.getRelazioneScavo()!=null) {
RelazioneScavo rel=c.getRelazioneScavo();
Document relDoc= new Document();
relDoc.put(ProfiledConcessione.Sections.TITOLO,rel.getTitolo());
relDoc.put(ProfiledConcessione.Relazione.RESPONSABILI,rel.getResponsabili());
relDoc.put(ProfiledConcessione.SOGGETTO,rel.getSoggetto());
Document updated =project.getTheDocument();
updated.put(ProfiledConcessione.RELAZIONE_SCAVO,relDoc);
project = client.updateDocument(project.getId(),updated);
List<PersistedContent> content=rel.getActualContent();
if(content!=null && !content.isEmpty()) {
req = FileSets.build("$." + ProfiledConcessione.RELAZIONE_SCAVO, "fileset",
"$." + ProfiledConcessione.RELAZIONE_SCAVO + "." + Field.CHILDREN
+ "[?(@.fileset)]");
req.addAll(upload(content,storage));
project = client.registerFileSet(project.getId(),req.getTheRequest());
}
// upload fileset
}
if(c.getAbstractRelazione()!=null) {
AbstractRelazione abs=c.getAbstractRelazione();
Document absDoc= new Document();
absDoc.put(ProfiledConcessione.Sections.TITOLO,abs.getTitolo());
absDoc.put(ProfiledConcessione.AbstractRelazione.ABSTRACT_ENG,abs.getAbstractEng());
absDoc.put(ProfiledConcessione.AbstractRelazione.ABSTRACT_ITA,abs.getAbstractIta());
Document updated =project.getTheDocument();
updated.put(ProfiledConcessione.ABSTRACT_RELAZIONE,absDoc);
project = client.updateDocument(project.getId(),updated);
//TODO ask Fra about mapping
// list persited content -> absIta, absEng
// List<PersistedContent> content=abs.getActualContent();
// if(content!=null && !content.isEmpty()) {
// req = FileSets.build("$." + ProfiledConcessione.RELAZIONE_SCAVO, "fileset",
// "$." + ProfiledConcessione.RELAZIONE_SCAVO + "." + Field.CHILDREN
// + "[?(@.fileset)]");
// content.forEach(uploader);
// project = client.registerFileSet(project.getId(),req.getTheRequest());
// }
}
//Immagini rappresentative
if(c.getImmaginiRappresentative()!=null){
List<Document> imgs=new ArrayList<>();
for (int i = 0; i < c.getImmaginiRappresentative().size(); i++) {
UploadedImage img=c.getImmaginiRappresentative().get(i);
Document imgDoc=new Document();
imgDoc.put(ProfiledConcessione.Sections.TITOLO,img.getTitolo());
imgDoc.put(ProfiledConcessione.Immagini.DIDASCALIA,img.getDidascalia());
imgDoc.put(ProfiledConcessione.Relazione.RESPONSABILI,img.getResponsabili());
imgDoc.put(ProfiledConcessione.SOGGETTO,img.getSoggetto());
imgs.add(imgDoc);
}
Document updated =project.getTheDocument();
updated.put(ProfiledConcessione.IMMAGINI_RAPPRESENTATIVE,imgs);
project = client.updateDocument(project.getId(),updated);
// FileSets
for (int i = 0; i < c.getImmaginiRappresentative().size(); i++) {
UploadedImage img=c.getImmaginiRappresentative().get(i);
List<PersistedContent> content=img.getActualContent();
if(content!=null && !content.isEmpty()) {
req = FileSets.build("$." + ProfiledConcessione.IMMAGINI_RAPPRESENTATIVE+"["+i+"]", "fileset",
"$." + ProfiledConcessione.IMMAGINI_RAPPRESENTATIVE + "." + Field.CHILDREN
+ "[?(@.fileset)]");
req.addAll(upload(content,storage));
project = client.registerFileSet(project.getId(),req.getTheRequest());
}
}
}
// POS
if(c.getPosizionamentoScavo()!=null) {
LayerConcessione l=c.getPosizionamentoScavo();
Document lDoc= new Document();
lDoc.put(ProfiledConcessione.Sections.TITOLO,l.getTitolo());
lDoc.put(ProfiledConcessione.RESPONSABILE,l.getResponsabile());
lDoc.put(ProfiledConcessione.AUTHORS,l.getAuthors());
lDoc.put(ProfiledConcessione.PAREOLE_CHIAVE_ICCD,l.getParoleChiaveICCD());
lDoc.put(ProfiledConcessione.PAROLE_CHIAVE_LIBERE,l.getParoleChiaveLibere());
lDoc.put(ProfiledConcessione.Layers.TOPIC,l.getTopicCategory());
lDoc.put(ProfiledConcessione.Layers.SUB_TOPIC,l.getSubTopic());
lDoc.put(ProfiledConcessione.Layers.METODO_RACCOLTA,l.getMetodoRaccoltaDati());
lDoc.put(ProfiledConcessione.Layers.SCALA_ACQUISIZIONE,l.getScalaAcquisizione());
lDoc.put(ProfiledConcessione.Layers.VALUTAZIONE_QUALITA,l.getValutazioneQualita());
lDoc.put(ProfiledConcessione.Sections.ABSTRACT,l.getAbstractSection());
Document updated =project.getTheDocument();
updated.put(ProfiledConcessione.POSIZIONAMENTO_SCAVO,lDoc);
project = client.updateDocument(project.getId(),updated);
List<PersistedContent> content=l.getActualContent();
if(content!=null && !content.isEmpty()) {
req = FileSets.build("$." + ProfiledConcessione.POSIZIONAMENTO_SCAVO, "fileset",
"$." + ProfiledConcessione.POSIZIONAMENTO_SCAVO + "." + Field.CHILDREN
+ "[?(@.fileset)]");
req.addAll(upload(content,storage));
project = client.registerFileSet(project.getId(),req.getTheRequest());
}
// upload fileset
}
// Piante
if(c.getPianteFineScavo()!=null){
List<Document> piante=new ArrayList<>();
for (int i = 0; i < c.getPianteFineScavo().size(); i++) {
LayerConcessione l=c.getPianteFineScavo().get(i);
Document lDoc= new Document();
lDoc.put(ProfiledConcessione.Sections.TITOLO,l.getTitolo());
lDoc.put(ProfiledConcessione.RESPONSABILE,l.getResponsabile());
lDoc.put(ProfiledConcessione.AUTHORS,l.getAuthors());
lDoc.put(ProfiledConcessione.PAREOLE_CHIAVE_ICCD,l.getParoleChiaveICCD());
lDoc.put(ProfiledConcessione.PAROLE_CHIAVE_LIBERE,l.getParoleChiaveLibere());
lDoc.put(ProfiledConcessione.Layers.TOPIC,l.getTopicCategory());
lDoc.put(ProfiledConcessione.Layers.SUB_TOPIC,l.getSubTopic());
lDoc.put(ProfiledConcessione.Layers.METODO_RACCOLTA,l.getMetodoRaccoltaDati());
lDoc.put(ProfiledConcessione.Layers.SCALA_ACQUISIZIONE,l.getScalaAcquisizione());
lDoc.put(ProfiledConcessione.Layers.VALUTAZIONE_QUALITA,l.getValutazioneQualita());
lDoc.put(ProfiledConcessione.Sections.ABSTRACT,l.getAbstractSection());
piante.add(lDoc);
}
Document updated =project.getTheDocument();
updated.put(ProfiledConcessione.PIANTE_FINE_SCAVO,piante);
project = client.updateDocument(project.getId(),updated);
// FileSets
for (int i = 0; i < c.getImmaginiRappresentative().size(); i++) {
UploadedImage img=c.getImmaginiRappresentative().get(i);
List<PersistedContent> content=img.getActualContent();
if(content!=null && !content.isEmpty()) {
req = FileSets.build("$." + ProfiledConcessione.PIANTE_FINE_SCAVO+"["+i+"]", "fileset",
"$." + ProfiledConcessione.PIANTE_FINE_SCAVO + "." + Field.CHILDREN
+ "[?(@.fileset)]");
req.addAll(upload(content,storage));
project = client.registerFileSet(project.getId(),req.getTheRequest());
}
}
}
} catch (Throwable throwable) {
System.err.println(throwable);
errCount.incrementAndGet();
} finally {
count.incrementAndGet();
}
}
System.out.println("Done "+count.get()+" [warn : "+warnCount.get()+", err : "+errCount.get()+"]");
}
public static List<TempFile> upload(List<PersistedContent> contents,StorageUtils storage) throws IOException {
ArrayList toReturn = new ArrayList();
for (PersistedContent content : contents)
if (content instanceof WorkspaceContent) {
WorkspaceContent wc = (WorkspaceContent) content;
toReturn.add(storage.putOntoStorage(new URL(wc.getLink()).openStream(), wc.getName()));
}
return toReturn;
}
}