@Override public void preExecute(final OperationChain<?> opChain, final Context context) { if (!edges.isEmpty() || !entities.isEmpty()) { final List<Operation> updatedOps = new ArrayList<>(); for (final Operation op : new ArrayList<>(opChain.flatten())) { updatedOps.add(op); if (OperationView.hasView(op)) { updatedOps.addAll(migrateOperation(op)); } } opChain.updateOperations(updatedOps); } }
private void updateView(final OperationChain<?> opChain) { for (final Operation operation : opChain.flatten()) { if (operation instanceof OperationView) { final OperationView operationView = (OperationView) operation; final View.Builder viewBuilder = mergeView(operationView, getViewToMerge()); if ((null != whiteListElementGroups && !whiteListElementGroups.isEmpty()) || (null != blackListElementGroups && !blackListElementGroups.isEmpty())) { viewBuilder.removeEntities(this::removeElementGroups); viewBuilder.removeEdges(this::removeElementGroups); } if (!addExtraGroups && null != operationView.getView()) { final Set<String> entityGroups = operationView.getView().getEntityGroups(); viewBuilder.removeEntities(grp -> null == entityGroups || !entityGroups.contains(grp.getKey())); final Set<String> edgeGroups = operationView.getView().getEdgeGroups(); viewBuilder.removeEdges(grp -> null == edgeGroups || !edgeGroups.contains(grp.getKey())); } viewBuilder.expandGlobalDefinitions(); operationView.setView(viewBuilder.build()); } } }