本文整理汇总了Java中org.alfresco.webservice.types.CMLCreate类的典型用法代码示例。如果您正苦于以下问题:Java CMLCreate类的具体用法?Java CMLCreate怎么用?Java CMLCreate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CMLCreate类属于org.alfresco.webservice.types包,在下文中一共展示了CMLCreate类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContent
import org.alfresco.webservice.types.CMLCreate; //导入依赖的package包/类
private String createContent(
Reference ref,
String name,
String title,
String description,
byte[] data) throws RemoteException, ContentFault {
ParentReference parent = getReferenceToParent(ref);
parent.setChildName(Constants.createQNameString(
Constants.NAMESPACE_CONTENT_MODEL,
normalizeNodeName(name)));
NamedValue[] properties = new NamedValue[]{
Utils.createNamedValue(Constants.PROP_NAME, name),
Utils.createNamedValue(Constants.PROP_TITLE, title),
Utils.createNamedValue(Constants.PROP_DESCRIPTION, description)};
CMLCreate create = new CMLCreate("1", parent, null, null, null, Constants.TYPE_CONTENT, properties);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
UpdateResult[] result = getAlfrescoRepositoryService().update(cml);
Reference newContentNode = result[0].getDestination();
Content content = getAlfrescoContentService().write(
newContentNode,
Constants.PROP_CONTENT,
data,
new ContentFormat(new MimetypesFileTypeMap().getContentType(name), null));
return content.getNode().getUuid();
}
示例2: createContent
import org.alfresco.webservice.types.CMLCreate; //导入依赖的package包/类
public String createContent(
Reference ref,
String name,
String title,
String description,
byte[] data) throws RemoteException, ContentFault {
ParentReference parent = getReferenceToParent(ref);
parent.setChildName(Constants.createQNameString(
Constants.NAMESPACE_CONTENT_MODEL,
normalizeNodeName(name)));
NamedValue[] properties = new NamedValue[]{
Utils.createNamedValue(Constants.PROP_NAME, name),
Utils.createNamedValue(Constants.PROP_TITLE, title),
Utils.createNamedValue(Constants.PROP_DESCRIPTION, description)};
CMLCreate create = new CMLCreate("1", parent, null, null, null, Constants.TYPE_CONTENT, properties);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
UpdateResult[] result = getAlfrescoRepositoryService().update(cml);
Reference newContentNode = result[0].getDestination();
Content content = getAlfrescoContentService().write(
newContentNode,
Constants.PROP_CONTENT,
data,
new ContentFormat(new MimetypesFileTypeMap().getContentType(name), null));
return content.getNode().getUuid();
}
示例3: toCMLCreate
import org.alfresco.webservice.types.CMLCreate; //导入依赖的package包/类
public CMLCreate toCMLCreate() throws RepositoryAccessException, RepositoryException {
logger.debug("Converting doc to CMLCreate: {}", doc.name);
Reference parentSpace = session.createSpaceIfNotExists(getQnamePath());
ParentReference parentRef = new ParentReference(WebServiceRepositoryAccessSession.store,
parentSpace.getUuid(), null, Constants.ASSOC_CONTAINS, null);
parentRef.setChildName("{http://www.alfresco.org/model/content/1.0}"
+ doc.name);
return new CMLCreate(this.getId(), parentRef, parentSpace.getUuid(),
Constants.ASSOC_CONTAINS, null, /* Constants.TYPE_CONTENT */
doc.contentModelNamespace + doc.contentModelType, getContentPropsAndCreateIfNotExists());
}
示例4: addCreateForNode
import org.alfresco.webservice.types.CMLCreate; //导入依赖的package包/类
private void addCreateForNode(CMLHelper sCMLHelper, Node sNode, int sNodeIndex) {
NamedValue[] aProps = getProperties(sNode);
ParentReference aParentReference = new ParentReference(STORE, null, sNode.getParent().getPath(), Constants.ASSOC_CONTAINS, new QName(sNode.getType()
.getNamespaceURI(), sNode.getName()).toString());
String aNodeType = (sNode.getType() == null) ? Constants.TYPE_CONTENT : sNode.getType().toString();
sCMLHelper.addCreate(new CMLCreate(Integer.toString(sNodeIndex), aParentReference, null, null, null, aNodeType, aProps));
addAspectsForNode(sCMLHelper, sNode, null, sNodeIndex);
}
示例5: createDefaultMockResult
import org.alfresco.webservice.types.CMLCreate; //导入依赖的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;
}
示例6: createDefaultMockResult
import org.alfresco.webservice.types.CMLCreate; //导入依赖的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;
}
示例7: testWrite
import org.alfresco.webservice.types.CMLCreate; //导入依赖的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));
}
示例8: testWriteUpdate
import org.alfresco.webservice.types.CMLCreate; //导入依赖的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));
}
示例9: testWrite
import org.alfresco.webservice.types.CMLCreate; //导入依赖的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));
}