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


Java CMLUpdate类代码示例

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


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

示例1: updateNodeProperties

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
public void updateNodeProperties(Reference ref, Map<String, String> properties) throws RepositoryFault, RemoteException {
	NamedValue[] props = new NamedValue[properties.size()];
	int index = 0;
	for (String p: properties.keySet())
		props[index++] = Utils.createNamedValue(p, properties.get(p));
       CMLUpdate update = new CMLUpdate(
       		props,
       		new Predicate(new Reference[] {ref}, ALFRESCO_STORE, null),
       		null);       
       CML cml = new CML();
       cml.setUpdate(new CMLUpdate[]{update});
       getAlfrescoRepositoryService().update(cml);
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:14,代码来源:AlfrescoUtils.java

示例2: toCMLUpdate

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
public CMLUpdate toCMLUpdate(Reference ref) {
	logger.debug("Converting doc to CMLUpdate: {}", doc.name);
	Predicate pred = new Predicate(new Reference[] {ref},
			WebServiceRepositoryAccessSession.store, null);

	return new CMLUpdate(getContentPropsAndCreateIfNotExists(), pred, null);
}
 
开发者ID:xenit-eu,项目名称:move2alf,代码行数:8,代码来源:CMLDocument.java

示例3: updateFolder

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
protected void updateFolder(RepositoryServiceSoapBindingStub sRepositoryService, CMLHelper sCMLHelper, Map<Node, Integer> sNodesIndexes,
        String sCurrentNodePath, Map<String, List<Integer>> sNodesRefIndexes, Node sNode, Predicate sWhereNode) throws RemoteException {

    // Node.VersionOperation.RAISEERROR : Do nothing
    if (sNode.getVersionOperation().equals(Node.VersionOperation.REPLACE)) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Will replace folder node " + sNode.getId());
        }
        // WARNING : The node is deleted OUT OF THE CURRENT TRANSACTION !!!
        // But they are sent to the deleted items of the user used to
        // connect to Alfresco
        // FIXME : will fail if the folder is not empty
        CML aCML = new CML();
        aCML.setDelete(new CMLDelete[] { new CMLDelete(sWhereNode) });
        sRepositoryService.update(aCML);

        addCreateForNode(sCMLHelper, sNode, sNodesIndexes.get(sNode));
        addAssociationsForNode(sCMLHelper, sNode, null, sNodesRefIndexes, sNodesIndexes.get(sNode));

        // Clear the cache for the current node to force reload it
        evictRepositoryNode(sCurrentNodePath);

    } else if (sNode.getVersionOperation().equals(Node.VersionOperation.UPDATE) || sNode.getVersionOperation().equals(Node.VersionOperation.VERSION)) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Will skip folder node " + sNode.getId());
        }
        // Folders are not versionable, just update them
        sCMLHelper.addUpdate(new CMLUpdate(getProperties(sNode), sWhereNode, null));
        addAspectsForNode(sCMLHelper, sNode, sWhereNode, 0);
        addAssociationsForNode(sCMLHelper, sNode, sWhereNode, sNodesRefIndexes, 0);

        // Clear the cache for the current node to force reload it
        evictRepositoryNode(sCurrentNodePath);
    }
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:36,代码来源:AlfrescoNodeWriter.java

