use of com.servoy.j2db.util.ConcurrentSoftvaluesMultimap in project servoy-client by Servoy.
the class RowManager method fireNotifyChange.
void fireNotifyChange(IRowListener skip, Row row, String pkHashKey, Object[] changedColumns, int eventType, boolean isAggregateChange, boolean skipFSM) {
List<IRowListener> toNotify = new ArrayList<>();
if (eventType == RowEvent.INSERT && fsm.config.optimizedNotifyChange()) {
FlattenedSolution flattenedSolution = getFoundsetManager().getApplication().getFlattenedSolution();
listenersByRelationEqualValues.entrySet().stream().forEach(entry -> {
Relation relation = flattenedSolution.getRelation(entry.getKey());
List<Column> columns = relation.getForeignColumnsForEqualConditions(flattenedSolution);
if (!columns.isEmpty()) {
Object[] eqArgs = columns.stream().map(column -> row.getValue(column.getDataProviderID())).toArray();
String eqHash = RowManager.createPKHashKey(eqArgs);
toNotify.addAll(entry.getValue().get(eqHash));
}
});
} else {
// add all related foundsets
listenersByRelationEqualValues.values().stream().map(ConcurrentSoftvaluesMultimap::allValues).forEach(toNotify::addAll);
}
toNotify.addAll(listeners.keySet());
toNotify.remove(skip);
if (!toNotify.isEmpty()) {
RowEvent e = new RowEvent(this, row, pkHashKey, eventType, changedColumns, isAggregateChange);
toNotify.forEach(listener -> listener.notifyChange(e));
}
if (!skipFSM)
fsm.notifyChange(sheet.getTable());
}
Aggregations