Skip to content

Commit

Permalink
throw exception if aggregatedVia field is not set (will cause update
Browse files Browse the repository at this point in the history
task to fail)
  • Loading branch information
SrdjanStevanetic committed Jan 22, 2025
1 parent 2304e82 commit c681c1a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ protected void processRoleReference(Organization org) {
}
}

protected void fillAggregatedViaWithOrgIds(Organization org) {
protected void fillAggregatedViaWithOrgIds(Organization org) throws EntityUpdateException {
if (org.getAggregatedViaAggregatorUrls() != null && !org.getAggregatedViaAggregatorUrls().isEmpty()) {
List<String> aggregatorUrls = org.getAggregatedViaAggregatorUrls();
//search in the corefs
Expand All @@ -586,6 +586,13 @@ protected void fillAggregatedViaWithOrgIds(Organization org) {
logger.warn(
"No entities in the db with the sameAs having these aggregator urls: {}", aggregatorUrls);
}
/*
* if the aggregatedVia is not set, this exception will cause the consolidation processor
* spring batch step to fail, resulting a the failed update task
*/
throw new EntityUpdateException(
"Organization aggregatedVia field still not set (not found any internal organization with the given "
+ "aggregator id as a coref)!");
}
else {
org.setAggregatedVia(entityIds);
Expand All @@ -596,8 +603,9 @@ protected void fillAggregatedViaWithOrgIds(Organization org) {
/**
* Method used for entity consolidation
* @param entity consolidated Entities to process reference fields
* @throws EntityUpdateException
*/
public void processReferenceFields(Entity entity) {
public void processReferenceFields(Entity entity) throws EntityUpdateException {
if (EntityTypes.isOrganization(entity.getType())) {
Organization org = (Organization) entity;
// update country reference
Expand Down

0 comments on commit c681c1a

Please sign in to comment.