示例4: createDefaultMockResult

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
private CML createDefaultMockResult(RepositoryServiceSoapBindingStub sRepoService, String sDocName, String sDocTitle, String sFullPath, String sId, boolean isVersionable) throws Exception {
		CML aCML = new CML();
		ParentReference aRootfolderReference = new ParentReference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, null, "/app:company_home", Constants.ASSOC_CONTAINS, "{http://www.alfresco.org/model/content/1.0}Test Batch Writer");
		NamedValue aFolderNameProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}name", false, "Test Batch Writer", null);
		CMLCreate aFolderCreate = new CMLCreate("1", aRootfolderReference, null, null, null, "{http://www.alfresco.org/model/content/1.0}folder", new NamedValue[] {aFolderNameProperty});
		
		ParentReference aFolderReference = new ParentReference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, null, "/app:company_home/cm:Test_x0020_Batch_x0020_Writer", Constants.ASSOC_CONTAINS, "{http://www.alfresco.org/model/content/1.0}" + sDocName);
		NamedValue aDocumentNameProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}name", false, sDocName, null);
		NamedValue aDocumentTitleProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}title", false, sDocTitle, null);
		CMLCreate aDocumentCreate = new CMLCreate("2", aFolderReference, null, null, null, "{http://www.alfresco.org/model/content/1.0}content", new NamedValue[] {aDocumentNameProperty, aDocumentTitleProperty});
		CMLAddAspect aDocumentAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}titled", null, null, "2");
		CMLAddAspect aVersionAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}versionable", null, null, "2");
		FileInputStream aInputStream = new FileInputStream("src/test/resources/testFiles/content1.pdf");
		CMLWriteContent aDocumentContent = new CMLWriteContent(Constants.PROP_CONTENT, ContentUtils.convertToByteArray(aInputStream), new ContentFormat("application/pdf", null), null, "2");
		
		if (isVersionable) {
			aCML.setAddAspect(new CMLAddAspect[] {aDocumentAspect, aVersionAspect});
		} else {
			aCML.setAddAspect(new CMLAddAspect[] {aDocumentAspect});
		}
		aCML.setCreate(new CMLCreate[] {aFolderCreate, aDocumentCreate});
		aCML.setWriteContent(new CMLWriteContent[] {aDocumentContent});
		aCML.setCreateAssociation(new CMLCreateAssociation[] {});
		aCML.setUpdate(new CMLUpdate[] {});
		aCML.setDelete(new CMLDelete[] {});
		
		UpdateResult[] aUpdateResult = new UpdateResult[2];
//		aUpdateResult[0] = new UpdateResult();
//		aUpdateResult[0].setDestination(new Reference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, "00000000-0000-0000-0000-000000000001", "/app:company_home"));
		aUpdateResult[0] = new UpdateResult();
		aUpdateResult[0].setDestination(new Reference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, "00000000-0000-0000-0000-000000000002", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer"));
		aUpdateResult[1] = new UpdateResult();
		aUpdateResult[1].setDestination(new Reference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, sId, sFullPath));
		
		when(sRepoService.update(eq(aCML))).thenReturn(aUpdateResult);
		
		return aCML;
	}
 
开发者ID:acxio,项目名称:AGIA,代码行数:39,代码来源:AlfrescoNodeWriterCacheTest.java

示例5: createDefaultMockResult

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
private CML createDefaultMockResult(RepositoryServiceSoapBindingStub sRepoService, String sDocName, String sDocTitle, String sFullPath, String sId, boolean isVersionable) throws Exception {
		CML aCML = new CML();
		ParentReference aRootfolderReference = new ParentReference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, null, "/app:company_home", Constants.ASSOC_CONTAINS, "{http://www.alfresco.org/model/content/1.0}Test Batch Writer");
		NamedValue aFolderNameProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}name", false, "Test Batch Writer", null);
		CMLCreate aFolderCreate = new CMLCreate("1", aRootfolderReference, null, null, null, "{http://www.alfresco.org/model/content/1.0}folder", new NamedValue[] {aFolderNameProperty});
		
		ParentReference aFolderReference = new ParentReference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, null, "/app:company_home/cm:Test_x0020_Batch_x0020_Writer", Constants.ASSOC_CONTAINS, "{http://www.alfresco.org/model/content/1.0}" + sDocName);
		NamedValue aDocumentNameProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}name", false, sDocName, null);
		NamedValue aDocumentTitleProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}title", false, sDocTitle, null);
		CMLCreate aDocumentCreate = new CMLCreate("2", aFolderReference, null, null, null, "{http://www.alfresco.org/model/content/1.0}content", new NamedValue[] {aDocumentNameProperty, aDocumentTitleProperty});
		CMLAddAspect aDocumentAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}titled", null, null, "2");
		CMLAddAspect aVersionAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}versionable", null, null, "2");
		FileInputStream aInputStream = new FileInputStream("src/test/resources/testFiles/content1.pdf");
		
		if (isVersionable) {
			aCML.setAddAspect(new CMLAddAspect[] {aDocumentAspect, aVersionAspect});
		} else {
			aCML.setAddAspect(new CMLAddAspect[] {aDocumentAspect});
		}
		aCML.setCreate(new CMLCreate[] {aFolderCreate, aDocumentCreate});
		aCML.setWriteContent(new CMLWriteContent[] {});
		aCML.setCreateAssociation(new CMLCreateAssociation[] {});
		aCML.setUpdate(new CMLUpdate[] {});
		aCML.setDelete(new CMLDelete[] {});
		
		UpdateResult[] aUpdateResult = new UpdateResult[2];
