Package com.norconex.committer.core
Class CommitterUtil
java.lang.Object
com.norconex.committer.core.CommitterUtil
Committer-related utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyTargetContent(CommitterRequest req, String targetContentField) Applies the document content (input stream) to the target field name.static voidapplyTargetId(CommitterRequest req, String sourceIdField, String targetIdField) Applies the source ID field value after extracting it usingextractSourceIdValue(CommitterRequest, String), to the target ID ID field supplied.static StringextractSourceIdValue(CommitterRequest req, String sourceIdField) Extracts the source ID value.static StringextractSourceIdValue(CommitterRequest req, String sourceIdField, boolean keepSourceIdField) Extracts the source ID value.static StringGets the request content as a string.
-
Method Details
-
getContentAsString
Gets the request content as a string. Only applicable toUpsertRequestinstances.- Parameters:
req- committer request- Returns:
- content as string, or
null - Throws:
CommitterException- could not get content as string
-
extractSourceIdValue
Extracts the source ID value. If the supplied source ID value argument is not blank, the value is obtained from the corresponding metadata field and that field is deleted. Otherwise the document reference is returned.- Parameters:
req- committer requestsourceIdField- name of the metadata field holding the ID value or blank.- Returns:
- the source id value
-
extractSourceIdValue
public static String extractSourceIdValue(CommitterRequest req, String sourceIdField, boolean keepSourceIdField) Extracts the source ID value. If the supplied source ID value argument is not blank, the value is obtained from the corresponding metadata field. Otherwise the document reference is returned.- Parameters:
req- committer requestsourceIdField- name of the metadata field holding the ID value or blank.keepSourceIdField- whether to keep the source ID field- Returns:
- the source id value
-
applyTargetContent
public static void applyTargetContent(CommitterRequest req, String targetContentField) throws CommitterException Applies the document content (input stream) to the target field name. If thetargetContentFieldargument isnullor blank, the document content is ignored (not set). Only applicable toUpsertRequestinstances.- Parameters:
req- committer requesttargetContentField- name of the target field holding the document content.- Throws:
CommitterException- could not apply target content
-
applyTargetId
Applies the source ID field value after extracting it usingextractSourceIdValue(CommitterRequest, String), to the target ID ID field supplied. IftargetIdFieldor source ID value, isnullor blank, the document ID is ignored (not set).- Parameters:
req- committer requestsourceIdField- name of the source field holding the document IDtargetIdField- name of the target field holding the document ID
-