Examples of TerminalLocation


Examples of org.gsm.oneapi.responsebean.location.TerminalLocation

          TerminalLocation[] locations=new TerminalLocation[addresses.length];
          Random rng=new Random();
          rng.setSeed(System.currentTimeMillis());
         
          for (int i=0; i<addresses.length; i++) {
            TerminalLocation loc=new TerminalLocation();
            locations[i]=loc;
            loc.setAddress(addresses[i]);
           
            logger.debug("Processing address="+addresses[i]);
           
            // Simulate erroneous response
            if (addresses[i]==null || addresses[i].trim().length()==0) {
              TerminalLocation.RequestError err=new TerminalLocation.RequestError("LOC001", "Missing terminal address parameter", String.valueOf(i));
              loc.setErrorInformation(err);
              loc.setLocationRetrievalStatus("Error");
            } else if (rng.nextDouble()<0.4) {
              TerminalLocation.RequestError err=new TerminalLocation.RequestError("LOC001", "Terminal is not opted for location finding", addresses[i]);
              loc.setErrorInformation(err);
              loc.setLocationRetrievalStatus("Error");
            } else {
              TerminalLocation.CurrentLocation currentLocation=new TerminalLocation.CurrentLocation();
              currentLocation.setAccuracy(requestedAccuracy);
              currentLocation.setAltitude(75.0);
              currentLocation.setLatitude(41.3833333);
              currentLocation.setLongitude(2.1833333);
              currentLocation.setTimestampAsDate(new java.util.Date());
              loc.setCurrentLocation(currentLocation);
              loc.setLocationRetrievalStatus("Retrieved");
            }
          }
         
          rd.setTerminalLocation(locations);
        }
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.