当前位置: 首页>>代码示例>>Java>>正文


Java QueryResult类代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.client.api.QueryResult的典型用法代码示例。如果您正苦于以下问题:Java QueryResult类的具体用法?Java QueryResult怎么用?Java QueryResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


QueryResult类属于org.apache.chemistry.opencmis.client.api包,在下文中一共展示了QueryResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fullTextQuery

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
public static List<String> fullTextQuery(Session lSession, String pStrText) {

		List<String> lListResults = null;
		int lIntDocumentsFound = 0;

		mLog.debug("Start fullTextQuery(String) - ", pStrText);

		ItemIterable<QueryResult> lItemIterableQueryResult =
		        lSession.query("SELECT cmis:objectId FROM cmis:document where CONTAINS('" + pStrText + "')", false);

		lListResults = new ArrayList<String>();
		for (QueryResult lQueryResult : lItemIterableQueryResult) {
			for (PropertyData<?> lPropertyData : lQueryResult.getProperties()) {
				lListResults.add((String) lPropertyData.getFirstValue());
			}
		}

		if (lListResults != null) {
			lIntDocumentsFound = lListResults.size();
		}

		mLog.debug("End fullTextQuery(String) - ", pStrText, " - found ", lIntDocumentsFound, " documents.");

		return lListResults;
	}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:26,代码来源:AlfrescoHelper.java

示例2: read

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
@Override
public QueryResult read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
    QueryResult aResult = null;

    if (unreadObjects.hasNext()) {
        aResult = unreadObjects.next();
        if (aResult != null) {
            lastTimestamp = CONVERTER_TIMESTAMP.convert((Calendar) aResult.getPropertyByQueryName("cmis:creationDate").getFirstValue()).get(0);
        } else {
            executeQuery();
            aResult = read();
        }
    } else if (currentQueryResult.getHasMoreItems()) {
        executeQuery();
        aResult = read();
    }

    return aResult;
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:20,代码来源:CmisReader.java

示例3: runObjectIdQuery

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
private void runObjectIdQuery(Session session, String stmt, String objectId, boolean objectIdTwice) {
	QueryStatement queryStmt = session.createQueryStatement(stmt);

	if (objectIdTwice) {
		queryStmt.setString(1, new String[] { objectId, objectId });
	} else {
		queryStmt.setString(1, objectId);
	}

	QueryResult result = runQuerySingleHit(session, queryStmt.toQueryString());

	if (result != null) {
		CmisTestResult failure = createResult(FAILURE,
				"The query '" + queryStmt.toQueryString() + "' returned the wrong object!");
		assertEquals(objectId, result.getPropertyByQueryName("cmis:objectId"), null, failure);
	}
}
 
开发者ID:SAP,项目名称:cloud-cmis-workbench,代码行数:18,代码来源:SDCSyncTest.java

示例4: runQuerySingleHit

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
protected QueryResult runQuerySingleHit(Session session, String stmt) {
	try {
		QueryResult result = null;
		int count = 0;

		for (QueryResult qr : session.query(stmt, false)) {
			count++;
			result = qr;
		}

		if (count != 1) {
			addResult(createResult(FAILURE, "The query '" + stmt
					+ "' should return exactly one result, but it returned " + count + " results!"));
			return null;
		}

		return result;
	} catch (Exception e) {
		addResult(createResult(FAILURE, "The query '" + stmt + "' failed with this exception: " + e.toString(), e,
				false));
		return null;
	}
}
 
开发者ID:SAP,项目名称:cloud-cmis-workbench,代码行数:24,代码来源:AbstractSDCTest.java

