Examples of GPSTrace


Examples of org.worldbank.transport.tamt.shared.GPSTrace

               
                /*
                 * Now save the incoming data as a GPSTrace
                 * (along with the associated file)
                 */
                GPSTrace gpsTrace = new GPSTrace();
                gpsTrace.setId("TEMP");
                gpsTrace.setName(nameValue);
                gpsTrace.setDescription(descriptionValue);
               
                // add a study region with an id
                StudyRegion studyRegion = new StudyRegion();
                studyRegion.setId(studyRegionId);
                gpsTrace.setRegion(studyRegion);
                gpsTraceAPI.saveGPSTrace(gpsTrace, uploadedFile);
               
                // if it doesn't get thrown, then return 200
                resp.setStatus(HttpServletResponse.SC_OK);
                resp.getWriter().print(HttpServletResponse.SC_OK);
View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

    logger.debug("here is where we fire up the api and the thread with the status=" + this.status);
    long start = System.currentTimeMillis();
   
   
    try {
      GPSTrace gpsTrace = new GPSTrace();
      gpsTrace.setId(status.getGpsTraceId());
      api.assignPoints(gpsTrace)
    } catch (Exception e) {
      logger.error(e.getMessage());
      // TODO: what happens if we error out in this thread?
      // doesn't look like there is any way to tell the UI,
View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

        status.setLastUpdated(new Date());
        status.setComplete(true);
        logger.debug("completed status=" + status)
       
        // get the corresponding trace
        GPSTrace fetchTrace = new GPSTrace();
        fetchTrace.setId(status.getGpsTraceId());
        fetchTrace = traceAPI.getGPSTrace(fetchTrace);
        // now update the processed date and matchedpoints
        fetchTrace.setProcessDate(new Date());
        fetchTrace.setMatchedCount(status.getPointsMatched());
        fetchTrace.setProcessedCount(status.getPointsProcessed());
        fetchTrace.setProcessed(true);
       
        // and update it (not the file bits, just the meta-data)
        traceAPI.updateGPSTrace(fetchTrace);
       
        // and clean it up
View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

     
      // delete gps traces (including gpsfiles and gpspoints)
      ArrayList<GPSTrace> gpsTraces = gpsTraceDAO.getGPSTraces(region);
      ArrayList<String> gpsTraceIds = new ArrayList<String>();
      for (Iterator iterator = gpsTraces.iterator(); iterator.hasNext();) {
        GPSTrace gpsTrace = (GPSTrace) iterator.next();
        gpsTraceIds.add(gpsTrace.getId());
      }
      logger.debug("Deleting GPS traces for study region: " + studyRegionId);
      gpsTraceDAO.deleteGPSTraces(gpsTraceIds);
     
      // delete zones
View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

     * Add a new date, get the record count from the GPS trace
     * (matched, processed all came from http get from handler)
     */
   
    String id = status.getGpsTraceId();
    GPSTrace trace = new GPSTrace();
    trace.setId(id);
    //trace = traceBO.getGPSTrace(trace);
   
    status.setLastUpdated(new Date());
    status.setPointsTotal(trace.getRecordCount());
    status.setPointsMatched(0);
    status.setPointsProcessed(0);
   
    dao.insertAssignStatus(status);
  }
View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

      logger.debug("Saving file took (ms):" + (endSaveFile - startSaveFile));
     
      // save just the gpsTrace with the associated fileId
      long startSaveGPSTrace = System.currentTimeMillis();
      gpsTrace.setFileId(fileId);
      GPSTrace savedGPSTrace = saveGPSTrace(gpsTrace);
      long endSaveGPSTrace = System.currentTimeMillis();
      logger.debug("Saving GPSTrace took (ms):" + (endSaveGPSTrace - startSaveGPSTrace));
     
      // and now we can process too (since we sped up the algorithm)
      long startProcessGPSTrace = System.currentTimeMillis();
      gpsTraceDAO.processGPSTraceById(savedGPSTrace.getId());
      long endProcessGPSTrace = System.currentTimeMillis();
      logger.debug("Processing GPSTrace took (ms):" + (endProcessGPSTrace - startProcessGPSTrace));
     
    } catch (NonZipFileException e)
    {
View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

            checkboxes.clear();
            uncheckMasterCheckBox();
             
        for (int i = 0; i < gpsTraces.size(); i++) {
              final int count = i;
          final GPSTrace gpsTrace = gpsTraces.get(i);
          GWT.log(gpsTrace.getName());
         
          CheckBox cb = new CheckBox();
          cb.setFormValue(gpsTrace.getId()); //store the id in the checkbox value
          checkboxes.add(cb); // keep track for selecting all|none to delete
          cb.setStyleName(style.checkbox());

          // if a checkbox is checked, deselect the master checkbox
          cb.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              uncheckMasterCheckBox();
            }
          });
         
          Label name = new Label(gpsTrace.getName());
          name.setStyleName(style.list());
         
          // also store id/name for use later
          gpsTraceNames.put(gpsTrace.getId(), gpsTrace.getName());
         
          //TODO: add clickable only if we load the details to edit
          // name.addStyleName(style.clickable());
          name.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              //TODO: loadTagDetails(gpsTrace);
            }
          });
         
          String description = gpsTrace.getDescription();
          if( description.length() > 10)
          {
            description = description.substring(0, 10) + "...";
          }
          Label desc = new Label(description);
          desc.setTitle(gpsTrace.getDescription());
         
          Label upload = new Label(DateTimeFormat.getMediumDateTimeFormat().format(gpsTrace.getUploadDate()));
          Label processed = new Label("No");
          Label processedDate = new Label("n/a");
          if( gpsTrace.isProcessed() )
          {
            processed.setText("Yes");
            processedDate.setText(DateTimeFormat.getMediumDateTimeFormat().format(gpsTrace.getProcessDate()));
          }
         
          Label records = new Label(Integer.toString(gpsTrace.getRecordCount()));
          Label matchedRecords = new Label(Integer.toString(gpsTrace.getMatchedCount()));
         
          int row = i + 1; // to account for column headers
          gpsTraceList.setWidget(row, 0, cb);
          gpsTraceList.getCellFormatter().setWidth(row, 0, "20px");
          gpsTraceList.setWidget(row, 1, name);
