04-24-2013 09:59 AM
org.alfresco.service.cmr.repository.XPathException: 03242678 Error executing xpath: \n /app:company_home/st:sites/cm:prova-italia-spa/cm:documentLibrary/cm:TestPorting/cm:2388/cm:InVigore
boolean res = this.createFolder("2388","/app:company_home/st:sites/cm:bosco-italia-spa/cm:documentLibrary/cm:TestPorting");
boolean res1 = this.createFolder("Approvati","/app:company_home/st:sites/cm:bosco-italia-spa/cm:documentLibrary/cm:TestPorting/cm:2388");
boolean res2 = this.createFolder("inVigore","/app:company_home/st:sites/cm:bosco-italia-spa/cm:documentLibrary/cm:TestPorting/cm:2388");
public boolean createFolder(String fileName,String percorso) throws Exception
{
// Avvio sessione
//AuthenticationUtils.startSession(user, password);
try
{
// Referenza al nodo padre in cui inserire il documento
Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
ParentReference companyHomeParent = new ParentReference(storeRef, null, percorso, Constants.ASSOC_CONTAINS, Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, "folder"));
//Richiesta del repository service e del content service
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
//Vettori delle proprietà
NamedValue[] contentProps = new NamedValue[1];
//Assegnazione ai vettori delle proprietà
contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME, fileName);
//Upload file custom
CMLCreate create = new CMLCreate("1", companyHomeParent, null, null, null, Constants.TYPE_FOLDER, contentProps);
// Blocco create CML
CML cml = new CML();
cml.setCreate(new CMLCreate[] {create});
//Creazione effettiva del nodo
UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
System.out.println("Cartella creata: " + fileName);
return true;
}
catch(Throwable e)
{
System.out.println(e.getMessage());
return false;
}
finally
{
// Fine della sessione
//AuthenticationUtils.endSession();
}
}
04-25-2013 06:45 AM
04-30-2013 08:37 AM
04-30-2013 11:40 AM
String[] fragments = "app:company_home/st:sites/cm:bosco-italia-spa/cm:documentLibrary/cm:TestPorting".split("/");
StringBuilder builder = new StringBuilder();
for(String fragment : fragments)
{
builder.append("/");
builder.append(ISO9075.getXPathName(QName.createQName(fragment, namespaceService), namespaceService));
}
String xpath = builder.toString();
05-08-2013 08:19 AM
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.