-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-3735 Add an "entity indexing failure" to the failure handler
- Loading branch information
Showing
8 changed files
with
170 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
engine/src/main/java/org/hibernate/search/engine/reporting/EntityIndexingFailureContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.engine.reporting; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* Contextual information about a failure to index entities. | ||
*/ | ||
public class EntityIndexingFailureContext extends FailureContext { | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
private final List<Object> entityReferences; | ||
|
||
private EntityIndexingFailureContext(Builder builder) { | ||
super( builder ); | ||
this.entityReferences = builder.entityReferences == null | ||
? Collections.emptyList() : Collections.unmodifiableList( builder.entityReferences ); | ||
} | ||
|
||
/** | ||
* @return A list of references to entities that may not be indexed correctly as a result of the failure. | ||
* Never {@code null}, but may be empty. | ||
* Use {@link Object#toString()} to get a textual representation of each reference, | ||
* or cast it to the mapper-specific {@code EntityReference} type. | ||
*/ | ||
public List<Object> getEntityReferences() { | ||
return entityReferences; | ||
} | ||
|
||
public static class Builder extends FailureContext.Builder { | ||
|
||
private List<Object> entityReferences; | ||
|
||
private Builder() { | ||
} | ||
|
||
public void entityReference(Object entityReference) { | ||
if ( entityReferences == null ) { | ||
entityReferences = new ArrayList<>(); | ||
} | ||
entityReferences.add( entityReference ); | ||
} | ||
|
||
@Override | ||
public EntityIndexingFailureContext build() { | ||
return new EntityIndexingFailureContext( this ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters