Example #1
0
 public static void addOrganizationToDSSK(DD_SK d_SK, D_Organization crt_org) {
   if (crt_org == null) return;
   for (D_Organization c : d_SK.org) {
     if (c == crt_org) return;
     if (c.getLID() == crt_org.getLID()) return;
   }
   d_SK.org.add(crt_org);
 }
Example #2
0
 private String getLabelText() {
   String result;
   if (organization == null) return __("No current organization!");
   if (organization.getName() == null) return __("Incomplete organization data!");
   result = __("Current Organization:") + " \"" + organization.getName() + "\"";
   result += " || " + __("I am :") + " " + tree.getModel().getConstituentMyselfName();
   return result;
 }
Example #3
0
 @Override
 public DD_SK decode(Decoder dec) throws ASN1DecoderFail {
   String default_orgGID = null;
   String default_orgGIDH = null;
   Decoder d = dec.getContent();
   if (d.getTypeByte() == DD.TAG_AP0)
     version = d.getFirstObject(true).getInteger(DD.TAG_AP0).intValue();
   if (d.getTypeByte() == DD.TAG_AC0)
     sk = d.getFirstObject(true).getSequenceOfAL(DD_SK_Entry.getASN1Tag(), new DD_SK_Entry());
   if (d.getTypeByte() == DD.TAG_AC1)
     peer = d.getFirstObject(true).getSequenceOfAL(D_Peer.getASN1Type(), D_Peer.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC2) {
     org =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Organization.getASN1Type(), D_Organization.getEmpty());
     if (org.size() == 1) {
       default_orgGID = org.get(0).getGID();
       default_orgGIDH = org.get(0).getGIDH();
       if (DEBUG)
         System.out.println(
             "DD_SK: has a GID for orgs: " + default_orgGID + " H=" + default_orgGIDH);
     }
   }
   if (d.getTypeByte() == DD.TAG_AC3)
     neigh =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Neighborhood.getASN1Type(), D_Neighborhood.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC4)
     constit =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Constituent.getASN1Type(), D_Constituent.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC5)
     witn = d.getFirstObject(true).getSequenceOfAL(D_Witness.getASN1Type(), D_Witness.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC6) {
     moti = d.getFirstObject(true).getSequenceOfAL(D_Motion.getASN1Type(), D_Motion.getEmpty());
     for (D_Motion m : moti) {
       if (m.getOrganizationGIDH() == null) {
         if (_DEBUG) System.out.println("DD_SK: put a GIDH for " + m);
         m.setOrganizationGID(default_orgGIDH);
         if (_DEBUG) System.out.println("DD_SK: did put a GIDH for " + m);
       } else if (DEBUG) System.out.println("DD_SK: had a GIDH for " + m);
     }
   }
   if (d.getTypeByte() == DD.TAG_AC7)
     just =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Justification.getASN1Type(), D_Justification.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC8)
     vote = d.getFirstObject(true).getSequenceOfAL(D_Vote.getASN1Type(), D_Vote.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC10)
     tran =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Translations.getASN1Type(), D_Translations.getEmpty());
   if (d.getTypeByte() == DD.TAG_AP1) sender = D_Peer.getEmpty().decode(d.getFirstObject(true));
   if (d.getTypeByte() == DD.TAG_AP2) signature = d.getFirstObject(true).getBytes(DD.TAG_AP2);
   return this;
 }
