buenas, estoy intentando actualizar un par de parametros de unos documentos pero no consigo que me funcione… el codigo es el siguiente
public void updateContent(docEv document, String nuevoNombre, String nuevaDescr, String path){
try {
WebServiceFactory.setEndpointAddress("http://...:8080/alfresco/api");
AuthenticationUtils.startSession("admin", "admin");
Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"" +path + "\"AND @ev\\:IDdoc:" + document.getIDdoc());
Predicate pred = new Predicate(null,storeRef,query);
NamedValue[] titledProps = new NamedValue[2];
titledProps[0] = Utils.createNamedValue(Constants.PROP_NAME, nuevoNombre);
titledProps[1] = Utils.createNamedValue(Constants.createQNameString(docEvModel.NAMESPACE_CONTENT_MODEL,
docEvModel.DESCRIPCIO), nuevaDescr);
CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_TITLED, titledProps, null, "1");
CMLUpdate update = new CMLUpdate(titledProps, pred, null);
CML cml = new CML();
cml.setUpdate(new CMLUpdate[] {update});
WebServiceFactory.getRepositoryService().update(cml);
//UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
//dumpUpdateResults (results);
}
catch (Exception e) {
e.printStackTrace();
} finally {
// tanca sessió
System.out.println("Desconectant…");
AuthenticationUtils.endSession();
}
tal y como esta el codigo no me da ningun problema pero no hace nada..Si quito el comentario de las lineas:
//UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
//dumpUpdateResults (results);
me da el siguiente erroriniciant sessio…java.lang.NullPointerExceptionDesconectant… at com.ev.ad10.data.documents.dao.DocumentDAOAlfrescoImpl.dumpUpdateResults(DocumentDAOAlfrescoImpl.java:389) at com.ev.ad10.data.documents.dao.DocumentDAOAlfrescoImpl.updateContent(DocumentDAOAlfrescoImpl.java:220) at com.ev.ad10.data.documents.dao.testDocumentDaoAlfrescoImpl.main(testDocumentDaoAlfrescoImpl.java:40)haber si alguien me sabe ayudar… Gracias!