use of org.opentransactions.otapi.Storable in project otapij by FellowTraveler.
the class Helpers method getNYMOffer.
public static OfferListNym getNYMOffer(String serverID, String nymID) {
OfferListNym offerListNym = null;
Storable storable = null;
if (otapi.Exists("nyms", serverID, "offers", nymID + ".bin")) {
storable = otapi.QueryObject(StoredObjectType.STORED_OBJ_OFFER_LIST_NYM, "nyms", serverID, "offers", nymID + ".bin");
if (storable == null) {
return null;
}
offerListNym = OfferListNym.ot_dynamic_cast(storable);
} else {
storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_OFFER_LIST_NYM);
if (storable == null) {
return null;
}
offerListNym = OfferListNym.ot_dynamic_cast(storable);
}
return offerListNym;
}
use of org.opentransactions.otapi.Storable in project otapij by FellowTraveler.
the class Helpers method getMarketTradeList.
public static TradeListMarket getMarketTradeList(String serverID, String marketID) {
TradeListMarket tradeListMarket = null;
Storable storable = null;
if (otapi.Exists("markets", serverID, "recent", marketID + ".bin")) {
storable = otapi.QueryObject(StoredObjectType.STORED_OBJ_TRADE_LIST_MARKET, "markets", serverID, "recent", marketID + ".bin");
if (storable == null) {
return null;
}
tradeListMarket = TradeListMarket.ot_dynamic_cast(storable);
} else {
storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_TRADE_LIST_MARKET);
if (storable == null) {
return null;
}
tradeListMarket = TradeListMarket.ot_dynamic_cast(storable);
}
return tradeListMarket;
}
use of org.opentransactions.otapi.Storable in project otapij by FellowTraveler.
the class Helpers method getWalletData.
public static WalletData getWalletData() {
WalletData walletData = null;
Storable storable = null;
if (otapi.Exists("moneychanger", "gui_wallet.dat")) {
storable = otapi.QueryObject(StoredObjectType.STORED_OBJ_WALLET_DATA, "moneychanger", "gui_wallet.dat");
if (storable == null) {
return null;
}
walletData = WalletData.ot_dynamic_cast(storable);
} else {
storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_WALLET_DATA);
if (storable == null) {
return null;
}
walletData = WalletData.ot_dynamic_cast(storable);
}
return walletData;
}
use of org.opentransactions.otapi.Storable in project otapij by FellowTraveler.
the class AddressBookHelper method createContact.
public static String createContact(String name, String email, String publicKey, String memo) {
String contactID = "error";
System.out.println("in createContact");
AddressBook addressBook = Helpers.getAddressBook();
if (addressBook == null) {
System.out.println("createContact - addressBook returns null");
return contactID;
}
System.out.println("in createContact,addressBook:" + addressBook);
Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_CONTACT);
System.out.println("in createContact, storable:" + storable);
if (storable != null) {
Contact contact = Contact.ot_dynamic_cast(storable);
System.out.println("contact:" + contact);
if (contact != null) {
contact.setContact_id(Helpers.generateID());
contact.setEmail(email);
contact.setGui_label(name);
contact.setMemo(memo);
contact.setPublic_key(publicKey);
boolean status = addressBook.AddContact(contact);
System.out.println("status addressBook.AddContact:" + status);
if (!status) {
return contactID;
}
status = otapi.StoreObject(addressBook, "moneychanger", "gui_contacts.dat");
System.out.println("status addressBook otapi.StoreObject:" + status);
if (!status) {
return contactID;
}
contactID = Helpers.generateID();
}
}
return contactID;
}
Aggregations