01-23-2007 09:19 PM
Store store = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
Reference reference = new Reference(store, null, path);
ParentReference parentReference = new ParentReference(store,
reference.getUuid(),
reference.getPath(),
Constants.ASSOC_CONTAINS,
Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, name));
NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, name)};
CMLCreate create = new CMLCreate("1", parentReference, null, null,null, Constants.TYPE_FOLDER, properties);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
repositoryService.update(cml);
faultDetail:
{http://www.alfresco.org/ws/service/repository/1.0}RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>Error executing xpath:
xpath: /app:company_home/cm:yyy/cm:zzz/cm:ttt/cm:rrr/cm:2007</ns1:message>
{http://xml.apache.org/axis/}exceptionNamerg.alfresco.repo.webservice.repository.RepositoryFault
{http://xml.apache.org/axis/}stackTrace:
at org.alfresco.repo.webservice.repository.RepositoryWebService.update(RepositoryWebService.java:509)
at sun.reflect.GeneratedMethodAccessor534.invoke(Unknown Source)
01-24-2007 05:22 AM
01-31-2007 10:26 AM
public void testFolderCreate()
throws Exception
{
Reference newFolder = createFolder(BaseWebServiceSystemTest.rootReference, "123TestFolder");
assertNotNull(newFolder);
Reference newFolder2 = createFolder(BaseWebServiceSystemTest.rootReference, "2007");
assertNotNull(newFolder2);
}
private Reference createFolder(Reference parent, String folderName)
throws Exception
{
ParentReference parentReference = new ParentReference();
parentReference.setAssociationType(Constants.ASSOC_CHILDREN);
parentReference.setChildName(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, folderName));
parentReference.setStore(parent.getStore());
parentReference.setUuid(parent.getUuid());
NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, folderName)};
CMLCreate create = new CMLCreate("1", parentReference, null, null, null, Constants.TYPE_FOLDER, properties);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
return results[0].getDestination();
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.