View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

        Date processDate = r.getTimestamp(7);
        int processedCount = r.getInt(8);
        int matchedCount = r.getInt(9);
        int recordCount = r.getInt(10);

        GPSTrace gpsTrace = new GPSTrace();
        gpsTrace.setId(id);
        gpsTrace.setName(name);
        gpsTrace.setDescription(description);
        gpsTrace.setRegion(region); // came in as param, no need to
                      // reset
        gpsTrace.setFileId(fileId);
        gpsTrace.setUploadDate(uploadDate);
        gpsTrace.setProcessDate(processDate);
        gpsTrace.setProcessedCount(processedCount);
        gpsTrace.setMatchedCount(matchedCount);
        gpsTrace.setRecordCount(recordCount);

        /*
         * If process date is after upload date, we know this is
         * processed. (Saving trace in BO sets process date to yesterday
         * on upload). Default for processed flag is false.
         */
        if (processDate.after(uploadDate)) {
          gpsTrace.setProcessed(true);
        }

        gpsTraceList.add(gpsTrace);
      }

View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

    return gpsTraceList;

  }

  public GPSTrace getGPSTraceById(String id) throws Exception {
    GPSTrace gpsTrace = new GPSTrace();
    try {
      Connection connection = getConnection();
      Statement s = connection.createStatement();
      String sql = "select id, name, description, region, fileId, "
          + "uploaddate, processdate, processrecordcount, "
          + "matchedpoints, recordCount from \"gpstraces\" "
          + "where id = '" + id + "' ORDER BY name";
      ResultSet r = s.executeQuery(sql);
      while (r.next()) {
        /*
         * Retrieve the geometry as an object then cast it to the
         * geometry type. Print things out.
         */
        String name = r.getString(2);
        String description = r.getString(3);
        String regionId = r.getString(4);
        String fileId = r.getString(5);
        Date uploadDate = r.getTimestamp(6);
        Date processDate = r.getTimestamp(7);
        int processedCount = r.getInt(8);
        int matchedCount = r.getInt(9);
        int recordCount = r.getInt(10);

        gpsTrace.setId(id);
        gpsTrace.setName(name);
        gpsTrace.setDescription(description);

        StudyRegion region = new StudyRegion();
        region.setId(regionId);

        gpsTrace.setRegion(region);
        gpsTrace.setFileId(fileId);
        gpsTrace.setUploadDate(uploadDate);
        gpsTrace.setProcessDate(processDate);

        /*
         * If process date is after upload date, we know this is
         * processed. (Saving trace in BO sets process date to yesterday
         * on upload). Default for processed flag is false.
         */
        if (processDate.after(uploadDate)) {
          gpsTrace.setProcessed(true);
        }

        gpsTrace.setProcessedCount(processedCount);
        gpsTrace.setMatchedCount(matchedCount);
        gpsTrace.setRecordCount(recordCount);

      }

      connection.close(); // returns connection to pool

View Full Code Here

Examples of org.worldbank.transport.tamt.shared.GPSTrace

  public void processGPSTraceById(String id) throws Exception {
    try {
      logger.debug("processing traces from id=" + id);

      // fetch the GPSTrace by id
      GPSTrace gpsTrace = getGPSTraceById(id);
      logger.debug("gpsTrace=" + gpsTrace);

      // use the fileId from the trace to get the archived bytes
      processTraceContents(gpsTrace);
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.