Thanks Rick!
To read using BaseDaoImpl:
@Override
public T read(ID id) {
return Stripersist.getEntityManager().find(getEntityClass(), id);
}
To store the attachment:
private void addAttachment(FileBean fileBean) throws IOException {
Attachment attachment = new Attachment();
attachment.setFileName(fileBean.getFileName());
attachment.setContentType(fileBean.getContentType());
attachment.setFilesize(fileBean.getSize());
byte[] data = new byte[(int) fileBean.getSize()];
InputStream in = fileBean.getInputStream();
in.read(data);
attachment.setData(data);
attachment.setIns(getIns());
attachmentDao.save(attachment);
attachmentDao.commit();
attachment = attachmentDao.read(attachment.getId());
fileBean.save(new File(attachmentDao.getFilePath(attachment)));
getIns().getAttachments().add(attachment);
}
Thank you,
Joaquin
On Oct 3, 2014, at 6:31 AM, Rick Grashel <rgras...@gmail.com> wrote:
> What does the code look like in AttachmentDAO.read( id )? Also, what does
> the code look like that stores the attachment when it is uploaded?
>
> -- Rick
>
> On Fri, Oct 3, 2014 at 8:16 AM, Joaquin Valdez <joaquinfval...@gmail.com>
> wrote:
> Hello!
>
> I seem to have trouble with the results of downloading an Excel spreadsheet
> (XLS or XSLX) file using the following code:
>
> public Resolution getAttachment() {
>
> Attachment attachment = attachmentDao.read(getAttachId());
> if (attachment.getIns().getId().equals(getIns().getId())) {
> return new StreamingResolution
> (attachment.getContentType(), new
> ByteArrayInputStream(attachment.getData()))
> .setFilename(attachment.getFileName());
> }
> }
>
> The upload appears to happen just fine as I am able to open up the uploaded
> file and it renders like it should. The downloaded file appears garbled.
> Attached is an image of the mess in Apple Numbers and it looks Similar in
> Libre Office.
>
> Any help or ideas would be appreciated!
>
> Thanks,
> Joaquin
>
>
> <Screen Shot 2014-10-03 at 6.14.30 AM.png>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users