Examples of DBSubset


Examples of com.knowgate.dataobjs.DBSubset

    if (DebugFile.trace) {
      DebugFile.writeln("Begin Project.getAllChilds([Connection])");
      DebugFile.incIdent();
    }

    DBSubset oTree = new DBSubset(DB.k_project_expand + " e," + DB.k_projects + " p",
                                  "e."+DB.gu_project + ",e." + DB.nm_project + ",e." + DB.od_level + ",e." + DB.od_walk + ",e." + DB.gu_parent + ",p." +DB.id_status + ",p." +DB.gu_company + ",p." +DB.gu_contact + ",p." +DB.gu_user,
                                  "e."+DB.gu_project + "=p." + DB.gu_project + " AND " +
                                  DB.gu_rootprj + "='" + getString(DB.gu_project) + "' ORDER BY " + DB.od_walk, 50);

    int iChildCount = oTree.load(oConn);

    if (DebugFile.trace) {
      for (int c=0; c<iChildCount; c++)
        DebugFile.writeln(String.valueOf(oTree.getInt(3,c))+" lv="+String.valueOf(oTree.getInt(2,c))+",gu="+oTree.getString(0,c)+",nm="+oTree.getString(1,c));
      DebugFile.decIdent();
      DebugFile.writeln("End Project.getAllChilds() : "+String.valueOf(iChildCount));
    }

    return oTree;
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

  aIdCounters[0] = aIdCounters[0]+1;
  oAttrs.put("id_project", String.valueOf(aIdCounters[0]));
 
  String sXml = toXML(oConn, sIdent, "\n", oAttrs);

  DBSubset oDuties = new DBSubset (DB.k_duties, "*", DB.gu_project+"=? ORDER BY "+DB.dt_modified+" DESC", 50);
  int nDuties = oDuties.load(oConn, new Object[]{getString(DB.gu_project)});

    if (DebugFile.trace) DebugFile.writeln("duties count is "+String.valueOf(nDuties));

  DBSubset oBugs = new DBSubset (DB.k_bugs, "*", DB.gu_project+"=? ORDER BY "+DB.dt_modified+" DESC", 50);
  int nBugs = oBugs.load(oConn, new Object[]{getString(DB.gu_project)});

    if (DebugFile.trace) DebugFile.writeln("bugs count is "+String.valueOf(nBugs));

  DBSubset oSubp = new DBSubset (DB.k_projects, "*", DB.  id_parent+"=? ORDER BY "+DB.dt_start+","+DB.dt_end, 20);
  int nSubp = oSubp.load(oConn, new Object[]{getString(DB.gu_project)});

    if (DebugFile.trace) DebugFile.writeln("subprojects count is "+String.valueOf(nSubp));

    StringBuffer oSS = new StringBuffer(sXml.length()+256*nDuties+256*nBugs+4000*nSubp);

  oSS.append(sXml.substring(0,sXml.length()-(sIdent+"</Project>").length()));

  Duty oDut = new Duty();
  oDut.getTable(oConn);
  oSS.append(s2+"<Duties count=\""+String.valueOf(nDuties)+"\">\n");
  for (int d=0; d<nDuties; d++) {
    oDut.clear();
    oDut.putAll(oDuties.getRowAsMap(d));
    if (oDut.isNull(DB.ti_duration))
      oDut.replace(DB.ti_duration, new BigDecimal(1d));
    oAttrs.clear();
    aIdCounters[0] = aIdCounters[0]+1;
    oAttrs.put("id_duty", String.valueOf(aIdCounters[0]));
    oSS.append(oDut.toXML(s3,"\n",oAttrs));
    oSS.append("\n");
    Resource[] aResources = oDut.resources(oConn);
    if (aResources!=null) {
      int nResources = aResources.length;
      for (int r=0; r<nResources; r++) {
      if (!oResources.containsKey(aResources[r].getValue())) {
        aIdCounters[1] = aIdCounters[1]+1;
        aResources[r].setProgressive(aIdCounters[1]);
        oResources.put(aResources[r].getValue(), aResources[r]);
      } // fi
      oAllocations.append("    <Allocation id_duty=\""+String.valueOf(aIdCounters[0])+"\" pg_resource=\""+String.valueOf(aIdCounters[1])+"\" load=\""+String.valueOf(aResources[r].getWorkLoadPercentage())+"\" />\n");
      } // next
    }
  } // next
  oDuties = null;
  oDut = null;
  oSS.append(s2+"</Duties>\n");
 
  Bug oBug = new Bug();
  oBug.getTable(oConn);
  oSS.append(s2+"<Bugs count=\""+String.valueOf(nBugs)+"\">\n");
  for (int b=0; b<nBugs; b++) {
    oBug.clear();
    oBug.putAll(oBugs.getRowAsMap(b));
    oSS.append(oBug.toXML(s3));   
    oSS.append("\n");
  } // next
  oBugs = null;
  oBug = null;
  oSS.append(s2+"</Bugs>\n");

  Project oSub = new Project();
  oSub.getTable(oConn);
  oSS.append(s2+"<Subprojects count=\""+String.valueOf(nSubp)+"\">\n");
  for (int p=0; p<nSubp; p++) {
    oSub.clear();
    oSub.putAll(oSubp.getRowAsMap(p));
    oSS.append(oSub.snapshotBuilder(oConn,s3,aIdCounters,oResources,oAllocations));
  } // next
  oSubp = null;
  oSub = null;
  oSS.append(s2+"</Subprojects>\n");
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

  public void inheritPermissions(JDCConnection oConn, String sFromCategory, short iRecurse, short iObjects) throws SQLException {
    int i;
    int iUsrPerms;
    int iGrpPerms;
    String sIdCategory = getString(DB.gu_category);
    DBSubset oUsrPerms = new DBSubset(DB.k_x_cat_user_acl, DB.gu_user + "," + DB.acl_mask, DB.gu_category + "='" + sFromCategory + "'", 100);
    DBSubset oGrpPerms = new DBSubset(DB.k_x_cat_group_acl, DB.gu_acl_group + "," + DB.acl_mask, DB.gu_category + "='" + sFromCategory + "'", 100);
    Statement oDelete = oConn.createStatement();
    PreparedStatement oInsert;

    if (DebugFile.trace) {
       DebugFile.writeln("Begin Category.inheritPermissions([Connection], " + sFromCategory + "," + iRecurse + "," + iObjects + ")" );
       DebugFile.incIdent();
     }

    if (DebugFile.trace) DebugFile.writeln("  loading user permissions from " + DB.k_x_cat_user_acl);

    iUsrPerms = oUsrPerms.load(oConn);

    if (DebugFile.trace) DebugFile.writeln("  loading group permissions from " + DB.k_x_cat_group_acl);

    iGrpPerms = oGrpPerms.load(oConn);

    if (DebugFile.trace) DebugFile.writeln("  Connection.executeUpdate(" + "DELETE FROM " + DB.k_x_cat_user_acl + " WHERE " + DB.gu_category + "='" + sIdCategory + "')");

    oDelete.executeUpdate("DELETE FROM " + DB.k_x_cat_user_acl + " WHERE " + DB.gu_category + "='" + sIdCategory + "'");

    if (DebugFile.trace) DebugFile.writeln("  Connection.executeUpdate(" + "DELETE FROM " + DB.k_x_cat_group_acl + " WHERE " + DB.gu_category + "='" + sIdCategory + "')");

    oDelete.executeUpdate("DELETE FROM " + DB.k_x_cat_group_acl + " WHERE " + DB.gu_category + "='" + sIdCategory + "'");

    oDelete.close();
    oDelete = null;

    if (DebugFile.trace) DebugFile.writeln("  Connection.prepareStatement(" + "INSERT INTO " + DB.k_x_cat_user_acl + "(" + DB.gu_category + "," + DB.gu_user + "," + DB.acl_mask + ") VALUES (?,?,?))");

    oInsert = oConn.prepareStatement("INSERT INTO " + DB.k_x_cat_user_acl + "(" + DB.gu_category + "," + DB.gu_user + "," + DB.acl_mask + ") VALUES (?,?,?)");

    for (i=0; i<iUsrPerms; i++) {
      oInsert.setString(1, sIdCategory );
      oInsert.setString(2, oUsrPerms.getString(0,i) );
      oInsert.setInt(3, oUsrPerms.getInt(1,i) );

      if (DebugFile.trace) DebugFile.writeln("    PreparedStatement.executeUpdate(" + sIdCategory + "," + oUsrPerms.getString(0,i) + "," + oUsrPerms.getInt(1,i) + ")");
      oInsert.executeUpdate();
      oInsert.close();
    }

    if (DebugFile.trace) DebugFile.writeln("  Connection.prepareStatement(" + "INSERT INTO " + DB.k_x_cat_group_acl + "(" + DB.gu_category + "," + DB.gu_acl_group + "," + DB.acl_mask + ") VALUES (?,?,?))");

    oInsert = oConn.prepareStatement("INSERT INTO " + DB.k_x_cat_group_acl + "(" + DB.gu_category + "," + DB.gu_acl_group + "," + DB.acl_mask + ") VALUES (?,?,?)");
    for (i=0; i<iGrpPerms; i++) {
      oInsert.setString(1, sIdCategory );
      oInsert.setString(2, oGrpPerms.getString(0,i) );
      oInsert.setInt(3, oGrpPerms.getInt(1,i) );

      if (DebugFile.trace) DebugFile.writeln("    PreparedStatement.executeUpdate(" + sIdCategory + "," + oGrpPerms.getString(0,i) + "," + oGrpPerms.getInt(1,i) + ")");
      oInsert.executeUpdate();
      oInsert.close();
    }

    if (DebugFile.trace) {
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * @throws SQLException
   */
  public DBSubset getNames(JDCConnection oConn) throws SQLException {
    Object aCatg[] = { get(DB.gu_category) };

    oNames = new DBSubset(DB.k_cat_labels, DB.id_language + "," + DB.tr_category + "," + DB.url_category, DB.gu_category + "=?", 4);
    oNames.load (oConn, aCatg);

    return oNames;
  } // getNames
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * @throws SQLException
   */
  public DBSubset getChilds(JDCConnection oConn) throws SQLException {
    Object aCatg[] = { get(DB.gu_category) };

    oChilds = new DBSubset(DB.k_cat_tree, DB.gu_child_cat, DB.gu_parent_cat + "=?",1);

    oChilds.load (oConn, aCatg);

    return oChilds;
  } // getChilds
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * @throws SQLException
   */
  public DBSubset getParents(JDCConnection oConn) throws SQLException {
    Object aCatg[] = { get(DB.gu_category) };

    oParents = new DBSubset(DB.k_cat_tree, DB.gu_parent_cat, DB.gu_child_cat + "=?", 1);
    oParents.load (oConn, aCatg);

    return oParents;
  } // getParents
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * <tr><td><b>gu_object</b></td><td><b>id_class</b></td><td><b>bi_attribs</b></td></tr>
   * </table>
   * @throws SQLException
   */
  public DBSubset getObjects(JDCConnection oConn) throws SQLException {
    DBSubset oObjs = new DBSubset(DB.k_x_cat_objs, DB.gu_object + "," + DB.id_class + "," + DB.bi_attribs,           
                         DB.gu_category + "=? ORDER BY " + DB.od_position, 64);

    oObjs.load(oConn, new Object[]{getString(DB.gu_category)});

    return oObjs;
  } // getObjects
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * </table>
   * @throws SQLException
   * @since 4.0
   */
  public DBSubset getObjectsOfClass(JDCConnection oConn, short iClassId) throws SQLException {
    DBSubset oObjs;
   
    if (Product.ClassId==iClassId) {
      Product oProd = new Product();
      try {
        oObjs = new DBSubset(DB.k_x_cat_objs+" x, "+DB.k_products+" p",
                     "x." + DB.gu_object + ",x." + DB.id_class + ",x." + DB.bi_attribs + "," +
                    "p."+Gadgets.replace(oProd.getTable(oConn).getColumnsStr(),",",",p."),
                    "x."+DB.gu_object+"=p."+DB.gu_product+" AND "+
                   "x."+DB.id_class+"=? AND x."+DB.gu_category + "=? ORDER BY " + DB.od_position, 64);
      } catch (Exception neverthrown) { oObjs=null; }
    } else {
      oObjs = new DBSubset(DB.k_x_cat_objs, DB.gu_object + "," + DB.id_class + "," + DB.bi_attribs,
                 DB.id_class+"=? AND "+DB.gu_category + "=? ORDER BY " + DB.od_position, 64);
    }

    oObjs.load(oConn, new Object[]{new Short(iClassId), getString(DB.gu_category)});

    return oObjs;
  } // getObjectsOfClass
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * @since 4.0
   */
  public Product[] getProducts (JDCConnection oConn, String sOrderBy) throws SQLException {
    Product oProd = new Product();
    Product[] aProds = null;
    DBSubset oProds = null;
  String sOrderClause;

    if (DebugFile.trace) {
      DebugFile.writeln("Begin Category.getProducts([Connection], " + sOrderBy + ")" );
      DebugFile.incIdent();
    }
     
  if (null!=sOrderBy)
    sOrderClause = "";
  else
    sOrderClause = " ORDER BY " + (sOrderBy.equalsIgnoreCase(DB.od_position) ? "x." : "p.") + sOrderBy;

    try {
      oProds = new DBSubset(DB.k_x_cat_objs+" x, "+DB.k_products+" p",
                   "p."+Gadgets.replace(oProd.getTable(oConn).getColumnsStr(),",",",p."),
                   "x."+DB.gu_object+"=p."+DB.gu_product+" AND "+
                  "x."+DB.id_class+"="+String.valueOf(Product.ClassId)+" AND x."+DB.gu_category + "=? "+sOrderClause, 64);
    } catch (Exception neverthrown) {}

    oProds.load(oConn, new Object[]{getString(DB.gu_category)});
    int nProds = oProds.getRowCount();
    if (0!=nProds) {
    aProds = new Product[nProds];
    for (int p=0; p<nProds; p++) {
      aProds[p] = new Product();
      aProds[p].putAll(oProds.getRowAsMap(p));
     } // next
    } // fi

    if (DebugFile.trace) {
      DebugFile.decIdent();
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   * @throws SQLException
   */
  public DBSubset getACLGroups(JDCConnection oConn) throws SQLException {
    Object aCatg[] = { get(DB.gu_category) };

    oACLGroups = new DBSubset(DB.k_x_cat_group_acl, DB.gu_acl_group + "," + DB.acl_mask, DB.gu_category + "=?", 50);
    oACLGroups.load (oConn, aCatg);

    return oACLGroups;
  } // getACLGroups
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.