示例5: createNode

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
public static CMISNode createNode(QueryResult qr)
{
	List<PropertyData<?>> props = qr.getProperties();
	Map<String, Serializable> properties = new HashMap<String, Serializable>();

	for(PropertyData<?> p : props)
	{
		properties.put(p.getId(), (Serializable)p.getFirstValue());
	}

	String objectId = (String)qr.getPropertyById(PropertyIds.OBJECT_ID).getFirstValue();
	CMISNode n = new CMISNode(objectId, objectId, properties);
	return n;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:15,代码来源:CMISNode.java

示例6: searchDocuments

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
public static List<Document> searchDocuments(Session pSession, String pQuery) {
	mLog.debug("START searchDocuments(String");
	mLog.debug("CMIS query: {}", pQuery);
	
	// per evitare il problema dei documenti duplicati
	LinkedHashMap<String, Document> lHashMapResults = new LinkedHashMap<String, Document>();

	ItemIterable<QueryResult> lResults = pSession.query(pQuery, false);
	// XXX (Alessio): sarà il modo giusto? Prestazioni?
	
	if (lResults != null) {
		int i = 0;
		//
		for (Iterator<QueryResult> iterator = lResults.iterator(); i < ((CollectionIterator<QueryResult>)iterator).getTotalNumItems();) {
			QueryResult qResult  =  iterator.next();
			
		//} (QueryResult qResult : lResults) {
			if (qResult != null) {
				PropertyData<?> lPropData = qResult.getPropertyById("cmis:objectId");
				
				if (lPropData != null) {
					String lObjectId = (String) lPropData.getFirstValue();
					CmisObject lObj = pSession.getObject(pSession.createObjectId(lObjectId));
		
					lHashMapResults.put(lObjectId, (Document) lObj);
				}
			}
			
			i++;
		}
	}

	mLog.debug("END searchDocuments(String");
	return new ArrayList<Document>(lHashMapResults.values());
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:36,代码来源:AlfrescoHelper.java

示例7: executeQuery

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
private List<Map<String, Object>> executeQuery(Exchange exchange) throws Exception {
    String query = exchange.getIn().getMandatoryBody(String.class);
    Boolean retrieveContent = getRetrieveContent(exchange);
    Integer readSize = getReadSize(exchange);

    ItemIterable<QueryResult> itemIterable = getSessionFacade().executeQuery(query);
    return getSessionFacade().retrieveResult(retrieveContent, readSize, itemIterable);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:CMISQueryProducer.java

示例8: pollWithQuery

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
private int pollWithQuery(CMISConsumer cmisConsumer) throws Exception {
    int count = 0;
    int pageNumber = 0;
    boolean finished = false;
    ItemIterable<QueryResult> itemIterable = executeQuery(query);
    while (!finished) {
        ItemIterable<QueryResult> currentPage = itemIterable.skipTo(count).getPage();
        LOG.debug("Processing page {}", pageNumber);
        for (QueryResult item : currentPage) {
            Map<String, Object> properties = CMISHelper.propertyDataToMap(item.getProperties());
            Object objectTypeId = item.getPropertyValueById(PropertyIds.OBJECT_TYPE_ID);
            InputStream inputStream = null;
            if (readContent && CamelCMISConstants.CMIS_DOCUMENT.equals(objectTypeId)) {
                inputStream = getContentStreamFor(item);
            }

            cmisConsumer.sendExchangeWithPropsAndBody(properties, inputStream);
            count++;
            if (count == readCount) {
                finished = true;
                break;
            }
        }
        pageNumber++;
        if (!currentPage.getHasMoreItems()) {
            finished = true;
        }
    }
    return count;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:31,代码来源:CMISSessionFacade.java

示例9: retrieveResult

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
public List<Map<String, Object>> retrieveResult(Boolean retrieveContent, Integer readSize,
                                                ItemIterable<QueryResult> itemIterable) {
    List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
    boolean queryForContent = retrieveContent != null ? retrieveContent : readContent;
    int documentsToRead = readSize != null ? readSize : readCount;
    int count = 0;
    int pageNumber = 0;
    boolean finished = false;
    while (!finished) {
        ItemIterable<QueryResult> currentPage = itemIterable.skipTo(count).getPage();
        LOG.debug("Processing page {}", pageNumber);
        for (QueryResult item : currentPage) {
            Map<String, Object> properties = CMISHelper.propertyDataToMap(item.getProperties());
            if (queryForContent) {
                InputStream inputStream = getContentStreamFor(item);
                properties.put(CamelCMISConstants.CAMEL_CMIS_CONTENT_STREAM, inputStream);
            }

            result.add(properties);
            count++;
            if (count == documentsToRead) {
                finished = true;
                break;
            }
        }
        pageNumber++;
        if (!currentPage.getHasMoreItems()) {
            finished = true;
        }
    }
    return result;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:33,代码来源:CMISSessionFacade.java

示例10: getDocument

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
public Document getDocument(QueryResult queryResult) {
    if (CamelCMISConstants.CMIS_DOCUMENT.equals(queryResult.getPropertyValueById(PropertyIds.OBJECT_TYPE_ID))
            || CamelCMISConstants.CMIS_DOCUMENT.equals(queryResult.getPropertyValueById(PropertyIds.BASE_TYPE_ID))) {
        String objectId = (String) queryResult.getPropertyById(PropertyIds.OBJECT_ID).getFirstValue();
        return (org.apache.chemistry.opencmis.client.api.Document) session.getObject(objectId);
    }
    return null;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:CMISSessionFacade.java

示例11: getContentStreamFor

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
public InputStream getContentStreamFor(QueryResult item) {
    Document document = getDocument(item);
    if (document != null && document.getContentStream() != null) {
        return document.getContentStream().getStream();
    }
    return null;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:CMISSessionFacade.java

示例12: testCreate

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
public void testCreate()
{
    Session session = getSession("admin", "admin");
    
    String folderName = getRootFolderName();
    Folder root = session.getRootFolder();
    
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
    properties.put(PropertyIds.NAME, folderName);

    // create the folder
    Folder newFolder = root.createFolder(properties);
    
    for(int i = 0; i < 50; i++)
    {
        AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl("user"+i);
        List<String> permissions = new ArrayList<String>(1);
        permissions.add(BasicPermissions.READ);
        List<Ace> addAces = new ArrayList<Ace>(1);
        addAces.add(new AccessControlEntryImpl(principal, permissions));
        newFolder.addAcl(addAces, AclPropagation.PROPAGATE);
        
        Map<String, Object> updateProperties = new HashMap<String, Object>();
        updateProperties.put("cm:title", "Update title "+i);
        newFolder.updateProperties(properties);
        
        if(i % 10 == 0)
        {
            System.out.println("@ "+i);
        }
    }
    ItemIterable<QueryResult> result = session.query("select * from cmis:folder", false);
    assertTrue(result.getTotalNumItems() > 0);
    
    result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false);
    assertTrue(result.getTotalNumItems() > 0);
    
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:40,代码来源:CMISDataCreatorTest.java

示例13: runTest

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
public SampleResult runTest(JavaSamplerContext runTestContext) {
	String cmisQuery = runTestContext.getParameter("cmis.query");
	
	SampleResult result = new SampleResult();
	result.sampleStart();
	try{
		logger.info("Executing cmis query with string: " + cmisQuery);
		ItemIterable<QueryResult> queryResults = cmis.getCmisSession().query(cmisQuery, false, cmis.getMinimalOperationContext());
        
		logger.info("Retrieved query results with count: " + queryResults.getTotalNumItems());
		logger.info("First result found: " + queryResults.iterator().next().getPropertyByQueryName("cmis:name").getFirstValue());
		
        result.sampleEnd();
        result.setSuccessful(true);
        result.setResponseMessage("Successfully retrieved cmis documents by query.");
        result.setResponseCodeOK();
        
	}
	catch(Exception e){
		result.sampleEnd();
           result.setSuccessful(false);
           result.setResponseMessage("Failed to retrieve cmis documents by query: " + e);
           
           StringWriter stringWriter = new StringWriter();
           e.printStackTrace( new PrintWriter(stringWriter));
           result.setResponseData(stringWriter.toString().getBytes());
           result.setDataType(SampleResult.TEXT);
           result.setResponseCode("500");
	}
		
       return result;
}
 
开发者ID:kylefernandadams,项目名称:cmis-jmeter-test,代码行数:33,代码来源:GetDocumentsByQuery.java

示例14: next

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
/**
 * Returns the next element in the iteration.
 *
 * @return the next element in the iteration
 * @throws NoSuchElementException if the iteration has no more elements
 */
@Override
public DocumentView next() {
    QueryResult queryResult = delegate.next();
    String objectId = (String) queryResult.getPropertyByQueryName(PropertyIds.OBJECT_ID).getFirstValue();
    return documentFetcher.getDocument(objectId);
}
 
开发者ID:federicamazza,项目名称:vaadin-cmis-browser,代码行数:13,代码来源:QueryResults.java

示例15: runQueryNoException

import org.apache.chemistry.opencmis.client.api.QueryResult; //导入依赖的package包/类
protected boolean runQueryNoException(Session session, String stmt) {
	try {
		for (QueryResult qr : session.query(stmt, false)) {
			qr.getPropertyByQueryName("cmis:name");
		}

		return true;
	} catch (Exception e) {
		addResult(createResult(FAILURE, "The query '" + stmt + "' failed with this exception: " + e.toString(), e,
				false));
		return false;
	}
}
 
开发者ID:SAP,项目名称:cloud-cmis-workbench,代码行数:14,代码来源:AbstractSDCTest.java


注:本文中的org.apache.chemistry.opencmis.client.api.QueryResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。