예제 #1
0
  public Object getVehicleInfo(String _type, String _id, String _state) {
    CVehicle cv = null; // this is the return object

    // get the request from the server
    CitationCatcher_Stub serverObj = new CitationCatcher_Stub();
    // try{
    // String xml = serverObj.getVehicleAsXML(_type, _id, _state);
    // Dummy implementation.
    String xml = null;
    if (xml == null) {
      cv = new CVehicle();
      XMLStringParser parser = new XMLStringParser(xml);
      cv.setElement(CVehicle.MAKE, parser.getNamedElement("Make"));
      cv.setElement(CVehicle.MODEL, parser.getNamedElement("Model"));
      cv.setElement(CVehicle.STYLE, parser.getNamedElement("Style"));
      cv.setElement(CVehicle.YEAR, parser.getNamedElement("Year"));
      cv.setElement(CVehicle.PRIM_COLOR, parser.getNamedElement("Color1"));
      cv.setElement(CVehicle.SEC_COLOR, parser.getNamedElement("Color2"));
      cv.setElement(CVehicle.VIN, parser.getNamedElement("VIN"));
    }
    /*}
    catch (RemoteException e) {
            // TODO Auto-generated catch block - need to add error recovery
            e.printStackTrace();
    }*/
    return cv;
  }
예제 #2
0
  /**
   * findDMVRecord - retrieves a DMV record for a person from a Web service
   *
   * @param _license - a string of the license number to lookup
   * @return - CPerson class with relevant user information entered
   */
  public Object findDMVRecord(String _license) {
    CPerson cp = null; // this is the return object
    String xml = null;

    // make sure that there is at least one active data service network
    if (!RadioInfo.isDataServiceOperational()) {
      lastError = new String("No Data Service Available");
      return null;
    }

    // get the request from the server
    CitationCatcher_Stub serverObj = new CitationCatcher_Stub();
    try {
      xml = serverObj.getDMVResultAsXML(_license);
    } catch (JAXRPCException e) {
      lastError = e.getMessage();
    } catch (RemoteException e) {
      lastError = e.getMessage();
    }

    // fill out a person object from the returned DMV lookup results
    if (xml != null) {
      cp = new CPerson();
      XMLStringParser parser = new XMLStringParser(xml);

      cp.setElement(CPerson.LAST, parser.getNamedElement("Lname"));
      cp.setElement(CPerson.MIDDLE, parser.getNamedElement("Mname"));
      cp.setElement(CPerson.FIRST, parser.getNamedElement("Fname"));
      cp.setElement(CPerson.ADDRESS, parser.getNamedElement("Address"));
      cp.setElement(CPerson.CITY, parser.getNamedElement("City"));
      cp.setElement(CPerson.ZIP, parser.getNamedElement("Zip"));
      cp.setElement(CPerson.DOB, parser.getNamedElement("DOB"));
      cp.setElement(CPerson.SEX, parser.getNamedElement("Sex"));
      cp.setElement(CPerson.HEIGHT, parser.getNamedElement("Height"));
      cp.setElement(CPerson.WEIGHT, parser.getNamedElement("Weight"));
      cp.setElement(CPerson.ENDORSEMENTS, parser.getNamedElement("Endorsements"));
      cp.setElement(CPerson.RESTRICTIONS, parser.getNamedElement("Restrictions"));
    }
    return cp;
  }
예제 #3
0
  /**
   * getCourtInfo - return a court date and address information from the Web Service
   *
   * @param - none
   * @return - CViolation class with relevant court information entered
   */
  public Object getCourtInfo() {
    CViolation cv =
        null; // this is the return object that has the necessary court information embedded
    String xml = null; // unused (non-court info) members are left emtpy

    // make sure that there is at least one active data service network
    if (!RadioInfo.isDataServiceOperational()) {
      lastError = new String("No Data Service Available");
      return null;
    }

    // get the request from the server
    CitationCatcher_Stub serverObj = new CitationCatcher_Stub();
    try {
      xml = serverObj.getCourtInfoAsXML();
    } catch (JAXRPCException e) {
      lastError = e.getMessage();
    } catch (RemoteException e) {
      lastError = e.getMessage();
    }

    // fill out a violation object from the returned court lookup results
    if (xml != null) {
      cv = new CViolation();
      XMLStringParser parser = new XMLStringParser(xml);

      cv.setElement(CViolation.COURT_DATE, parser.getNamedElement("COURT_DATE"));
      cv.setElement(CViolation.COURT_NAME, parser.getNamedElement("COURT_NAME"));
      cv.setElement(CViolation.COURT_ADDRESS, parser.getNamedElement("COURT_ADDRESS"));
      cv.setElement(CViolation.COURT_CITY, parser.getNamedElement("COURT_CITY"));
      cv.setElement(CViolation.COURT_STATE, parser.getNamedElement("COURT_STATE"));
      cv.setElement(CViolation.COURT_ZIP, parser.getNamedElement("COURT_ZIP"));
      cv.setElement(CViolation.COURT_PHONE, parser.getNamedElement("COURT_PHONE"));
    }
    return cv;
  }