• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java AlfrescoDocument类的典型用法和代码示例

java 2次浏览

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

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

示例1: executeImplSimpleQuery

点赞 2

import org.alfresco.cmis.client.AlfrescoDocument; //导入依赖的package包/类
private void executeImplSimpleQuery(Object inputMessage) {
    logger.info("Simple query");
    Session session = createSession();
    int pageSize = CmisQuery.pageSize;

    int count = 0;
    int pageNumber = 0;
    boolean finished = false;
    logger.debug("Sending query {}", cmisQuery);
    ItemIterable<QueryResult> itemIterable = CmisQuery.executeQuery(cmisQuery,session);
    while (!finished) {
        int countStart=count;
        ItemIterable<QueryResult> currentPage = itemIterable.skipTo(count).getPage();
        logger.debug("Processing page {}", pageNumber, " with total number of items=" + currentPage.getTotalNumItems());
        if(pageSize!=currentPage.getTotalNumItems() && currentPage.getHasMoreItems()) {
            logger.error("Page " + pageNumber + " did not get the correct number of results:" + currentPage.getTotalNumItems() + " will repeat");
            continue;
        }
        for (QueryResult item : currentPage) {

            String objectId = item.getPropertyValueById(PropertyIds.OBJECT_ID);
            try {
                AlfrescoDocument doc = (AlfrescoDocument) session.getObject(session.createObjectId(objectId));
                Map<String, Object> properties = CMISHelper.propertyDataToMap(doc.getProperties());
                List<Folder> parents = doc.getParents();
                if(parents!=null && !(parents.isEmpty())) {
                    properties.put(Parameters.PARAM_ACL, doc.getAcl());
                    String path = parents.get(0).getPath();
                    String name = doc.getName();
                    properties.put(Parameters.PARAM_INPUT_PATH, path);
                    Object objectBaseTypeId = item.getPropertyValueById(PropertyIds.BASE_TYPE_ID);
                    InputStream inputStream = null;
                    if(!(skipContentUpload) && (CMISHelper.CMIS_DOCUMENT).equals(objectBaseTypeId)) {
                        inputStream = CmisQuery.getContentStreamFor(item, session);
                    }
                    logger.debug("Will process document " + objectId + " with path " + path + " and inputStream=" + inputStream + " and skipContentUpload=" + skipContentUpload);
                    ProcessCmisDocument.processDocument(objectId, name, path, CmisQuery.tempFolder, inputStream, properties, skipContentUpload, sendingContext);
                } else {
                    logger.info("Skipping " + doc.getName() + " because it has no parents");
                }
            } catch (Exception e) {
                logger.error("Skipping " + objectId + ", exception: " + e);
            }

            count++;
        }
        if(!finished)
            if(currentPage.getTotalNumItems()*(pageNumber+1)==count) {
                pageNumber++;
                logger.debug("Increased page number, now " + pageNumber + " where count=" + count + " and total number of items on paged processed=" + currentPage.getTotalNumItems());
            } else {
                logger.error("Page " + pageNumber + " has not been processed correctly, count=" + count + " and total number of items=" + currentPage.getTotalNumItems() + " retrying");
                count=countStart;
            }
        if (!(currentPage.getHasMoreItems())) {
            //if(count==currentPage.getTotalNumItems()) {
            finished = true;
        }
    }
}
 

开发者ID:xenit-eu,
项目名称:move2alf,
代码行数:61,
代码来源:SACMISInput.java

示例2: testALF19320

点赞 2

import org.alfresco.cmis.client.AlfrescoDocument; //导入依赖的package包/类
@Test
  public void testALF19320() throws Exception
  {
      final TestNetwork network1 = getTestFixture().getRandomNetwork();

      String username = "user" + System.currentTimeMillis();
PersonInfo personInfo = new PersonInfo(username, username, username, TEST_PASSWORD, null, null, null, null, null, null, null);
      TestPerson person1 = network1.createUser(personInfo);
      String person1Id = person1.getId();

      final String siteName = "site" + System.currentTimeMillis();

      TenantUtil.runAsUserTenant(new TenantRunAsWork<NodeRef>()
      {
          @Override
          public NodeRef doWork() throws Exception
          {
              SiteInformation siteInfo = new SiteInformation(siteName, siteName, siteName, SiteVisibility.PRIVATE);
              TestSite site = repoService.createSite(null, siteInfo);

              String name = GUID.generate();
		NodeRef folderNodeRef = repoService.createFolder(site.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), name);
              return folderNodeRef;
          }
      }, person1Id, network1.getId());

      // Create a document...
      publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_10, AlfrescoObjectFactoryImpl.class.getName());
      AlfrescoFolder docLibrary = (AlfrescoFolder)cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary");
      Map<String, String> properties = new HashMap<String, String>();
      {
          // create a document with 2 aspects
          properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled,P:cm:author");
          properties.put(PropertyIds.NAME, "mydoc-" + GUID.generate() + ".txt");
      }
      ContentStreamImpl fileContent = new ContentStreamImpl();
      {
          ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
          writer.putContent("Ipsum and so on");
          ContentReader reader = writer.getReader();
          fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
          fileContent.setStream(reader.getContentInputStream());
      }
      
      AlfrescoDocument doc = (AlfrescoDocument)docLibrary.createDocument(properties, fileContent, VersioningState.MAJOR);
      String versionLabel = doc.getVersionLabel();
assertEquals(CMIS_VERSION_10, versionLabel);

      AlfrescoDocument doc1 = (AlfrescoDocument)doc.getObjectOfLatestVersion(false);
      String versionLabel1 = doc1.getVersionLabel();
assertEquals(CMIS_VERSION_10, versionLabel1);
  }
 

开发者ID:Alfresco,
项目名称:alfresco-remote-api,
代码行数:54,
代码来源:TestCMIS.java

示例3: setPropertyImportFlag

点赞 2

import org.alfresco.cmis.client.AlfrescoDocument; //导入依赖的package包/类
private void setPropertyImportFlag(final CmisObject cmisObject, final BatchClassCmisConfiguration batchClassCmisConfiguration) {
	final AlfrescoDocument alfrescoDocument = (AlfrescoDocument) cmisObject;
	final Map<String, Object> updateproperties = new HashMap<String, Object>();
	updateproperties.put(batchClassCmisConfiguration.getCmisProperty(), (Object) batchClassCmisConfiguration.getValueToUpdate());
	alfrescoDocument.updateProperties(updateproperties);
}
 

开发者ID:kuzavas,
项目名称:ephesoft,
代码行数:7,
代码来源:CmisImport.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)