Examples of HUDXML3Blob


Examples of org.pathways.openciss.shared.HUDXML3Blob

    // if file1 already started and not finished, resume file 1
      // get last marker processed from file or db?  what is the key?
      // continue, writing out each time
    HUDXML3BlobService hxbs = new HUDXML3BlobService();
    log.info("trying to get HUDXML3Blob object from Key String: " + hudXMLURL.getKeyString());
    HUDXML3Blob blob = hxbs.getHUDXML3BlobFromXMLKey(hudXMLURL.getKeyString());
    if (blob != null) {
      String id = blob.getId().toString();
      if (!recordExists(id)) {
        log.info("for HUD XML blob record: " + id + " nothing has been done, not even file 1 indexing, so start up first time.");
        startUpFirstTime(id);
      }
      else {
        log.info("HUD XML blob record: " + id + " already exists, so continuing from past session.");
        //everything keys of the household index
        if (!finishedConverting(id)) {
          convertHUDXMLToRosieCSV2(id);
          // set as finished in database
          blob = hxbs.getHUDXML3BlobFromXMLKey(hudXMLURL.getKeyString());
          blob.setCsvUrl2Completed(1);
          hxbs.updateHUDXML3Blob(blob);
        }
      }
      log.info("finished storing in db, now writing to a GCS file");
      writeToGoogleCloudStorage();
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

    ris.deleteAllRosieIndexes();
    startRecordsCreation();
    indexHouseholds(id);
    // set as finished in database
    HUDXML3BlobService hxbs = new HUDXML3BlobService();
    HUDXML3Blob blob = hxbs.getHUDXML3BlobFromXMLKey(hudXMLURL.getKeyString());
    //blob.setCsvUrl1Completed(1);
    //hxbs.updateHUDXML3Blob(blob);
    //blob = null;
    convertHUDXMLToRosieCSV2(id);
    blob = hxbs.getHUDXML3BlobFromXMLKey(hudXMLURL.getKeyString());
    blob.setCsvUrl2Completed(1);
    hxbs.updateHUDXML3Blob(blob);
    blob = null;
    log.info("finished processing in one pass!");
  }
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

  }

  boolean recordExists(String id) {
    boolean result = false;
    HUDXML3BlobService hxbs = new HUDXML3BlobService();
    HUDXML3Blob blob = hxbs.getHUDXML3Blob(id);
    if (blob != null) {
      if (blob.getCsvUrl2Indexed() == 1) {
        result = true;
      }
    }
    return result;
  }
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

          }
        }
        //mark this file as indexed
        HUDXML3BlobService hxbs = new HUDXML3BlobService();
        log.info("hudXMLURL.getKeyString() for blob being searched for" + hudXMLURL.getKeyString());
        HUDXML3Blob blob = hxbs.getHUDXML3BlobFromXMLKey(hudXMLURL.getKeyString());
        blob.setCsvUrl2Indexed(1);
        hxbs.updateHUDXML3Blob(blob)
      } catch (Exception e) {
        log.info("XML Stream exception caught: " + e.toString());
      }
      xmlr0.close();
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

    }

    List<BlobKey> blobKeys = blobs.get("upload");

    //Get the parameters from the request to populate the HUDXML3Blob object
    HUDXML3Blob b = new HUDXML3Blob();
    b.setXmlUrl(blobKeys.get(0).getKeyString());
    log.info("setting HUDXML blob key to: " + blobKeys.get(0).getKeyString());
    // get the url id for the converted csv
    //RosieCSVBlobService r = new RosieCSVBlobService();
   
    //start the conversion of the XML to CSV
    //String[] csvUrls = r.convertHUDXMLToRosieCSV(b.getXMLUrl());
    //use the backend servlet instead of a class
  //String json = "";
    //try{
    //URL url = new URL("http://rosie-conversion-backend-dot-open-ciss.appspot.com");
      String rosieBackendAddress = BackendServiceFactory.getBackendService().getBackendAddress("big");
      //String url = "http://" + rosieBackendAddress + "/rosie";
      String charset = "UTF-8";
      String hud_xml_url = b.getXmlUrl();
      //String query = String.format("hud_xml_url=%s", URLEncoder.encode(hud_xml_url, charset));
      //HttpURLConnection connection = (HttpURLConnection)(new URL(url + "?" + query).openConnection());
      String key = "hud_xml_url";
      String value = URLEncoder.encode(hud_xml_url, charset);
      System.out.println("value is:" + value);
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

 
  //Retrieve the Blob's meta-data from Cloud SQL using JPA
  public HUDXML3Blob getHUDXML3BlobMetadata(String id) {
    HUDXML3BlobService hxbs = new HUDXML3BlobService();
    System.out.println("client wants to get HUDXML3Blob with ID: " + id);
    HUDXML3Blob b = hxbs.getHUDXML3Blob(id);
    return b;
  }
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
      System.out.println("Received a request to serve a blob with the id: " + req.getParameter("id")
          + ", and file: " + req.getParameter("file"));
      HUDXML3BlobService hxbs = new HUDXML3BlobService();
      HUDXML3Blob b = hxbs.getHUDXML3Blob(req.getParameter("id"));
      int requestedfileNumber = Integer.valueOf(req.getParameter("file"));
      BlobKey blobKey;
      switch (requestedfileNumber) {
          case 1: blobKey = new BlobKey(b.getCsvUrl1());
          break;
          case 2: blobKey = new BlobKey(b.getCsvUrl2());
          break;
          case 3: blobKey = new BlobKey(b.getCsvUrl3());
          break;
          case 4: blobKey = new BlobKey(b.getCsvUrl4());
          break;
          case 6: blobKey = new BlobKey(b.getCsvUrl6());
          break;
          default: blobKey = new BlobKey(b.getCsvUrl1()); }
        //BlobKey blobKey2 = new BlobKey("wWN4LMO8okJ-zlmkdQk8Bg");
      //System.out.println("overriding returned key:" + blobKey.getKeyString() + " with static key: " + blobKey2.getKeyString());
        System.out.println("sending blob key: " + blobKey.getKeyString());
        resp.setContentType("application/x-download");
        BlobInfoFactory bif = new BlobInfoFactory();
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