Example #4
0
 public ConstituentsPanel(
     DBInterface db, int _organizationID, int _constituentID, String _global_constituentID) {
   super(new BorderLayout());
   MainFrame.status.addOrgStatusListener(this);
   // Application.orgs.addListener(this);
   if (_organizationID < 0) return;
   org_label.setText(getLabelText());
   refresh_button.addActionListener(this);
   // refresh_button.setEnabled(false);
   disableRefresh();
   add(getNorthComponent(), BorderLayout.NORTH);
   // _organizationID = 100;
   // _constituentID = 100;
   // String _global_constituentID = "global_ID_Test";
   constituentID = _constituentID;
   organizationID = _organizationID;
   global_constituentID = _global_constituentID;
   D_Organization org = null;
   if (organizationID > 0)
     try {
       org = D_Organization.getOrgByLID_NoKeep(organizationID, true);
     } catch (Exception e) {
       e.printStackTrace();
       return;
     }
   ConstituentsModel cm =
       new ConstituentsModel(
           db, _organizationID, _constituentID, _global_constituentID, org, this);
   tree = new ConstituentsTree(cm);
   long cID = cm.getConstituentIDMyself();
   cm.expandConstituentID(tree, ((cID <= 0) ? null : ("" + cID)), true);
   JScrollPane scrollPane = new JScrollPane(tree);
   scrollPane.setPreferredSize(new Dimension(200, 200));
   add(scrollPane, BorderLayout.CENTER);
 }
Example #5
0
 @Override
 public String getNiceDescription() {
   String result = "";
   for (DD_SK_Entry _sk : sk)
     result += "SK[: sk=" + _sk.name + "]"; // Util.concat(sk, ";;;", "NULL");
   for (D_Peer _peer : peer) result += " Safe=[" + _peer.getName() + "]";
   for (D_Organization _org : org) result += " Org=[" + _org.getName() + "]";
   for (D_Constituent _constit : constit) result += " Cons=[" + _constit.getNameFull() + "]";
   for (D_Witness _witn : witn) result += " Witn=[" + _witn.witnessed_global_constituentID + "]";
   for (D_Motion _moti : moti) result += " Moti=[" + _moti.getTitleStrOrMy() + "]";
   for (D_Justification _just : just) result += " Just=[" + _just.getTitleStrOrMy() + "]";
   for (D_News _news : news) result += " News=[" + _news.getTitleStrOrMy() + "]";
   for (D_Vote _vote : vote)
     result += " Vote=[" + _vote.getChoice() + " " + _vote.getMotionGID() + "]";
   // to implement
   if (tran.size() > 0) result += " tran=" + Util.concat(tran, ",,,", "NULL");
   result += "]";
   return result;
 }
Example #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();
    }
  }
Example #7
0
  public static void _main(String args[]) throws P2PDDSQLException {
    net.ddp2p.java.db.Vendor_JDBC_EMAIL_DB.initJDBCEmail();
    Application.setDB(new DBInterface(Application.DELIBERATION_FILE));
    System.out.println("D_Organization: main: prog pID, verify, sign, store");
    long pID = Long.parseLong(args[0]);
    int verif = Integer.parseInt(args[1]);
    int sign = Integer.parseInt(args[2]);
    int store = Integer.parseInt(args[3]);
    /*
    HandlingMyself_Peer.loadIdentity(null);
    D_Organization me = HandlingMyself_Peer.getPeer(Identity.current_peer_ID);
    System.out.println("D_Organization: main: me= "+me);
    HandlingMyself_Peer.setMyself(me, false);
    */

    // D_Organization d = D_Organization.getPeerByLID(1, true);
    // System.out.println("D_Organization: main:read(1) "+d);
    D_Organization d2 = D_Organization.getOrgByLID_NoKeep(pID, true);
    // System.out.println("D_Organization: main: cache="+dumpDirCache());
    System.out.println("\nD_Organization: main: d[" + pID + "]=" + d2);
    if (d2 == null) {
      System.out.println("D_Organization: no d2=: " + d2);
      return;
    }

    // System.out.println("\nD_Organization: main 1: ********\n");
    // d2.verifySignature();
    // System.out.println("\nD_Organization: main 2: ********\n");
    // d2.sign();
    System.out.println("\nD_Organization: main 3: ********\n");
    if (verif > 0) {
      boolean r = d2.verifySignature();
      System.out.println("\nD_Organization: main 3: verif result=" + r);
    }
    if (sign > 0) {
      d2.sign();
      boolean r2 = d2.verifySignature();
      System.out.println("\nD_Organization: main 4: verif result=" + r2);
    }
    if (store > 0) d2.storeSynchronouslyNoException();
  }