Examples of DBSubset


Examples of com.knowgate.dataobjs.DBSubset

   
    if (isNull(DB.gu_duty))
      throw new IllegalStateException("Duty.resources() Duty must be loaded before calling resources() method");

    Resource[] aResces = null;
    DBSubset oResces = new DBSubset(DB.k_x_duty_resource,
                                    DB.nm_resource+","+DB.pct_time,
                                    DB.gu_duty+"=?",10);
    int nResources = oResces.load(oConn, new Object[]{getString(DB.gu_duty)});
    if (nResources>0) {
      String sWorkArea = DBCommand.queryStr(oConn, "SELECT "+DB.gu_owner+" FROM "+DB.k_projects+" p,"+DB.k_duties+" d WHERE d."+DB.gu_project+"=p."+DB.gu_project+" AND d."+DB.gu_duty+"='"+getString(DB.gu_duty)+"'");
      aResces = new Resource[nResources];
      for (int r=0; r<nResources; r++) {
        aResces[r] = new Resource();
        aResces[r].load(oConn, sWorkArea, oResces.getString(0,r));
        if (!oResces.isNull(1,r))
          aResces[r].setWorkLoadPercentage(oResces.getShort(1,r));
      } // next
    } // fi

    return aResces;
  } // resources
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

    // ***********************************************
    // First delete the empty messages
    // (used for clearing drafts that have no contents)

  DBSubset oEmptyDrafts = new DBSubset (DB.k_mime_msgs+" m",
                      "m."+DB.gu_mimemsg,
                      "m."+DB.gu_category+"=? AND m."+DB.gu_workarea+"=? AND " +
                                          "m." + DB.bo_deleted + "<>1 AND m." + DB.gu_parent_msg + " IS NULL AND " +
                                          DBBind.Functions.LENGTH+"("+DBBind.Functions.ISNULL+"(m."+DB.tx_subject+",''))=0 AND " +
                                          "m."+DB.len_mimemsg + "=0 AND NOT EXISTS (SELECT p." + DB.gu_mimemsg + " FROM " +
                                          DB.k_mime_parts + " p WHERE m." + DB.gu_mimemsg + "=p." + DB.gu_mimemsg + ")" , 10);
    int iEmptyDrafts = 0;
   
    JDCConnection oConn = null;
    try {
      oConn = getConnection();
      iEmptyDrafts = oEmptyDrafts.load(oConn, new Object[]{getCategoryGuid(),((DBStore)getStore()).getUser().getString(DB.gu_workarea)});
    } catch (SQLException sqle) {
    throw new MessagingException(sqle.getMessage(), sqle);
    }
   
    if (iEmptyDrafts>0) {
    sSQL = "UPDATE " + DB.k_mime_msgs + " SET " + DB.bo_deleted + "=1 WHERE " + DB.gu_mimemsg + "=?";
   
      if (DebugFile.trace) DebugFile.writeln("Connection.prepareStatement("+sSQL+")");
   
      try {
        oUpdt = oConn.prepareStatement(sSQL);
        for (int d=0; d<iEmptyDrafts; d++) {
          oUpdt.setString(1,oEmptyDrafts.getString(0,d));
        oUpdt.executeUpdate();
        } // next
      oUpdt.close();
      } catch (SQLException sqle) {
      throw new MessagingException(sqle.getMessage(), sqle);
      }
    } // fi

    // ***********************************************
    // Get the list of deleted and not purged messages

    MboxFile oMBox = null;
    DBSubset oDeleted = new DBSubset(DB.k_mime_msgs,
                                     DB.gu_mimemsg+","+DB.pg_message,
                                     DB.bo_deleted+"=1 AND "+DB.gu_category+"='"+oCatg.getString(DB.gu_category)+"'", 100);

    try {
      int iDeleted = oDeleted.load(getConnection());

      File oFile = getFile();

      // *************************************
      // Purge deleted messages from MBOX file

      if (oFile.exists() && iDeleted>0) {
        oMBox = new MboxFile(oFile, MboxFile.READ_WRITE);
        int[] msgnums = new int[iDeleted];
        for (int m=0; m<iDeleted; m++)
          msgnums[m] = oDeleted.getInt(1, m);
        oMBox.purge(msgnums);
        oMBox.close();
      }

      // *********************************************************
      // Remove from disk the files referenced by deleted messages

      oStmt = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
     
      if (DebugFile.trace) DebugFile.writeln("Connection.executeQuery(SELECT p." + DB.file_name + " FROM " + DB.k_mime_parts + " p," + DB.k_mime_msgs + " m WHERE p." + DB.gu_mimemsg + "=m."+ DB.gu_mimemsg + " AND m." + DB.id_disposition + "='reference' AND m." + DB.bo_deleted + "=1 AND m." + DB.gu_category +"='"+oCatg.getString(DB.gu_category)+"')");

      oRSet = oStmt.executeQuery("SELECT p." + DB.id_part + ",p." + DB.id_type + ",p." + DB.file_name + " FROM " + DB.k_mime_parts + " p," + DB.k_mime_msgs + " m WHERE p." +
                                 DB.gu_mimemsg + "=m."+ DB.gu_mimemsg + " AND m." + DB.id_disposition + "='reference' AND m." +
                                 DB.bo_deleted + "=1 AND m." + DB.gu_category +"='"+oCatg.getString(DB.gu_category)+"'");

      while (oRSet.next()) {
        if (DebugFile.trace) DebugFile.writeln("processing part "+String.valueOf(oRSet.getInt(1))+" "+oRSet.getString(2));
        String sFileName = oRSet.getString(3);
        if (!oRSet.wasNull()) {
          if (DebugFile.trace) DebugFile.writeln("trying to delete file "+sFileName);
          try {
            File oRef = new File(sFileName);
            if (oRef.exists())
              oRef.delete();
            else if (DebugFile.trace)
              DebugFile.writeln("file "+sFileName+" not found");           
          }
          catch (SecurityException se) {
            if (DebugFile.trace) DebugFile.writeln("SecurityException deleting file " + sFileName + " " + se.getMessage());
          }
        }
      } // wend

      oRSet.close();
      oRSet = null;
      oStmt.close();
      oStmt = null;

      // ****************************************************
      // Set Category size to length of MBOX file after purge

      oFile = getFile();
      oStmt = oConn.createStatement();
      oStmt.executeUpdate("UPDATE "+DB.k_categories+" SET "+DB.len_size+"="+String.valueOf(oFile.length())+" WHERE "+DB.gu_category+"='"+getCategory().getString(DB.gu_category)+"'");
      oStmt.close();
      oStmt=null;

      // *********************************************
      // Actually delete messages from database tables

      if (oConn.getDataBaseProduct()==JDCConnection.DBMS_POSTGRESQL) {
        oStmt = oConn.createStatement();
        for (int d=0; d<iDeleted; d++)
          oStmt.executeQuery("SELECT k_sp_del_mime_msg('" + oDeleted.getString(0,d) + "')");
        oStmt.close();
        oStmt=null;
      }
      else {
        oCall = oConn.prepareCall("{ call k_sp_del_mime_msg(?) }");

        for (int d=0; d<iDeleted; d++) {
          oCall.setString(1, oDeleted.getString(0,d));
          oCall.execute();
        } // next
        oCall.close();
        oCall=null;
      }

      if (oFile.exists() && iDeleted>0) {

        // ***********************************************************************
        // Temporary move all messages at k_mime_msgs, k_mime_parts & k_inet_addrs
        // beyond its maximum so they do not clash when progressive identifiers
        // are re-assigned

        BigDecimal oUnit = new BigDecimal(1);
        oStmt = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        oRSet = oStmt.executeQuery("SELECT MAX("+DB.pg_message+") FROM "+DB.k_mime_msgs+" WHERE "+DB.gu_category+"='"+getCategory().getString(DB.gu_category)+"'");
        oRSet.next();
        BigDecimal oMaxPg = oRSet.getBigDecimal(1);
        if (oRSet.wasNull()) oMaxPg = new BigDecimal(0);
        oRSet.close();
        oRSet = null;
        oStmt.close();
        oStmt = null;
        oMaxPg = oMaxPg.add(oUnit);

        String sCat = getCategory().getString(DB.gu_category);
        oStmt = oConn.createStatement();
        oStmt.executeUpdate("UPDATE "+DB.k_mime_msgs+" SET "+DB.pg_message+"="+DB.pg_message+"+"+oMaxPg.toString()+" WHERE "+DB.gu_category+"='"+sCat+"'");
        oStmt.close();
        oStmt = null;

        // *********************************************************************************
        // Re-assign ordinal position and byte offset for all messages remaining after purge

        DBSubset oMsgSet = new DBSubset(DB.k_mime_msgs, DB.gu_mimemsg+","+DB.pg_message, DB.gu_category+"='"+getCategory().getString(DB.gu_category)+"' ORDER BY "+DB.pg_message, 1000);
        int iMsgCount = oMsgSet.load(oConn);

        oMBox = new MboxFile(oFile, MboxFile.READ_ONLY);
        long[] aPositions = oMBox.getMessagePositions();
        oMBox.close();

        oMaxPg = new BigDecimal(0);
        oUpdt = oConn.prepareStatement("UPDATE "+DB.k_mime_msgs+" SET "+DB.pg_message+"=?,"+DB.nu_position+"=? WHERE "+DB.gu_mimemsg+"=?");
        oPart = oConn.prepareStatement("UPDATE "+DB.k_mime_parts+" SET "+DB.pg_message+"=? WHERE "+DB.gu_mimemsg+"=?");
        oAddr = oConn.prepareStatement("UPDATE "+DB.k_inet_addrs+" SET "+DB.pg_message+"=? WHERE "+DB.gu_mimemsg+"=?");
        for (int m=0; m<iMsgCount; m++) {
          String sGuMsg = oMsgSet.getString(0,m);
          oUpdt.setBigDecimal(1, oMaxPg);
          oUpdt.setBigDecimal(2, new BigDecimal(aPositions[m]));
          oUpdt.setString(3, sGuMsg);
          oUpdt.executeUpdate();
          oPart.setBigDecimal(1, oMaxPg);
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

    // *************************************************
    // Get the list of all messages stored at this folder

    MboxFile oMBox = null;
    DBSubset oDeleted = new DBSubset(DB.k_mime_msgs, DB.gu_mimemsg+","+DB.pg_message, DB.gu_category+"='"+oCatg.getString(DB.gu_category)+"'", 100);
    JDCConnection oConn = null;

    try {
    oConn = getConnection();
      int iDeleted = oDeleted.load(oConn);
      if (DebugFile.trace) DebugFile.writeln("there are "+String.valueOf(iDeleted)+" messages to be deleted");

      // ****************************************
      // Erase files referenced by draft messages   
      oStmt = oConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      if (DebugFile.trace) DebugFile.writeln("Statement.executeQuery(SELECT p." + DB.file_name + " FROM " + DB.k_mime_parts + " p," + DB.k_mime_msgs + " m WHERE p." + DB.gu_mimemsg + "=m."+ DB.gu_mimemsg + " AND m." + DB.id_disposition + "='reference' AND m." + DB.bo_deleted + "=1 AND m." + DB.gu_category +"='"+oCatg.getString(DB.gu_category)+"')");
      oRSet = oStmt.executeQuery("SELECT p." + DB.file_name + " FROM " + DB.k_mime_parts + " p," + DB.k_mime_msgs + " m WHERE p." + DB.gu_mimemsg + "=m."+ DB.gu_mimemsg + " AND m." + DB.id_disposition + "='reference' AND m." + DB.bo_deleted + "=1 AND m." + DB.gu_category +"='"+oCatg.getString(DB.gu_category)+"'");

      while (oRSet.next()) {
        String sFileName = oRSet.getString(1);
        if (!oRSet.wasNull()) {
          try {
            File oRef = new File(sFileName);
            if (oRef.exists()) oRef.delete();
          }
          catch (SecurityException se) {
            if (DebugFile.trace) DebugFile.writeln("SecurityException " + sFileName + " " + se.getMessage());
          }
        }
      } // wend

      oRSet.close();
      oRSet = null;
      oStmt.close();
      oStmt = null;

      // *************************
      // Set Category size to zero

      oStmt = oConn.createStatement();
      if (DebugFile.trace) DebugFile.writeln("Statement.executeUpdate(UPDATE "+DB.k_categories+" SET "+DB.len_size+"=0 WHERE "+DB.gu_category+"='"+getCategory().getString(DB.gu_category)+"')");
      oStmt.executeUpdate("UPDATE "+DB.k_categories+" SET "+DB.len_size+"=0 WHERE "+DB.gu_category+"='"+getCategory().getString(DB.gu_category)+"'");
      oStmt.close();
      oStmt=null;

      // *********************************************
      // Actually delete messages from database tables

      if (oConn.getDataBaseProduct()==JDCConnection.DBMS_POSTGRESQL) {
        oStmt = oConn.createStatement();
        for (int d=0; d<iDeleted; d++)
          oStmt.executeQuery("SELECT k_sp_del_mime_msg('" + oDeleted.getString(0,d) + "')");
        oStmt.close();
        oStmt=null;
      }
      else {
        oCall = oConn.prepareCall("{ call k_sp_del_mime_msg(?) }");

        for (int d=0; d<iDeleted; d++) {
          oCall.setString(1, oDeleted.getString(0,d));
          oCall.execute();
        } // next
        oCall.close();
        oCall=null;
      }
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

   
  SimpleDateFormat DateFrmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  String[] aMsgsXml;
  StringBuffer oBuffXml = new StringBuffer(1024);
 
    DBSubset oMsgs = new DBSubset (DB.k_mime_msgs,
                     DB.gu_mimemsg+","+DB.id_message+","+DB.id_priority+","+DB.nm_from+","+DB.nm_to+","+DB.tx_subject+","+DB.dt_received+","+DB.dt_sent+","+DB.len_mimemsg+","+DB.pg_message+","+DB.bo_deleted+","+DB.tx_email_from+","+DB.nm_to+","+DB.bo_spam+","+DB.id_type,
                               DB.gu_category+"=? AND "+DB.gu_workarea+"=? AND " + DB.bo_deleted + "<>1 AND " + DB.gu_parent_msg + " IS NULL ORDER BY " + DB.dt_received + "," + DB.dt_sent + " DESC", 10);
    int iMsgs = oMsgs.load(((DBStore)getStore()).getConnection(), new Object[]{getCategoryGuid(), ((DBStore)getStore()).getUser().getString(DB.gu_workarea)});

  if (iMsgs>0) {
    aMsgsXml = new String[iMsgs];
    for (int m=0; m<iMsgs; m++) {
      oBuffXml.append("<msg>");
        oBuffXml.append("<num>"+String.valueOf(oMsgs.getInt(DB.pg_message,m))+"</num>");
        oBuffXml.append("<id><![CDATA["+oMsgs.getStringNull(DB.id_message,m,"").replace('\n',' ')+"]]></id>");
        oBuffXml.append("<len>"+String.valueOf(oMsgs.getInt(DB.len_mimemsg,m))+"</len>");
        String sCType = oMsgs.getStringNull(DB.id_type,m,"");
        int iCType = sCType.indexOf(';');
        if (iCType>0) sCType = sCType.substring(0, iCType);
        oBuffXml.append("<type>"+sCType+"</type>");
        String sDisposition = oMsgs.getStringNull(DB.id_type,m,"").substring(iCType+1).trim();
        int iDisposition = sDisposition.indexOf(';');
        if (iDisposition>0) sDisposition = sDisposition.substring(0, iDisposition);
        int iEq = sDisposition.indexOf('=');
        if (iEq>0) sDisposition = sDisposition.substring(iEq+1);
        oBuffXml.append("<disposition>"+sDisposition+"</disposition>");
        oBuffXml.append("<priority>"+oMsgs.getStringNull(DB.id_priority,m,"")+"</priority>");
        if (oMsgs.isNull(DB.bo_spam,m))
      oBuffXml.append("<spam></spam>");
      else
      oBuffXml.append("<spam>"+(oMsgs.getShort(DB.bo_spam,m)==0 ? "NO" : "YES")+"</spam>");
    oBuffXml.append("<subject><![CDATA["+Gadgets.XHTMLEncode(oMsgs.getStringNull(DB.tx_subject,m,"no subject"))+"]]></subject>");
      if (oMsgs.isNull(DB.dt_sent,m))
          oBuffXml.append("<sent></sent>");
        else
        oBuffXml.append("<sent>"+oMsgs.getDateFormated(7,m,DateFrmt)+"</sent>");
      if (oMsgs.isNull(DB.dt_received,m))
          oBuffXml.append("<received></received>");
        else
        oBuffXml.append("<received>"+oMsgs.getDateFormated(6,m,DateFrmt)+"</received>");
        oBuffXml.append("<from>"+oMsgs.getStringNull(DB.nm_from,m,oMsgs.getStringNull(DB.tx_email_from,m,""))+"</from>");
        oBuffXml.append("<to>"+oMsgs.getStringNull(DB.nm_to,m,oMsgs.getStringNull(DB.nm_to,m,""))+"</to>");       
        if (oMsgs.getInt(DB.len_mimemsg,m)<=1024)
          oBuffXml.append("<kb>1</kb>");
        else
          oBuffXml.append("<kb>"+String.valueOf(oMsgs.getInt(DB.len_mimemsg,m)/1024)+"</kb>");
        oBuffXml.append("<err/>");
      oBuffXml.append("</msg>");
      aMsgsXml[m] = oBuffXml.toString();
      oBuffXml.setLength(0);
    } // next
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

      ByteArrayOutputStream byOutStrm = null;
      Session oSession = ((DBStore)getStore()).getSession();
      String sGuWorkArea = ((DBStore)getStore()).getUser().getString(DB.gu_workarea);
      String sGuFolder = getCategoryGuid();
      oInputMbox = new MboxFile(sMboxFilePath, MboxFile.READ_ONLY);
      DBSubset oMsgs = new DBSubset (DB.k_mime_msgs, DB.gu_mimemsg+","+DB.gu_workarea, DB.gu_category+"=?", 1000);
      oConn = getConnection();
      iMsgCount = oMsgs.load(oConn, new Object[]{sGuFolder});

      if (DebugFile.trace) DebugFile.writeln(String.valueOf(iMsgCount)+" indexed messages");

      for (int m=0; m<iMsgCount; m++)
        DBMimeMessage.delete(oConn, sGuFolder, oMsgs.getString(0,m));

      iMsgCount = oInputMbox.getMessageCount();

      if (DebugFile.trace) DebugFile.writeln(String.valueOf(iMsgCount)+" stored messages");
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

  private static void deleteCategorySet(JDCConnection oConn, DBSubset oCatgSet)
    throws SQLException, IOException {
    final int iSize = oCatgSet.getRowCount();
    // Delete recursively children categories first
    for (int c=0; c<iSize; c++) {
      DBSubset oChildCatgs = new DBSubset(DB.k_cat_tree, DB.gu_child_cat, DB.gu_parent_cat+"=?", 10);
      oChildCatgs.load(oConn, new Object[]{oCatgSet.getString(0,c)});
      deleteCategorySet(oConn, oChildCatgs);
    }
    // Deleting the category will delete the associated MimeMessages, but it is faster to do it first
    // for avoiding lots of calls to MimeMessage.delete() method
    for (int d=0; d<iSize; d++) {
      DBSubset oDeleted = new DBSubset(DB.k_mime_msgs, DB.gu_mimemsg, DB.gu_category+"=?", 100);
      oDeleted.load(oConn, new Object[]{oCatgSet.getString(0,d)});
      final int iDeleted = oDeleted.getRowCount();
      if (oConn.getDataBaseProduct()==JDCConnection.DBMS_POSTGRESQL) {
        Statement oStmt = oConn.createStatement();
        for (int m=0; m<iDeleted; m++) {
          oStmt.executeQuery("SELECT k_sp_del_mime_msg('" + oDeleted.getString(0,m) + "')");
        } // next (message)
        oStmt.close();
        oStmt=null;
      } else {
        CallableStatement oCall = oConn.prepareCall("{ call k_sp_del_mime_msg(?) }");
        for (int m=0; m<iDeleted; m++) {
          oCall.setString(1, oDeleted.getString(0,m));
          oCall.execute();
        } // next
        oCall.close();
        oCall=null;
      } // fi
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

  public boolean delete(JDCConnection oConn)
    throws SQLException {
    ACLUser oUsr = new ACLUser(getString(DB.gu_user));
    Category oRootCat = new Category(oConn, oUsr.getMailRoot(oConn));
    DBSubset oMailFoldersCatgs = new DBSubset(DB.k_cat_tree, DB.gu_child_cat, DB.gu_parent_cat+"=?", 10);
    oMailFoldersCatgs.load(oConn, new Object[]{oRootCat.getString(DB.gu_category)});
    try {
      deleteCategorySet(oConn, oMailFoldersCatgs);
    } catch (IOException ioe) {
      throw new SQLException (ioe.getMessage());
    }
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

    if (DebugFile.trace) {
      DebugFile.writeln("Begin QueryByForm.queryToStream([Connection]," + sColumnList + "," + sFilter + ", [OutputStream], " + sShowAs + ")");
      DebugFile.incIdent();
    }

    DBSubset oDBSS = new DBSubset(getBaseObject(), sColumnList, sFilter, 100);

    if (sShowAs.equalsIgnoreCase("TSV")) {
      oDBSS.setColumnDelimiter("\t");
      oDBSS.setRowDelimiter("\n");
      oDBSS.setTextQualifier("");
    }
    else if (sShowAs.equalsIgnoreCase("XLS")) {
      oDBSS.setColumnDelimiter(";");
      oDBSS.setRowDelimiter("\n");
      oDBSS.setTextQualifier("");
    }
    else {
      oDBSS.setColumnDelimiter(",");
      oDBSS.setRowDelimiter("\n");
      oDBSS.setTextQualifier("\"");
    }

    oDBSS.print(oConn, oOutStrm);

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End QueryByForm.queryToStream()");
    }
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

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

    DBSubset oLists = new DBSubset(DB.k_lists, DB.gu_list, DB.gu_query+"=?", 10);
    int iLists = oLists.load(oConn, new Object[]{sQBFGUID});

    for (int l=0; l<iLists; l++) {
      DistributionList.delete(oConn, oLists.getString(0,l));
    } // next

    DBPersist oDBP = new DBPersist(DB.k_queries, "QueryByForm");

    oDBP.put(DB.gu_query, sQBFGUID);
View Full Code Here

Examples of com.knowgate.dataobjs.DBSubset

    oProj.replace(DB.gu_project, Gadgets.generateUUID());
    oProj.store(oConn);

    oSubProjMap.put(aChild[0], oProj.get(DB.gu_project));

    DBSubset oChilds = new DBSubset(DB.k_projects, DB.gu_project, DB.id_parent + "=?", 10);
    DBSubset oDuties = new DBSubset (DB.k_duties, oDuty.getTable(oConn).getColumnsStr(), DB.gu_project + "=?", 10);
    DBSubset oBugs = new DBSubset (DB.k_bugs, oBug.getTable(oConn).getColumnsStr(), DB.gu_project + "=?", 10);

    int iDuties = oDuties.load (oConn, new Object[]{get(DB.gu_project)});

    if (DebugFile.trace) DebugFile.writeln(String.valueOf(iDuties) + " duties loaded for " + getString(DB.gu_project));

    for (int d=0; d<iDuties; d++) {
      oDuties.setElementAt(Gadgets.generateUUID(), 0, d);
      oDuties.setElementAt(oProj.get(DB.gu_project), 2, d);
    }

    try { oDuties.store(oConn, oDuty.getClass(), true); }
    catch (java.lang.InstantiationException ignore) { /* never thrown*/ }

    int iBugs = oBugs.load (oConn, new Object[]{get(DB.gu_project)});

    if (DebugFile.trace) DebugFile.writeln(String.valueOf(iBugs) + " bugs loaded for " + getString(DB.gu_project));

    for (int b=0; b<iBugs; b++) {
      oBugs.setElementAt(Gadgets.generateUUID(), 0, b);
      oBugs.setElementAt(oProj.get(DB.gu_project), 3, b);
    }

    try { oBugs.store(oConn, oBug.getClass(), true); }
    catch (java.lang.InstantiationException ignore) { /* never thrown*/ }

    Stack oPending = new Stack();

    int iChilds = oChilds.load(oConn, aChild);

    if (DebugFile.trace) DebugFile.writeln(String.valueOf(iChilds) + " childs loaded for " + getString(DB.gu_project));

    for (int c=0; c<iChilds;c++) oPending.push(oChilds.get(0,c));

    while (!oPending.empty()) {
      aChild[0] = oPending.pop();

      iChilds = oChilds.load(oConn, aChild);

      if (DebugFile.trace) DebugFile.writeln(String.valueOf(iChilds) + " childs loaded for " + aChild[0]);

      oProj = new Project(oConn, (String) aChild[0]);
      oProj.replace(DB.gu_project, Gadgets.generateUUID());
      if (oSubProjMap.containsKey(oProj.get(DB.id_parent)))
        oProj.replace(DB.id_parent, oSubProjMap.get(oProj.get(DB.id_parent)));
      oProj.store(oConn);

      iDuties = oDuties.load (oConn, new Object[]{oProj.get(DB.gu_project)});

      if (DebugFile.trace) DebugFile.writeln(String.valueOf(iDuties) + " duties loaded for " + oProj.getString(DB.gu_project));

      for (int d=0; d<iDuties; d++) {
        oDuties.setElementAt(Gadgets.generateUUID(), 0, d);
        oDuties.setElementAt(oProj.get(DB.gu_project), 2, d);
      }

      try {
        oDuties.store(oConn, oDuty.getClass(), true);
      }
      catch (java.lang.InstantiationException ignore) { /* never thrown*/ }

      iBugs = oBugs.load (oConn, new Object[]{oProj.get(DB.gu_project)});

      if (DebugFile.trace) DebugFile.writeln(String.valueOf(iBugs) + " bugs loaded for " + oProj.getString(DB.gu_project));

      for (int b=0; b<iBugs; b++) {
        oBugs.setElementAt(Gadgets.generateUUID(), 0, b);
        oBugs.setElementAt(oProj.get(DB.gu_project), 3, b);
      }

      try {
        oBugs.store(oConn, oBug.getClass(), true);
      }
      catch (java.lang.InstantiationException ignore) { /* never thrown*/ }

      oSubProjMap.put (aChild[0], oProj.getString(DB.gu_project));

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.