Exemplo n.º 1
0
 private int createNewPropertyIndex(String stringKey) {
   PropertyIndexStore idxStore = getPropertyIndexStore();
   int keyId = (int) idxStore.nextId();
   PropertyIndexRecord record = new PropertyIndexRecord(keyId);
   record.setInUse(true);
   record.setCreated();
   int nameId = idxStore.nextNameId();
   record.setNameId(nameId);
   Collection<DynamicRecord> keyRecords =
       idxStore.allocateNameRecords(nameId, encodeString(stringKey));
   for (DynamicRecord keyRecord : keyRecords) {
     record.addNameRecord(keyRecord);
   }
   idxStore.updateRecord(record);
   indexHolder.addPropertyIndex(stringKey, keyId);
   return keyId;
 }
    public void createPropertyIndex(PropertyIndexStore propIndexStore, String key, int id) {
      long nextIdFromStore = propIndexStore.nextId();
      while (nextIdFromStore < id) {
        nextIdFromStore = propIndexStore.nextId();
      }

      PropertyIndexRecord record = new PropertyIndexRecord(id);

      record.setInUse(true);
      record.setCreated();
      int keyBlockId = propIndexStore.nextNameId();
      record.setNameId(keyBlockId);
      Collection<DynamicRecord> keyRecords =
          propIndexStore.allocateNameRecords(keyBlockId, encodeString(key));
      for (DynamicRecord keyRecord : keyRecords) {
        record.addNameRecord(keyRecord);
      }
      propIndexStore.updateRecord(record);
    }