Search in sources :

Example 1 with IndexDefinitions

use of com.enonic.xp.repository.IndexDefinitions in project xp by enonic.

the class RepositoryNodeTranslator method toIndexConfigs.

private static IndexDefinitions toIndexConfigs(final PropertyTree nodeData) {
    final PropertySet indexConfigsSet = nodeData.getSet(INDEX_CONFIG_KEY);
    if (indexConfigsSet != null) {
        final IndexDefinitions.Builder indexConfigs = IndexDefinitions.create();
        for (IndexType indexType : IndexType.values()) {
            final PropertySet indexConfigSet = indexConfigsSet.getSet(indexType.getName());
            if (indexConfigSet != null) {
                final IndexDefinition.Builder indexConfig = IndexDefinition.create();
                final PropertySet mappingSet = indexConfigSet.getSet(MAPPING_KEY);
                indexConfig.mapping(mappingSet == null ? null : IndexMapping.from(mappingSet.toTree()));
                final PropertySet settingsSet = indexConfigSet.getSet(SETTINGS_KEY);
                indexConfig.settings(settingsSet == null ? null : IndexSettings.from(settingsSet.toTree()));
                indexConfigs.add(indexType, indexConfig.build());
            }
        }
        return indexConfigs.build();
    }
    return null;
}
Also used : IndexDefinition(com.enonic.xp.repository.IndexDefinition) PropertySet(com.enonic.xp.data.PropertySet) IndexType(com.enonic.xp.index.IndexType) IndexDefinitions(com.enonic.xp.repository.IndexDefinitions)

Aggregations

PropertySet (com.enonic.xp.data.PropertySet)1 IndexType (com.enonic.xp.index.IndexType)1 IndexDefinition (com.enonic.xp.repository.IndexDefinition)1 IndexDefinitions (com.enonic.xp.repository.IndexDefinitions)1