Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.QueryObjectModelFactory


        }
        String statement = node.getProperty(resolver.getJCRName(NameConstants.JCR_STATEMENT)).getString();
        String language = node.getProperty(resolver.getJCRName(NameConstants.JCR_LANGUAGE)).getString();

        if (Query.JCR_JQOM.equals(language)) {
            QueryObjectModelFactory qomFactory = new QOMFactory(node, resolver);
            QueryObjectModelBuilder builder = QueryObjectModelBuilderRegistry.getQueryObjectModelBuilder(language);
            return builder.createQueryObjectModel(statement, qomFactory, valueFactory);
        } else {
            return new QueryImpl(session, mgrProvider, itemMgr, wspManager,
                    statement, language, node);
View Full Code Here


     *
     * @return array of columns.
     * @throws RepositoryException if an error occurs.
     */
    protected ColumnImpl[] getColumns() throws RepositoryException {
        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

     * @param propertyName the name of the property as well as the column.
     * @return a column.
     * @throws RepositoryException if an error occurs while creating the column.
     */
    protected ColumnImpl columnForName(Name propertyName) throws RepositoryException {
        QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
        String name = session.getJCRName(propertyName);
        return (ColumnImpl) qomFactory.column(
                session.getJCRName(DEFAULT_SELECTOR_NAME), name, name);
    }
View Full Code Here

        List<ColumnImpl> columns = new ArrayList<ColumnImpl>();
        // expand columns without name
        for (ColumnImpl column : qomTree.getColumns()) {
            if (column.getColumnName() == null) {
                QueryObjectModelFactory qomFactory = getQOMFactory();
                NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
                SelectorImpl selector = qomTree.getSelector(column.getSelectorQName());
                NodeTypeImpl nt = ntMgr.getNodeType(selector.getNodeTypeQName());
                for (PropertyDefinition pd : nt.getPropertyDefinitions()) {
                    PropertyDefinitionImpl propDef = (PropertyDefinitionImpl) pd;
                    if (!propDef.definesResidual() && !propDef.isMultiple()) {
                        String sn = selector.getSelectorName();
                        String pn = propDef.getName();
                        columns.add((ColumnImpl) qomFactory.column(sn, pn, sn + "." + pn));
                    }
                }
            } else {
                columns.add(column);
            }
View Full Code Here

     * will build a query directly via the api using a spaced path
     *
     * @throws Exception
     */
    public void testGetChildrenApiDirect() throws Exception {
        QueryObjectModelFactory qomf = qm.getQOMFactory();
        Source source1 = qomf.selector(NodeType.NT_BASE, "selector");
        Column[] columns = new Column[] { qomf.column("selector", null, null) };
        Constraint constraint2 = qomf.childNode("selector", n1.getPath());
        QueryObjectModel qom = qomf.createQuery(source1, constraint2, null,
                columns);
        checkResult(qom.execute(), 2);
    }
View Full Code Here

     *
     * @throws Exception
     */
    public void testGetChildrenApiStatement() throws Exception {

        QueryObjectModelFactory qomf = qm.getQOMFactory();
        Source source1 = qomf.selector(NodeType.NT_BASE, "selector");
        Column[] columns = new Column[] { qomf.column("selector", null, null) };
        Constraint constraint2 = qomf.childNode("selector", n1.getPath());
        QueryObjectModel qom = qomf.createQuery(source1, constraint2, null,
                columns);
        checkResult(executeSQL2Query(qom.getStatement()), 2);
    }
View Full Code Here

        List<ColumnImpl> columns = new ArrayList<ColumnImpl>();
        // expand columns without name
        for (ColumnImpl column : qomTree.getColumns()) {
            if (column.getColumnName() == null) {
                QueryObjectModelFactory qomFactory = getQOMFactory();
                NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
                SelectorImpl selector = qomTree.getSelector(column.getSelectorQName());
                NodeTypeImpl nt = ntMgr.getNodeType(selector.getNodeTypeQName());
                for (PropertyDefinition pd : nt.getPropertyDefinitions()) {
                    PropertyDefinitionImpl propDef = (PropertyDefinitionImpl) pd;
                    if (!propDef.unwrap().definesResidual() && !propDef.isMultiple()) {
                        String sn = selector.getSelectorName();
                        String pn = propDef.getName();
                        columns.add((ColumnImpl) qomFactory.column(sn, pn, sn + "." + pn));
                    }
                }
            } else {
                columns.add(column);
            }
View Full Code Here

     *
     * @return array of columns.
     * @throws RepositoryException if an error occurs.
     */
    protected ColumnImpl[] getColumns() throws RepositoryException {
        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

     * @param propertyName the name of the property as well as the column.
     * @return a column.
     * @throws RepositoryException if an error occurs while creating the column.
     */
    protected ColumnImpl columnForName(Name propertyName) throws RepositoryException {
        QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
        String name = session.getJCRName(propertyName);
        return (ColumnImpl) qomFactory.column(
                session.getJCRName(DEFAULT_SELECTOR_NAME), name, name);
    }
View Full Code Here

        }
        String statement = node.getProperty(resolver.getJCRName(NameConstants.JCR_STATEMENT)).getString();
        String language = node.getProperty(resolver.getJCRName(NameConstants.JCR_LANGUAGE)).getString();

        if (Query.JCR_JQOM.equals(language)) {
            QueryObjectModelFactory qomFactory = new QOMFactory(node, resolver);
            QueryObjectModelBuilder builder = QueryObjectModelBuilderRegistry.getQueryObjectModelBuilder(language);
            return builder.createQueryObjectModel(statement, qomFactory, valueFactory);
        } else {
            return new QueryImpl(session, mgrProvider, itemMgr, wspManager,
                    statement, language, node);
View Full Code Here

TOP

Related Classes of javax.jcr.query.qom.QueryObjectModelFactory

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.