Package org.modeshape.jcr.api.index

Examples of org.modeshape.jcr.api.index.IndexColumnDefinition


        if (desc != null) {
            template.setDescription(desc);
        }

        // Set up the columns ...
        IndexColumnDefinition colDefn = indexManager().createIndexColumnDefinitionTemplate().setPropertyName(propertyName)
                                                      .setColumnType(propertyType);
        template.setColumnDefinitions(colDefn);

        // Register the index ...
        indexManager().registerIndex(template, false);
View Full Code Here


        }

        Collection<IndexColumnDefinition> columnDefns = new LinkedList<>();
        for (ChildReference ref : indexDefn.getChildReferences(system)) {
            CachedNode indexColumnDefn = system.getNode(ref);
            IndexColumnDefinition defn = readIndexColumnDefinition(indexColumnDefn);
            columnDefns.add(defn);
        }

        WorkspaceMatchRule rule = RepositoryIndexDefinition.workspaceMatchRule(workspacesRule);
        return new RepositoryIndexDefinition(name, providerNameStr, kind, nodeTypeName, columnDefns, extendedProps, desc,
View Full Code Here

                                    Matcher matcher = COLUMN_DEFN_PATTERN.matcher(columnDefn);
                                    if (matcher.find()) {
                                        final String propertyName = matcher.group(1).trim();
                                        String typeStr = matcher.group(2).trim();
                                        final PropertyType type = PropertyType.valueFor(typeStr);
                                        columns.add(new IndexColumnDefinition() {

                                            @Override
                                            public String getPropertyName() {
                                                return propertyName;
                                            }
View Full Code Here

            if (providerName == null) {
                problems.addError(JcrI18n.indexMustHaveProviderName, defn.getName(), repository.name());
                continue;
            }
            if (defn.hasSingleColumn()) {
                IndexColumnDefinition columnDefn = defn.getColumnDefinition(0);
                Name propName = context.getValueFactories().getNameFactory().create(columnDefn.getPropertyName());
                switch (defn.getKind()) {
                    case UNIQUE_VALUE:
                        if (NON_UNIQUE_PROPERTY_NAMES.contains(propName)) {
                            problems.addError(JcrI18n.unableToCreateUniqueIndexForColumn, defn.getName(),
                                              columnDefn.getPropertyName());
                        }
                        break;
                    case ENUMERATED_VALUE:
                        if (NON_ENUMERATED_PROPERTY_NAMES.contains(propName)) {
                            problems.addError(JcrI18n.unableToCreateEnumeratedIndexForColumn, defn.getName(),
                                              columnDefn.getPropertyName());
                        }
                        break;
                    case VALUE:
                    case NODE_TYPE:
                    case TEXT:
View Full Code Here

    private boolean isChanged( IndexDefinition defn1,
                               IndexDefinition defn2 ) {
        if (defn1.getKind() != defn2.getKind()) return true;
        if (defn1.size() != defn2.size()) return true;
        for (int i = 0; i != defn1.size(); ++i) {
            IndexColumnDefinition col1 = defn1.getColumnDefinition(i);
            IndexColumnDefinition col2 = defn2.getColumnDefinition(i);
            if (isChanged(col1, col2)) return true;
        }
        // We don't care about any properties ...
        return false;
    }
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.api.index.IndexColumnDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.