/** * Indices deleted. * * @return the list */ public List<String> indicesDeleted() { if (previousState == null) { return ImmutableList.of(); } if (!metaDataChanged()) { return ImmutableList.of(); } List<String> deleted = null; for (String index : previousState.metaData().indices().keySet()) { if (!state.metaData().hasIndex(index)) { if (deleted == null) { deleted = Lists.newArrayList(); } deleted.add(index); } } return deleted == null ? ImmutableList.<String> of() : deleted; }
/** * Indices created. * * @return the list */ public List<String> indicesCreated() { if (previousState == null) { return Lists.newArrayList(state.metaData().indices().keySet()); } if (!metaDataChanged()) { return ImmutableList.of(); } List<String> created = null; for (String index : state.metaData().indices().keySet()) { if (!previousState.metaData().hasIndex(index)) { if (created == null) { created = Lists.newArrayList(); } created.add(index); } } return created == null ? ImmutableList.<String> of() : created; }
/** * Index meta data changed. * * @param current the current * @return true, if successful */ public boolean indexMetaDataChanged(IndexMetaData current) { MetaData previousMetaData = previousState.metaData(); if (previousMetaData == null) { return true; } IndexMetaData previousIndexMetaData = previousMetaData.index(current.index()); if (previousIndexMetaData == current) { return false; } return true; }
/** * Meta data changed. * * @return true, if successful */ public boolean metaDataChanged() { return state.metaData() != previousState.metaData(); }