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(); UseCaseDescriptor useCaseDescriptor = request.getUseCaseDescriptor();
Document requestArguments = request.getCallParameters(); Document requestArguments = request.getCallParameters();
log.debug("requestArguments is {} ", requestArguments);
IndexDocumentReport report = new IndexDocumentReport(request); IndexDocumentReport report = new IndexDocumentReport(request);
try { try {
@ -116,7 +118,7 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
centroidDoc.put(DBConstants.Defaults.PROJECT_ID, project.getId()); centroidDoc.put(DBConstants.Defaults.PROJECT_ID, project.getId());
centroidDoc.put(DBConstants.Defaults.DISPLAYED, true); centroidDoc.put(DBConstants.Defaults.DISPLAYED, true);
boolean isInternalIndex = false; Boolean isInternalIndex = null;
try { try {
isInternalIndex = requestArguments.getBoolean("flagInternalIndex"); isInternalIndex = requestArguments.getBoolean("flagInternalIndex");
log.debug("flagInternalIndex read as {} ", isInternalIndex); log.debug("flagInternalIndex read as {} ", isInternalIndex);
@ -125,27 +127,29 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
} }
log.info("flagInternalIndex is {} ", isInternalIndex); log.info("flagInternalIndex is {} ", isInternalIndex);
try { if (isInternalIndex != null) {
log.debug("Trying to generate Geoportal Gis Link..."); try {
//Contacting the Geoportal-Resolver via UriResolverManager log.debug("Trying to generate Geoportal Gis Link...");
UriResolverManager uriResolverManager = new UriResolverManager("GEO"); // Contacting the Geoportal-Resolver via UriResolverManager
GeoportalResolverQueryStringBuilder builder = new GeoportalResolverQueryStringBuilder(project.getProfileID(),project.getId()); UriResolverManager uriResolverManager = new UriResolverManager("GEO");
builder.scope(request.getContext().getId()); GeoportalResolverQueryStringBuilder builder = new GeoportalResolverQueryStringBuilder(
project.getProfileID(), project.getId());
builder.scope(request.getContext().getId());
if(isInternalIndex) { if (isInternalIndex) {
builder.resolverAs(RESOLVE_AS.PRIVATE); builder.resolverAs(RESOLVE_AS.PRIVATE);
}else { } else {
builder.resolverAs(RESOLVE_AS.PUBLIC); 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 // ********************** EVALAUTE POSITION
log.debug("indexing UseCaseDescriptor {} : Evaluating Centroid... ", useCaseDescriptor.getId()); log.debug("indexing UseCaseDescriptor {} : Evaluating Centroid... ", useCaseDescriptor.getId());
SpatialReference reference = null; SpatialReference reference = null;