Class NamedEntityUtility
- java.lang.Object
-
- com.nuix.superutilities.namedentities.NamedEntityUtility
-
public class NamedEntityUtility extends java.lang.Object
Provides functionality for working with Nuix named entities.
-
-
Constructor Summary
Constructors Constructor Description NamedEntityUtility()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedEntityRedactionResults
recordRedactedCopies(java.util.Collection<nuix.Item> items, NamedEntityRedactionSettings settings)
Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text.NamedEntityRedactionResults
recordRedactedCopies(nuix.Case nuixCase, NamedEntityRedactionSettings settings)
Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text.NamedEntityRedactionResults
recordRedactedCopies(nuix.Case nuixCase, java.util.Collection<nuix.Item> arbitraryItems, NamedEntityRedactionSettings settings)
Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text.NamedEntityRedactionResults
recordRedactedCopies(nuix.Item item, NamedEntityRedactionSettings settings)
Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text.static void
saveRedactionProfile(java.io.File destination, NamedEntityRedactionResults redactionResults, NamedEntityRedactionSettings settings)
Builds and saves to a file a Nuix metadata profile containing fields 'Name' and 'Position' as well as a series of derived fields that use "first-non-blank" to coalesce a redacted field and the based original field.static void
saveRedactionProfile(java.lang.String destination, NamedEntityRedactionResults redactionResults, NamedEntityRedactionSettings settings)
Builds and saves to a file a Nuix metadata profile containing fields 'Name' and 'Position' as well as a series of derived fields that use "first-non-blank" to coalesce a redacted field and the based original field.void
whenMessageGenerated(java.util.function.Consumer<java.lang.String> callback)
Registers callback for when this instance logs a message.void
whenProgressUpdated(NamedEntityRedactionProgressCallback callback)
Registers callback for when this instance signals it has made progress.
-
-
-
Method Detail
-
whenProgressUpdated
public void whenProgressUpdated(NamedEntityRedactionProgressCallback callback)
Registers callback for when this instance signals it has made progress.- Parameters:
callback
- Invoked when this instance signals it has made progress.
-
whenMessageGenerated
public void whenMessageGenerated(java.util.function.Consumer<java.lang.String> callback)
Registers callback for when this instance logs a message.- Parameters:
callback
- Invoked when this instance logs a message.
-
recordRedactedCopies
public NamedEntityRedactionResults recordRedactedCopies(nuix.Item item, NamedEntityRedactionSettings settings) throws java.lang.Exception
Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text. Find and replace is performed using Pattern objects crafted by taking named entity match strings, escaping them into regex literals and then running find replace against each property or item text. Redactions are then recorded as custom metadata fields back to the item. SeeNamedEntityRedactionSettings
for a list of settings you can configure to determine how this process is performed.- Parameters:
item
- The item to processsettings
- The settings to use while processing the item.- Returns:
- Results object which contains some information about how things went.
- Throws:
java.lang.Exception
- Thrown is something unexpectedly goes wrong.
-
recordRedactedCopies
public NamedEntityRedactionResults recordRedactedCopies(java.util.Collection<nuix.Item> items, NamedEntityRedactionSettings settings)
Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text. This method processes multiple items by repeated calls torecordRedactedCopies(Item, NamedEntityRedactionSettings)
.- Parameters:
items
- The items to processsettings
- The settings to use when processing the items- Returns:
- Results object which contains some information about how things went. Is a combination of the results generated for each individual item.
-
recordRedactedCopies
public NamedEntityRedactionResults recordRedactedCopies(nuix.Case nuixCase, NamedEntityRedactionSettings settings) throws java.lang.Exception
Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text. This method locates items in the specified case based on the list of named entities specified in theNamedEntityRedactionSettings
object provided. Once those items are obtained, this method callsrecordRedactedCopies(Collection, NamedEntityRedactionSettings)
.- Parameters:
nuixCase
- The Nuix case from which items will be obtained.settings
- The settings used to process the obtained items.- Returns:
- Results object which contains some information about how things went. Is a combination of the results generated for each individual item.
- Throws:
java.lang.Exception
- Thrown if something goes wrong running the search to obtain the items to process.
-
recordRedactedCopies
public NamedEntityRedactionResults recordRedactedCopies(nuix.Case nuixCase, java.util.Collection<nuix.Item> arbitraryItems, NamedEntityRedactionSettings settings) throws java.lang.Exception
Creates redacted copies of metadata properties and item content text by performing find and replace operations by finding named entity matches in the values and replacing them with redaction text. This method method accepts an arbitrary collection of items which are filtered to only items with the relevant named entities as specified byrecordRedactedCopies(Collection, NamedEntityRedactionSettings)
. Items with appropriate named entities is determined by first running a search for items with those named entities, as provided byQueryHelper.namedEntityQuery(Collection)
. The hits of that query are then intersected against the arbitrary collection of items provided to produce the filtered collection of items which is then provided as an argument in an internal call torecordRedactedCopies(Collection, NamedEntityRedactionSettings)
.- Parameters:
nuixCase
- The Nuix case used to obtain collection of items with relevant named entitiesarbitraryItems
- A collection of items (likely from user selection) from which only items with relevant named entities will be pulledsettings
- The settings used to process the items.- Returns:
- Results object which contains some information about how things went. Is a combination of the results generated for each individual item.
- Throws:
java.lang.Exception
- Thrown if something goes wrong running the search to obtain the items to process.
-
saveRedactionProfile
public static void saveRedactionProfile(java.io.File destination, NamedEntityRedactionResults redactionResults, NamedEntityRedactionSettings settings) throws java.lang.Exception
Builds and saves to a file a Nuix metadata profile containing fields 'Name' and 'Position' as well as a series of derived fields that use "first-non-blank" to coalesce a redacted field and the based original field.- Parameters:
destination
- Where the profile should be saved to.redactionResults
- Results from a redaction run, used to determine which redacted fields need to be in the profile.settings
- Settings used in a redaction run, used mostly to determine prefix used for custom metadata fields.- Throws:
java.lang.Exception
- Thrown if something goes wrong unexpectedly.
-
saveRedactionProfile
public static void saveRedactionProfile(java.lang.String destination, NamedEntityRedactionResults redactionResults, NamedEntityRedactionSettings settings) throws java.lang.Exception
Builds and saves to a file a Nuix metadata profile containing fields 'Name' and 'Position' as well as a series of derived fields that use "first-non-blank" to coalesce a redacted field and the based original field.- Parameters:
destination
- Where the profile should be saved to.redactionResults
- Results from a redaction run, used to determine which redacted fields need to be in the profile.settings
- Settings used in a redaction run, used mostly to determine prefix used for custom metadata fields.- Throws:
java.lang.Exception
- Thrown if something goes wrong unexpectedly.
-
-