示例#1
0
  public static void insertTesterIntroducerInfo(D_TesterIntroducer testerIntroducer) {
    String params[] = new String[net.ddp2p.common.table.tester_introducer.F_FIELDS_NOID];

    params[net.ddp2p.common.table.tester_introducer.F_TESTER_LID] =
        Util.getStringID(testerIntroducer.testerLID);
    params[net.ddp2p.common.table.tester_introducer.F_INTRODUCER_PEER_LID] =
        Util.getStringID(testerIntroducer.introducerPeerLID);
    params[net.ddp2p.common.table.tester_introducer.F_SIGNATURE] =
        Util.stringSignatureFromByte(testerIntroducer.signature);
    params[net.ddp2p.common.table.tester_introducer.F_WEIGH] = testerIntroducer.weight;
    params[net.ddp2p.common.table.tester_introducer.F_CREATION_DATE] =
        Encoder.getGeneralizedTime(testerIntroducer.creation_date);
    // the following should be null!!
    params[net.ddp2p.common.table.tester_introducer.F_TESTER_REJECTING_DATE] =
        null; // Encoder.getGeneralizedTime(testerIntroducer.testerRejectingDate);
    params[net.ddp2p.common.table.tester_introducer.F_ATTACK_BY_INTRODUCER] =
        "0"; // Util.getString(testerIntroducer.attackByIntroducer);
    //			// ID:
    //			params[table.tester_introducer.F_ID] =
    // Util.getStringID(testerIntroducer.testerIntroducerID);

    try {
      Application.db.insert(
          net.ddp2p.common.table.tester_introducer.TNAME,
          net.ddp2p.common.table.tester_introducer._fields_tester_introducer_no_ID,
          params,
          DEBUG);
    } catch (P2PDDSQLException e) {
      e.printStackTrace();
    }
  }
示例#2
0
  public static void updateTesterIntroducer(
      long testerIntroducerID, D_TesterIntroducer testerIntroducer) {
    String params[] = new String[net.ddp2p.common.table.tester_introducer.F_FIELDS];

    params[net.ddp2p.common.table.tester_introducer.F_TESTER_LID] =
        Util.getStringID(testerIntroducer.testerLID);
    params[net.ddp2p.common.table.tester_introducer.F_INTRODUCER_PEER_LID] =
        Util.getStringID(testerIntroducer.introducerPeerLID);
    params[net.ddp2p.common.table.tester_introducer.F_SIGNATURE] =
        Util.stringSignatureFromByte(testerIntroducer.signature);
    params[net.ddp2p.common.table.tester_introducer.F_WEIGH] = testerIntroducer.weight;
    params[net.ddp2p.common.table.tester_introducer.F_CREATION_DATE] =
        Encoder.getGeneralizedTime(testerIntroducer.creation_date);
    params[net.ddp2p.common.table.tester_introducer.F_TESTER_REJECTING_DATE] =
        Encoder.getGeneralizedTime(testerIntroducer.testerRejectingDate);
    params[net.ddp2p.common.table.tester_introducer.F_ATTACK_BY_INTRODUCER] =
        Util.getString(testerIntroducer.attackByIntroducer);
    // ID:
    params[net.ddp2p.common.table.tester_introducer.F_ID] = Util.getStringID(testerIntroducerID);

    try {
      Application.db.update(
          net.ddp2p.common.table.tester_introducer.TNAME,
          net.ddp2p.common.table.tester_introducer._fields_tester_introducer_no_ID,
          new String[] {net.ddp2p.common.table.tester_introducer.testerIntroducerID},
          params,
          DEBUG);
    } catch (P2PDDSQLException e) {
      e.printStackTrace();
    }
  }
