Ejemplo n.º 1
0
  public Vendor viewVendorProfile(String user_name) {
    // Author: Vivek Shukla
    // Date: 14-October-2013
    // Description:
    Vendor objVendor = new Vendor();
    CallableStatement callstmt;
    try {
      cstmt = con.connection.prepareCall("{call getVendor(?)}");
      cstmt.setString(1, user_name);

      //      callstmt = con.connection.prepareCall("{call getRatings(?)}");
      ResultSet rs = cstmt.executeQuery();
      while (rs.next()) {
        String UserName = rs.getString("UserName");
        objVendor.setVendorName(rs.getString("VendorName"));
        //                objVendor.setEmailID(rs.getString("EmailID"));
        //                objVendor.setMobileNo("MobileNo");
        //                objVendor.setOwnerName("OwnerName");
        //                objVendor.setStatus(rs.getBoolean("Status"));
        objVendor.setUserName(UserName);
        //                callstmt.setString(1, UserName);
        //                ResultSet rs_rating = callstmt.executeQuery();
        //                while(rs_rating.next()){
        //                objVendor.setRating(rs_rating.getInt("Rating"));
        //                }

      }
      rs.close();
    } catch (SQLException ex) {
      ex.getMessage();
    } finally {
      con.closeConnection();
    }
    return objVendor;
  }
Ejemplo n.º 2
0
 @Override
 public String toString() {
   return "guid="
       + guid
       + ", vendor="
       + vendor.getName()
       + ", name="
       + name
       + ", version="
       + version;
 }
Ejemplo n.º 3
0
 @Override
 public String toString() {
   return "Notebook: id = "
       + id
       + ", "
       + model
       + ", "
       + vendor.getName()
       + ", "
       + cpu.getModel()
       + ", "
       + memory.getModel()
       + ", "
       + date;
 }
Ejemplo n.º 4
0
  public ArrayList<Vendor> getAllVendors() {
    con = new DBConnection();
    ArrayList<Vendor> vendors = new ArrayList<Vendor>();
    try {
      cstmt = con.connection.prepareCall("{call getAllVendors ()}");
      ResultSet rs = cstmt.executeQuery();
      while (rs.next()) {
        Vendor objVendor = new Vendor();
        objVendor.setUserName(rs.getString("UserName"));
        objVendor.setVendorName(rs.getString("VendorName"));
        Area objArea = new Area(); // Creating area object
        objArea.setAreaName(rs.getString("AreaName")); // setting areaname of vendor

        City objCity = new City();
        objCity.setCityName(rs.getString("CityName")); // setting cityname
        objArea.setCity(objCity);

        objVendor.setArea(objArea);
        // setting all other fields
        objVendor.setMobileNo(rs.getString("MobileNo"));
        objVendor.setEmailID(rs.getString("EmailID"));
        objVendor.setLane(rs.getString("Lane"));
        objVendor.setOwnerName(rs.getString("OwnerName"));
        objVendor.setLandlineNumber(rs.getString("LandlineNo"));
        objVendor.setStatus(rs.getBoolean("Status"));
        vendors.add(objVendor);
      }
      rs.close();
    } catch (Exception ex) {
      ex.getMessage();
    } finally {

      con.closeConnection();
    }
    return vendors;
  }
