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


Java ItemIterable类代码示例

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


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

示例1: checkChildren

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
public void checkChildren(ItemIterable<CmisObject> expectedChildren)
{
	Map<String, FolderNode> expectedFolderNodes = new HashMap<String, FolderNode>();
	Map<String, CMISNode> expectedDocumentNodes = new HashMap<String, CMISNode>();
	for(CmisObject child : expectedChildren)
	{
		CMISNode dn = CMISNode.createNode(child);
		if(dn instanceof FolderNode)
		{
			expectedFolderNodes.put(getBareObjectId(dn.getNodeId()), (FolderNode)dn);
		}
		else
		{
			expectedDocumentNodes.put(getBareObjectId(dn.getNodeId()), dn);
		}
	}
	checkChildrenImpl(expectedFolderNodes, expectedDocumentNodes);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:19,代码来源:FolderNode.java

示例2: searchDocuments

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
public static List<Document> searchDocuments(Session pSession, String pTypeId, String pWhereClause) {
	mLog.debug("START searchDocuments(String, String");

	// per evitare il problema dei documenti duplicati
	LinkedHashMap<String, Document> lHashMapResults = new LinkedHashMap<String, Document>();

	// Temporanea disabilitazione della cache
	OperationContext lOperationContext = pSession.createOperationContext();
	lOperationContext.setCacheEnabled(false);

	ItemIterable<CmisObject> lResult = pSession.queryObjects(pTypeId, pWhereClause, false, lOperationContext);
	for (CmisObject cmisObject : lResult) {
		// TODO (Alessio) gestione paginazione (in entrata e in uscita, anche se probabilmente è
		// già gestita internamente in queryObjects)
		lHashMapResults.put(cmisObject.getId(), (Document) cmisObject);
	}

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

示例3: fullTextQuery

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的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

示例4: deleteAllContent

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
protected void deleteAllContent() {
    Session session = createSession();
    Folder rootFolder = session.getRootFolder();
    ItemIterable<CmisObject> children = rootFolder.getChildren();
    for (CmisObject cmisObject : children) {
        if ("cmis:folder".equals(cmisObject.getPropertyValue(PropertyIds.OBJECT_TYPE_ID))) {
            List<String> notDeltedIdList = ((Folder)cmisObject)
                    .deleteTree(true, UnfileObject.DELETE, true);
            if (notDeltedIdList != null && notDeltedIdList.size() > 0) {
                throw new RuntimeException("Cannot empty repo");
            }
        } else {
            cmisObject.delete(true);
        }
    }
    session.getBinding().close();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:CMISTestSupport.java

示例5: getTargetFolder

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
private CmisObject getTargetFolder(final Session session, final BatchClassCmisConfiguration batchClassCmisConfiguration) {
	CmisObject targetFolder = null;
	LOGGER.info("Acquiring Root Folder.");
	final Folder root = session.getRootFolder();
	final ItemIterable<CmisObject> children = root.getChildren();
	LOGGER.info("Looping through Root Folder children.");
	for (final CmisObject cmisObject : children) {
		if (cmisObject != null && cmisObject.getName() != null
				&& cmisObject.getName().equalsIgnoreCase(batchClassCmisConfiguration.getFolderName())
				&& isObjectFolder(cmisObject)) {
			LOGGER.info("Verified that the target is of type cmis:folder.");
			LOGGER.info("Target folder, " + batchClassCmisConfiguration.getFolderName() + ", found.");
			targetFolder = cmisObject;
			break;
		}
	}
	return targetFolder;
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:19,代码来源:CmisImport.java

示例6: addVfsOnlyFolderTreeToSyncList

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
private void addVfsOnlyFolderTreeToSyncList(OpenCmsModule ocmsModule, String vfsPath, CmisObject vfsObject, boolean replaceExistingEntity) {
	LOG.info("Adding VFS only folder " + vfsPath);

	SyncAction syncAction = getVfsOnlySyncAction(ocmsModule.getSyncMode());
	SyncFolder syncFolder = new SyncFolder(ocmsModule, vfsPath, null, vfsObject, syncAction, replaceExistingEntity);
	syncList.add(syncFolder);

	if (syncAction != SyncAction.DELETE_VFS) {
		// traverse folder, add children to the SyncJob
		LOG.info("Get children of VFS folder " + vfsPath);
		ItemIterable<CmisObject> vfsChildren = ((Folder) vfsObject).getChildren();
		for (CmisObject child : vfsChildren) {
			String childVfsPath = vfsPath + "/" + child.getName();

			// files
			if (child.getBaseTypeId().equals(BaseTypeId.CMIS_DOCUMENT)) {
				addVfsOnlyFileToSyncList(ocmsModule, childVfsPath, child, false);
			}
			// folders
			else if (child.getBaseTypeId().equals(BaseTypeId.CMIS_FOLDER)) {
				addVfsOnlyFolderTreeToSyncList(ocmsModule, childVfsPath, child, false);
			}
		}
	}
}
 
开发者ID:mediaworx,项目名称:opencms-intellijplugin,代码行数:26,代码来源:SyncFileAnalyzer.java

示例7: addModuleResourceFolderTreeToSyncList

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
private void addModuleResourceFolderTreeToSyncList(OpenCmsModule ocmsModule, String vfsPath, CmisObject vfsObject) {
	LOG.info("Adding VFS module resource folder " + vfsPath);

	SyncFolder syncFolder = new SyncFolder(ocmsModule, vfsPath, null, vfsObject, SyncAction.PULL, false);
	syncList.add(syncFolder);

	// traverse folder, add children to the SyncJob
	LOG.info("Get children of VFS folder " + vfsPath);
	ItemIterable<CmisObject> vfsChildren = ((Folder) vfsObject).getChildren();
	for (CmisObject child : vfsChildren) {
		if (progressIndicator.isCanceled()) {
			executeSync = false;
			return;
		}
		String childVfsPath = vfsPath + "/" + child.getName();

		// files
		if (child.getBaseTypeId().equals(BaseTypeId.CMIS_DOCUMENT)) {
			addModuleResourceFileToSyncList(ocmsModule, childVfsPath, child);
		}
		// folders
		else if (child.getBaseTypeId().equals(BaseTypeId.CMIS_FOLDER)) {
			addModuleResourceFolderTreeToSyncList(ocmsModule, childVfsPath, child);
		}
	}
}
 
开发者ID:mediaworx,项目名称:opencms-intellijplugin,代码行数:27,代码来源:SyncFileAnalyzer.java

示例8: buildRootFolders

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
/**
 * Build the root folders 
 * 
 * @param folderFrontLocation
 * @param docLibTree
 */
private void buildRootFolders(Location start, ItemIterable<CmisObject> items)
{
	Location startLocation = start.clone().add(VectorUtil.NORTH.clone().multiply(10));
			
	for (CmisObject item : items) 
	{
		if (item instanceof AlfrescoFolder)
		{
			// build root folder				
			buildRootFolder(startLocation, (AlfrescoFolder)item);			
			
			// move to the next folder location
			startLocation.add(VectorUtil.UP.clone().multiply(5));
		}
	}		
}
 
开发者ID:rwetherall,项目名称:ContentCraft,代码行数:23,代码来源:SiteBuilder.java

示例9: getChildren

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
public FolderNode getChildren(String folderId, int skipCount, int maxItems)
{
    CmisObject o = session.getObject(folderId);
    if(o instanceof Folder)
    {
        Folder f = (Folder)o;
        FolderNode ret = (FolderNode)CMISNode.createNode(f);

        OperationContextImpl ctx = new OperationContextImpl();
        ItemIterable<CmisObject> res = f.getChildren(ctx);
        res.skipTo(skipCount);
        ItemIterable<CmisObject> l = res.getPage(maxItems);
        for(CmisObject c : l)
        {
            CMISNode child = null;
            if(c.getBaseType() instanceof FolderTypeDefinition)
            {
                child = (FolderNode)CMISNode.createNode(c);
                ret.addFolder((FolderNode)child);
            }
            else
            {
                child = CMISNode.createNode(c);
                ret.addNode(child);
            }
        }

        return ret;
    }
    else
    {
        throw new IllegalArgumentException("Folder does not exist or is not a folder");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:35,代码来源:PublicApiClient.java

示例10: executeQuery

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的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

示例11: pollWithQuery

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的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

示例12: retrieveResult

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的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

示例13: processFolderRecursively

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
int processFolderRecursively(Folder folder) throws Exception {
    processFolderNode(folder);

    
    OperationContext operationContext = cmisConsumer.createOperationContext();
    operationContext.setMaxItemsPerPage(pageSize);

    int count = 0;
    int pageNumber = 0;
    boolean finished = false;
    ItemIterable<CmisObject> itemIterable = folder.getChildren(operationContext);
    while (!finished) {
        ItemIterable<CmisObject> currentPage = itemIterable.skipTo(count).getPage();
        LOG.debug("Processing page {}", pageNumber);
        for (CmisObject child : currentPage) {
            if (CMISHelper.isFolder(child)) {
                Folder childFolder = (Folder)child;
                processFolderRecursively(childFolder);
            } else {
                processNonFolderNode(child, folder);
            }

            count++;
            if (totalPolled == readCount) {
                finished = true;
                break;
            }
        }
        pageNumber++;
        if (!currentPage.getHasMoreItems()) {
            finished = true;
        }
    }

    return totalPolled;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:37,代码来源:RecursiveTreeWalker.java

示例14: monitorTargetFolder

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
private void monitorTargetFolder(final CmisObject cmisFolder, final BatchClassCmisConfiguration batchClassCmisConfiguration) {
	final Folder targetFolder = (Folder) cmisFolder;
	final ItemIterable<CmisObject> folderChildren = targetFolder.getChildren();

	LOGGER.info("ImportFolder has children count of = " + folderChildren.getTotalNumItems());
	LOGGER.info("Looping through " + batchClassCmisConfiguration.getFolderName() + " children...");

	for (final CmisObject cmisObject : folderChildren) {
		LOGGER.info("Name = " + cmisObject.getName() + "\nId = " + cmisObject.getId());
		if (cmisObject instanceof Folder) {
			LOGGER.info("Found sub folder :" + cmisObject.getName());
			LOGGER.info("Skipping sub folder for processing");
			// Uncomment below line for supporting the subfolder.
			// monitorTargetFolder(cmisFolder);
		} else if (eligibleForImport(cmisObject, batchClassCmisConfiguration)) {
			LOGGER.info("Name = " + cmisObject.getName() + " HAS NOT BEEN IMPORTED TO EPHESOFT YET!");
			// GETTING OBJECT CONTENT
			String fileName = cmisObject.getName();
			final String destinationFolder = batchClassCmisConfiguration.getBatchClass().getUncFolder() + File.separator
					+ fileName.substring(0, fileName.indexOf('.')) + "_" + System.currentTimeMillis();
			final String destinationFile = destinationFolder + File.separator + fileName;
			copyObjectToLocation(getObjectContent(cmisObject), destinationFolder, destinationFile);

			outputToXml(generatePropertiesXml(cmisObject), destinationFolder + File.separator + fileName + "_PROPERTIES" + ".xml");
			setPropertyImportFlag(cmisObject, batchClassCmisConfiguration);
		}
	}
	LOGGER.info("***** Target Folder Monitor Service Scan END *****");
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:30,代码来源:CmisImport.java

示例15: getChildren

import org.apache.chemistry.opencmis.client.api.ItemIterable; //导入依赖的package包/类
public FolderNode getChildren(String folderId, int skipCount, int maxItems)
{
	CmisObject o = session.getObject(folderId);
	if(o instanceof Folder)
	{
		Folder f = (Folder)o;
		FolderNode ret = (FolderNode)CMISNode.createNode(f);

		OperationContextImpl ctx = new OperationContextImpl();
		ItemIterable<CmisObject> res = f.getChildren(ctx);
		res.skipTo(skipCount);
		ItemIterable<CmisObject> l = res.getPage(maxItems);
		for(CmisObject c : l)
		{
			CMISNode child = null;
			if(c.getBaseType() instanceof FolderTypeDefinition)
			{
				child = (FolderNode)CMISNode.createNode(c);
				ret.addFolder((FolderNode)child);
			}
			else
			{
				child = CMISNode.createNode(c);
				ret.addNode(child);
			}
		}

		return ret;
	}
	else
	{
		throw new IllegalArgumentException("Folder does not exist or is not a folder");
	}
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:35,代码来源:PublicApiClient.java


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