Package org.opentransactions.otapi

Examples of org.opentransactions.otapi.ContactNym


            if (contact == null) {
                continue;
            }
            if (contactID.equals(contact.getContact_id())) {
                System.out.println("createContactNym - contactID matches");
                ContactNym contactNYM = null;
                if (index == -1) {
                    Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_CONTACT_NYM);
                    if (storable != null) {
                        contactNYM = ContactNym.ot_dynamic_cast(storable);
                    }
                } else {
                    contactNYM = contact.GetContactNym(index);
                }
                if (contactNYM != null) {
                    contactNYM.setGui_label(label);
                    contactNYM.setMemo(memo);
                    contactNYM.setNym_id(nymID);
                    contactNYM.setNym_type(nymType);
                    contactNYM.setPublic_key(publickey);
                    while (contactNYM.GetServerInfoCount() > 0) {
                        contactNYM.RemoveServerInfo(0);
                    }

                    for (int j = 0; j < serverID.length; j++) {
                        Storable storable1 = otapi.CreateObject(StoredObjectType.STORED_OBJ_SERVER_INFO);
                        if (storable1 != null) {
                            ServerInfo serverInfo = ServerInfo.ot_dynamic_cast(storable1);
                            if (serverInfo != null) {
                                serverInfo.setServer_id(serverID[j]);
                                System.out.println("serverType[j]:"+serverType[j]);
                                serverInfo.setServer_type(serverType[j]);
                                contactNYM.AddServerInfo(serverInfo);

                            }
                        }
                    }
View Full Code Here


    public static ContactNymDetails getContactNymDetails(Contact contact,int index){

            ContactNymDetails data = new ContactNymDetails();
            List serverList = new ArrayList();
            if(contact!=null && index>-1){
            ContactNym contactNYM = contact.GetContactNym(index);
            if(contactNYM==null){
                System.out.println("getContactNymDetails contact.GetContactNym(index) returned null");
                return null;
            }
            data.setLabel(contactNYM.getGui_label());
            data.setMemo(contactNYM.getMemo());
            data.setNymID(contactNYM.getNym_id());
            data.setNymType(contactNYM.getNym_type());
            data.setPublicKey(contactNYM.getPublic_key());

            for(int i=0;i<contactNYM.GetServerInfoCount();i++){
                String [] servers = new String[2];
                if(contactNYM.GetServerInfo(i)==null)
                    continue;
                servers [0] = contactNYM.GetServerInfo(i).getServer_id();
                servers [0] = contactNYM.GetServerInfo(i).getServer_type();
                serverList.add(servers);
            }
            data.setServerList(serverList);
        }
       
View Full Code Here

TOP

Related Classes of org.opentransactions.otapi.ContactNym

Copyright © 2018 www.massapicom. 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.