updated "flagInternalIndex" read

This commit is contained in:
Francesco Mangiacrapa 2023-03-28 17:06:02 +02:00
parent 18458b99f6
commit 374544a28a
1 changed files with 24 additions and 20 deletions

View File

@ -95,6 +95,8 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
UseCaseDescriptor useCaseDescriptor = request.getUseCaseDescriptor();
Document requestArguments = request.getCallParameters();
log.debug("requestArguments is {} ", requestArguments);
IndexDocumentReport report = new IndexDocumentReport(request);
try {
@ -116,7 +118,7 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
centroidDoc.put(DBConstants.Defaults.PROJECT_ID, project.getId());
centroidDoc.put(DBConstants.Defaults.DISPLAYED, true);
boolean isInternalIndex = false;
Boolean isInternalIndex = null;
try {
isInternalIndex = requestArguments.getBoolean("flagInternalIndex");
log.debug("flagInternalIndex read as {} ", isInternalIndex);
@ -125,27 +127,29 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
}
log.info("flagInternalIndex is {} ", isInternalIndex);
try {
log.debug("Trying to generate Geoportal Gis Link...");
//Contacting the Geoportal-Resolver via UriResolverManager
UriResolverManager uriResolverManager = new UriResolverManager("GEO");
GeoportalResolverQueryStringBuilder builder = new GeoportalResolverQueryStringBuilder(project.getProfileID(),project.getId());
builder.scope(request.getContext().getId());
if (isInternalIndex != null) {
try {
log.debug("Trying to generate Geoportal Gis Link...");
// Contacting the Geoportal-Resolver via UriResolverManager
UriResolverManager uriResolverManager = new UriResolverManager("GEO");
GeoportalResolverQueryStringBuilder builder = new GeoportalResolverQueryStringBuilder(
project.getProfileID(), project.getId());
builder.scope(request.getContext().getId());
if(isInternalIndex) {
builder.resolverAs(RESOLVE_AS.PRIVATE);
}else {
builder.resolverAs(RESOLVE_AS.PUBLIC);
if (isInternalIndex) {
builder.resolverAs(RESOLVE_AS.PRIVATE);
} else {
builder.resolverAs(RESOLVE_AS.PUBLIC);
}
Map<String, String> params = builder.buildQueryParameters();
String shortLink = uriResolverManager.getLink(params, true);
log.info("Geoportal GisViewer link is {} ", shortLink);
centroidDoc.put(DBConstants.Defaults.GEOVIEWER_LINK_FIELD, shortLink);
} catch (Exception e) {
log.error("Error on creating the Geoportal GisViewer link for project id {}", project.getId(), e);
}
Map<String, String> params = builder.buildQueryParameters();
String shortLink = uriResolverManager.getLink(params, true);
log.info("Geoportal GisViewer link is {} ", shortLink);
centroidDoc.put(DBConstants.Defaults.GEOVIEWER_LINK_FIELD, shortLink);
}catch (Exception e) {
log.error("Error on creating the Geoportal GisViewer link for project id {}", project.getId(), e);
}
// ********************** EVALAUTE POSITION
log.debug("indexing UseCaseDescriptor {} : Evaluating Centroid... ", useCaseDescriptor.getId());
SpatialReference reference = null;