em = EMF.get().createEntityManager();
Long id_max = (Long)em.createQuery("select max(rr.id) from RosieRecords rr where rr.used =0").getSingleResult(); // this will give you the current record's id
Long id_min = (Long)em.createQuery("select min(rr.id) from RosieRecords rr where rr.used =0").getSingleResult(); // this will give you the current record's id
em.close();
RosieRecordsService rrs = new RosieRecordsService();
GcsFilename filename = new GcsFilename(BUCKETNAME, "RosieConversion_" + (new Date()).toString());
GcsFileOptions options = new GcsFileOptions.Builder().mimeType("text/html").acl("public-read").build();
//.addUserMetadata("myfield1", "my field value").build();
GcsOutputChannel writeChannel;
try {
writeChannel = gcsService.createOrReplace(filename, options);