Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class Settings {
public static final String SYSTEM_SELECTIONMANAGER_MAXRECORDS = "system/selectionmanager/maxrecords";
public static final String SYSTEM_CSW_ENABLE = "system/csw/enable";
public static final String SYSTEM_CSW_ENABLEWHENINDEXING = "system/csw/enabledWhenIndexing";
public static final String SYSTEM_CSW_GETRECORDS_IGNORE_METADATA_NOT_SUPPORTED = "system/csw/getRecordsIgnoreMetadataNotSupported";
public static final String SYSTEM_CSW_CAPABILITY_RECORD_UUID = "system/csw/capabilityRecordUuid";
public static final String SYSTEM_CSW_METADATA_PUBLIC = "system/csw/metadataPublic";
public static final String SYSTEM_USERSELFREGISTRATION_ENABLE = "system/userSelfRegistration/enable";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@
import org.fao.geonet.kernel.schema.MetadataSchema;
import org.fao.geonet.kernel.search.EsFilterBuilder;
import org.fao.geonet.kernel.search.EsSearchManager;
import org.fao.geonet.kernel.setting.SettingManager;
import org.fao.geonet.kernel.setting.Settings;
import org.fao.geonet.utils.Log;
import org.fao.geonet.utils.Xml;
import org.jdom.Attribute;
import org.jdom.Comment;
import org.jdom.Content;
import org.jdom.Element;
import org.jdom.Namespace;
Expand Down Expand Up @@ -458,6 +461,9 @@ public Element search(ServiceContext context, int startPos, int maxRecords,
// TODO: Check to get summary or remove custom summary output

try {
SettingManager sm = context.getBean(SettingManager.class);
boolean ignoreMetadataNotSupported = sm.getValueAsBool(Settings.SYSTEM_CSW_GETRECORDS_IGNORE_METADATA_NOT_SUPPORTED, true);

SearchResponse result = searchManager.query(esJsonQuery, new HashSet<>(), startPos - 1, maxRecords, sort);

List<Hit> hits = result.hits().hits();
Expand All @@ -482,18 +488,25 @@ public Element search(ServiceContext context, int startPos, int maxRecords,
AbstractMetadata metadata = metadataUtils.findOne(mdId);

String displayLanguage = context.getLanguage();
// The query to retrieve GetRecords, filters by portal. No need to re-check again when retrieving each metadata.
Element resultMD = retrieveMetadata(context, metadata.getId() + "",
setName, outSchema, elemNames, typeName, resultType, strategy, displayLanguage, false);
try {
// The query to retrieve GetRecords, filters by portal. No need to re-check again when retrieving each metadata.
Element resultMD = retrieveMetadata(context, metadata.getId() + "",
setName, outSchema, elemNames, typeName, resultType, strategy, displayLanguage, false);

if (resultMD != null) {
if (resultType == ResultType.RESULTS) {
results.addContent(resultMD);
}
if (resultMD != null) {
if (resultType == ResultType.RESULTS) {
results.addContent(resultMD);
}

counter++;
counter++;
}
} catch (InvalidParameterValueEx e) {
if (ignoreMetadataNotSupported) {
results.addContent(new Comment(e.getMessage()));
} else {
throw e;
}
}

}

results.setAttribute("numberOfRecordsMatched", Long.toString(numMatches));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Configuration options:

- *Create element if it does not exist when using XPath in CSW transaction.*: If not checked, only existing elements can be updated.

- *Ignore metadata not supporting requested outputSchema.*: If checked, when a metadata record does not support the requested outputSchema in GetRecords operation, it will be skipped from the search results. If not checked, an exception will be returned.

## Service Metadata Record {#csw-configuration_service_record}

In order to create a custom capabilities, it is recommended to create a dedicated service metadata record (using ISO19115-3 or ISO19139 standards). This record is used to build the capabilities document using the template `web/src/main/webapp/xml/csw/capabilities.xml`.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public enum SettingSet {
Settings.SYSTEM_CSW_ENABLE,
Settings.SYSTEM_CSW_ENABLEWHENINDEXING,
Settings.SYSTEM_CSW_METADATA_PUBLIC,
Settings.SYSTEM_CSW_TRANSACTION_XPATH_UPDATE_CREATE_NEW_ELEMENTS
Settings.SYSTEM_CSW_TRANSACTION_XPATH_UPDATE_CREATE_NEW_ELEMENTS,
Settings.SYSTEM_CSW_GETRECORDS_IGNORE_METADATA_NOT_SUPPORTED
}),
HARVESTER(new String[]{
Settings.SYSTEM_HARVESTER_ENABLE_EDITING
Expand Down
2 changes: 2 additions & 0 deletions web-ui/src/main/resources/catalog/locales/en-admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,8 @@
"system/csw/metadataPublic-help": "When a transaction insert a new record via the CSW-T protocol, automatically publish the record to all users.",
"system/csw/transactionUpdateCreateXPath": "Create element if it does not exist when using XPath in CSW transaction.",
"system/csw/transactionUpdateCreateXPath-help": "If not checked, only existing elements can be updated.",
"system/csw/getRecordsIgnoreMetadataNotSupported": "Ignore metadata not supporting requested outputSchema",
"system/csw/getRecordsIgnoreMetadataNotSupported-help": "When enabled, if a metadata record does not support the requested outputSchema in GetRecords operation, it will be skipped from the search results. If disabled, an exception will be returned.",
"system/feedback": "Feedback",
"system/feedback/email": "Email",
"system/feedback/email-help": "This is the administrator's email address used to send feedback.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@
{{'system/csw/transactionUpdateCreateXPath-help' | translate}}
</p>
</div>
<div data-ng-show="cswSettings['system/csw/enable']">
<label>
<input
type="checkbox"
name="system/csw/getRecordsIgnoreMetadataNotSupported"
value="{{cswSettings['system/csw/getRecordsIgnoreMetadataNotSupported']}}"
data-ng-model="cswSettings['system/csw/getRecordsIgnoreMetadataNotSupported']"
/>
<span
>{{'system/csw/getRecordsIgnoreMetadataNotSupported' | translate}}</span
>
</label>

<p class="help-block">
{{'system/csw/getRecordsIgnoreMetadataNotSupported-help' | translate}}
</p>
</div>
</form>

<div data-gn-need-help="csw-configuration"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/csw/capabilityRecordUuid', '-1', 0, 1220, 'y');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/csw/metadataPublic', 'false', 2, 1310, 'y');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/csw/transactionUpdateCreateXPath', 'true', 2, 1320, 'y');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/csw/getRecordsIgnoreMetadataNotSupported', 'true', 2, 1321, 'y');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/userSelfRegistration/enable', 'false', 2, 1910, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/userFeedback/enable', 'false', 2, 1911, 'n');
INSERT INTO Settings (name, value, datatype, position, internal, editable) VALUES ('system/userFeedback/lastNotificationDate', '', 0, 1912, 'y', 'n');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/csw/getRecordsIgnoreMetadataNotSupported', 'true', 2, 1321, 'y');

UPDATE Settings SET value='4.4.12' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';
Loading