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


Java Session.getRootFolder方法代码示例

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


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

示例1: deleteAllContent

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

示例2: getTargetFolder

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

示例3: DISABLED_testBasicFileOps

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
public void DISABLED_testBasicFileOps()
{
    Repository repository = getRepository("admin", "admin");
    Session session = repository.createSession();
    Folder rootFolder = session.getRootFolder();
    // create folder
    Map<String,String> folderProps = new HashMap<String, String>();
    {
        folderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
        folderProps.put(PropertyIds.NAME, getName() + "-" + GUID.generate());
    }
    Folder folder = rootFolder.createFolder(folderProps, null, null, null, session.getDefaultContext());
    
    Map<String, String> fileProps = new HashMap<String, String>();
    {
        fileProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
        fileProps.put(PropertyIds.NAME, "mydoc-" + GUID.generate() + ".txt");
    }
    ContentStreamImpl fileContent = new ContentStreamImpl();
    {
        ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(getName(), ".txt"));
        writer.putContent("Ipsum and so on");
        ContentReader reader = writer.getReader();
        fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
        fileContent.setStream(reader.getContentInputStream());
    }
    folder.createDocument(fileProps, fileContent, VersioningState.MAJOR);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:OpenCmisLocalTest.java

示例4: testDownloadEvent

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
public void testDownloadEvent() throws InterruptedException
{
    Repository repository = getRepository("admin", "admin");
    Session session = repository.createSession();
    Folder rootFolder = session.getRootFolder();
    String docname = "mydoc-" + GUID.generate() + ".txt";
    Map<String, String> props = new HashMap<String, String>();
    {
        props.put(PropertyIds.OBJECT_TYPE_ID, "D:cmiscustom:document");
        props.put(PropertyIds.NAME, docname);
    }
    
    // content
    byte[] byteContent = "Hello from Download testing class".getBytes();
    InputStream stream = new ByteArrayInputStream(byteContent);
    ContentStream contentStream = new ContentStreamImpl(docname, BigInteger.valueOf(byteContent.length), "text/plain", stream);

    Document doc1 = rootFolder.createDocument(props, contentStream, VersioningState.MAJOR);
    NodeRef doc1NodeRef = cmisIdToNodeRef(doc1.getId());
    
    ContentStream content = doc1.getContentStream();
    assertNotNull(content);
    
    //range request
    content = doc1.getContentStream(BigInteger.valueOf(2),BigInteger.valueOf(4));
    assertNotNull(content);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:OpenCmisLocalTest.java

示例5: testEncodingForCreateContentStream

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
public void testEncodingForCreateContentStream()
{
    ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
    FileFolderService ffs = serviceRegistry.getFileFolderService();
    // Authenticate as system
    AuthenticationComponent authenticationComponent = (AuthenticationComponent) ctx
            .getBean(BEAN_NAME_AUTHENTICATION_COMPONENT);
    authenticationComponent.setSystemUserAsCurrentUser();
    try
    {
        /* Create the document using openCmis services */
        Repository repository = getRepository("admin", "admin");
        Session session = repository.createSession();
        Folder rootFolder = session.getRootFolder();
        Document document = createDocument(rootFolder, "test_file_" + GUID.generate() + ".txt", session);

        ContentStream content = document.getContentStream();
        assertNotNull(content);

        content = document.getContentStream(BigInteger.valueOf(2), BigInteger.valueOf(4));
        assertNotNull(content);

        NodeRef doc1NodeRef = cmisIdToNodeRef(document.getId());
        FileInfo fileInfo = ffs.getFileInfo(doc1NodeRef);
        Map<QName, Serializable> properties = fileInfo.getProperties();
        ContentDataWithId contentData = (ContentDataWithId) properties
                .get(QName.createQName("{http://www.alfresco.org/model/content/1.0}content"));
        String encoding = contentData.getEncoding();

        assertEquals("ISO-8859-1", encoding);
    }
    finally
    {
        authenticationComponent.clearCurrentSecurityContext();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:OpenCmisLocalTest.java

示例6: createFolder

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
/**
 * 
 * @param session Session
 * @param name String
 * @return Folder
 */
private Folder createFolder(Session session, String name)
{
    Folder testFolder;
    Folder folder = session.getRootFolder();
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
    properties.put(PropertyIds.NAME, name);

    testFolder = folder.createFolder(properties);

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

示例7: testCreate

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

示例8: testConnect

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
public static String testConnect()
{
	String result = "Unable to connect to " + alfrescoAtomPubURL;
	Session session = CMIS.getSession();		
	Folder rootFolder = session.getRootFolder();
	if (rootFolder != null)
	{
		result = "Successfully connected to " + alfrescoAtomPubURL; 
	}
	return result;
}
 
开发者ID:rwetherall,项目名称:ContentCraft,代码行数:12,代码来源:CMIS.java

示例9: getDocumentLibFolderForASite

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
@Test
@Ignore
public void getDocumentLibFolderForASite()
{
	Session session = CMIS.getSession();
	
	Folder rootFolder = session.getRootFolder();
	System.out.println(rootFolder.getPath());		
	
    Folder folder = CMIS.getSiteRoot(session, "test");
    Assert.assertNotNull(folder);
    System.out.println(folder.getName());	    
}
 
开发者ID:rwetherall,项目名称:ContentCraft,代码行数:14,代码来源:CMISUnitTest.java

示例10: createApplicationRootFolder

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
/**
 * Gets the application root folder and if it doesn't exist, creates
 * it.
 */
protected Folder createApplicationRootFolder(Session session,
		String path) {
	try {
		// get the folder
		return (Folder) session.getObjectByPath(path,
				CMISHelper.LIGHT_OPERATION_CONTEXT);
	} catch (CmisObjectNotFoundException nfe) {
		// folder doesn't exist -> create it

		int x = path.lastIndexOf('/');

		Folder parent = null;
		if (x == 0) {
			parent = session.getRootFolder();
		} else {
			parent = createApplicationRootFolder(session,
					path.substring(0, x));
		}

		// create folder
		Map<String, Object> properties = new HashMap<String, Object>();
		properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
		properties.put(PropertyIds.NAME, path.substring(x + 1));

		return parent.createFolder(properties, null, null, null,
				CMISHelper.LIGHT_OPERATION_CONTEXT);
	}
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:33,代码来源:AbstractTheBlendServlet.java

示例11: testALF10085

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
public void testALF10085() throws InterruptedException
{
    Repository repository = getRepository("admin", "admin");
    Session session = repository.createSession();
    Folder rootFolder = session.getRootFolder();

    Map<String, String> props = new HashMap<String, String>();
    {
        props.put(PropertyIds.OBJECT_TYPE_ID, "D:cmiscustom:document");
        props.put(PropertyIds.NAME, "mydoc-" + GUID.generate() + ".txt");
    }
    Document doc1 = rootFolder.createDocument(props, null, null);
    
    props = new HashMap<String, String>();
    {
        props.put(PropertyIds.OBJECT_TYPE_ID, "D:cmiscustom:document");
        props.put(PropertyIds.NAME, "mydoc-" + GUID.generate() + ".txt");
    }
    Document doc2 = rootFolder.createDocument(props, null, null);
    
    Thread.sleep(6000); 
    
    session.getObject(doc1);

    doc1.refresh();
    Calendar doc1LastModifiedBefore = (Calendar)doc1.getProperty(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
    assertNotNull(doc1LastModifiedBefore);

    doc2.refresh();
    Calendar doc2LastModifiedBefore = (Calendar)doc2.getProperty(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
    assertNotNull(doc2LastModifiedBefore);

    // Add relationship A to B
    props = new HashMap<String, String>();
    {
        props.put(PropertyIds.OBJECT_TYPE_ID, "R:cmiscustom:assoc");
        props.put(PropertyIds.NAME, "A Relationship"); 
        props.put(PropertyIds.SOURCE_ID, doc1.getId()); 
        props.put(PropertyIds.TARGET_ID, doc2.getId()); 
    }
    session.createRelationship(props); 

    doc1.refresh();
    Calendar doc1LastModifiedAfter = (Calendar)doc1.getProperty(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
    assertNotNull(doc1LastModifiedAfter);
    
    doc2.refresh();
    Calendar doc2LastModifiedAfter = (Calendar)doc2.getProperty(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
    assertNotNull(doc2LastModifiedAfter);

    assertEquals(doc1LastModifiedBefore, doc1LastModifiedAfter);
    assertEquals(doc2LastModifiedBefore, doc2LastModifiedAfter);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:54,代码来源:OpenCmisLocalTest.java

示例12: testCancelCheckoutWhileInCheckedOutState

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
/**
 * MNT-14687 - Creating a document as checkedout and then cancelling the
 * checkout should delete the document.
 * 
 * This test would have fit better within CheckOutCheckInServiceImplTest but
 * was added here to make use of existing methods
 */
public void testCancelCheckoutWhileInCheckedOutState()
{
    ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
    CheckOutCheckInService cociService = serviceRegistry.getCheckOutCheckInService();

    // Authenticate as system
    AuthenticationComponent authenticationComponent = (AuthenticationComponent) ctx.getBean(BEAN_NAME_AUTHENTICATION_COMPONENT);
    authenticationComponent.setSystemUserAsCurrentUser();

    /* Create the document using openCmis services */
    Repository repository = getRepository("admin", "admin");
    Session session = repository.createSession();
    Folder rootFolder = session.getRootFolder();

    // Set file properties
    String docname = "myDoc-" + GUID.generate() + ".txt";
    Map<String, String> props = new HashMap<String, String>();
    {
        props.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value());
        props.put(PropertyIds.NAME, docname);
    }

    // Create some content
    byte[] byteContent = "Some content".getBytes();
    InputStream stream = new ByteArrayInputStream(byteContent);
    ContentStream contentStream = new ContentStreamImpl(docname, BigInteger.valueOf(byteContent.length), MIME_PLAIN_TEXT, stream);

    // Create the document
    Document doc1 = rootFolder.createDocument(props, contentStream, VersioningState.CHECKEDOUT);
    NodeRef doc1NodeRef = cmisIdToNodeRef(doc1.getId());
    NodeRef doc1WorkingCopy = cociService.getWorkingCopy(doc1NodeRef);

    /* Cancel Checkout */
    cociService.cancelCheckout(doc1WorkingCopy);

    /* Check if both the working copy and the document were deleted */
    NodeService nodeService = serviceRegistry.getNodeService();
    assertFalse(nodeService.exists(doc1NodeRef));
    assertFalse(nodeService.exists(doc1WorkingCopy));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:48,代码来源:OpenCmisLocalTest.java

示例13: testCreateLots

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
public void testCreateLots() throws Exception
{
    Session session = getSession("admin", "admin");
    
    Folder root = session.getRootFolder();
    String folderNameBase = getRootFolderName();

    
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
    properties.put(PropertyIds.NAME, folderNameBase);
    
    Folder base = root.createFolder(properties);
    for(int i = 0; i < 10; i++)
    {
       AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl(""+i+i+i);
       List<String> permissions = new ArrayList<String>(1);
       permissions.add(BasicPermissions.ALL);
       List<Ace> addAces = new ArrayList<Ace>(1);
       addAces.add(new AccessControlEntryImpl(principal, permissions));
       base.addAcl(addAces, AclPropagation.PROPAGATE);
    }
    
    
    Thread last = null;
    
    for(int i = 0; i < 10; i++)
    {
        Creator creator = new Creator(base.getPath(), i);
        Thread thread = new Thread(creator);
        thread.start();
        last = thread;
    }
    
    if(last != null)
    {
        last.join();
    }
  
    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,代码行数:47,代码来源:CMISDataCreatorTest.java

示例14: testQueryFolderProperties

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
public void testQueryFolderProperties()
{
    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);
    
    ItemIterable<QueryResult>  result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false);
    assertEquals(1, result.getTotalNumItems());
    
    
    String uniqueName = getUniqueName();
    Map<String, Object> uProperties = new HashMap<String, Object>();
    uProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
    uProperties.put(PropertyIds.NAME, uniqueName);
    Folder uniqueFolder = newFolder.createFolder(uProperties);
    
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"'", false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"' AND IN_FOLDER('"+ uniqueFolder.getParentId() + "')" , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:folder where IN_FOLDER('"+ uniqueFolder.getParentId() + "')" , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"' AND cmis:createdBy = '"+ uniqueFolder.getCreatedBy()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"' AND cmis:objectId = '"+ uniqueFolder.getId()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"' AND cmis:lastModifiedBy = '"+ uniqueFolder.getLastModifiedBy()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:folder where cmis:name = '"+ uniqueFolder.getName()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    String creationDate = ISO8601DateFormat.format(uniqueFolder.getCreationDate().getTime());
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"' AND cmis:creationDate = '"+ creationDate +"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    String modificationDate = ISO8601DateFormat.format(uniqueFolder.getLastModificationDate().getTime());
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"' AND cmis:lastModificationDate = '"+ modificationDate+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"' AND cmis:objectTypeId = '"+ uniqueFolder.getType().getQueryName()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:folder where cmis:name = '"+uniqueName+"' AND cmis:baseTypeId = '"+ uniqueFolder.getBaseType().getQueryName()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:60,代码来源:CMISDataCreatorTest.java

示例15: testQueryDocumentProperties

import org.apache.chemistry.opencmis.client.api.Session; //导入方法依赖的package包/类
public void testQueryDocumentProperties() throws Exception
{
    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);
    
    ItemIterable<QueryResult>  result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false);
    assertEquals(1, result.getTotalNumItems());
    
    
    Document uniqueDocument = createUniqueDocument(newFolder);
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"'", false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND IN_FOLDER('"+ newFolder.getId() + "')" , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where IN_FOLDER('"+ newFolder.getId() + "')" , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:createdBy = '"+ uniqueDocument.getCreatedBy()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:objectId = '"+ uniqueDocument.getId()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:lastModifiedBy = '"+ uniqueDocument.getLastModifiedBy()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+ uniqueDocument.getName()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    String creationDate = ISO8601DateFormat.format(uniqueDocument.getCreationDate().getTime());
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:creationDate = '"+ creationDate +"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    String modificationDate = ISO8601DateFormat.format(uniqueDocument.getLastModificationDate().getTime());
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:lastModificationDate = '"+ modificationDate+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:objectTypeId = '"+ uniqueDocument.getType().getQueryName()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:baseTypeId = '"+ uniqueDocument.getBaseType().getQueryName()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:contentStreamFileName = '"+ uniqueDocument.getContentStreamFileName()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:contentStreamLength = '"+ uniqueDocument.getContentStreamLength()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
    
    result = session.query("select * from cmis:document where cmis:name = '"+uniqueDocument.getName()+"' AND cmis:contentStreamMimeType = '"+ uniqueDocument.getContentStreamMimeType()+"'"  , false);
    assertEquals(1, result.getTotalNumItems());
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:65,代码来源:CMISDataCreatorTest.java


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