How to read attachment from Omero using Java

Hi,

I would like to read attachments from Omero, I followed the example in here, but I got stuck with the function getOriginalFile, that seems to be the crucial function here :wink: . I would like to make a local copy of the attachment.

Thanks

Thomas

Hi Thomas

Thanks for pointing that out. The method to retrieve the Originalfile is not included in the doc
Below is the code to use

    private OriginalFile getOriginalFile(long id)
            throws Exception
    {
        ParametersI param = new ParametersI();
        param.map.put("id", omero.rtypes.rlong(id));
        IQueryPrx svc = gateway.getQueryService(ctx);
        return (OriginalFile) svc.findByQuery(
                "select p from OriginalFile as p " +
                        "where p.id = :id", param);
    }

We will update the documentation

Cheers

Jmarie

Hi @j.burel,

Works perfectly, thanks !

Thomas