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


Java CmisObject类代码示例

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


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

示例1: getObjectParents

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
public List<Folder> getObjectParents(String objectId)
{
    CmisObject o = session.getObject(objectId);
    if(o instanceof FileableCmisObject)
    {
        FileableCmisObject f = (FileableCmisObject)o;

        OperationContextImpl ctx = new OperationContextImpl();
        List<Folder> res = f.getParents(ctx);
        return res;
    }
    else
    {
        throw new IllegalArgumentException("Object does not exist or is not a fileable cmis object");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:PublicApiClient.java

示例2: getDescendants

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
public FolderNode getDescendants(String folderId, int depth)
{
    Session session = getCMISSession();

    CmisObject o = session.getObject(folderId);
    if(o instanceof Folder)
    {
        Folder f = (Folder)o;

        OperationContextImpl ctx = new OperationContextImpl();
        List<Tree<FileableCmisObject>> res = f.getDescendants(depth, ctx);
        FolderNode ret = (FolderNode)CMISNode.createNode(f);
        for(Tree<FileableCmisObject> t : res)
        {
            addChildren(ret, t);
        }

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

示例3: move

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
@Override
public void move(String pathOrigin, String documentNameOrigin, String pathDestination, String documentNameDestination, Session session) throws Exception {
    // Disable cache
    session.getDefaultContext().setCacheEnabled(false);

    // Fetch the object
    FileableCmisObject fileableCmisObject = (FileableCmisObject) FileUtils.getObject(pathOrigin + documentNameOrigin, session);

    // ECM folder paths does not end with "/"
    if (pathOrigin.endsWith("/")) pathOrigin = pathOrigin.substring(0, pathOrigin.length()-1);
    if (pathDestination.endsWith("/")) pathDestination = pathDestination.substring(0, pathDestination.length()-1);

    // Fetch source folder
    CmisObject sourceObject = FileUtils.getObject(pathOrigin, session);

    // Fetch the destination folder
    // We need to make sure the target folder exists
    createFolder(pathDestination);
    CmisObject targetObject = FileUtils.getObject(pathDestination, session);
    if (documentNameDestination != documentNameOrigin){
        fileableCmisObject.rename(documentNameDestination, true);
    }

    // Move the object
    fileableCmisObject.move(sourceObject, targetObject);

    // Enable cache
    session.getDefaultContext().setCacheEnabled(true);
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:30,代码来源:CMISSimpleNonVersionedDocumentService.java

示例4: updateDescriptorFile

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
@Override
public void updateDescriptorFile(String tenantId, String uuid, CMISEvidenceFile cmisFile) {
	Session session = createSession();
	Folder multitenantRootFolder = (Folder) session.getObjectByPath("/" + tenantId);
	Folder uuidFolder = getUuidFolder(session, uuid, multitenantRootFolder, repoFolderNestingLevels, true);
	for (CmisObject cmisObject : uuidFolder.getChildren()) {
		if (cmisObject.getType().getId().equals(CMISEvidenceFile.PROPERTY_DOC_ID)) {
			Document doc = (Document) cmisObject;
			if (doc.getName().equals(cmisFile.getFileName())) {
				Map<String, String> newDocProps = new HashMap<String, String>();
				newDocProps.put(CMISEvidenceFile.PROPERTY_TRANSACTION_STATUS, cmisFile.getTransactionStatus());
				doc.updateProperties(newDocProps);
				// Recover mime type from stored content
				ContentStream contentStream = new ContentStreamImpl(cmisFile.getFileName(), null, doc.getContentStreamMimeType(), cmisFile.getInputStream());
				doc.setContentStream(contentStream, true);
			} else {
				log.warn("Found unexpected CMIS object type in descriptor folder: " + cmisObject.getName() + " - " + cmisObject.getType().getId() + 
						" (expected " + cmisFile.getFileName() + ")");
			}
		}
	}
	
}
 
开发者ID:keensoft,项目名称:icearchiva,代码行数:24,代码来源:AtomBindingCMISClientImpl.java

示例5: directoryExistCMIS

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
/** Verifie qu'un dossier existe en mode CMIS
 * @param idFolder
 * @return
 */
private Boolean directoryExistCMIS(String idFolder, Session cmisSession) {
	if (idFolder == null || idFolder.equals("")) {
		return false;
	}
	try{
		CmisObject object = cmisSession.getObject(cmisSession.createObjectId(idFolder));
		if (!(object instanceof Folder)){
			logger.error("Stockage de fichier - CMIS : l'object CMIS "+idFolder+" n'est pas un dossier");
			return false;
		}
	}catch(Exception e){
		logger.error("Stockage de fichier - CMIS : erreur sur l'object CMIS "+idFolder, e);
		return false;
	}
	return true;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:21,代码来源:FileManagerCmisImpl.java

示例6: assertIsPwcProperty

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
private void assertIsPwcProperty(CmisObject pwc, boolean nullExpected)
{
    boolean isPwcFound = false;
    Boolean isPwcValueTrue = null;
    for (Property<?> property : pwc.getProperties())
    {
        if ((null != property) && PropertyIds.IS_PRIVATE_WORKING_COPY.equals(property.getId()))
        {
            isPwcFound = true;
            isPwcValueTrue = property.getValue();
            break;
        }
    }

    if (nullExpected)
    {
        assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property is not null!"), !isPwcFound || (null == isPwcValueTrue));
        return;
    }

    assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property has not been found!"), isPwcFound);
    assertNotNull(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property value must not be null!"), isPwcValueTrue);
    assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property value must be equal to 'true'!"), isPwcValueTrue);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:TestCMIS.java

示例7: getFolderTree

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
public List<Tree<FileableCmisObject>> getFolderTree(String folderId, int depth)
{
    CmisObject o = session.getObject(folderId);
    if(o instanceof Folder)
    {
        Folder f = (Folder)o;

        OperationContextImpl ctx = new OperationContextImpl();
        List<Tree<FileableCmisObject>> res = f.getFolderTree(depth, ctx);
        return res;
    }
    else
    {
        throw new IllegalArgumentException("Object does not exist or is not a folder");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:PublicApiClient.java

示例8: createNode

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
public static CMISNode createNode(CmisObject o)
{
	CMISNode n = null;

	Map<String, Serializable> properties = CMISNode.getProperties(o.getProperties());

	if(o.getBaseType() instanceof FolderTypeDefinition)
	{
		n = new FolderNode(o.getId(), o.getId(), properties);
	}
	else
	{
		n = new CMISNode(o.getId(), o.getId(), properties);
	}

	return n;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:18,代码来源:CMISNode.java

示例9: checkChildren

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

示例10: searchDocuments

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

示例11: createNode

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
private CmisObject createNode(Exchange exchange) throws Exception {
    validateRequiredHeader(exchange, PropertyIds.NAME);

    Message message = exchange.getIn();
    String parentFolderPath = parentFolderPathFor(message);
    Folder parentFolder = getFolderOnPath(exchange, parentFolderPath);
    Map<String, Object> cmisProperties = filterTypeProperties(message.getHeaders());

    if (isDocument(exchange)) {
        String fileName = message.getHeader(PropertyIds.NAME, String.class);
        String mimeType = getMimeType(message);
        byte[] buf = getBodyData(message);
        ContentStream contentStream = getSessionFacade().createContentStream(fileName, buf, mimeType);
        return storeDocument(parentFolder, cmisProperties, contentStream);
    } else if (isFolder(message)) {
        return storeFolder(parentFolder, cmisProperties);
    } else { // other types
        return storeDocument(parentFolder, cmisProperties, null);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:CMISProducer.java

示例12: deleteAllContent

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

示例13: cmisSecondaryTypePropertiesAreStored

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
@Test
public void cmisSecondaryTypePropertiesAreStored() throws Exception {

    List<String> secondaryTypes = Arrays.asList("MySecondaryType");

    Exchange exchange = createExchangeWithInBody("Some content to be store");
    exchange.getIn().getHeaders().put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "text/plain; charset=UTF-8");
    exchange.getIn().getHeaders().put(PropertyIds.NAME, "test.txt");
    exchange.getIn().getHeaders().put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
    exchange.getIn().getHeaders().put("SecondaryStringProp", "secondaryTypePropValue");

    template.send(exchange);
    String newNodeId = exchange.getOut().getBody(String.class);
    CmisObject newNode = retrieveCMISObjectByIdFromServer(newNodeId);

    assertEquals(1, newNode.getSecondaryTypes().size());
    assertEquals("secondaryTypePropValue", newNode.getPropertyValue("SecondaryStringProp"));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:CMISProducerTest.java

示例14: getTargetFolder

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

示例15: getObjectParents

import org.apache.chemistry.opencmis.client.api.CmisObject; //导入依赖的package包/类
public List<Folder> getObjectParents(String objectId)
{
	CmisObject o = session.getObject(objectId);
	if(o instanceof FileableCmisObject)
	{
		FileableCmisObject f = (FileableCmisObject)o;
	
		OperationContextImpl ctx = new OperationContextImpl();
		List<Folder> res = f.getParents(ctx);
		return res;
	}
	else
	{
		throw new IllegalArgumentException("Object does not exist or is not a fileable cmis object");
	}
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:17,代码来源:PublicApiClient.java


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