//		aUpdateResult[0] = new UpdateResult();
//		aUpdateResult[0].setDestination(new Reference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, "00000000-0000-0000-0000-000000000001", "/app:company_home"));
		aUpdateResult[0] = new UpdateResult();
		aUpdateResult[0].setDestination(new Reference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, "00000000-0000-0000-0000-000000000002", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer"));
		aUpdateResult[1] = new UpdateResult();
		aUpdateResult[1].setDestination(new Reference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, sId, sFullPath));
		
		when(sRepoService.update(eq(aCML))).thenReturn(aUpdateResult);
		
		return aCML;
	}
 
开发者ID:acxio,项目名称:AGIA,代码行数:38,代码来源:AlfrescoNodeContentWriterTest.java

示例6: updateDocument

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
protected void updateDocument(RepositoryServiceSoapBindingStub sRepositoryService, CMLHelper sCMLHelper, Map<Node, Integer> sNodesIndexes,
        String sCurrentNodePath, Map<String, List<Integer>> sNodesRefIndexes, Node sNode, Predicate sWhereNode) throws VersionOperationException,
        IOException {

    if (sNode.getVersionOperation().equals(Node.VersionOperation.RAISEERROR)) {
        throw new VersionOperationException("Node already exists " + sNode.getId());
    } else if (sNode.getVersionOperation().equals(Node.VersionOperation.REPLACE)) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Will replace document node " + sNode.getId());
        }
        // aCMLHelper.addDelete(new CMLDelete(sWhereNode)); // THIS DOES NOT
        // WORK because every CMLCreate happen BEFORE every CMLDelete

        // WARNING : The node is deleted OUT OF THE CURRENT TRANSACTION !!!
        // But they are sent to the deleted items of the user used to
        // connect to Alfresco
        CML aCML = new CML();
        aCML.setDelete(new CMLDelete[] { new CMLDelete(sWhereNode) });
        sRepositoryService.update(aCML);

        addCreateForNode(sCMLHelper, sNode, sNodesIndexes.get(sNode));
        addAssociationsForNode(sCMLHelper, sNode, null, sNodesRefIndexes, sNodesIndexes.get(sNode));
        addContentForNode(sCMLHelper, (Document) sNode, null, sNodesIndexes.get(sNode));
    } else if (sNode.getVersionOperation().equals(Node.VersionOperation.UPDATE)) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Will update document node " + sNode.getId());
        }
        // WARNING : Updating a versionable node will create a new version
        sCMLHelper.addUpdate(new CMLUpdate(getProperties(sNode), sWhereNode, null));
        addAspectsForNode(sCMLHelper, sNode, sWhereNode, 0);
        addAssociationsForNode(sCMLHelper, sNode, sWhereNode, sNodesRefIndexes, 0);
        addContentForNode(sCMLHelper, (Document) sNode, sWhereNode, 0);
    } else if (sNode.getVersionOperation().equals(Node.VersionOperation.VERSION)) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Will create a new version of document node " + sNode.getId());
        }
        // WARNING : the update will not create a version if there is not
        // property or content change
        // WARNING : the aspect is added AFTER the properties or content
        // change
        // so the document will not retain its current version and the new
        // one will update it

        sCMLHelper.addAddAspect(new CMLAddAspect(Constants.ASPECT_VERSIONABLE, null, sWhereNode, null));
        sCMLHelper.addUpdate(new CMLUpdate(getProperties(sNode), sWhereNode, null));
        addAspectsForNode(sCMLHelper, sNode, sWhereNode, 0);
        addAssociationsForNode(sCMLHelper, sNode, sWhereNode, sNodesRefIndexes, 0);
        addContentForNode(sCMLHelper, (Document) sNode, sWhereNode, 0);
    }
    // Clear the cache for the current node to force reload it
    evictRepositoryNode(sCurrentNodePath);
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:53,代码来源:AlfrescoNodeWriter.java

