Package org.worldbank.transport.tamt.shared

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


                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);
View Full Code Here


   
    if ( region == null ) // possible on initial load
    {
      ArrayList<StudyRegion> regions = regionDAO.getStudyRegions();
      for (Iterator iterator = regions.iterator(); iterator.hasNext();) {
        StudyRegion studyRegion = (StudyRegion) iterator.next();
        if(studyRegion.isCurrentRegion())
        {
          region = studyRegion;
          break;
        }
      }
View Full Code Here

    ArrayList<ZoneDetails> zoneDetails = new ArrayList<ZoneDetails>();
    if ( region == null )
    {
      ArrayList<StudyRegion> regions = regionDAO.getStudyRegions();
      for (Iterator iterator = regions.iterator(); iterator.hasNext();) {
        StudyRegion studyRegion = (StudyRegion) iterator.next();
        if(studyRegion.isCurrentRegion())
        {
          region = studyRegion;
          break;
        }
      }
View Full Code Here

     
      // cleans up analysis tables and supporting tables
      dao.deleteAnalysisAndSupportRecords(studyRegionId);
     
      // create a StudyRegion to be used in deleting other entities
      StudyRegion region = new StudyRegion();
      region.setId(studyRegionId);
     
      // 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();) {
View Full Code Here

    return dao.getStudyRegions();
  }
 
  public StudyRegion getCurrentStudyRegion() throws Exception {
    ArrayList<StudyRegion> regions = getStudyRegions();
    StudyRegion currentStudyRegion = null;
    for (Iterator iterator = regions.iterator(); iterator.hasNext();) {
      StudyRegion studyRegion = (StudyRegion) iterator.next();
      if( studyRegion.isCurrentRegion())
      {
        currentStudyRegion = studyRegion;
        break;
      }
    }
View Full Code Here

    Vertex mapCenterVertex = studyRegion.getMapCenter();
    logger.debug("mapCenter=" + studyRegion.getMapCenter());
    Coordinate mapCenterCoord = new Coordinate(mapCenterVertex.getLng(), mapCenterVertex.getLat());
    Geometry mapCenter = new GeometryFactory().createPoint(mapCenterCoord);
   
    StudyRegion savedStudyRegion = null;
   
    try {
      if( studyRegion.getId().indexOf("TEMP") != -1 )
      {
        // create an id, and save it
View Full Code Here

  }
 
  @Test
  public void validateStudyRegion()
  {
    StudyRegion r = new StudyRegion();
    r.setName("stuartmoffatt");
    logger.debug(r.getName().indexOf(","));
    assertEquals(-1, r.getName().indexOf(","));
  }
View Full Code Here

  }
 
  @Test
  public void validateMinimumSoakIntervalEmpty()
  {
    StudyRegion studyRegion = new StudyRegion();
    studyRegion.setMinimumSoakInterval("1");
    if( !studyRegion.getMinimumSoakInterval().matches("[0-9]*") )
    {
      try {
        throw new Exception("Minimum soak interval must be an integer (in seconds)");
      } catch (Exception e) {
        logger.error(e.getMessage());
View Full Code Here

 
 
  @Test
  public void validateUTCOffset()
  {
    StudyRegion studyRegion = new StudyRegion();
    studyRegion.setUtcOffset("12");
    if( !studyRegion.getUtcOffset().matches("^-{0,1}[0-9]*") )
    {
        try {
          throw new Exception("UTC offset must be an integer (in hours)");
        } catch (Exception e) {
          logger.error(e.getMessage());
View Full Code Here

  }

  @Test
  public void validateStudyRegionBO()
  {
    StudyRegion r = new StudyRegion();
    r.setName("accra, ghana");
    try {
      regionBO.validateStudyRegion(r);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.worldbank.transport.tamt.shared.StudyRegion

Copyright © 2018 www.massapicom. 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.