private static Set<String> findClustersByIds(int[] clusterIdsToIndex, ODatabase database) { Set<String> clustersToIndex = new HashSet<>(); if (clusterIdsToIndex != null) { for (int clusterId : clusterIdsToIndex) { final String clusterNameToIndex = database.getClusterNameById(clusterId); if (clusterNameToIndex == null) throw new OIndexException("Cluster with id " + clusterId + " does not exist."); clustersToIndex.add(clusterNameToIndex); } } return clustersToIndex; }
@Override public OIndexInternal<?> create(OIndexDefinition indexDefinition, String clusterIndexName, Set<String> clustersToIndex, boolean rebuild, OProgressListener progressListener, OBinarySerializer valueSerializer) { if (indexDefinition.getFields().size() > 1) { throw new OIndexException(type + " indexes cannot be used as composite ones."); } return super.create(indexDefinition, clusterIndexName, clustersToIndex, rebuild, progressListener, valueSerializer); }
@Override public OIndexMultiValues create(String name, OIndexDefinition indexDefinition, String clusterIndexName, Set<String> clustersToIndex, boolean rebuild, OProgressListener progressListener) { if (indexDefinition.getFields().size() > 1) { throw new OIndexException(type + " indexes cannot be used as composite ones."); } return super.create(name, indexDefinition, clusterIndexName, clustersToIndex, rebuild, progressListener); }
@Override public void create(OBinarySerializer valueSerializer, boolean isAutomatic, OType[] keyTypes, boolean nullPointerSupport, OBinarySerializer keySerializer, int keySize, Set<String> clustersToIndex, Map<String, String> engineProperties, ODocument metadata, OEncryption encryption) { try { //noinspection unchecked sbTree.create(keySerializer, valueSerializer, keyTypes, keySize, nullPointerSupport, encryption); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during creation of index " + name), e); } }
@Override public boolean remove(Object key) { try { return sbTree.remove(key) != null; } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during removal of key " + key + " from index " + name), e); } }
@Override public void put(Object key, ORID value) { try { sbTree.put(key, value); } catch (IOException e) { throw OException .wrapException(new OIndexException("Error during insertion of key " + key + " and RID " + value + " to index " + name), e); } }
@Override public void clear() { try { sbTree.clear(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during clear index " + name), e); } }
@Override public void update(Object key, OIndexKeyUpdater<Object> updater) { try { sbTree.update(key, updater, null); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during update of key " + key + " in index " + name), e); } }
@Override public void clear() { try { sbTree.clear(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during clearing of index " + name), e); } }
@Override public void delete() { try { sbTree.delete(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during deletion of index " + name), e); } }
@Override public void clear() { try { sbTree.clear(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during clear of index " + name), e); } }
@Override public boolean validatedPut(Object key, ORID value, Validator<Object, ORID> validator) { try { return sbTree.validatedPut(key, value, validator); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during insertion of key " + key + " into index " + name), e); } }
@Override public void delete() { try { sbTree.delete(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during deletion of index " + name), e); } }
@Override public void deleteWithoutLoad(String indexName) { try { sbTree.deleteWithoutLoad(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during deletion of index " + name), e); } }
@Override public void clear() { try { if (partitions != null) for (OHashTable<Object, Object> p : partitions) p.clear(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during clear of index with name " + name), e); } }
@Override public void create(OBinarySerializer valueSerializer, boolean isAutomatic, OType[] keyTypes, boolean nullPointerSupport, OBinarySerializer keySerializer, int keySize, Set<String> clustersToIndex, Map<String, String> engineProperties, ODocument metadata, OEncryption encryption) { try { //noinspection unchecked sbTree.create(keySerializer, keyTypes, keySize, encryption); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error of creation of index " + name), e); } }
@Override public void deleteWithoutLoad(String indexName) { try { sbTree.deleteWithoutLoad(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during deletion of index " + name), e); } }
@Override public boolean remove(Object key) { try { return sbTree.remove(key) != null; } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during removal of key " + key + " from index " + name), e); } }
@Override public void deleteWithoutLoad(String indexName) { try { sbTree.deleteWithoutLoad(); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during deletion of index " + name), e); } }
@Override public void create(OBinarySerializer valueSerializer, boolean isAutomatic, OType[] keyTypes, boolean nullPointerSupport, OBinarySerializer keySerializer, int keySize, Set<String> clustersToIndex, Map<String, String> engineProperties, ODocument metadata, OEncryption encryption) { try { //noinspection unchecked sbTree.create(keySerializer, keyTypes, keySize, encryption); } catch (IOException e) { throw OException.wrapException(new OIndexException("Error during creation of index " + name), e); } }