Package org.apache.chemistry.opencmis.jcr.query

Examples of org.apache.chemistry.opencmis.jcr.query.QueryTranslator


        int max = maxItems == null ? Integer.MAX_VALUE : maxItems.intValue();
        if (max < 0) {
            max = Integer.MAX_VALUE;
        }

        QueryTranslator queryTranslator = new QueryTranslator(typeManager) {
            @Override
            protected String jcrPathFromId(String id) {
                try {
                    JcrFolder folder = getJcrNode(session, id).asFolder();
                    String path = folder.getNode().getPath();
                    return Util.escape(path);                   
                }
                catch (RepositoryException e) {
                    log.debug(e.getMessage(), e);
                    throw new CmisRuntimeException(e.getMessage(), e);
                }
            }

            @Override
            protected String jcrPathFromCol(TypeDefinition fromType, String name) {
                return typeHandlerManager.getIdentifierMap(fromType.getId()).jcrPathFromCol(name);
            }

            @Override
            protected String jcrTypeName(TypeDefinition fromType) {
                return typeHandlerManager.getIdentifierMap(fromType.getId()).jcrTypeName();
            }

            @Override
            protected String jcrTypeCondition(TypeDefinition fromType) {
                return typeHandlerManager.getIdentifierMap(fromType.getId()).jcrTypeCondition();
            }
        };

        String xPath = queryTranslator.translateToXPath(statement);
        try
            // Execute query
            QueryManager queryManager = session.getWorkspace().getQueryManager();
            Query query = queryManager.createQuery(xPath, Query.XPATH);
View Full Code Here


        int max = maxItems == null ? Integer.MAX_VALUE : maxItems.intValue();
        if (max < 0) {
            max = Integer.MAX_VALUE;
        }

        QueryTranslator queryTranslator = new QueryTranslator(typeManager) {
            @Override
            protected String jcrPathFromId(String id) {
                try {
                    JcrFolder folder = getJcrNode(session, id).asFolder();
                    String path = folder.getNode().getPath();
                    return Util.escape(path);                   
                }
                catch (RepositoryException e) {
                    log.debug(e.getMessage(), e);
                    throw new CmisRuntimeException(e.getMessage(), e);
                }
            }

            @Override
            protected String jcrPathFromCol(TypeDefinition fromType, String name) {
                return nodeFactory.getIdentifierMap(fromType).jcrPathFromCol(name);
            }

            @Override
            protected String jcrTypeName(TypeDefinition fromType) {
                return nodeFactory.getIdentifierMap(fromType).jcrTypeName();
            }

            @Override
            protected String jcrTypeCondition(TypeDefinition fromType) {
                return nodeFactory.getIdentifierMap(fromType).jcrTypeCondition();
            }
        };

        String xPath = queryTranslator.translateToXPath(statement);
        try
            // Execute query
            QueryManager queryManager = session.getWorkspace().getQueryManager();
            Query query = queryManager.createQuery(xPath, Query.XPATH);
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.jcr.query.QueryTranslator

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.