Examples of DBSubset


Examples of com.knowgate.dataobjs.DBSubset

   
    int iLoca;
    ProductLocation oLoca = new ProductLocation();
    Object aProd[] = { get(DB.gu_product) };

    oLocations = new DBSubset (DB.k_prod_locats, oLoca.getTable(oConn).getColumnsStr(), DB.gu_product + "=?", 10);
    iLoca = oLocations.load (oConn, aProd);

    oLoca = null;

    if (DebugFile.trace) {
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

  if (isNull(DB.gu_product)) {
      DebugFile.decIdent();
    throw new NullPointerException("Product.eraseImages() gu_product property not set");
  }
 
    DBSubset oImages = new DBSubset(DB.k_images, DB.gu_image + "," + DB.path_image, DB.gu_product + "=?", 10);
    int iImgCount = oImages.load(oConn, new Object[]{get(DB.gu_product)});
    Image oImg = new Image();

    for (int i=0; i<iImgCount; i++) {
      oImg.replace(DB.gu_image, oImages.get(0,i));
      oImg.replace(DB.path_image, oImages.get(1,i));
      oImg.delete(oConn);
    } // next

    oImg = null;
    oImages = null;
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

    if (DebugFile.trace) {
      DebugFile.writeln("Begin Product.eraseLocations(Connection)" );
      DebugFile.incIdent();
    }

    DBSubset oLocs = getLocations(oConn);
    int iLocs = oLocs.getRowCount();
    ProductLocation oLoca = new ProductLocation();

    for (int f=0; f<iLocs; f++) {
      oLoca = new ProductLocation(oConn, oLocs.getString(0,f));
      oLoca.delete(oConn);
    } // next (f)

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End Product.eraseLocations() : " + oLocs.getRowCount() );
    }

    return oLocs.getRowCount();
  } //  eraseLocations()
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * @return A DBSubset with a single column gu_category
   * @throws SQLException
   * @since 4.0
   */
  public DBSubset getCategories(JDCConnection oConn) throws SQLException {
    DBSubset oCats = new DBSubset(DB.k_x_cat_objs,DB.gu_category,
               DB.gu_object+"=?",4);
  oCats.load(oConn, new Object[]{get(DB.gu_product)});
    return oCats;
  }
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * @return Category GUID
   * @throws SQLException
   * @since 4.0
   */
  public String getCategoryId(JDCConnection oConn) throws SQLException {
    DBSubset oCats = new DBSubset(DB.k_x_cat_objs,DB.gu_category,
                    DB.gu_object+"=?",4);
  oCats.load(oConn, new Object[]{get(DB.gu_product)});
    if (oCats.getRowCount()>0)
      return oCats.getString(0,0);
    else
      return null;
  } // getCategoryId
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * @throws IllegalStateException
   * @since 4.0
   */
  public String getShopId (JDCConnection oConn) throws SQLException,IllegalStateException {
    String sGuShop = null;
    DBSubset oCats = getCategories(oConn);
    String sIdDomain = null;

    if (DebugFile.trace) {
      DebugFile.writeln("Begin Product.getShopId([JDCConnection])");
      DebugFile.incIdent();
    }
   
    if (oCats.getRowCount()!=0) {

    if (isNull(DB.gu_owner))
      throw new IllegalStateException("Product must be fully loaded before calling getShopId()");
       
      PreparedStatement oQury = oConn.prepareStatement("SELECT "+DB.id_domain+" FROM "+DB.k_users+" WHERE "+DB.gu_user+"=?",
                                                       ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      if (DebugFile.trace) DebugFile.writeln("Statement.executeQuery(SELECT "+DB.id_domain+" FROM "+DB.k_users+" WHERE "+DB.gu_user+"='"+getStringNull(DB.gu_owner,"null")+"'");
      oQury.setString(1, getString(DB.gu_owner));
      ResultSet oRSet = oQury.executeQuery();
      if (oRSet.next())
        sIdDomain = String.valueOf(oRSet.getInt(1));
      oRSet.close();
      oQury.close();
     
      if (null==sIdDomain) throw new SQLException("User "+getString(DB.gu_owner)+" not found at "+DB.k_users+" table");
     
      oQury = oConn.prepareStatement("SELECT "+DB.gu_shop+" FROM "+DB.k_shops+" WHERE "+DB.id_domain+"="+sIdDomain+" AND "+DB.gu_root_cat+"=?",
                                     ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      ListIterator oIter = new Category (oConn, oCats.getString(0,0)).browse(oConn, Category.BROWSE_UP, Category.BROWSE_TOPDOWN).listIterator();
      while (oIter.hasNext() && (null==sGuShop)) {
        Category oPrnt = (Category) oIter.next();
    if (DebugFile.trace) DebugFile.writeln("Statement.executeQuery(SELECT "+DB.gu_shop+" FROM "+DB.k_shops+" WHERE "+DB.id_domain+"="+sIdDomain+" AND "+DB.gu_root_cat+"='"+oPrnt.getStringNull(DB.gu_category,"null")+"'");
    oQury.setString(1, oPrnt.getString(DB.gu_category));
    oRSet = oQury.executeQuery();
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

      DebugFile.writeln("Begin Product.checkIn([JDCConnection]," + sUserId + ")" );
      DebugFile.incIdent();
    }

    Category oCatg = new Category();
    DBSubset oCats = getCategories(oConn);
    int nCats = oCats.getRowCount();
  int iAppMask = 0;
  if (!getStringNull(DB.gu_blockedby,"").equals(sUserId)) {
    throw new IllegalStateException("Product.checkIn() The requested document is not checked out by "+sUserId);
  }
  for (int c=0; c<nCats && ((iAppMask&ACL.PERMISSION_MODIFY)==0); c++) {
    oCatg.replace(DB.gu_category, oCats.getString(0,c));
    iAppMask = oCatg.getUserPermissions((oConn), sUserId);
  } // next
  int iAffected = DBCommand.executeUpdate(oConn, "UPDATE "+DB.k_products+" SET "+DB.gu_blockedby+"=NULL WHERE "+DB.gu_product+"='"+getStringNull(DB.gu_product,"")+"'");
    if (0==iAffected)
      throw new SQLException("Product.checkIn() Document "+getStringNull(DB.gu_product,"")+" not found","02000",200);
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

      DebugFile.writeln("Begin Product.checkOut([JDCConnection]," + sUserId + ")" );
      DebugFile.incIdent();
    }

    Category oCatg = new Category();
    DBSubset oCats = getCategories(oConn);
    int nCats = oCats.getRowCount();
  int iAppMask = 0;
  if (!getStringNull(DB.gu_blockedby,sUserId).equals(sUserId)) {
    String sBlockersNick = DBCommand.queryStr(oConn, "SELECT "+DB.tx_nickname+" FROM "+DB.k_users+" WHERE "+DB.gu_user+"='"+getStringNull(DB.gu_blockedby,"")+"'");
    throw new IllegalStateException("Product.checkOut() The requested document is already checked out by "+sBlockersNick);
  }
  for (int c=0; c<nCats && ((iAppMask&ACL.PERMISSION_MODIFY)==0); c++) {
    oCatg.replace(DB.gu_category, oCats.getString(0,c));
    iAppMask = oCatg.getUserPermissions((oConn), sUserId);
  } // next
  if ((iAppMask&ACL.PERMISSION_MODIFY)==0)
    throw new SecurityException("Product.checkOut() User does not have enought permissions to check-out the requested document");
  int iAffected = DBCommand.executeUpdate(oConn, "UPDATE "+DB.k_products+" SET "+DB.gu_blockedby+"='"+sUserId+"' WHERE "+DB.gu_product+"='"+getStringNull(DB.gu_product,"")+"'");
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

    int iChilds = 0;
    int iLevel = level();
    int iCols = aColArray.length;

    if (iLevel<10) {
      DBSubset oChilds;

      if (DebugFile.trace && iLevel>0)
        DebugFile.writeln("id_term" + String.valueOf(iLevel-1) + "=" + get(DB.id_term + String.valueOf(iLevel-1)));

      if (9==iLevel)
        oChilds = new DBSubset(DB.k_thesauri, sColList, DB.id_term + "9 IS NOT NULL AND " + DB.id_term + "8=" + String.valueOf(getInt(DB.id_term + "8")), 10);
      else {
        oChilds = new DBSubset(DB.k_thesauri, sColList,
                               DB.id_term + String.valueOf(iLevel) + " IS NOT NULL AND " +
                               DB.id_term + String.valueOf(iLevel+1) + " IS NULL AND " +
                               DB.id_term + String.valueOf(iLevel-1) + "=" + String.valueOf(getInt(DB.id_term + String.valueOf(iLevel-1))), 10);
      }

      iChilds = oChilds.load(oConn);

      Term oChld;

      for (int t=0; t<iChilds; t++) {
        oChld = new Term();

        for (int c=0; c<iCols; c++)
          oChld.put(aColArray[c], oChilds.get(c, t));

        oTermsList.addLast(oChld);

        if (SCOPE_ALL==iScope)
          oChld.browse (oConn, iScope, oTermsList, sColList, aColArray);
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

    }
    else {

      DBBind oDBB = (DBBind) getPortletContext().getAttribute("GlobalDBBind");

      DBSubset oCalls = new DBSubset (DB.k_phone_calls, DB.gu_phonecall + "," + DB.tp_phonecall + "," + DB.dt_start + "," + DB.dt_end + "," + DB.gu_contact + "," + DB.contact_person + "," + DB.tx_phone + "," + DB.tx_comments,
                                      DB.gu_workarea + "=? AND " + DB.gu_user + "=? AND " + DB.id_status + "=0 ORDER BY 3 DESC", 10);

      JDCConnection oCon = null;

      try  {
        oCon = oDBB.getConnection("CallsTab");

        iCalls = oCalls.load (oCon, new Object[]{sWorkAreaId,sUserId});

        for (int c=0; c<iCalls; c++) {
          if (oCalls.isNull(2,c))
            oCalls.setElementAt("",2,c);
          else {
            Date dtStart = oCalls.getDate(2,c);

            oCalls.setElementAt(Gadgets.leftPad(String.valueOf(dtStart.getHours()), '0', 2) + ":" + Gadgets.leftPad(String.valueOf(dtStart.getMinutes()), '0', 2), 2,c);
          }
        } // next (c)

        oCon.close("CallsTab");
        oCon = null;

        sXML += "<calls>\n"+oCalls.toXML("","call")+"</calls>";
      }
      catch (SQLException e) {
        sXML += "<calls/>";

        try {
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.