Free Support Forum - groupdocs.com

Count of annotations on a file


#1

hi there…


is there any way we can get number of annotations on a file…

as per requirement … we need to show file list with count of annotations on it …


#2
Hello,

Thank you for your inquiry.

Yes, you can get number of annotations from file , for it you should use DaoFactory API class. This class will help you to get all information about data from default DataBase. We have prepared code example for you:

String guid = new EncodedPath("full file name", annotationHandler().getConfiguration()).getPath();
DaoFactory daoFactory = null;
daoFactory = DaoFactory.create();
IDocumentDao documentDao = daoFactory.getDocumentDao();
IDocument document = documentDao.selectBy(Arrays.asList(IDocument.DOCUMENT_GUID), guid);
IAnnotationDao annotationDao = daoFactory.getAnnotationDao();
Integer id = document.getId();
List annotation = annotationDao.selectAllBy(Arrays.asList(IAnnotation.ANNOTATION_SESSION_ID), id.toString());
Integer count = annotation.size();
daoFactory.close();

Also you can try to use listAnnotationsHandler, it will return string with all annotations from document. But get number of annotations will be problematically, than using DaoFactory class.

Note: If you use other DataBase for storing annotations , then you should use default methods to get data from tables. By default our connector will create such tables "document", "annotation" and you should work with these tables to get number of annotations.

If you will have more questions please feel free to contact us.

------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+