AuthenticationUtils.startSession(ALFRESCO_USERNAME, ALFRESCO_PASSWORD);
QueryResult queryResultTestArea = null;
try {
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
Query query = new Query(Constants.QUERY_LANG_LUCENE, ALFRESCO_TEST_QUERY);
queryResultTestArea = repositoryService.query(STORE, query, false);
if(queryResultTestArea.getResultSet().getTotalRowCount()>0){
ResultSetRow row = queryResultTestArea.getResultSet().getRows(0);
Reference reference = new Reference();
reference.setStore(STORE);
reference.setUuid(row.getNode().getId());
Predicate predicate = new Predicate();
predicate.setStore(STORE);
predicate.setNodes(new Reference[]{reference});
CMLDelete cmlDelete = new CMLDelete();
cmlDelete.setWhere(predicate);
CML cml = new CML();
cml.setDelete(new CMLDelete[]{cmlDelete});
repositoryService.update(cml);
}
} finally {
AuthenticationUtils.endSession();
}