public class HUDXML3BlobService {
  private static final transient Logger log = LoggerFactory.getLogger(HUDXML3BlobService.class);

  public HUDXML3Blob getHUDXML3BlobFromXMLKey(String xml_key) {
    HUDXML3Blob result = null;
    List<HUDXML3Blob> resultList = subQuery(xml_key);
    if (resultList.isEmpty()) {
      log.info("no results from query in getHUDXML3BlobFromXMLKey.  wait 200ms, then try again.");
      try {
          Thread.sleep(200);
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

    }
    return resultList;
  }

  public HUDXML3Blob getHUDXML3Blob(String blob_key) {
    HUDXML3Blob result = null;
    EntityManager em =EMF.get().createEntityManager();
    try {
      result = em.find(HUDXML3Blob.class, blob_key);
    }
    finally {em.close();}
View Full Code Here

Examples of org.pathways.openciss.shared.HUDXML3Blob

    boolean result = false;
    EntityManager em =EMF.get().createEntityManager();
    try{
       em.getTransaction().begin();
       //This isn't finished yet, needs to handle the others
       HUDXML3Blob bx = em.find(HUDXML3Blob.class, b.getId());
       if (b.getCsvUrl1() !=null) {
         if (!(b.getCsvUrl1().equals(bx.getCsvUrl1()))) {
           bx.setCsvUrl1(b.getCsvUrl1());
         }
       }
       if (b.getCsvUrl2() !=null) {
         if (!(b.getCsvUrl2().equals(bx.getCsvUrl2()))) {
           bx.setCsvUrl2(b.getCsvUrl2());
         }
       }
       if (b.getCsvUrl3() !=null) {
         if (!(b.getCsvUrl3().equals(bx.getCsvUrl3()))) {
           bx.setCsvUrl3(b.getCsvUrl3());
         }
       }
       if (b.getCsvUrl4() !=null) {
         if (!(b.getCsvUrl4().equals(bx.getCsvUrl4()))) {
           bx.setCsvUrl4(b.getCsvUrl4());
         }
       }
       if (b.getCsvUrl6() !=null) {
         if (!(b.getCsvUrl6().equals(bx.getCsvUrl6()))) {
           bx.setCsvUrl6(b.getCsvUrl6());
         }
       }
       if (b.getXmlUrl() != null) {
         if (!(b.getXmlUrl().equals(bx.getXmlUrl()))) {
           bx.setXmlUrl(b.getXmlUrl());
         }
       }
       if (b.getCsvUrl1Indexed() != bx.getCsvUrl1Indexed()) {
         bx.setCsvUrl1Indexed(b.getCsvUrl1Indexed());
       }
       if (b.getCsvUrl2Indexed() != bx.getCsvUrl2Indexed()) {
         bx.setCsvUrl2Indexed(b.getCsvUrl2Indexed());
       }
       if (b.getCsvUrl3Indexed() != bx.getCsvUrl3Indexed()) {
         bx.setCsvUrl3Indexed(b.getCsvUrl3Indexed());
       }
       if (b.getCsvUrl4Indexed() != bx.getCsvUrl4Indexed()) {
         bx.setCsvUrl4Indexed(b.getCsvUrl4Indexed());
       }
       if (b.getCsvUrl6Indexed() != bx.getCsvUrl6Indexed()) {
         bx.setCsvUrl6Indexed(b.getCsvUrl6Indexed());
       }
       if (b.getCsvUrl1Completed() != bx.getCsvUrl1Completed()) {
         bx.setCsvUrl1Completed(b.getCsvUrl1Completed());
       }
       if (b.getCsvUrl2Completed() != bx.getCsvUrl2Completed()) {
         bx.setCsvUrl2Completed(b.getCsvUrl2Completed());
       }
       if (b.getCsvUrl3Completed() != bx.getCsvUrl3Completed()) {
         bx.setCsvUrl3Completed(b.getCsvUrl3Completed());
       }
       if (b.getCsvUrl4Completed() != bx.getCsvUrl4Completed()) {
         bx.setCsvUrl4Completed(b.getCsvUrl4Completed());
       }
       if (b.getCsvUrl6Completed() != bx.getCsvUrl6Completed()) {
         bx.setCsvUrl6Completed(b.getCsvUrl6Completed());
       }
       em.getTransaction().commit();
       result = true;
     }
    catch (Exception e){System.out.println("couldn't persist: " + e); e.printStackTrace();
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.