Bugfix hide and display ids

This commit is contained in:
Fabio Sinibaldi 2022-11-04 17:48:53 +01:00
parent 6e49b095e4
commit 3c9be903cc
2 changed files with 11 additions and 6 deletions

View File

@ -232,20 +232,20 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
centroidDoc.put(m.getName(),toSetValue);
}
log.info("Inserting Centroid {} into {} ",centroidDoc.toJson(),indexer);
log.info("Inserting Centroid {} into {} ",Serialization.write(centroidDoc.toJson()),indexer);
indexer.insert(centroidDoc);
//TODO SUPPORT HIDE AND DISPLAY
// Support to HIDE AND DISPLAY as requested by invoker
if(requestArguments.containsKey("_toHideIds")){
List<String> ids = requestArguments.getList("_toHideIds",String.class);
List<String> ids = Serialization.convert(requestArguments.get("_toHideIds"),List.class);
log.info("Requested to hide centroids {} ",ids);
indexer.updateIsVisible(false,ids);
}
if(requestArguments.containsKey("_toDisplayIds")){
List<String> ids = requestArguments.getList("_toDisplayIds",String.class);
List<String> ids = Serialization.convert(requestArguments.get("_toDisplayIds"),List.class);
log.info("Requested to hide centroids {} ",ids);
indexer.updateIsVisible(true,ids);
}

View File

@ -25,6 +25,8 @@ import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Test;
import java.util.Arrays;
import static junit.framework.TestCase.*;
import static org.junit.Assume.assumeTrue;
@ -35,8 +37,11 @@ public class IndexerTest extends BasicPluginTest {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Project doc= TestDocuments.documentMap.get("dummy.json");
doc.setProfileID("sdi-tests");
doc.getTheDocument().put("coordX",10d);
doc.getTheDocument().put("coordY",11d);
doc.getTheDocument().put("nome", Arrays.asList("My Little Test","Detto test"));
testIndexing(doc);
}