what-the-bank/sources/com/kofax/kmc/kut/utilities/appstats/AppStatsSqLiteDs.java

121 lines
6.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.kofax.kmc.kut.utilities.appstats;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.kofax.kmc.kut.utilities.AppContextProvider;
/* loaded from: classes3.dex */
public class AppStatsSqLiteDs extends AppStatsDataStore {
private static final String TAG = "AppStatsSqLiteDs";
private b qa;
@Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDataStore
public void close() {
}
@Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDataStore
public boolean isOpen() {
return false;
}
@Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDataStore
public void open() {
}
@Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDataStore
public void upgrade(String str) {
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class a {
public static final AppStatsSqLiteDs qb = new AppStatsSqLiteDs();
private a() {
}
}
public static AppStatsSqLiteDs getInstance() {
return a.qb;
}
/* loaded from: classes3.dex */
class b extends SQLiteOpenHelper {
private static final int qc = 310;
final AppStatsSqLiteDs qd;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public b(AppStatsSqLiteDs appStatsSqLiteDs, Context context, String str) {
super(context, str, (SQLiteDatabase.CursorFactory) null, qc);
this.qd = appStatsSqLiteDs;
}
@Override // android.database.sqlite.SQLiteOpenHelper
public final void onCreate(SQLiteDatabase sQLiteDatabase) {
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS Instance (InstanceID TEXT PRIMARY KEY NOT NULL, EnvironmentID TEXT, CreationTime DATETIME, DismissalTime DATETIME, InstanceType TEXT, SessionKey TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS Environment (ID TEXT PRIMARY KEY NOT NULL , DeviceID TEXT, Manufacturer TEXT, Model TEXT, Memory TEXT, OSVersion TEXT, Language TEXT, SDKVersion TEXT, TimeZone TEXT, Carrier TEXT, OSName TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS ClassificationEvent (ID TEXT PRIMARY KEY NOT NULL, InstanceID TEXT, StartTime DATETIME, StopTime DATETIME, ClassificationResult TEXT, ClassificationConfidence FLOAT, ImageID TEXT, DocumentID TEXT, SessionKey TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS ClassificationEventAlternative (ID TEXT PRIMARY KEY NOT NULL , ClassificationEventID TEXT, AlternativeResult TEXT, AlternativeConfidence FLOAT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS CaptureEvent (ID TEXT PRIMARY KEY NOT NULL , InstanceID TEXT, EventTime DATETIME, EventType TEXT, Value INTEGER, ImageID TEXT, SessionKey TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS PropertyChangeEvent (ID TEXT PRIMARY KEY NOT NULL , InstanceID TEXT, EventTime DATETIME, PropertyType TEXT, PropertyValue TEXT, SessionKey TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS FieldChangeEvent (ID TEXT PRIMARY KEY NOT NULL , DocumentID TEXT, EventTime DATETIME, OriginalValue TEXT, ChangedValue TEXT, FieldName TEXT, IsValid INTEGER, ErrorDescription TEXT, SessionEventID TEXT, Confidence FLOAT, FormattingFailed INTEGER)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS ErrorLog (ID TEXT PRIMARY KEY NOT NULL , EnvironmentID TEXT, ErrorTime DATETIME, ErrorCode INTEGER, Description TEXT, Recommendation TEXT, SessionKey TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS SessionEvent (ID TEXT PRIMARY KEY NOT NULL , SessionKey TEXT, Category TEXT, Type TEXT, EventTime DATETIME, EnvironmentID TEXT, Response TEXT, DocumentID TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS Document (ID TEXT PRIMARY KEY NOT NULL , SessionKey TEXT, CreationTime DATETIME, EnvironmentID TEXT, DocumentType TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS Image (ID TEXT PRIMARY KEY NOT NULL, EnvironmentID TEXT, CreationTime DATETIME, FileSize INTEGER, Source TEXT, DocumentID TEXT, StoragePath TEXT, SessionKey TEXT)");
sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS ImageProcessorEvent (ID TEXT PRIMARY KEY NOT NULL, InstanceID TEXT, StartTime DATETIME, StopTime DATETIME, ResultCode INTEGER, ProcessingProfile TEXT, SourceImageID TEXT, ProcessedImageID TEXT, SessionKey TEXT)");
}
@Override // android.database.sqlite.SQLiteOpenHelper
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS Instance");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS Environment");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS ClassificationEvent");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS ClassificationEventAlternative");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS CaptureEvent");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS PropertyChangeEvent");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS FieldChangeEvent");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS ErrorLog");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS SessionEvent");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS Document");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS Image");
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS ImageProcessorEvent");
onCreate(sQLiteDatabase);
}
}
@Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDataStore
public void open(String str) {
this.dsFilePathAsFileObj = AppContextProvider.getContext().getDatabasePath(str);
this.dsFilePath = this.dsFilePathAsFileObj.getAbsolutePath();
this.qa = new b(this, AppContextProvider.getContext(), this.dsFilePath);
countrows("ImageProcessorEvent");
}
@Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDataStore
public void remove() {
if (this.dsFilePathAsFileObj != null) {
this.dsFilePathAsFileObj.delete();
}
}
@Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDataStore
public long countrows(String str) {
SQLiteDatabase writableDatabase = this.qa.getWritableDatabase();
if (writableDatabase == null) {
return 0L;
}
return writableDatabase.compileStatement("SELECT count(*) from ".concat(String.valueOf(str))).simpleQueryForLong();
}
@Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDataStore
public Object getDsHandle() {
b bVar = this.qa;
if (bVar == null) {
return null;
}
return bVar.getWritableDatabase();
}
}