// Path: app/src/main/java/com/crazymin2/retailstore/ApplicationController.java
// public class ApplicationController extends Application {
// 
//     private static ApplicationController mInstance;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         mInstance = this;
//     }
// 
//     public static synchronized ApplicationController getInstance() {
//         return mInstance;
//     }
// }
// 
// Path: app/src/main/java/com/crazymin2/retailstore/util/LogUtils.java
// public static void LOGD(final String tag, String message) {
//     if (LOGGING_ENABLED){
//         if (Log.isLoggable(tag, Log.DEBUG)) {
//             Log.d(tag, message);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/crazymin2/retailstore/util/LogUtils.java
// public static String makeLogTag(String str) {
//     if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
//         return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
//     }
// 
//     return LOG_PREFIX + str;
// }


import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.crazymin2.retailstore.ApplicationController;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import static com.crazymin2.retailstore.util.LogUtils.LOGD;
import static com.crazymin2.retailstore.util.LogUtils.makeLogTag;
package com.crazymin2.retailstore.database;





public class DatabaseHelper extends SQLiteOpenHelper {

    private static final String TAG = makeLogTag(DatabaseHelper.class);

    /**
     * Database Version
     */
    private static final int DB_VERSION = 1;
    private String databasePath;
    private SQLiteDatabase mDataBase;
    private Context mContext;

    /**
     * Database Name
     */
    private static final String DB_NAME = "retail_store";

    /**
     * Constructor Takes and keeps a reference of the passed context in order to access to the
     * application assets and resources.
     *
     * @param context
     */
    public DatabaseHelper(Context context) {

        this(context, DB_NAME, DB_VERSION);
    }

    /**
     * Constructor of class. Database Helper class for creating database.
     *
     * @param context
     * @param DB_NAME
     * @param version
     */
    private DatabaseHelper(Context context, String DB_NAME, int version) {
        super(context, DB_NAME, null, version);

        this.databasePath = ApplicationController.getInstance().getFilesDir().getParentFile().getPath() + "/databases/";

        this.mContext = context;

        try {

// Path: app/src/main/java/com/crazymin2/retailstore/ApplicationController.java
// public class ApplicationController extends Application {
// 
//     private static ApplicationController mInstance;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         mInstance = this;
//     }
// 
//     public static synchronized ApplicationController getInstance() {
//         return mInstance;
//     }
// }
// 
// Path: app/src/main/java/com/crazymin2/retailstore/util/LogUtils.java
// public static void LOGD(final String tag, String message) {
//     if (LOGGING_ENABLED){
//         if (Log.isLoggable(tag, Log.DEBUG)) {
//             Log.d(tag, message);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/crazymin2/retailstore/util/LogUtils.java
// public static String makeLogTag(String str) {
//     if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
//         return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
//     }
// 
//     return LOG_PREFIX + str;
// }


// Path: app/src/main/java/com/crazymin2/retailstore/database/DatabaseHelper.java
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.crazymin2.retailstore.ApplicationController;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import static com.crazymin2.retailstore.util.LogUtils.LOGD;
import static com.crazymin2.retailstore.util.LogUtils.makeLogTag;

package com.crazymin2.retailstore.database;





public class DatabaseHelper extends SQLiteOpenHelper {

    private static final String TAG = makeLogTag(DatabaseHelper.class);

    /**
     * Database Version
     */
    private static final int DB_VERSION = 1;
    private String databasePath;
    private SQLiteDatabase mDataBase;
    private Context mContext;

    /**
     * Database Name
     */
    private static final String DB_NAME = "retail_store";

    /**
     * Constructor Takes and keeps a reference of the passed context in order to access to the
     * application assets and resources.
     *
     * @param context
     */
    public DatabaseHelper(Context context) {

        this(context, DB_NAME, DB_VERSION);
    }

    /**
     * Constructor of class. Database Helper class for creating database.
     *
     * @param context
     * @param DB_NAME
     * @param version
     */
    private DatabaseHelper(Context context, String DB_NAME, int version) {
        super(context, DB_NAME, null, version);

        this.databasePath = ApplicationController.getInstance().getFilesDir().getParentFile().getPath() + "/databases/";

        this.mContext = context;

        try {

            LOGD(TAG, "Initializing database..." + DB_NAME);