Examples of RosieRecords


Examples of org.pathways.openciss.model.RosieRecords

      StringWriter sw = new StringWriter();
      CSVWriter writer = new CSVWriter(sw, ',', '"', "\r\n");
      writer.flush();
      writer.writeNext(csvRecord);
      writer.close();
      RosieRecords rr = new RosieRecords();
      log.info("writing out csv record:" + sw.toString());
      rr.setValue(sw.toString());
      Date now = new Date();
      rr.setTimestamp(now);
      rr.setUsed(0);
      RosieRecordsService rrs = new RosieRecordsService();
      rrs.createRosieRecords(rr);
    } catch (IOException e) {
      log.info("Problem closing file in writeNextAndClose: " + e.toString());
    }
View Full Code Here

Examples of org.pathways.openciss.model.RosieRecords

      csv7Record[i] = "";
    }
  }
  void writeToGoogleCloudStorage() {
    //for each unused Google Cloud SQL "rosie_records" table record, write a line into a single GCS bucket, and close the file finally.
    RosieRecords rr = new RosieRecords();
    EntityManager em;
    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);
      // You can write to the channel using the standard Java methods.
      // Here we use a PrintWriter:
      PrintWriter out = new PrintWriter(Channels.newWriter(writeChannel, "UTF8"));
      for (Long id_count = id_min; id_count <= id_max;  id_count++) {
        //write record value as a new line in Google Cloud Storage object
        rr = rrs.getRosieRecords(Long.valueOf(id_count));
        if (rr.getUsed() != 1) {
          log.info("writing out rosie record id: " + id_count);
          out.print(rr.getValue());
          out.flush();
          rrs.setRosieRecordsUsed(id_count);
        }
      }
      log.info("Done writing...");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.