Interface IEntity
- All Known Implementing Classes:
Image
public interface IEntity
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
active()
Checks if the entity is considered active, based on its removed and ignored status.default void
addMatchedRule
(MatchedRule matchedRule) Adds a single matched rule to this entity.default void
addMatchedRules
(Collection<MatchedRule> matchedRules) Adds a collection of matched rules to this entity.default boolean
applied()
Determines if the entity has been applied, considering manual overwrites.default void
Applies a rule to the entity without specifying a legal basis, which will be replaced by "n-a".default void
Applies a rule to the entity with an optional legal basis.default void
applyWithLineBreaks
(@NonNull String ruleIdentifier, String reason, @NonNull String legalBasis) Applies a rule to the entity, indicating that the value should be written with line breaks.default void
applyWithReferences
(@NonNull String ruleIdentifier, String reason, @NonNull String legalBasis, Collection<com.iqser.red.service.redaction.v1.server.model.document.entity.TextEntity> references) Applies a rule to the entity with a collection of references.default String
Builds a reason string for this entity, incorporating descriptions from manual changes.com.iqser.red.service.redaction.v1.server.model.document.entity.ManualChangeOverwrite
Gets the manual overwrite actions applied to this entity, if any.default MatchedRule
Gets the highest priority matched rule for this entity.Gets the list of rules matched against this entity.default int
Retrieves the 'unit' value of the highest priority matched rule.Gets the range of text in the document associated with this entity.getValue()
Gets the value of this entity as a string.default boolean
Checks if there are any manual changes applied to the entity.default void
Marks the entity as ignored according to a specific rule.default boolean
ignored()
Determines if the entity has been ignored, considering manual overwrites.default String
Retrieves the legal basis for the action taken on this entity, considering any manual overwrite.default int
length()
Calculates the length of the entity's value.default void
Applies a redaction to the entity with a specified legal basis.default Set<com.iqser.red.service.redaction.v1.server.model.document.entity.TextEntity>
Retrieves a set of references associated with the entity's matched rule.default void
Marks the entity as removed according to a specific rule.default boolean
removed()
Determines if the entity has been removed, considering manual overwrites.default boolean
resized()
Checks if the entity has been resized, considering manual overwrites.default void
Marks the entity as skipped according to a specific rule.default boolean
skipped()
Determines if the entity has been skipped, based on its applied status.default void
skipWithReferences
(@NonNull String ruleIdentifier, String reason, Collection<com.iqser.red.service.redaction.v1.server.model.document.entity.TextEntity> references) Marks the entity as skipped for a specific rule and associates a collection of references.type()
Gets the type of this entity.default boolean
valid()
An Entity is valid, when it active and not a false recommendation, a false positive or a dictionary removal.default String
value()
Retrieves the value of the entity, considering any manual overwrite.
-
Method Details
-
getMatchedRuleList
PriorityQueue<MatchedRule> getMatchedRuleList()Gets the list of rules matched against this entity.- Returns:
- A priority queue of matched rules.
-
getManualOverwrite
com.iqser.red.service.redaction.v1.server.model.document.entity.ManualChangeOverwrite getManualOverwrite()Gets the manual overwrite actions applied to this entity, if any.- Returns:
- The manual overwrite details.
-
getValue
String getValue()Gets the value of this entity as a string.- Returns:
- The string value.
-
getTextRange
TextRange getTextRange()Gets the range of text in the document associated with this entity.- Returns:
- The text range.
-
type
String type()Gets the type of this entity.- Returns:
- The entity type.
-
valid
default boolean valid()An Entity is valid, when it active and not a false recommendation, a false positive or a dictionary removal.- Returns:
- true, if the entity is valid, false otherwise/
-
length
default int length()Calculates the length of the entity's value.- Returns:
- The length of the value.
-
value
Retrieves the value of the entity, considering any manual overwrite. If no manual overwrite value is found, return the value of the entity or an empty string if that value is null.- Returns:
- The possibly overwritten value
-
applied
default boolean applied()Determines if the entity has been applied, considering manual overwrites.- Returns:
- True if applied, false otherwise.
-
skipped
default boolean skipped()Determines if the entity has been skipped, based on its applied status.- Returns:
- True if skipped, false otherwise.
-
ignored
default boolean ignored()Determines if the entity has been ignored, considering manual overwrites.- Returns:
- True if ignored, false otherwise.
-
removed
default boolean removed()Determines if the entity has been removed, considering manual overwrites.- Returns:
- True if removed, false otherwise.
-
resized
default boolean resized()Checks if the entity has been resized, considering manual overwrites.- Returns:
- True if resized, false otherwise.
-
active
default boolean active()Checks if the entity is considered active, based on its removed and ignored status. An active entry is not removed or ignored.- Returns:
- True if active, false otherwise.
-
hasManualChanges
default boolean hasManualChanges()Checks if there are any manual changes applied to the entity.- Returns:
- True if there are manual changes, false otherwise.
-
references
default Set<com.iqser.red.service.redaction.v1.server.model.document.entity.TextEntity> references()Retrieves a set of references associated with the entity's matched rule.- Returns:
- A set of references.
-
redact
default void redact(@NonNull @NonNull String ruleIdentifier, String reason, @NonNull @NonNull String legalBasis) Applies a redaction to the entity with a specified legal basis.- Parameters:
ruleIdentifier
- The identifier of the rule being applied.reason
- The reason for the redaction.legalBasis
- The legal basis for the redaction, which must not be blank or empty.- Throws:
IllegalArgumentException
- If the legal basis is blank or empty.
-
apply
Applies a rule to the entity with an optional legal basis.- Parameters:
ruleIdentifier
- The identifier of the rule being applied.reason
- The reason for applying the rule.legalBasis
- The legal basis for the application, can be a default or unspecified value.
-
apply
Applies a rule to the entity without specifying a legal basis, which will be replaced by "n-a".- Parameters:
ruleIdentifier
- The identifier of the rule being applied.reason
- The reason for applying the rule.
-
skip
Marks the entity as skipped according to a specific rule.- Parameters:
ruleIdentifier
- The identifier of the rule being skipped.reason
- The reason for skipping the rule.
-
remove
Marks the entity as removed according to a specific rule.- Parameters:
ruleIdentifier
- The identifier of the rule based on which the entity is removed.reason
- The reason for the removal.
-
ignore
Marks the entity as ignored according to a specific rule.- Parameters:
ruleIdentifier
- The identifier of the rule based on which the entity is removed.reason
- The reason for the removal.
-
applyWithLineBreaks
default void applyWithLineBreaks(@NonNull @NonNull String ruleIdentifier, String reason, @NonNull @NonNull String legalBasis) Applies a rule to the entity, indicating that the value should be written with line breaks.- Parameters:
ruleIdentifier
- The identifier of the rule being applied.reason
- The reason for the rule application.legalBasis
- The legal basis for the rule, which must not be empty.- Throws:
IllegalArgumentException
- If the legal basis is blank or empty.
-
applyWithReferences
default void applyWithReferences(@NonNull @NonNull String ruleIdentifier, String reason, @NonNull @NonNull String legalBasis, Collection<com.iqser.red.service.redaction.v1.server.model.document.entity.TextEntity> references) Applies a rule to the entity with a collection of references.- Parameters:
ruleIdentifier
- The identifier of the rule being applied.reason
- The reason for the rule application.legalBasis
- The legal basis for the rule, which must not be empty.references
- A collection of text entities that are referenced by this rule application.- Throws:
IllegalArgumentException
- If the legal basis is blank or empty.
-
skipWithReferences
default void skipWithReferences(@NonNull @NonNull String ruleIdentifier, String reason, Collection<com.iqser.red.service.redaction.v1.server.model.document.entity.TextEntity> references) Marks the entity as skipped for a specific rule and associates a collection of references.- Parameters:
ruleIdentifier
- The identifier of the rule being skipped.reason
- The reason for skipping the rule.references
- A collection of text entities that are referenced by the skipped rule.
-
addMatchedRule
Adds a single matched rule to this entity.- Parameters:
matchedRule
- The matched rule to add.
-
addMatchedRules
Adds a collection of matched rules to this entity.- Parameters:
matchedRules
- The collection of matched rules to add.
-
getMatchedRuleUnit
default int getMatchedRuleUnit()Retrieves the 'unit' value of the highest priority matched rule.- Returns:
- The unit value of the matched rule.
-
getMatchedRule
Gets the highest priority matched rule for this entity.- Returns:
- The matched rule.
-
buildReasonWithManualChangeDescriptions
Builds a reason string for this entity, incorporating descriptions from manual changes.- Returns:
- The built reason string.
-
legalBasis
Retrieves the legal basis for the action taken on this entity, considering any manual overwrite.- Returns:
- The legal basis.
-