class EntityGraph implements ConfigurationChangeListener {

    @Override
    public void onRemove(Entity entity) throws IvoryException {
        Map<Node, Set<Node>> nodeEdges = null;
        switch (entity.getEntityType()) {
            case PROCESS:
                nodeEdges = getEdgesFor((Process) entity);
                break;
            case FEED:
                nodeEdges = getEdgesFor((Feed) entity);
                break;
        }
        if (nodeEdges == null)
            return;

        for (Map.Entry<Node, Set<Node>> entry : nodeEdges.entrySet()) {
            if (graph.containsKey(entry.getKey())) {
                graph.get(entry.getKey()).removeAll(entry.getValue());
                if (graph.get(entry.getKey()).isEmpty()) {
                    graph.remove(entry.getKey());
                }
            }
        }
    }

    private  EntityGraph();

}