Package com.knowgate.hipergate

Examples of com.knowgate.hipergate.Product


   */
  public static boolean delete(JDCConnection oConn, String sNewsGroupGUID) throws SQLException {
    Statement oStmt;
    ResultSet oRSet;
    String sProductId;
    Product oProd;
    String sSQL;

    if (DebugFile.trace) {
      DebugFile.writeln("Begin NewsGroup.delete([Connection], " + sNewsGroupGUID + ")");
      DebugFile.incIdent();
    }

    // Borrar los archivos adjuntos
    sSQL = "SELECT " + DB.gu_product + "," + DB.gu_msg + " FROM " + DB.k_newsmsgs + " WHERE " + DB.gu_product + " IS NOT NULL AND " + DB.gu_msg + " IN (SELECT " + DB.gu_object + " FROM " + DB.k_x_cat_objs + " WHERE " + DB.gu_category + "='" + sNewsGroupGUID + "')";
    oStmt = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
    if (DebugFile.trace) DebugFile.writeln("Statement.executeQuery(" + sSQL + ")");
    oRSet = oStmt.executeQuery(sSQL);
    while (oRSet.next()) {
      sProductId = oRSet.getString(1);

      if (DebugFile.trace) DebugFile.writeln("ResultSet.updateString gu_product = " + sProductId + " to NULL");

      oRSet.updateString(1, null);

      if (DebugFile.trace) DebugFile.writeln("ResultSet.updateRow();");

      oRSet.updateRow();

      if (DebugFile.trace) DebugFile.writeln("new Product([Connection], " + sProductId + ")");

      oProd = new Product(oConn, sProductId);

      oProd.delete(oConn);
    } // wend
    oRSet.close();
    oStmt.close();

    // Borrar los mensajes y la categoría subyacente
View Full Code Here


          oStmt = null;

          if (!bHasFilePointer) {
            oConn.setAutoCommit(false);

            Product oProd = new Product();
            oProd.put(DB.gu_owner, oCatg.getString(DB.gu_owner));
            oProd.put(DB.nm_product, oCatg.getString(DB.nm_category));
            oProd.store(oConn);

            ProductLocation oLoca = new ProductLocation();
            oLoca.put(DB.gu_product, oProd.getString(DB.gu_product));
            oLoca.put(DB.gu_owner, oCatg.getString(DB.gu_owner));
            oLoca.put(DB.pg_prod_locat, 1);
            oLoca.put(DB.id_cont_type, 1);
            oLoca.put(DB.id_prod_type, "MBOX");
            oLoca.put(DB.len_file, 0);
            oLoca.put(DB.xprotocol, "file://");
            oLoca.put(DB.xhost, "localhost");
            oLoca.put(DB.xpath, Gadgets.chomp(sFolderDir, File.separator));
            oLoca.put(DB.xfile, oCatg.getString(DB.nm_category)+".mbox");
            oLoca.put(DB.xoriginalfile, oCatg.getString(DB.nm_category)+".mbox");
            oLoca.store(oConn);

            oStmt = oConn.prepareStatement("INSERT INTO "+DB.k_x_cat_objs+" ("+DB.gu_category+","+DB.gu_object+","+DB.id_class+") VALUES (?,?,15)");
            oStmt.setString(1, oCatg.getString(DB.gu_category));
            oStmt.setString(2, oProd.getString(DB.gu_product));
            oStmt.executeUpdate();
            oStmt.close();
            oStmt = null;

            oConn.commit();
View Full Code Here

    boolean bRetVal = super.store(oConn);

    if (bRetVal) {
    if (AllVals.containsKey(DB.gu_category)) {
      if (getStringNull(DB.gu_category,"").length()>0) {
      Product oProd;
      if (bIsNew) {
        oProd = new Product(getString(DB.gu_acourse));
        oProd.put(DB.pct_tax_rate, 0f);
        oProd.put(DB.is_tax_included, (short) 1);
      } else {
        oProd = new Product(oConn, getString(DB.gu_acourse));
      } // fi
      oProd.replace(DB.id_status, getShort(DB.bo_active)==(short)1 ? Product.STATUS_ACTIVE : Product.STATUS_RETIRED);
      if (isNull(DB.gu_owner)) {
        if (DebugFile.trace) {
          DebugFile.writeln("NullPointerException gu_owner GUID from k_users table is required when storing an AcademicCourse that it is also a Product");
          DebugFile.decIdent();
        } // fi
        throw new NullPointerException("gu_owner GUID from k_users table is required when storing an AcademicCourse that it is also a Product");
      } // gu_owner==null
      oProd.replace(DB.gu_owner, getString(DB.gu_owner));
      oProd.replace(DB.nm_product, getString(DB.nm_course));
      if (!isNull(DB.id_course))
        oProd.replace(DB.id_ref, getString(DB.id_course));
      if (!isNull(DB.gu_address))
        oProd.replace(DB.gu_address, getString(DB.gu_address));
      else
        oProd.remove(DB.gu_address);       
      if (!isNull(DB.pr_acourse))
        oProd.replace(DB.pr_list, getDecimal(DB.pr_acourse));
      else
        oProd.remove(DB.pr_list);
      oProd.store(oConn);

      Category oCatg = new Category(getString(DB.gu_category));
      oCatg.addObject(oConn, getString(DB.gu_acourse), AcademicCourse.ClassId, 0, 0);
    } // fi (gu_category!="")
    } // fi (gu_category!=null)
View Full Code Here

    if (DebugFile.trace) {
      DebugFile.writeln("Begin AcademicCourse.delete([JDCConnection],"+sGuACourse+")");
      DebugFile.incIdent();
    }
   
    Product oProd = new Product(sGuACourse);
    if (oProd.exists(oConn)) oProd.delete(oConn);
   
    if (oConn.getDataBaseProduct()==JDCConnection.DBMS_POSTGRESQL) {
      if (DebugFile.trace) {
        DebugFile.writeln("Connection.prepareStatement(SELECT k_sp_del_acourse('"+sGuACourse+"'))");
      }
View Full Code Here

    String sFileServer = Environment.getProfileVar(sProfile, "fileserver", "localhost");

    String sWrkAHome = sStorage + "domains" + File.separator + iDom.toString() + File.separator + "workareas" + File.separator + getString(DB.gu_workarea) + File.separator;
    if (DebugFile.trace) DebugFile.writeln("workarea home = "+sWrkAHome);

    Product oProd = new Product();
    oProd.put(DB.nm_product,Gadgets.left(sFileName, 128));
    oProd.put(DB.gu_owner, sGuWriter);
    oProd.put(DB.dt_uploaded, dtNow);
    if (sDescription!=null) oProd.put(DB.de_product, Gadgets.left(sDescription,254));
    oProd.store(oConn);

    ProductLocation oLoca = new ProductLocation();
    oLoca.put(DB.gu_owner, sGuWriter);
    oLoca.put(DB.gu_product, oProd.get(DB.gu_product));
    oLoca.put(DB.dt_uploaded, dtNow);
    oLoca.setPath  (sFileProtocol, sFileServer, sWrkAHome + sCatPath, sFileName, sFileName);
    oLoca.setLength(oFile.length());
    oLoca.replace(DB.id_cont_type, oLoca.getContainerType());
    oLoca.store(oConn);

    if (sFileProtocol.equalsIgnoreCase("ftp://"))
      oLoca.upload(oConn, oFileSys, "file://" + sDirPath, sFileName, "ftp://" + sFileServer + sWrkAHome + sCatPath, sFileName);
    else
      oLoca.upload(oConn, oFileSys, "file://" + sDirPath, sFileName, sFileProtocol + sWrkAHome + sCatPath, sFileName);

    Attachment oAttach = new Attachment();
    oAttach.put(DB.gu_contact, getString(DB.gu_contact));
    oAttach.put(DB.gu_product, oProd.getString(DB.gu_product));
    oAttach.put(DB.gu_location, oLoca.getString(DB.gu_location));
    oAttach.put(DB.gu_writer, sGuWriter);
    oAttach.store(oConn);

    if (bDeleteOriginalFile) {
View Full Code Here

    DBSubset oAttachs = new DBSubset(DB.k_contact_attachs, DB.gu_product, DB.gu_contact + "='" + sContactGUID + "'" , 64);
    int iAttachs = oAttachs.load(oConn);

    if (DebugFile.trace) DebugFile.writeln("new Product()");

    Product oProd = new Product();

    for (int a=0;a<iAttachs; a++) {
      oProd.replace(DB.gu_product, oAttachs.getString(0,a));
      oProd.delete(oConn);
    } // next (a)

    oProd = null;

    oAttachs = null;
View Full Code Here

   
  Company oComp = new Company(oConn, getString(DB.gu_contact));
  if (oComp.isNull(DB.id_legal))
    throw new SQLException("Legal document number not set for given Company");
   
  Product oProd = new Product();

  if (!oProd.load(oConn, new Object[]{getString(DB.gu_acourse)})) {
    throw new SQLException("No product found for given academic course");
  } else {
    if (oProd.isNull(DB.id_currency)) {
      throw new SQLException("Currency for product is not set");
    }
    if (oProd.isNull(DB.pr_list)) {
      throw new SQLException("List price for product is not set");
    }
  }

  DBSubset oAddrs = oComp.getAddresses(oConn);
  DBSubset oBanks = oComp.getActiveBankAccounts(oConn);
 
  Invoice oInvc = new Invoice();
  oInvc.put(DB.bo_active, (short) 1);
  oInvc.put(DB.gu_shop, sGuShop);
  oInvc.put(DB.id_currency, oProd.get(DB.id_currency));
  oInvc.put(DB.id_legal, oComp.getString(DB.id_legal));
  oInvc.put(DB.de_order, Gadgets.left(getStringNull(DB.nm_course,"")+"/"+oCntc.getStringNull(DB.tx_name,"")+" "+oCntc.getStringNull(DB.tx_surname,""),100))
  oInvc.put(DB.gu_company, oComp.getString(DB.gu_company));
  oInvc.put(DB.nm_client, oComp.getString(DB.nm_legal));
  if (oAddrs.getRowCount()>0) {
    oInvc.put(DB.gu_bill_addr, oAddrs.getString(DB.gu_address,0));
    if (!oAddrs.isNull(DB.tx_email,0)) {
      oInvc.put(DB.tx_email_to, oAddrs.getString(DB.tx_email,0));     
    }
  } // fi
  if (oBanks.getRowCount()>0) {
    oInvc.put(DB.nu_bank, oBanks.getString(DB.nu_bank_acc,0));
  } // fi
    oInvc.store(oConn);

  oInvc.addProduct(oConn, oProd.getString(DB.gu_product), 1f);

  oInvc.put(DB.im_subtotal, oInvc.computeSubtotal(oConn));
  oInvc.put(DB.im_taxes, oInvc.computeTaxes(oConn));
  oInvc.put(DB.im_total, oInvc.computeTotal(oConn));
  oInvc.put(DB.im_paid, new BigDecimal(0d));
View Full Code Here

    StringBuffer oXML = new StringBuffer(8192);

    oXML.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text/xsl\"?>\n<products count=\"" + String.valueOf(iProdCount) + "\">\n");

    Product oCurrentProd = new Product();

    for (int c=0; c<iProdCount; c++) {
      oXML.append("  <product>");
      oXML.append("<gu_product>"+dbs.getString(0,c)+"</gu_product><nm_product>"+dbs.getString(1,c)+"</nm_product><tr_product><![CDATA["+dbs.getStringNull(2,c,"")+"]]></tr_product><de_product><![CDATA["+dbs.getStringNull(3,c,"")+"]]></de_product>");

      oCurrentProd.replace(DB.gu_product, dbs.getString(0,c));

      oXML.append("<images>");

      try {
        img = oCurrentProd.getImages(con);
        iImgCount = img.getRowCount();

        for (int i=0; i<iImgCount; i++) {
          oXML.append("<image tp=\"" + img.getString(DB.tp_image,i) + "\"><gu_image>"+img.getString(DB.gu_image,i)+"</gu_image>");
View Full Code Here

   */
  public boolean delete(JDCConnection oConn) throws SQLException {
    Statement oStmt;
    boolean bRetVal;

    Product oProd = new Product(oConn, getString(DB.gu_product));
    bRetVal = oProd.delete(oConn);

    if (bRetVal) bRetVal = super.delete(oConn);

    oStmt = oConn.createStatement();
    oStmt.executeUpdate("UPDATE " + DB.k_contacts + " SET " + DB.nu_attachs + "=" + DB.nu_attachs + "-1 WHERE gu_contact='" +  getString(DB.gu_contact) + "'");
View Full Code Here

  Contact oCntc = new Contact(oConn, getString(DB.gu_contact));
  if (oCntc.isNull(DB.sn_passport))
    throw new SQLException("Legal document number not set for Contact "+getString(DB.gu_contact)+" at bookig for academic course "+getString(DB.gu_acourse));
   
  Product oProd = new Product();

  if (!oProd.load(oConn, new Object[]{getString(DB.gu_acourse)})) {
    throw new SQLException("No product found for given academic course");
  } else {
    if (oProd.isNull(DB.id_currency)) {
      throw new SQLException("Currency for product is not set");
    }
    if (oProd.isNull(DB.pr_list)) {
      throw new SQLException("List price for product is not set");
    }
  }

  DBSubset oAddrs = oCntc.getAddresses(oConn);
  DBSubset oBanks = oCntc.getActiveBankAccounts(oConn);
 
  Invoice oInvc = new Invoice();
  oInvc.put(DB.gu_shop, sGuShop);
  oInvc.put(DB.id_currency, oProd.get(DB.id_currency));
  oInvc.put(DB.id_legal, oCntc.getString(DB.sn_passport));
  oInvc.put(DB.de_order, Gadgets.left(getStringNull(DB.nm_acourse,"")+"/"+oCntc.getStringNull(DB.tx_name,"")+" "+oCntc.getStringNull(DB.tx_surname,""),100))
  oInvc.put(DB.gu_contact, oCntc.getString(DB.gu_contact));
  oInvc.put(DB.nm_client, Gadgets.left(oCntc.getStringNull(DB.tx_name,"")+" "+oCntc.getStringNull(DB.tx_surname,""),200));
  if (oAddrs.getRowCount()>0) {
    oInvc.put(DB.gu_bill_addr, oAddrs.getString(DB.gu_address,0));
    if (!oAddrs.isNull(DB.tx_email,0)) {
      oInvc.put(DB.tx_email_to, oAddrs.getString(DB.tx_email,0));     
    }
  } // fi
  if (oBanks.getRowCount()>0) {
    oInvc.put(DB.nu_bank, oBanks.getString(DB.nu_bank_acc,0));
  } // fi
    oInvc.store(oConn);

  oInvc.addProduct(oConn, oProd.getString(DB.gu_product), 1f);

  oInvc.put(DB.im_subtotal, oInvc.computeSubtotal(oConn));
  oInvc.put(DB.im_taxes, oInvc.computeTaxes(oConn));
  oInvc.put(DB.im_total, oInvc.computeTotal(oConn));
  oInvc.put(DB.im_paid, new BigDecimal(0d));
View Full Code Here

TOP

Related Classes of com.knowgate.hipergate.Product

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.