Search in sources :

Example 1 with LinkedHashMap

use of jetbrains.exodus.core.dataStructures.hash.LinkedHashMap in project xodus by JetBrains.

the class UniqueKeyIndicesEngine method getUniqueKeyIndexName.

private String getUniqueKeyIndexName(@NotNull final Index index) {
    final List<IndexField> fields = index.getFields();
    final int fieldCount = fields.size();
    if (fieldCount < 1) {
        throw new EntityStoreException("Can't define unique key on empty set of fields");
    }
    final LinkedHashMap<String, Boolean> names = new LinkedHashMap<>();
    for (final IndexField field : fields) {
        final String name = field.getName();
        final Boolean b = names.get(name);
        if (b != null && b == field.isProperty()) {
            throw new EntityStoreException("Can't define unique key, field is used twice: " + name);
        }
        names.put(name, field.isProperty());
    }
    return getUniqueKeyIndexName(index.getOwnerEntityType(), names);
}
Also used : IndexField(jetbrains.exodus.query.metadata.IndexField) LinkedHashMap(jetbrains.exodus.core.dataStructures.hash.LinkedHashMap)

Aggregations

LinkedHashMap (jetbrains.exodus.core.dataStructures.hash.LinkedHashMap)1 IndexField (jetbrains.exodus.query.metadata.IndexField)1