Skip to content

Commit

Permalink
Update rule calculator to do both inbound and outbound rules as well …
Browse files Browse the repository at this point in the history
…as point-to-point flows

- When decorators updated the classifications are applied

#CTCTOWALTZ-3090
finos#7032
  • Loading branch information
jessica-woodland-scott-db committed Apr 4, 2024
1 parent 752aa8f commit 328a4b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,22 +208,6 @@ private Tuple2<AuthoritativenessRatingValue, Optional<Long>> lookupClassificatio
return resolver.resolve(vantagePointOrgUnit, vantagePointEntity, subject, decorator.decoratorEntity().id());
}

//
// private Optional<Long> lookupFlowClassificationRule(Map<Long, DataType> typesById,
// Map<Long, LogicalFlow> flowsById,
// Map<Long, Application> targetAppsById,
// FlowClassificationRuleResolver resolver,
// DataTypeDecorator decorator) {
// LogicalFlow flow = flowsById.get(decorator.dataFlowId());
// EntityReference vantagePoint = lookupVantagePoint(targetAppsById, flow);
// EntityReference source = flow.source();
//
// Optional<FlowClassificationRuleVantagePoint> flowClassificationRuleVantagePoint = resolver.resolveAuthSource(vantagePoint, source, decorator.dataTypeId());
//
// return flowClassificationRuleVantagePoint
// .map(FlowClassificationRuleVantagePoint::ruleId);
// }


// Vantage point needs to be included in lookup of both point to point flows and org unit flows. So need ot pass in the app and then offer both the OU and App lookup
private EntityReference lookupVantagePoint(Map<Long, Application> appsById, EntityReference lookupEntity) {
Expand All @@ -239,11 +223,4 @@ private EntityReference lookupVantagePoint(Map<Long, Application> appsById, Enti
}
}


private String lookupDataTypeCode(Map<Long, DataType> typesById, DataTypeDecorator decorator) {
long dataTypeId = decorator.decoratorEntity().id();
return typesById.get(dataTypeId).code();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ public int[] addDecorators(String userName,
checkNotNull(userName, "userName cannot be null");
checkNotNull(dataTypeIds, "dataTypeIds cannot be null");

Collection<DataTypeDecorator> dataTypeDecorators
= mkDecorators(userName, entityReference, dataTypeIds);
Collection<DataTypeDecorator> dataTypeDecorators = mkDecorators(
userName,
entityReference,
dataTypeIds);

int[] result = dataTypeDecoratorDaoSelectorFactory
.getDao(entityReference.kind())
Expand Down Expand Up @@ -258,17 +260,10 @@ private Collection<DataTypeDecorator> mkDecorators(String userName,
entityReference,
dtId,
Optional.of(AuthoritativenessRatingValue.NO_OPINION)));
LogicalFlow flow = logicalFlowDao.getByFlowId(entityReference.id());
// boolean requiresRating = flow.source().kind() == APPLICATION && flow.target().kind() == APPLICATION;
boolean requiresRating = true;

return requiresRating
? ratingsCalculator.calculate(decorators)
: decorators;
return ratingsCalculator.calculate(decorators);
}

return map(dataTypeIds,
dtId -> mkDecorator(userName, entityReference, dtId, Optional.empty()));
return map(dataTypeIds, dtId -> mkDecorator(userName, entityReference, dtId, Optional.empty()));
}


Expand Down

0 comments on commit 328a4b2

Please sign in to comment.