//Searching and Deleting documents(CE API)
SearchScope search=new SearchScope(objectstore);
String value = abc;
String sql1= "Select * from DocClass where DocumentTitle = "+ Value;
SearchSQL searchSQL=new SearchSQL(sql1);
DocumentSet documents=(DocumentSet)search.fetchObjects(searchSQL, Integer.getInteger("50"), null, Boolean.valueOf(true));
Document doc;
Iterator it=documents.iterator();
while(it.hasNext())
{
doc=(Document)it.next();
logger.info("document name::"+doc.get_Name());
logger.info("deleting the document now:::");
doc.delete();
doc.save(RefreshMode.REFRESH);
}
SearchScope search=new SearchScope(objectstore);
String value = abc;
String sql1= "Select * from DocClass where DocumentTitle = "+ Value;
SearchSQL searchSQL=new SearchSQL(sql1);
DocumentSet documents=(DocumentSet)search.fetchObjects(searchSQL, Integer.getInteger("50"), null, Boolean.valueOf(true));
Document doc;
Iterator it=documents.iterator();
while(it.hasNext())
{
doc=(Document)it.next();
logger.info("document name::"+doc.get_Name());
logger.info("deleting the document now:::");
doc.delete();
doc.save(RefreshMode.REFRESH);
}
good
ReplyDelete