示例#3
0
  public static ArrayList<D_TesterIntroducer> retrieveTesterIntroducers(String tLID) {
    ArrayList<D_TesterIntroducer> result = new ArrayList<D_TesterIntroducer>();
    ArrayList<ArrayList<Object>> obj;
    try {
      obj = Application.db.select(sql_load_testerIntroducers, new String[] {tLID}, DEBUG);
    } catch (P2PDDSQLException e) {
      e.printStackTrace();
      return result;
    }
    // if (obj.size() <= 0) throw new  Exception("D_RecommendationOfTester:
    // retrieveAllTestersLIDs:");
    // init(obj.get(0));
    if (DEBUG)
      System.out.println("D_RecommendationOfTester: retrieveAllTestersLIDs: got=" + obj.size());
    for (int i = 0; i < obj.size(); i++) result.add(buildRecord(obj.get(i)));
    // if(DEBUG) System.out.println("D_RecommendationOfTester: retrieveAllTestersLIDs:
    // got="+result.size());//result);
    if (DEBUG) {
      System.out.println("D_RecommendationOfTester: retrieveAllTestersLIDs: got=" + result.size());
      for (int i = 0; i < result.size(); i++)
        System.out.print(
            "D_RecommendationOfTester: retrieveAllTestersLIDs: got[=" + result.get(i) + " ,");
      System.out.println("]");
    }

    Collections.sort(result);
    return result;
  }
示例#4
0
  private void jtableMouseReleased(java.awt.event.MouseEvent evt) {
    if (!evt.isPopupTrigger()) return;
    boolean autoSeleced = false;
    try {
      autoSeleced = DD.getAppBoolean(DD.AUTOMATIC_TESTERS_RATING_BY_SYSTEM);
    } catch (P2PDDSQLException e) {
      e.printStackTrace();
    }
    if (autoSeleced) {
      Application_GUI.warning(
          "you need to select manual rating mode to use this option", "Manual Rating");
      return;
    }
    int row; // =this.getSelectedRow();
    int col; // =this.getSelectedColumn();

    // if ( !SwingUtilities.isLeftMouseButton( evt )) return;
    Point point = evt.getPoint();
    row = this.rowAtPoint(point);
    col = this.columnAtPoint(point);
    this.getSelectionModel().setSelectionInterval(row, row);
    if (row >= 0) row = this.convertRowIndexToModel(row);
    JPopupMenu popup = getPopup(row, col);
    if (popup == null) return;
    popup.show((Component) evt.getSource(), evt.getX(), evt.getY());
    //	getModel().update(null, null);
  }
示例#5
0
 @Override
 public D_TesterIntroducer decode(Decoder dec) throws ASN1DecoderFail {
   Decoder d = dec.getContent();
   introducerPeerGID = d.getFirstObject(true).getString();
   try {
     introducerPeerLID = Util.lval(D_Peer.getPeerLIDbyGID(introducerPeerGID), -1);
   } catch (P2PDDSQLException e) {
     e.printStackTrace();
   }
   testerGID = d.getFirstObject(true).getString();
   testerLID = net.ddp2p.common.data.D_Tester.getTesterLIDbyGID(testerGID);
   _weight = Util.fval(weight = d.getFirstObject(true).getString(), 0.0f);
   creation_date = d.getFirstObject(true).getGeneralizedTimeCalender_();
   signature = d.getFirstObject(true).getBytes();
   return this;
 }
示例#6
0
  @Override
  public void orgUpdate(String orgID, int col, D_Organization org) {
    if (DEBUG) System.out.println("ConstituentsTest:orgUpdate: id=" + orgID + " col=" + col);
    long _orgID = -1;

    if (orgID != null) {
      _orgID = new Integer(orgID).longValue();
      if (org == null) org = D_Organization.getOrgByLID_NoKeep(orgID, true);
      if (org == null) _orgID = -1;

    } else {
      if (org != null) _orgID = org.getLID_forced();
    }
    try {
      this.setOrg(_orgID, org);
    } catch (P2PDDSQLException e) {
      e.printStackTrace();
    }
  }
示例#7
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (DEBUG) System.out.println("ConstituentsPanel:action Refresh \n" + e);
   if (e.getSource() == this.refresh_button) {
     if (!this.refresh_button.isEnabled()) return;
     // disableRefresh();
     if (tree == null) return;
     ConstituentsModel model = tree.getModel();
     if (model == null) return;
     try {
       model.doRefreshAll();
       /*
       Object oldRoot = model.getRoot();
       model.init(model.getOrganizationID(), model.getConstituentIDMyself(), model.getConstituentGIDMyself(), model.getOrganization());
       model.fireTreeStructureChanged(new TreeModelEvent(tree,new Object[]{model.root}));
       model.refresh(new JTree[]{tree}, oldRoot);
       model.runCensus();
       	 */
     } catch (P2PDDSQLException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
     }
   }
 }