// @Override public List<Capture> getAllCaptures() { UserDetails userDetails = JarvisContextHolder.getContext().getUserDetails(); if (userDetails == null) { ResponseBuilderImpl builder = new ResponseBuilderImpl(); builder.status(Response.Status.UNAUTHORIZED); Response response = builder.build(); throw new WebApplicationException(response); } List<Capture> result = Lists.newArrayList(); for (final Annotation annotation : annotatorDao.getAnnotationsByUsername(userDetails.getUsername())) { Capture capture = new Capture(); capture.setAnnotator_schema_version(annotation.getAnnotatorSchemaVersion()); capture.setCreated(new Date(annotation.getCreated())); capture.setId(annotation.getId()); capture.setOfflineId(annotation.getOfflineId()); capture.setQuote(annotation.getQuote()); capture.setRanges(annotation.getRanges()); capture.setResearchSession(annotation.getResearchSession()); capture.setText(annotation.getText()); capture.setUri(annotation.getUri()); result.add(capture); } return result; }
// @Override public Capture saveCapture(final String sessionId, final Capture capture) { UserDetails userDetails = JarvisContextHolder.getContext().getUserDetails(); if (userDetails == null) { ResponseBuilderImpl builder = new ResponseBuilderImpl(); builder.status(Response.Status.UNAUTHORIZED); Response response = builder.build(); throw new WebApplicationException(response); } Annotation annotation = new Annotation(); annotation.setAuthor(userDetails.getUsername()); annotation.setAnnotatorSchemaVersion(capture.getAnnotator_schema_version()); annotation.setCreated(new Date().getTime()); annotation.setOfflineId(capture.getOfflineId()); annotation.setQuote(capture.getQuote()); annotation.setRanges(capture.getRanges()); annotation.setResearchSession(capture.getResearchSession()); annotation.setText(capture.getText()); annotation.setUri(capture.getUri()); annotatorDao.insertAnnotation(annotation); capture.setId(annotation.getId()); capture.setCreated(new Date(annotation.getCreated())); return capture; }
@Override public ConfluenceManager confluenceConnect() throws ConfluenceManagerException { logger.info("sonarConnect()"); ConfluenceManager sonarManager = null; if (JarvisContextHolder.getConfluenceContext() != null && JarvisContextHolder.getConfluenceContext().getConfluenceManager() != null) { sonarManager = JarvisContextHolder.getConfluenceContext().getConfluenceManager(); } else { JarvisContextHolder.setConfluenceContext( new ConfluenceContext(confluenceURL, confluenceUsername, confluencePass)); if (JarvisContextHolder.getConfluenceContext() != null && JarvisContextHolder.getConfluenceContext().getConfluenceManager() != null) { sonarManager = JarvisContextHolder.getConfluenceContext().getConfluenceManager(); } } return sonarManager; }