This commit is contained in:
Fabio Sinibaldi 2021-01-27 16:03:25 +01:00
parent 8772708efb
commit c70ba6651e
6 changed files with 51 additions and 16 deletions

View File

@ -2,7 +2,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.application.geoportal-logic
## [v1.0.14-SNAPSHOT] - 2020-12-11
## [v1.0.14] - 2020-12-11
Fixes "no transaction" issue

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-logic</artifactId>
<version>1.0.14-SNAPSHOT</version>
<version>1.0.14</version>
<name>Geoportal Logic</name>

View File

@ -94,7 +94,7 @@ public class TestModel {
// Piante fine scavo
ArrayList<LayerConcessione> piante=new ArrayList<LayerConcessione>();
for(int i=0;i<2;i++) {
for(int i=0;i<5;i++) {
LayerConcessione pianta=new LayerConcessione();
pianta.setValutazioneQualita("Secondo me si");
pianta.setMetodoRaccoltaDati("Fattobbene");

View File

@ -3,6 +3,7 @@ package org.gcube.application.geoportal;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import org.gcube.application.geoportal.managers.AbstractRecordManager;
import org.gcube.application.geoportal.managers.ConcessioneManager;
@ -117,15 +118,17 @@ public class UseCases {
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.shp")),"pos.shp"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.shx")),"pos.shx"));
for(LayerConcessione layer:TestModel.prepareConcessione().getPianteFineScavo())
List<LayerConcessione> ls=TestModel.prepareConcessione().getPianteFineScavo();
for(int i=0;i<ls.size();i++) {
LayerConcessione layer=ls.get(i);
//Istruisco il manager per gestire il/i payload del layer, specificando i nomi dei file originali
manager.addPiantaFineScavo(layer,
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.dbf")),"qualche Pianta.dbf"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.prj")),"qualche Pianta.prj"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.qpj")),"qualche Pianta.qpj"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.shp")),"qualche Pianta.shp"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.shx")),"qualche Pianta.shx"));
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.dbf")),"qualche Pianta "+i+".dbf"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.prj")),"qualche Pianta "+i+".prj"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.qpj")),"qualche Pianta "+i+".qpj"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.shp")),"qualche Pianta "+i+".shp"),
new InputStreamDescriptor(new FileInputStream(Files.getFileFromResources("concessioni/pos.shx")),"qualche Pianta "+i+".shx"));
}
//If true -> data are published into the SDI
Boolean publish=true;

View File

@ -1,9 +1,13 @@
package org.gcube.application.geoportal;
import java.util.List;
import org.gcube.application.geoportal.utils.Workspace;
import org.gcube.common.storagehub.client.dsl.FileContainer;
import org.gcube.common.storagehub.client.dsl.ContainerType;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.gcube.common.storagehub.client.dsl.ItemContainer;
import org.gcube.common.storagehub.client.dsl.ListResolver;
import org.gcube.common.storagehub.client.dsl.ListResolverTyped;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.gcube.common.storagehub.model.items.Item;
@ -11,22 +15,32 @@ import org.gcube.common.storagehub.model.items.Item;
public class WSTests {
public static void main(String[] args) throws StorageHubException {
TokenSetter.set("/gcube/devNext/NextNext");
TokenSetter.set("/gcube/devsec/devVRE");
StorageHubClient client=Workspace.getClient();
String id="9e397c1f-0b52-4b59-b247-e5ef301978ed";
String id="f835cd8a-0a92-4266-8c33-0b05e202ed94";
ItemContainer item=client.open(id).asItem();
// FolderContainer item=client.open(id).asFolder();
FolderContainer item=client.openVREFolder().openByRelativePath(".GNA_RECORDS").asFolder();
System.out.println(item.get().getPath());
// switch(item.getType()) {
// case FILE :
// FileContainer file=(FileContainer) item;
// file.getAnchestors();
// case FOLDER :
// }
System.out.println(path(item));
// System.out.println(path(item));
//
// System.out.println("TREE : ");
boolean showHidden=true;
printTree("", item,showHidden);
}
public static String path(ItemContainer item) throws StorageHubException {
StringBuilder builder=new StringBuilder();
ListResolver resolver=item.getAnchestors();
@ -36,4 +50,22 @@ public class WSTests {
return builder.toString();
}
public static void printTree(String padding,ItemContainer item,boolean showHidden){
System.out.println(padding + "" +item.get().getName() +" [ID : "+item.getId()+", hidden = "+item.get().isHidden()+"]" );
if(item.getType().equals(ContainerType.FOLDER)) {
FolderContainer c =((FolderContainer)item);
String newPadding=padding+"\t";
List<? extends ItemContainer> l;
try {
ListResolverTyped lt=c.list();
if(showHidden)lt.includeHidden();
l = lt.getContainers();
} catch (StorageHubException e) {
throw new RuntimeException("Errore",e);
}
l.forEach((ItemContainer i)->{printTree(newPadding, i,showHidden);});
}
}
}

View File

@ -1,4 +1,4 @@
log4j.rootLogger=WARN, stdout
log4j.rootLogger=ERROR, stdout
log4j.logger.org.gcube.application=DEBUG, stdout
#CONSOLE