Examples of ColumnImpl


Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

    @Override
    public Iterator<ResultRowImpl> getRows() {
        prepare();
        if (explain) {
            String plan = getPlan();
            columns = new ColumnImpl[] { new ColumnImpl("explain", "plan", "plan")};
            ResultRowImpl r = new ResultRowImpl(this,
                    Tree.EMPTY_ARRAY,
                    new PropertyValue[] { PropertyValues.newString(plan)},
                    null);
            return Arrays.asList(r).iterator();
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

    @Override
    public Iterator<ResultRowImpl> getRows() {
        prepare();
        if (explain) {
            String plan = getPlan();
            columns = new ColumnImpl[] { new ColumnImpl("explain", "plan", "plan")};
            ResultRowImpl r = new ResultRowImpl(this,
                    Tree.EMPTY_ARRAY,
                    new PropertyValue[] { PropertyValues.newString(plan)},
                    null);
            return Arrays.asList(r).iterator();
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("query execute {} ", statement);
            LOG.debug("query plan {}", getPlan());
        }
        RowIterator rowIt = new RowIterator(context.getBaseState());
        Comparator<ResultRowImpl> orderBy = ResultRowImpl.getComparator(orderings);
        Iterator<ResultRowImpl> it =
                FilterIterators.newCombinedFilter(rowIt, distinct, limit, offset, orderBy);
        if (measure) {
            // run the query
            while (it.hasNext()) {
                it.next();
            }
            columns = new ColumnImpl[] {
                    new ColumnImpl("measure", "selector", "selector"),
                    new ColumnImpl("measure", "scanCount", "scanCount")
            };
            ArrayList<ResultRowImpl> list = new ArrayList<ResultRowImpl>();
            ResultRowImpl r = new ResultRowImpl(this,
                    Tree.EMPTY_ARRAY,
                    new PropertyValue[] {
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

            trees[i] = s.currentTree();
        }
        int columnCount = columns.length;
        PropertyValue[] values = new PropertyValue[columnCount];
        for (int i = 0; i < columnCount; i++) {
            ColumnImpl c = columns[i];
            values[i] = c.currentProperty();
        }
        PropertyValue[] orderValues;
        if (orderings == null) {
            orderValues = null;
        } else {
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.ast.ColumnImpl

        return getColumnIndex(columns, columnName);
    }
   
    static int getColumnIndex(ColumnImpl[] columns, String columnName) {
        for (int i = 0, size = columns.length; i < size; i++) {
            ColumnImpl c = columns[i];
            String cn = c.getColumnName();
            if (cn != null && cn.equals(columnName)) {
                return i;
            }
        }
        return -1;
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.query.qom.ColumnImpl

            session.getWorkspace().getQueryManager().getQOMFactory();
        // get columns
        Map<Name, ColumnImpl> columns = new LinkedHashMap<Name, ColumnImpl>();
        for (Name name : root.getSelectProperties()) {
            String pn = sessionContext.getJCRName(name);
            ColumnImpl col = (ColumnImpl) qomFactory.column(
                    sessionContext.getJCRName(DEFAULT_SELECTOR_NAME), pn, pn);
            columns.put(name, col);
        }
        if (columns.size() == 0) {
            // use node type constraint
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.query.qom.ColumnImpl

         *                               among the column names of the query result table.
         * @throws RepositoryException   if another error occurs.
         */
        public Value getValue(String columnName) throws ItemNotFoundException, RepositoryException {
            try {
                ColumnImpl col = columns.get(columnName);
                if (col == null) {
                    if (isExcerptFunction(columnName)) {
                        // excerpt function with parameter
                        return getExcerpt(columnName);
                    } else {
                        throw new ItemNotFoundException(columnName);
                    }
                }
                Node n = getNode(col.getSelectorName());
                if (n == null) {
                    return null;
                }

                if (NameConstants.JCR_PATH.equals(col.getPropertyQName())) {
                    int idx = getSelectorIndex(col.getSelectorName());
                    QValue p = valueFactory.getQValueFactory().create(hmgr.getPath(sn[idx].getNodeId()));
                    return valueFactory.createValue(p);
                } else if (n.hasProperty(col.getPropertyName())) {
                    Property p = n.getProperty(col.getPropertyName());
                    if (p.getDefinition().isMultiple()) {
                        // mvp values cannot be returned
                        return null;
                    } else {
                        if (p.getDefinition().getRequiredType() == PropertyType.UNDEFINED) {
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.query.qom.ColumnImpl

            session.getWorkspace().getQueryManager().getQOMFactory();
        // get columns
        Map<Name, ColumnImpl> columns = new LinkedHashMap<Name, ColumnImpl>();
        for (Name name : root.getSelectProperties()) {
            String pn = sessionContext.getJCRName(name);
            ColumnImpl col = (ColumnImpl) qomFactory.column(
                    sessionContext.getJCRName(DEFAULT_SELECTOR_NAME), pn, pn);
            columns.put(name, col);
        }
        if (columns.size() == 0) {
            // use node type constraint
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.query.qom.ColumnImpl

         *                               among the column names of the query result table.
         * @throws RepositoryException   if another error occurs.
         */
        public Value getValue(String columnName) throws ItemNotFoundException, RepositoryException {
            try {
                ColumnImpl col = columns.get(columnName);
                if (col == null) {
                    if (isExcerptFunction(columnName)) {
                        // excerpt function with parameter
                        return getExcerpt(columnName);
                    } else {
                        throw new ItemNotFoundException(columnName);
                    }
                }
                Node n = getNode(col.getSelectorName());
                if (n == null) {
                    return null;
                }

                if (NameConstants.JCR_PATH.equals(col.getPropertyQName())) {
                    int idx = getSelectorIndex(col.getSelectorName());
                    QValue p = valueFactory.getQValueFactory().create(hmgr.getPath(sn[idx].getNodeId()));
                    return valueFactory.createValue(p);
                } else if (n.hasProperty(col.getPropertyName())) {
                    Property p = n.getProperty(col.getPropertyName());
                    if (p.isMultiple()) {
                        // mvp values cannot be returned
                        return null;
                    } else {
                        if (p.getDefinition().getRequiredType() == PropertyType.UNDEFINED) {
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.query.qom.ColumnImpl

         *                               among the column names of the query result table.
         * @throws RepositoryException   if another error occurs.
         */
        public Value getValue(String columnName) throws ItemNotFoundException, RepositoryException {
            try {
                ColumnImpl col = columns.get(columnName);
                if (col == null) {
                    if (isExcerptFunction(columnName)) {
                        // excerpt function with parameter
                        return getExcerpt(columnName);
                    } else {
                        throw new ItemNotFoundException(columnName);
                    }
                }
                Node n = getNode(col.getSelectorName());
                if (n == null) {
                    return null;
                }

                if (NameConstants.JCR_PATH.equals(col.getPropertyQName())) {
                    int idx = getSelectorIndex(col.getSelectorName());
                    QValue p = valueFactory.getQValueFactory().create(hmgr.getPath(sn[idx].getNodeId()));
                    return valueFactory.createValue(p);
                } else if (n.hasProperty(col.getPropertyName())) {
                    Property p = n.getProperty(col.getPropertyName());
                    if (p.getDefinition().isMultiple()) {
                        // mvp values cannot be returned
                        return null;
                    } else {
                        if (p.getDefinition().getRequiredType() == PropertyType.UNDEFINED) {
View Full Code Here

Examples of org.apache.jackrabbit.spi.commons.query.qom.ColumnImpl

        QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
        // get columns
        Map<Name, ColumnImpl> columns = new LinkedHashMap<Name, ColumnImpl>();
        for (Name name : root.getSelectProperties()) {
            String pn = session.getJCRName(name);
            ColumnImpl col = (ColumnImpl) qomFactory.column(
                    session.getJCRName(DEFAULT_SELECTOR_NAME), pn, pn);
            columns.put(name, col);
        }
        if (columns.size() == 0) {
            // use node type constraint
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.