List of usage examples for org.springframework.dao DataAccessException fillInStackTrace
public synchronized Throwable fillInStackTrace()
From source file:org.uhp.portlets.news.service.BasicFeedService.java
/** * Get the attachment file to download.//from w w w . ja v a2 s .c o m * * @param fileUid * @param itemId * @param isProtected * @return AttachmentD */ public AttachmentD getAttachmentToDownload(final String fileUid, final Long itemId, final boolean isProtected) { try { List<Attachment> attachments = attachmentDao.getAttachmentsListByItem(itemId); boolean found = false; Attachment attachement = null; for (Attachment att : attachments) { String cmisUid = att.getCmisUid(); if (cmisUid.equalsIgnoreCase(fileUid)) { found = true; attachement = att; break; } } if (found) { // retrieve entity Item item = itemDao.getItemById(itemId); Category c = categoryDao.getCategoryById(item.getCategoryId()); if (NewsConstants.S_N.equals(c.getRssAllowed()) || (NewsConstants.S_N.equals(c.getPublicView()) && !isProtected)) { return null; } Long entityId = c.getEntityId(); AttachmentD toDownload = cmisDao.getAttachmentById(fileUid, entityId); toDownload.setFileName(attachement.getFileName()); toDownload.setAttachmentId(attachement.getAttachmentId()); return toDownload; } return null; } catch (DataAccessException e) { LOG.error("DAE " + e.getMessage(), e.fillInStackTrace()); } catch (CmisException ce) { LOG.error(ce, ce.fillInStackTrace()); } return null; }