示例7: testWrite

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
@Test
@DirtiesContext
public void testWrite() throws Exception {
	RepositoryServiceSoapBindingStub aRepoService = nodeWriter.getAlfrescoService().getRepositoryService();
	CML aCML = createDefaultMockResult(aRepoService, "Test Batch Writer Content", "Text content", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer/cm:Test_x0020_Batch_x0020_Writer_x0020_Content", "00000000-0000-0000-0000-000000000003", false);
	List<NodeList> aData = createDefaultNodeListList("Test Batch Writer Content", "Text content", "cm:Test_x0020_Batch_x0020_Writer_x0020_Content", null, false);
	
	nodeWriter.write(aData);
	
	// Verify sent CML
	verify(aRepoService, times(1)).update(eq(aCML));
	verify(aRepoService, times(0)).query(any(Store.class), any(Query.class), anyBoolean());
	verify(aRepoService, times(3)).get(any(Predicate.class));
	
	updateMockContext(aRepoService, "00000000-0000-0000-0000-000000000003", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer/cm:Test_x0020_Batch_x0020_Writer_x0020_Content");
	
	aCML = new CML();
	
	ParentReference aFolderReference = new ParentReference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, null, "/app:company_home/cm:Test_x0020_Batch_x0020_Writer", Constants.ASSOC_CONTAINS, "{http://www.alfresco.org/model/content/1.0}Test Batch Writer Content 2");
	NamedValue aDocumentNameProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}name", false, "Test Batch Writer Content 2", null);
	NamedValue aDocumentTitleProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}title", false, "Text content", null);
	CMLCreate aDocumentCreate = new CMLCreate("2", aFolderReference, null, null, null, "{http://www.alfresco.org/model/content/1.0}content", new NamedValue[] {aDocumentNameProperty, aDocumentTitleProperty});
	CMLAddAspect aDocumentAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}titled", null, null, "2");
	FileInputStream aInputStream = new FileInputStream("src/test/resources/testFiles/content1.pdf");
	CMLWriteContent aDocumentContent = new CMLWriteContent(Constants.PROP_CONTENT, ContentUtils.convertToByteArray(aInputStream), new ContentFormat("application/pdf", null), null, "2");
	
	aCML.setAddAspect(new CMLAddAspect[] {aDocumentAspect});
	aCML.setCreate(new CMLCreate[] {aDocumentCreate});
	aCML.setWriteContent(new CMLWriteContent[] {aDocumentContent});
	aCML.setCreateAssociation(new CMLCreateAssociation[] {});
	aCML.setUpdate(new CMLUpdate[] {});
	aCML.setDelete(new CMLDelete[] {});

	UpdateResult[] aUpdateResult2 = new UpdateResult[1];
	aUpdateResult2[0] = new UpdateResult();
	aUpdateResult2[0].setDestination(new Reference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, "00000000-0000-0000-0000-000000000004", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer/cm:Test_x0020_Batch_x0020_Writer_x0020_Content_2"));
	
	when(aRepoService.update(eq(aCML))).thenReturn(aUpdateResult2);
	
	
	aData = createDefaultNodeListList("Test Batch Writer Content 2", "Text content", "cm:Test_x0020_Batch_x0020_Writer_x0020_Content_x0020_2", null, false);
	
	nodeWriter.write(aData);
	
	// Verify sent CML
	
	verify(aRepoService, times(1)).update(eq(aCML));
	verify(aRepoService, times(0)).query(any(Store.class), any(Query.class), anyBoolean());
	verify(aRepoService, times(4)).get(any(Predicate.class));
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:51,代码来源:AlfrescoNodeWriterCacheTest.java

示例8: testWriteUpdate

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
@Test
@DirtiesContext
public void testWriteUpdate() throws Exception {
	RepositoryServiceSoapBindingStub aRepoService = nodeWriter.getAlfrescoService().getRepositoryService();
	CML aCML = createDefaultMockResult(aRepoService, "Test Batch Writer ContentU", "Text content", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer/cm:Test_x0020_Batch_x0020_Writer_x0020_ContentU", "00000000-0000-0000-0000-000000000004", true);
	List<NodeList> aData = createDefaultNodeListList("Test Batch Writer ContentU", "Text content", "cm:Test_x0020_Batch_x0020_Writer_x0020_ContentU", null, true);
	
	nodeWriter.write(aData);
	
	// Verify sent CML
	verify(aRepoService, times(1)).update(eq(aCML));
	verify(aRepoService, times(0)).query(any(Store.class), any(Query.class), anyBoolean());
	verify(aRepoService, times(3)).get(any(Predicate.class));
	
	updateMockContext(aRepoService, "00000000-0000-0000-0000-000000000004", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer/cm:Test_x0020_Batch_x0020_Writer_x0020_ContentU");
	
	aCML = new CML();
	
	NamedValue aDocumentNameProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}name", false, "Test Batch Writer ContentU", null);
	NamedValue aDocumentTitleProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}title", false, "Text content UPDATED", null);
	
	Reference aDocReference = new Reference(AlfrescoServicesConsumer.STORE, "00000000-0000-0000-0000-000000000004", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer/cm:Test_x0020_Batch_x0020_Writer_x0020_ContentU");
	Predicate sWhereNode = new Predicate(new Reference[] {aDocReference}, null, null);
	CMLUpdate aDocumentUpdate = new CMLUpdate(new NamedValue[] {aDocumentNameProperty, aDocumentTitleProperty}, sWhereNode, null);
	CMLAddAspect aDocumentAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}titled", null, sWhereNode, null);
	FileInputStream aInputStream = new FileInputStream("src/test/resources/testFiles/content1.pdf");
	CMLWriteContent aDocumentContent = new CMLWriteContent(Constants.PROP_CONTENT, ContentUtils.convertToByteArray(aInputStream), new ContentFormat("application/pdf", null), sWhereNode, null);
	
	aCML.setAddAspect(new CMLAddAspect[] {aDocumentAspect});
	aCML.setCreate(new CMLCreate[] {});
	aCML.setWriteContent(new CMLWriteContent[] {aDocumentContent});
	aCML.setCreateAssociation(new CMLCreateAssociation[] {});
	aCML.setUpdate(new CMLUpdate[] {aDocumentUpdate});
	aCML.setDelete(new CMLDelete[] {});

	UpdateResult[] aUpdateResult2 = new UpdateResult[1];
	aUpdateResult2[0] = new UpdateResult();
	aUpdateResult2[0].setDestination(new Reference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, "00000000-0000-0000-0000-000000000004", "/app:company_home/cm:Test_x0020_Batch_x0020_Writer/cm:Test_x0020_Batch_x0020_Writer_x0020_ContentU"));
	
	when(aRepoService.update(eq(aCML))).thenReturn(aUpdateResult2);
	
	aData = createDefaultNodeListList("Test Batch Writer ContentU", "Text content UPDATED", "cm:Test_x0020_Batch_x0020_Writer_x0020_ContentU", VersionOperation.UPDATE, false);

	nodeWriter.write(aData);
	
	// Verify sent CML
	
	verify(aRepoService, times(1)).update(eq(aCML));
	verify(aRepoService, times(0)).query(any(Store.class), any(Query.class), anyBoolean());
	verify(aRepoService, times(3)).get(any(Predicate.class));

}
 
