boolean bHaveImage = false;
// First Lets Check if we already have a password image. (we don't need annother one)
if (otapi.Exists("moneychanger", "settings.dat")) {
Storable storable = null;
StringMap stringMap = null;
storable = otapi.QueryObject(StoredObjectType.STORED_OBJ_STRING_MAP, "moneychanger", "settings.dat");
if (null != storable) {
stringMap = StringMap.ot_dynamic_cast(storable);
imagePath = stringMap.GetValue("ImagePath");
File f = new File(imagePath);
if (f.exists()) {
// Good we have a password Image
bHaveImage = true;
}
}
}
// We don't have an image... lets get it from the user, then save it.
if (!bHaveImage) {
for (;;) {
imagePath = passwordImage.GetPasswordImageFromUser("passwordImage");
if (passwordImage.GetIfUserCancelled()) {
bHaveImage = false;
break;
}
File f = new File(imagePath);
if (f.exists()) {
bHaveImage = true;
// Good we have a password Image
break;
}
}
if (!bHaveImage)
{
return false;
}
StringMap stringMap = null; // we are about to create this object
Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_STRING_MAP);
if (storable != null) {
stringMap = StringMap.ot_dynamic_cast(storable);
System.out.println("stringMap:" + stringMap);