Skip to content

Commit

Permalink
CSW server / Use portal filter in GetRecordById requests (#7890)
Browse files Browse the repository at this point in the history
* CSW server / Use portal filter in GetRecordById requests. Fixes #7443

* CSW server / Use portal filter in GetRecordById requests / Only check total. (#100)

---------

Co-authored-by: François Prunayre <[email protected]>
  • Loading branch information
josegar74 and fxprunayre authored Apr 12, 2024
1 parent e63f0b3 commit a51a5a3
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 99 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//=============================================================================
//=== Copyright (C) 2001-2007 Food and Agriculture Organization of the
//=== Copyright (C) 2001-2024 Food and Agriculture Organization of the
//=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
//=== and United Nations Environment Programme (UNEP)
//===
Expand Down Expand Up @@ -30,14 +30,9 @@

import jeeves.server.context.ServiceContext;

import org.apache.commons.lang.NotImplementedException;
import org.fao.geonet.kernel.SchemaManager;
import org.fao.geonet.kernel.setting.SettingInfo;
import org.fao.geonet.utils.Log;
import org.fao.geonet.Util;

import org.fao.geonet.utils.Xml;
import org.apache.commons.lang.StringUtils;
import org.fao.geonet.GeonetContext;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.csw.common.Csw;
Expand All @@ -54,7 +49,6 @@
import org.fao.geonet.kernel.csw.CatalogService;
import org.fao.geonet.kernel.csw.services.AbstractOperation;
import org.fao.geonet.kernel.csw.services.getrecords.SearchController;
import org.fao.geonet.domain.Pair;
import org.fao.geonet.lib.Lib;
import org.jdom.Element;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -76,12 +70,14 @@ public class GetRecordById extends AbstractOperation implements CatalogService {
//---------------------------------------------------------------------------

static final String NAME = "GetRecordById";
private SearchController _searchController;

@Autowired
private SearchController searchController;
@Autowired
private CatalogConfiguration _catalogConfig;
private CatalogConfiguration catalogConfig;

@Autowired
private SchemaManager _schemaManager;
private SchemaManager schemaManager;

@Autowired
public GetRecordById(ApplicationContext applicationContext) {
Expand All @@ -106,7 +102,7 @@ public Element execute(Element request, ServiceContext context) throws CatalogEx
checkVersion(request);
//-- Added for CSW 2.0.2 compliance by [email protected]
checkOutputFormat(request);
String outSchema = OutputSchema.parse(request.getAttributeValue("outputSchema"), _schemaManager);
String outSchema = OutputSchema.parse(request.getAttributeValue("outputSchema"), schemaManager);
//--------------------------------------------------------

ElementSetName setName = getElementSetName(request, ElementSetName.SUMMARY);
Expand Down Expand Up @@ -135,8 +131,8 @@ public Element execute(Element request, ServiceContext context) throws CatalogEx
Lib.resource.checkPrivilege(context, id, ReservedOperation.view);

final String displayLanguage = context.getLanguage();
Element md = SearchController.retrieveMetadata(context, id, setName, outSchema, null, null, ResultType.RESULTS, null,
displayLanguage);
Element md = searchController.retrieveMetadata(context, id, setName, outSchema, null, null, ResultType.RESULTS,null,
displayLanguage, true);

if (md != null) {
final Map<String, GetRecordByIdMetadataTransformer> transformers = context.getApplicationContext()
Expand All @@ -150,7 +146,7 @@ public Element execute(Element request, ServiceContext context) throws CatalogEx

response.addContent(md);

if (_catalogConfig.isIncreasePopularity()) {
if (catalogConfig.isIncreasePopularity()) {
gc.getBean(DataManager.class).increasePopularity(context, id);
}
}
Expand Down
Loading

0 comments on commit a51a5a3

Please sign in to comment.