//primero te declaras la sentencia que necesites
//en mi caso el nombre del documento era el mismo que su UUId, la arroba significa "dentro de", y el \\ es para hacer literal el \
String sentencia="@cm\\:name:'tu_nombre'";
//ahora declaras una nueva query, con tu sentencia
Query query = new Query(Constants.QUERY_LANG_LUCENE, sentencia)
//ahora te declaras el objeto queryresult, para poder pillar posteriormente el resultset
Store STORE = new Store (Constants.WORKSPACE_STORE, "SpacesStore");
QueryResult = queryresult = repositoryService.query(STORE, query, false);
//ahora ya podemos pillar el ResultSet de toda la vida
ResultSet = resultSet = queryresult.getResultSet();
//y el número de retornos
ResultSetRow[] rows = resultSet.getRows();
if(rows == null) //no resultados!!
else {
//ahora vamos a crear el objeto CML para eliminar los documentos que ha encontrado
CMLDelete[] deleteCMLArray = new CMLDelete[rows.length];
for(int index = 0; index<rows.length;index++) {
//pillamos el resultset de la posición
ResultSetRow row = rows[index];
deleteCMLArray[index] = new CLMDelete(new Predicate(new Reference[] {new Reference(storeRef, row.getNode().getId(),null)},null,null));
}
//y ahora ya podemos ejecutar el delete de todos los elementos de dentro del deleteCMLArray
CML cml = new CML();
cml.setDelete(deleteCMLArray);
UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.