public void addMapIndex(MapContainer mapContainer) {
   final Indexes indexes = mapContainer.getIndexes();
   if (indexes.hasIndex()) {
     MapIndexInfo mapIndexInfo = new MapIndexInfo(mapContainer.getName());
     for (Index index : indexes.getIndexes()) {
       mapIndexInfo.addIndexInfo(index.getAttributeName(), index.isOrdered());
     }
     indexInfoList.add(mapIndexInfo);
   }
 }
Пример #2
0
  @Override
  public void run() throws Exception {
    Indexes indexes = mapContainer.getIndexes();
    Index index = indexes.addOrGetIndex(attributeName, ordered);

    final long now = getNow();
    final Iterator<Record> iterator = recordStore.iterator(now, false);
    SerializationService serializationService = getNodeEngine().getSerializationService();
    while (iterator.hasNext()) {
      final Record record = iterator.next();
      Data key = record.getKey();
      Object value = Records.getValueOrCachedValue(record, serializationService);
      QueryableEntry queryEntry = mapContainer.newQueryEntry(key, value);
      index.saveEntryIndex(queryEntry, null);
    }
  }
 @Before
 public void setUp() {
   mockIndexes = mock(Indexes.class);
   mockIndex = mock(Index.class);
   when(mockIndexes.getIndex(anyString())).thenReturn(mockIndex);
   visitor = new OrToInVisitor();
   useConverter(INTEGER_CONVERTER);
 }
 @Override
 public void run() throws Exception {
   MapService mapService = getService();
   MapServiceContext mapServiceContext = mapService.getMapServiceContext();
   for (MapIndexInfo mapIndex : indexInfoList) {
     final MapContainer mapContainer = mapServiceContext.getMapContainer(mapIndex.mapName);
     final Indexes indexes = mapContainer.getIndexes();
     for (MapIndexInfo.IndexInfo indexInfo : mapIndex.lsIndexes) {
       indexes.addOrGetIndex(indexInfo.attributeName, indexInfo.ordered);
     }
   }
   for (InterceptorInfo interceptorInfo : interceptorInfoList) {
     final MapContainer mapContainer = mapServiceContext.getMapContainer(interceptorInfo.mapName);
     InterceptorRegistry interceptorRegistry = mapContainer.getInterceptorRegistry();
     Map<String, MapInterceptor> interceptorMap = interceptorRegistry.getId2InterceptorMap();
     List<Map.Entry<String, MapInterceptor>> entryList = interceptorInfo.interceptors;
     for (Map.Entry<String, MapInterceptor> entry : entryList) {
       if (!interceptorMap.containsKey(entry.getKey())) {
         interceptorRegistry.register(entry.getKey(), entry.getValue());
       }
     }
   }
 }