Examples of RosieIndexes


Examples of org.pathways.openciss.model.RosieIndexes

  public static EntityManager em;
  private static final transient Logger log = LoggerFactory.getLogger(RosieCSVBlobServlet.class);

 
  public RosieIndexes getRosieIndexes(String id) {
    RosieIndexes result = null;
    em =EMF.get().createEntityManager();
    try {
      result = em.find(RosieIndexes.class, id);
    }
    finally {em.close();}
View Full Code Here

Examples of org.pathways.openciss.model.RosieIndexes

    boolean result = false;
    em =EMF.get().createEntityManager();
    try{
       em.getTransaction().begin();
       //This isn't finished yet, needs to handle the others
       RosieIndexes rx = em.find(RosieIndexes.class, r.getId());
       if (r.getUsed() != rx.getUsed()) {
         rx.setUsed(r.getUsed());
       }
       em.getTransaction().commit();
       result = true;
     }
    catch (Exception e){System.out.println("couldn't persist: " + e);
View Full Code Here

Examples of org.pathways.openciss.model.RosieIndexes

    //This needs to be improved, but it works fine.  It just doesn't go in true ascending order
    Query q = em.createQuery ("SELECT rosie FROM RosieIndexes rosie WHERE rosie.xmlBlobId = :xmlBlobId AND rosie." + file_index_column + " = (SELECT MIN(rosie." + file_index_column + ") FROM RosieIndexes rosie WHERE rosie.used = 0)");
   
    if (id != null) {
      q.setParameter ("xmlBlobId",(new BigInteger(id)));
      RosieIndexes r = null;
      try {
        @SuppressWarnings("unchecked")
        List<RosieIndexes> resultList = q.getResultList();
        for (RosieIndexes i : resultList) {
          log.info("RosieIndexes record ID returned in getNextIndexToProcess is: " + i.getId());
        }
        r = (RosieIndexes) q.getSingleResult();
      }
      catch (NoResultException nr) {
        log.info("no results from query.  wait, then try again.");
        try {
            Thread.sleep(70);
            r = (RosieIndexes) q.getSingleResult();
       
        catch (NoResultException nr1) {
          log.info("no results from query.  wait, then try again.");
          try {
            Thread.sleep(200);
            r = (RosieIndexes) q.getSingleResult();
          }
          catch (NoResultException nr2) {
            log.info("no results from query, even after waiting twice.");
            nextIndexRecord[0] = "-1";
            nextIndexRecord[1] = "-1";
            return nextIndexRecord;
           
          }
          catch (InterruptedException ie) {
            log.info("Timer issue: ");
            ie.printStackTrace();
          }
        }
        catch (InterruptedException ie) {
          log.info("Timer issue: ");
          ie.printStackTrace();
        }
      }
     
      String idResult = r.getId().toString();
      String indexResult = null;
      indexResult = r.getFile2index();
      nextIndexRecord[0] = idResult;
      nextIndexRecord[1] = indexResult;
      log.info("getNextIndexToProcess got next id: " + idResult + " and next index: " + indexResult);
      if (nextIndexRecord[0] == null || nextIndexRecord[0].isEmpty()) {
        nextIndexRecord[0] = "-1";
View Full Code Here

Examples of org.pathways.openciss.model.RosieIndexes

          keepRunning = false;
        } else {
          processNextCSV2(nextIndex);
          //mark nextIndex as processed
          RosieIndexesService ris = new RosieIndexesService();
          RosieIndexes ri = ris.getRosieIndexes(nextIndexRecord[0]);
          ri.setUsed(1);
          ris.updateRosieIndexes(ri);
        }
      }
    }
    //else index it
View Full Code Here

Examples of org.pathways.openciss.model.RosieIndexes

                if (xmlr0.isStartElement()) {
                  if (xmlr0.getLocalName().equals("IDStr")) {
                    xmlr0.require(XMLStreamConstants.START_ELEMENT, null, "IDStr");
                    //save this index in db for later sequential processing
                    String index = xmlr0.getElementText();
                    RosieIndexes r = new RosieIndexes();
                    r.setXmlBlobId(new BigInteger(id));
                    r.setFile2index(index);
                    RosieIndexesService ris = new RosieIndexesService();
                    //log.info("file 2 being indexed");
                    ris.createRosieIndexes(r);
                    break;
                  }
                  else if (xmlr0.getLocalName().equals("IDNum")) {
                    xmlr0.require(XMLStreamConstants.START_ELEMENT, null, "IDNum");
                    //save this index in db for later sequential processing
                    String index = xmlr0.getElementText();
                    RosieIndexes r = new RosieIndexes();
                    r.setXmlBlobId(new BigInteger(id));
                    r.setFile2index(index);
                    RosieIndexesService ris = new RosieIndexesService();
                    //log.info("file 2 being indexed");
                    ris.createRosieIndexes(r);
                    break;
                  }
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.