Ejemplo n.º 5
0
  /*
   * Converts the Vendor Object into an TriG String
   * representation.
   */
  private String convertVendor(Vendor vendor) {
    StringBuffer result = new StringBuffer();
    // First the uriref for the subject

    result.append(Vendor.getPrefixed(vendor.getNr()));
    result.append("\n");

    // rdf:type
    result.append(createTriplePO(RDF.prefixed("type"), BSBM.prefixed("Vendor")));

    // rdfs:label
    result.append(createTriplePO(RDFS.prefixed("label"), createLiteral(vendor.getLabel())));

    // rdfs:comment
    result.append(createTriplePO(RDFS.prefixed("comment"), createLiteral(vendor.getComment())));

    // foaf:homepage
    result.append(createTriplePO(FOAF.prefixed("homepage"), createURIref(vendor.getHomepage())));

    // bsbm:country
    result.append(
        createTriplePO(
            BSBM.prefixed("country"), createURIref(ISO3166.find(vendor.getCountryCode()))));

    // dc:publisher
    result.append(
        createTriplePO(DC.prefixed("publisher"), Vendor.getPrefixed(vendor.getPublisher())));

    // dc:date
    GregorianCalendar date = new GregorianCalendar();
    date.setTimeInMillis(vendor.getPublishDate());
    String dateString = DateGenerator.formatDate(date);
    result.append(
        createTriplePOEnd(
            DC.prefixed("date"), createDataTypeLiteral(dateString, XSD.prefixed("date"))));

    return result.toString();
  }
  private void displayInventoryRecord(Inventory theInventory) throws DatabaseException {

    System.out.println(theInventory.getSku() + ":");
    System.out.println("\t " + theInventory.getItemName());
    System.out.println("\t " + theInventory.getCategory());
    System.out.println("\t " + theInventory.getVendor());
    System.out.println("\t\tNumber in stock: " + theInventory.getVendorInventory());
    System.out.println("\t\tPrice per unit:  " + theInventory.getVendorPrice());
    System.out.println("\t\tContact: ");

    Vendor theVendor = da.vendorByName.get(theInventory.getVendor());
    assert theVendor != null;

    System.out.println("\t\t " + theVendor.getAddress());
    System.out.println(
        "\t\t " + theVendor.getCity() + ", " + theVendor.getState() + " " + theVendor.getZipcode());
    System.out.println("\t\t Business Phone: " + theVendor.getBusinessPhoneNumber());
    System.out.println("\t\t Sales Rep: " + theVendor.getRepName());
    System.out.println("\t\t            " + theVendor.getRepPhoneNumber());
  }
 private Vendor getVendorAset(int idVendor) throws SQLException {
   String query = "SELECT * FROM " + VENDOR_TABLE + " WHERE id = " + idVendor;
   ResultSet rs = executeQuery(query);
   Vendor vendor = null;
   if (rs.next()) {
     vendor = new Vendor();
     vendor.setId(rs.getInt("id"));
     vendor.setNama(rs.getString("nama"));
     vendor.setAlamat(rs.getString("alamat"));
     vendor.setTelepon(rs.getString("telepon"));
     vendor.setEmail(rs.getString("email"));
   }
   return vendor;
 }
Ejemplo n.º 8
0
  /*
   * Converts the Offer Object into an TriG String
   * representation.
   */
  private String convertOffer(Offer offer) {
    StringBuffer result = new StringBuffer();
    // First the uriref for the subject

    result.append(offer.getPrefixed());
    result.append("\n");

    // rdf:type
    result.append(createTriplePO(RDF.prefixed("type"), BSBM.prefixed("Offer")));

    // bsbm:product
    int productNr = offer.getProduct();
    int producerNr = Generator.getProducerOfProduct(productNr);
    result.append(
        createTriplePO(BSBM.prefixed("product"), Product.getPrefixed(productNr, producerNr)));

    // bsbm:vendor
    result.append(createTriplePO(BSBM.prefixed("vendor"), Vendor.getPrefixed(offer.getVendor())));

    // bsbm:price
    result.append(
        createTriplePO(
            BSBM.prefixed("price"),
            //                createDataTypeLiteral(offer.getPriceString(),BSBM.prefixed("USD"))
            offer.getPriceString() + "e0"));

    // bsbm:validFrom
    GregorianCalendar validFrom = new GregorianCalendar();
    validFrom.setTimeInMillis(offer.getValidFrom());
    String validFromString = DateGenerator.formatDateTime(validFrom);
    result.append(
        createTriplePO(
            BSBM.prefixed("validFrom"),
            createDataTypeLiteral(validFromString, XSD.prefixed("dateTime"))));

    // bsbm:validTo
    GregorianCalendar validTo = new GregorianCalendar();
    validTo.setTimeInMillis(offer.getValidTo());
    String validToString = DateGenerator.formatDateTime(validTo);
    result.append(
        createTriplePO(
            BSBM.prefixed("validTo"),
            createDataTypeLiteral(validToString, XSD.prefixed("dateTime"))));

    // bsbm:deliveryDays
    result.append(
        createTriplePO(
            BSBM.prefixed("deliveryDays"),
            //                createDataTypeLiteral(offer.getDeliveryDays().toString(),
            // XSD.prefixed("integer"))
            offer.getDeliveryDays().toString()));

    // bsbm:offerWebpage
    result.append(
        createTriplePO(BSBM.prefixed("offerWebpage"), createURIref(offer.getOfferWebpage())));

    // dc:publisher
    result.append(
        createTriplePO(DC.prefixed("publisher"), Vendor.getPrefixed(offer.getPublisher())));

    // dc:date
    GregorianCalendar date = new GregorianCalendar();
    date.setTimeInMillis(offer.getPublishDate());
    String dateString = DateGenerator.formatDate(date);
    result.append(
        createTriplePOEnd(
            DC.prefixed("date"), createDataTypeLiteral(dateString, XSD.prefixed("date"))));

    return result.toString();
  }