开发者ID:acxio,项目名称:AGIA,代码行数:53,代码来源:AlfrescoNodeWriterCacheTest.java

示例9: testWrite

import org.alfresco.webservice.types.CMLUpdate; //导入依赖的package包/类
@Test
public void testWrite() throws Exception {
	List<NodeList> aData = new ArrayList<NodeList>();
	NodeList aNodeList = new NodeList();
	
	Folder aRootFolder = new Folder();
	aRootFolder.setParent(null);
	aRootFolder.setType(new QName("cm:folder", namespaceContext));
	aRootFolder.addProperty(new Property(new QName("cm:name", namespaceContext), "company_home"));
	aRootFolder.setPathElement("app:company_home");
	
	Folder aTestFolder = new Folder();
	aTestFolder.setParent(aRootFolder);
	aRootFolder.addFolder(aTestFolder);
	aTestFolder.setType(new QName("cm:folder", namespaceContext));
	aTestFolder.addProperty(new Property(new QName("cm:name", namespaceContext), "Test Batch Writer"));
	aTestFolder.setPathElement("cm:Test_x0020_Batch_x0020_Writer");
	
	Document aDocument = new Document();
	aDocument.setParent(aTestFolder);
	aTestFolder.addDocument(aDocument);
	aDocument.setType(new QName("cm:content", namespaceContext));
	aDocument.addProperty(new Property(new QName("cm:name", namespaceContext), "Test Batch Writer Content"));
	aDocument.addProperty(new Property(new QName("cm:title", namespaceContext), "Text content"));
	aDocument.addAspect(new Aspect(new QName("cm:titled", namespaceContext)));
	aDocument.setContentPath("src/test/resources/testFiles/content1.pdf");
	aDocument.setMimeType("application/pdf");
	aDocument.setPathElement("cm:Test_x0020_Batch_x0020_Writer_x0020_Content");
	
	aNodeList.add(aRootFolder);
	aNodeList.add(aTestFolder);
	aNodeList.add(aDocument);
	
	aData.add(aNodeList);
	
	nodeWriter.write(aData);
	
	// Verify sent CML
	RepositoryServiceSoapBindingStub aRepoService = nodeWriter.getAlfrescoService().getRepositoryService();
	CML aCML = new CML();
	ParentReference aRootfolderReference = new ParentReference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, null, "/app:company_home", Constants.ASSOC_CONTAINS, "{http://www.alfresco.org/model/content/1.0}Test Batch Writer");
	NamedValue aFolderNameProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}name", false, "Test Batch Writer", null);
	CMLCreate aFolderCreate = new CMLCreate("1", aRootfolderReference, null, null, null, "{http://www.alfresco.org/model/content/1.0}folder", new NamedValue[] {aFolderNameProperty});
	
	ParentReference aFolderReference = new ParentReference(fr.acxio.tools.agia.alfresco.AlfrescoServicesConsumer.STORE, null, "/app:company_home/cm:Test_x0020_Batch_x0020_Writer", Constants.ASSOC_CONTAINS, "{http://www.alfresco.org/model/content/1.0}Test Batch Writer Content");
	NamedValue aDocumentNameProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}name", false, "Test Batch Writer Content", null);
	NamedValue aDocumentTitleProperty = new NamedValue("{http://www.alfresco.org/model/content/1.0}title", false, "Text content", null);
	CMLCreate aDocumentCreate = new CMLCreate("2", aFolderReference, null, null, null, "{http://www.alfresco.org/model/content/1.0}content", new NamedValue[] {aDocumentNameProperty, aDocumentTitleProperty});
	CMLAddAspect aDocumentAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}titled", null, null, "2");
	FileInputStream aInputStream = new FileInputStream("src/test/resources/testFiles/content1.pdf");
	CMLWriteContent aDocumentContent = new CMLWriteContent(Constants.PROP_CONTENT, ContentUtils.convertToByteArray(aInputStream), new ContentFormat("application/pdf", null), null, "2");
	
	aCML.setAddAspect(new CMLAddAspect[] {aDocumentAspect});
	aCML.setCreate(new CMLCreate[] {aFolderCreate, aDocumentCreate});
	aCML.setWriteContent(new CMLWriteContent[] {aDocumentContent});
	aCML.setCreateAssociation(new CMLCreateAssociation[] {});
	aCML.setUpdate(new CMLUpdate[] {});
	aCML.setDelete(new CMLDelete[] {});
	
	verify(aRepoService, times(1)).update(eq(aCML));
	verify(aRepoService, times(0)).query(any(Store.class), any(Query.class), anyBoolean());
	verify(aRepoService, times(3)).get(any(Predicate.class));
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:64,代码来源:AlfrescoNodeWriterTest.java


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