Commit 1be58602 by Kunj Gupta

Added Local DB table for storing Catalogue categories.

parent 4335aee8
......@@ -2,16 +2,20 @@ package com.vsoft.uoflservicenow;
import android.app.Application;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.crashlytics.android.Crashlytics;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;
import com.vsoft.uoflservicenow.db.DBManager;
import io.fabric.sdk.android.Fabric;
public class CatalogueApplication extends Application {
private static DBManager sDBManager;
private ConnectivityManager mConMgr;
private static Context mContext;
private Tracker mTracker;
......@@ -22,6 +26,9 @@ public class CatalogueApplication extends Application {
Fabric.with(this, new Crashlytics());
mContext = getApplicationContext();
/*Database is created*/
initializeDatabase();
}
public static Context getContext() {
......@@ -37,6 +44,21 @@ public class CatalogueApplication extends Application {
return mTracker;
}
/*DataBase is created*/
public void initializeDatabase() {
if(sDBManager == null) {
sDBManager = new DBManager(this);
sDBManager.getWritableDatabase();
}
}
public static SQLiteDatabase getDatabase() {
if(sDBManager != null) {
return sDBManager.getWritableDatabase();
}
return null;
}
public boolean isNetConnected() {
if(mConMgr==null)
mConMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
......
package com.vsoft.uoflservicenow.db;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.preference.PreferenceManager;
import com.vsoft.uoflservicenow.utils.Constants;
import com.vsoft.uoflservicenow.utils.DBConstants;
/**
*
* @author Kunj on 11-08-2016.
*/
public class DBManager extends SQLiteOpenHelper implements DBConstants {
private static final String DATABASE_NAME = "uofl.db";
private static final int DATABASE_VERSION = 1;
private Context mContext;
public DBManager(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
mContext = context;
}
@Override
public void onCreate(SQLiteDatabase db) {
createCatalogueTable(db);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit();
editor.putInt(Constants.PREFS_OLD_VERSION_NUMBER, oldVersion);
editor.putInt(Constants.PREFS_NEW_VERSION_NUMBER, newVersion);
editor.apply();
onCreate(db);
}
private void createCatalogueTable(SQLiteDatabase db) {
db.execSQL("create table " + TABLE_CATALOGUE + "("
+ CATALOGUE_ID + " integer primary key autoincrement, "
+ CATALOGUE_SYS_ID + " text, "
+ CATALOGUE_TITLE + " text, "
+ CATALOGUE_DESCRIPTION + " text, "
+ CATALOGUE_ICON + " text, "
+ CATALOGUE_SYNC_DIRTY + " integer default " + SYNC_FLAG_NONE
+ ");");
}
}
package com.vsoft.uoflservicenow.db.managers;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.vsoft.uoflservicenow.CatalogueApplication;
import com.vsoft.uoflservicenow.db.models.Catalogue;
import com.vsoft.uoflservicenow.utils.DBConstants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
*
* @author Kunj on 11-08-2016.
*/
public class CatalogueManager implements DBConstants {
public static long save(Catalogue catalogue, int syncDirty) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
catalogue.setSyncDirty(syncDirty);
long id = db.insert(TABLE_CATALOGUE, null, getContentValues(catalogue));
catalogue.setId(id);
return id;
} else {
return -1;
}
}
public static int delete(Catalogue catalogue) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
if (catalogue.getSysId() == null || catalogue.getSysId().isEmpty()) {
return db.delete(TABLE_CATALOGUE, CATALOGUE_ID + "=" + catalogue.getId(), null);
} else {
return update(catalogue, SYNC_FLAG_DELETE);
}
}
return -1;
}
public static int update(Catalogue catalogue, int syncDirty) {
return update(catalogue, null, syncDirty);
}
public static int update(Catalogue catalogue, List<String> column, int syncDirty) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
catalogue.setSyncDirty(syncDirty);
if (column == null || column.size() == 0) {
return db.update(TABLE_CATALOGUE, getContentValues(catalogue), CATALOGUE_ID + "=" + catalogue.getId(), null);
} else {
ContentValues contentValues = new ContentValues(column.size());
contentValues.put(CATALOGUE_SYNC_DIRTY, catalogue.getSyncDirty());
for (int i = 0; i < column.size(); i++) {
String columnName = column.get(i);
if (CATALOGUE_SYS_ID.equals(columnName)) {
contentValues.put(CATALOGUE_SYS_ID, catalogue.getSysId());
} else if (CATALOGUE_TITLE.equals(columnName)) {
contentValues.put(CATALOGUE_TITLE, catalogue.getTitle());
} else if (CATALOGUE_DESCRIPTION.equals(columnName)) {
contentValues.put(CATALOGUE_DESCRIPTION, catalogue.getDescription());
} else if (CATALOGUE_ICON.equals(columnName)) {
contentValues.put(CATALOGUE_ICON, catalogue.getIcon());
}
}
return db.update(TABLE_CATALOGUE, contentValues, CATALOGUE_ID + "=" + catalogue.getId(), null);
}
} else {
return -1;
}
}
public static void handleGetCatalogue(List<Catalogue> serverCatalogueList) {
if(serverCatalogueList != null && !serverCatalogueList.isEmpty()) {
/*catalogueSysIdMap contain all server response catalogues Sys Id*/
HashMap<String, Integer> catalogueSysIdMap = new HashMap<>(0);
Integer intObj = Integer.valueOf(1);
for (int i = 0; i < serverCatalogueList.size(); i++) {
String sysId = serverCatalogueList.get(i).getSysId();
catalogueSysIdMap.put(sysId, intObj);
}
/*localCatalogueList is contain all local Catalogues */
List<Catalogue> localCatalogueList = getAllCatalogues();
if (localCatalogueList != null && !localCatalogueList.isEmpty()) {
for (int i = 0; i < localCatalogueList.size(); i++) {
Catalogue localCatalogue = localCatalogueList.get(i);
String localCatalogueSysId = localCatalogue.getSysId();
if (localCatalogueSysId != null
&& !localCatalogueSysId.isEmpty()
&& !catalogueSysIdMap.containsKey(localCatalogueSysId)) {
//Update sys_id with empty string because required to delete locally
localCatalogue.setSysId("");
delete(localCatalogue);
}
}
}
/*Check this catalogue is exist in local DB or not
* If doesn't exist in local, save it
* If exist in local, update the local item with data from server item.
* */
for (int i = 0; i < serverCatalogueList.size(); i++) {
Catalogue catalogue = serverCatalogueList.get(i);
Catalogue localCatalogue = getCatalogueFromSysId(catalogue.getSysId());
if (localCatalogue == null) {
save(catalogue, DBConstants.SYNC_FLAG_NONE);
} else {
/*Update complete local Catalogue object with response Catalogue object*/
catalogue.setId(localCatalogue.getId());
update(catalogue, DBConstants.SYNC_FLAG_NONE);
}
}
} else {
/*That means there is no Catalogue category in server response, then all local items should be deleted those are contain sys_id*/
/*localCatalogueList is contain all local Catalogues */
List<Catalogue> localCatalogueList = getAllCatalogues();
if (localCatalogueList != null && !localCatalogueList.isEmpty()) {
for (int i = 0; i < localCatalogueList.size(); i++) {
Catalogue localCatalogue = localCatalogueList.get(i);
String localCatalogueSysId = localCatalogue.getSysId();
if (localCatalogueSysId != null
&& !localCatalogueSysId.isEmpty()) {
//Update sys_id with empty string because required to delete locally
localCatalogue.setSysId("");
delete(localCatalogue);
}
}
}
}
}
public static List<Catalogue> getAllCatalogues() {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
Cursor c = db.rawQuery("select * from " + TABLE_CATALOGUE
+ " where " + CATALOGUE_SYNC_DIRTY
+ "!=" + DBConstants.SYNC_FLAG_DELETE, null);
ArrayList<Catalogue> catalogueList;
if (c.getCount() > 0) {
catalogueList = new ArrayList<>(c.getCount());
while (c.moveToNext()) {
Catalogue.CatalogueBuilder builder = Catalogue.CatalogueBuilder.aCatalogue();
fillAllCatalogueDetails(c, builder);
catalogueList.add(builder.build());
}
} else {
catalogueList = new ArrayList<>(0);
}
c.close();
return catalogueList;
} else {
return new ArrayList<>(0);
}
}
public static Catalogue get(long catalogueId) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
Catalogue catalogue = null;
if (db != null) {
Cursor c = db.rawQuery("select * from " + TABLE_CATALOGUE + " where " + CATALOGUE_ID + "=" + catalogueId, null);
if (c.moveToFirst()) {
Catalogue.CatalogueBuilder builder = Catalogue.CatalogueBuilder.aCatalogue();
fillAllCatalogueDetails(c, builder);
catalogue = builder.build();
}
c.close();
}
return catalogue;
}
public static Catalogue getCatalogueFromSysId(String sysId) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
Catalogue catalogue = null;
if(db!=null) {
Cursor c = db.rawQuery("select * from " + TABLE_CATALOGUE + " where " + CATALOGUE_SYS_ID + "='" + sysId + "'", null);
if (c.moveToFirst()) {
Catalogue.CatalogueBuilder builder = Catalogue.CatalogueBuilder.aCatalogue();
fillAllCatalogueDetails(c, builder);
catalogue = builder.build();
}
c.close();
}
return catalogue;
}
private static void fillAllCatalogueDetails(Cursor c, Catalogue.CatalogueBuilder builder) {
builder.setId(c.getLong(INDEX_CATALOGUE_ID));
builder.setSysId(c.getString(INDEX_CATALOGUE_SYS_ID));
builder.setTitle(c.getString(INDEX_CATALOGUE_TITLE));
builder.setDescription(c.getString(INDEX_CATALOGUE_DESCRIPTION));
builder.setIcon(c.getString(INDEX_CATALOGUE_ICON));
builder.setSyncDirty(c.getInt(INDEX_CATALOGUE_SYNC_DIRTY));
}
private static ContentValues getContentValues(Catalogue catalogue) {
ContentValues cv = new ContentValues(CATALOGUE_COLUMN_COUNT - 1);
cv.put(CATALOGUE_SYS_ID, catalogue.getSysId());
cv.put(CATALOGUE_TITLE, catalogue.getTitle());
cv.put(CATALOGUE_DESCRIPTION, catalogue.getDescription());
cv.put(CATALOGUE_ICON, catalogue.getIcon());
cv.put(CATALOGUE_SYNC_DIRTY, catalogue.getSyncDirty());
return cv;
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import com.google.gson.annotations.SerializedName;
*/
public class Catalogue {
private long id = -1;
@SerializedName("title")
@Expose
private String title;
......@@ -20,6 +21,15 @@ public class Catalogue {
@SerializedName("homepage_image")
@Expose
private String icon;
private int syncDirty;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
/**
*
......@@ -93,6 +103,75 @@ public class Catalogue {
this.icon = icon;
}
public int getSyncDirty() {
return syncDirty;
}
public void setSyncDirty(int syncDirty) {
this.syncDirty = syncDirty;
}
public static final class CatalogueBuilder {
private long id = -1;
private String title;
private String description;
private String sysId;
private String icon;
private int syncDirty;
private CatalogueBuilder() {
}
public static CatalogueBuilder aCatalogue() {
return new CatalogueBuilder();
}
public CatalogueBuilder setId(long id) {
this.id = id;
return this;
}
public CatalogueBuilder setTitle(String title) {
this.title = title;
return this;
}
public CatalogueBuilder setDescription(String description) {
this.description = description;
return this;
}
public CatalogueBuilder setSysId(String sysId) {
this.sysId = sysId;
return this;
}
public CatalogueBuilder setIcon(String icon) {
this.icon = icon;
return this;
}
public CatalogueBuilder setSyncDirty(int syncDirty) {
this.syncDirty = syncDirty;
return this;
}
public CatalogueBuilder but() {
return aCatalogue().setId(id).setTitle(title).setDescription(description).setSysId(sysId).setIcon(icon).setSyncDirty(syncDirty);
}
public Catalogue build() {
Catalogue catalogue = new Catalogue();
catalogue.setId(id);
catalogue.setTitle(title);
catalogue.setDescription(description);
catalogue.setSysId(sysId);
catalogue.setIcon(icon);
catalogue.setSyncDirty(syncDirty);
return catalogue;
}
}
public static class Json {
public static final String URL_PARAM_CATALOGUE_SYSPRM_QUERY_VALUE = "sc_catalog";
}
......@@ -100,10 +179,12 @@ public class Catalogue {
@Override
public String toString() {
return "Catalogue{" +
"title='" + title + '\'' +
"id=" + id +
", title='" + title + '\'' +
", description='" + description + '\'' +
", sysId='" + sysId + '\'' +
", icon='" + icon + '\'' +
", syncDirty=" + syncDirty +
'}';
}
}
package com.vsoft.uoflservicenow.db.models.managers;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.vsoft.uoflservicenow.CatalogueApplication;
import com.vsoft.uoflservicenow.db.models.Catalogue;
import com.vsoft.uoflservicenow.utils.DBConstants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
*
* @author Kunj on 11-08-2016.
*/
public class CatalogueManager implements DBConstants {
public static long save(Catalogue catalogue, int syncDirty) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
catalogue.setSyncDirty(syncDirty);
long id = db.insert(TABLE_CATALOGUE, null, getContentValues(catalogue));
catalogue.setId(id);
return id;
} else {
return -1;
}
}
public static int delete(Catalogue catalogue) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
if (catalogue.getSysId() == null || catalogue.getSysId().isEmpty()) {
return db.delete(TABLE_CATALOGUE, CATALOGUE_ID + "=" + catalogue.getId(), null);
} else {
return update(catalogue, SYNC_FLAG_DELETE);
}
}
return -1;
}
public static int update(Catalogue catalogue, int syncDirty) {
return update(catalogue, null, syncDirty);
}
public static int update(Catalogue catalogue, List<String> column, int syncDirty) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
catalogue.setSyncDirty(syncDirty);
if (column == null || column.size() == 0) {
return db.update(TABLE_CATALOGUE, getContentValues(catalogue), CATALOGUE_ID + "=" + catalogue.getId(), null);
} else {
ContentValues contentValues = new ContentValues(column.size());
contentValues.put(CATALOGUE_SYNC_DIRTY, catalogue.getSyncDirty());
for (int i = 0; i < column.size(); i++) {
String columnName = column.get(i);
if (CATALOGUE_TITLE.equals(columnName)) {
contentValues.put(CATALOGUE_TITLE, catalogue.getTitle());
} else if (CATALOGUE_DESCRIPTION.equals(columnName)) {
contentValues.put(CATALOGUE_DESCRIPTION, catalogue.getDescription());
} else if (CATALOGUE_SYS_ID.equals(columnName)) {
contentValues.put(CATALOGUE_SYS_ID, catalogue.getSysId());
}
}
return db.update(TABLE_CATALOGUE, contentValues, CATALOGUE_ID + "=" + catalogue.getId(), null);
}
} else {
return -1;
}
}
public static void handleGetCatalogue(List<Catalogue> serverCatalogueList) {
if(serverCatalogueList != null && !serverCatalogueList.isEmpty()) {
/*catalogueSysIdMap contain all server response catalogues Sys Id*/
HashMap<String, Integer> catalogueSysIdMap = new HashMap<>(0);
Integer intObj = Integer.valueOf(1);
for (int i = 0; i < serverCatalogueList.size(); i++) {
String sysId = serverCatalogueList.get(i).getSysId();
catalogueSysIdMap.put(sysId, intObj);
}
/*localCatalogueList is contain all local Catalogues */
List<Catalogue> localCatalogueList = getAllCatalogues();
if (localCatalogueList != null && !localCatalogueList.isEmpty()) {
for (int i = 0; i < localCatalogueList.size(); i++) {
Catalogue localCatalogue = localCatalogueList.get(i);
String localCatalogueSysId = localCatalogue.getSysId();
if (localCatalogueSysId != null
&& !localCatalogueSysId.isEmpty()
&& !catalogueSysIdMap.containsKey(localCatalogueSysId)) {
//Update sys_id with empty string because required to delete locally
localCatalogue.setSysId("");
delete(localCatalogue);
}
}
}
/*Check this catalogue is exist in local DB or not
* If doesn't exist in local, save it
* If exist in local, update the local item with data from server item.
* */
for (int i = 0; i < serverCatalogueList.size(); i++) {
Catalogue catalogue = serverCatalogueList.get(i);
Catalogue localCatalogue = getCatalogueFromSysId(catalogue.getSysId());
if (localCatalogue == null) {
save(catalogue, DBConstants.SYNC_FLAG_NONE);
} else {
/*Update complete local Catalogue object with response Catalogue object*/
catalogue.setId(localCatalogue.getId());
update(catalogue, DBConstants.SYNC_FLAG_NONE);
}
}
} else {
/*That means there is no Catalogue category in server response, then all local items should be deleted those are contain sys_id*/
/*localCatalogueList is contain all local Catalogues */
List<Catalogue> localCatalogueList = getAllCatalogues();
if (localCatalogueList != null && !localCatalogueList.isEmpty()) {
for (int i = 0; i < localCatalogueList.size(); i++) {
Catalogue localCatalogue = localCatalogueList.get(i);
String localCatalogueSysId = localCatalogue.getSysId();
if (localCatalogueSysId != null
&& !localCatalogueSysId.isEmpty()) {
//Update sys_id with empty string because required to delete locally
localCatalogue.setSysId("");
delete(localCatalogue);
}
}
}
}
}
public static List<Catalogue> getAllCatalogues() {
SQLiteDatabase db = CatalogueApplication.getDatabase();
if (db != null) {
Cursor c = db.rawQuery("select * from " + TABLE_CATALOGUE
+ " where " + CATALOGUE_SYNC_DIRTY
+ "!=" + DBConstants.SYNC_FLAG_DELETE, null);
ArrayList<Catalogue> catalogueList;
if (c.getCount() > 0) {
catalogueList = new ArrayList<>(c.getCount());
while (c.moveToNext()) {
Catalogue.CatalogueBuilder builder = Catalogue.CatalogueBuilder.aCatalogue();
fillAllCatalogueDetails(c, builder);
catalogueList.add(builder.build());
}
} else {
catalogueList = new ArrayList<>(0);
}
c.close();
return catalogueList;
} else {
return new ArrayList<>(0);
}
}
public static Catalogue get(long catalogueId) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
Catalogue catalogue = null;
if (db != null) {
Cursor c = db.rawQuery("select * from " + TABLE_CATALOGUE + " where " + CATALOGUE_ID + "=" + catalogueId, null);
if (c.moveToFirst()) {
Catalogue.CatalogueBuilder builder = Catalogue.CatalogueBuilder.aCatalogue();
fillAllCatalogueDetails(c, builder);
catalogue = builder.build();
}
c.close();
}
return catalogue;
}
public static Catalogue getCatalogueFromSysId(String sysId) {
SQLiteDatabase db = CatalogueApplication.getDatabase();
Catalogue catalogue = null;
if(db!=null) {
Cursor c = db.rawQuery("select * from " + TABLE_CATALOGUE + " where " + CATALOGUE_SYS_ID + "='" + sysId + "'", null);
if (c.moveToFirst()) {
Catalogue.CatalogueBuilder builder = Catalogue.CatalogueBuilder.aCatalogue();
fillAllCatalogueDetails(c, builder);
catalogue = builder.build();
}
c.close();
}
return catalogue;
}
private static void fillAllCatalogueDetails(Cursor c, Catalogue.CatalogueBuilder builder) {
builder.setId(c.getLong(INDEX_CATALOGUE_ID));
builder.setTitle(c.getString(INDEX_CATALOGUE_TITLE));
builder.setDescription(c.getString(INDEX_CATALOGUE_DESCRIPTION));
builder.setSysId(c.getString(INDEX_CATALOGUE_SYS_ID));
builder.setSyncDirty(c.getInt(INDEX_CATALOGUE_SYNC_DIRTY));
}
private static ContentValues getContentValues(Catalogue catalogue) {
ContentValues cv = new ContentValues(CATALOGUE_COLUMN_COUNT - 1);
cv.put(CATALOGUE_TITLE, catalogue.getTitle());
cv.put(CATALOGUE_DESCRIPTION, catalogue.getDescription());
cv.put(CATALOGUE_SYS_ID, catalogue.getSysId());
cv.put(CATALOGUE_SYNC_DIRTY, catalogue.getSyncDirty());
return cv;
}
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ import com.vsoft.uoflservicenow.R;
import com.vsoft.uoflservicenow.adapters.CatalogueCategoryAdapter;
import com.vsoft.uoflservicenow.api.listeners.get.GetCatalogueApiListener;
import com.vsoft.uoflservicenow.api.managers.CatalogueApiManager;
import com.vsoft.uoflservicenow.db.managers.CatalogueManager;
import com.vsoft.uoflservicenow.db.models.Catalogue;
import com.vsoft.uoflservicenow.enums.SyncStatus;
import com.vsoft.uoflservicenow.utils.CatalogueLog;
......@@ -40,8 +41,6 @@ public class CatalogueScreen extends AppCompatActivity {
@BindView(R.id.tool_bar_view) Toolbar mToolbar;
@BindView(R.id.catalogue_screen_list_view) ListView mListView;
private List<Catalogue> mCatalogueList;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
......@@ -66,11 +65,16 @@ public class CatalogueScreen extends AppCompatActivity {
// Send initial screen view hit.
Util.sendScreenName(tracker, actionBar.getTitle().toString());
List<Catalogue> catalogueList = CatalogueManager.getAllCatalogues();
if(catalogueList.isEmpty()) {
if(application.isNetConnected()) {
new FetchCatalogue().execute();
} else {
DialogUtils.showNoConnectionDialogWithCloseActivity(CatalogueScreen.this);
}
} else {
setData(catalogueList);
}
}
class FetchCatalogue extends AsyncTask<String, Void, SyncStatus> {
......@@ -91,7 +95,7 @@ public class CatalogueScreen extends AppCompatActivity {
@Override
public void onDoneApiCall(List<Catalogue> catalogueList) {
CatalogueLog.e("Data: catalogueList: "+catalogueList);
mCatalogueList = catalogueList;
CatalogueManager.handleGetCatalogue(catalogueList);
}
});
}
......@@ -103,8 +107,7 @@ public class CatalogueScreen extends AppCompatActivity {
progressDialog.dismiss();
}
if(syncStatus == SyncStatus.SUCCESS) {
if(mCatalogueList!=null)
setData(mCatalogueList);
setData(CatalogueManager.getAllCatalogues());
} else {
showErrorDialog(R.string.failed_to_fetch_catalogue_category_string);
}
......
......@@ -16,6 +16,12 @@ public class Constants {
public static final String[] month = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
/**
* Preference
*/
public static final String PREFS_OLD_VERSION_NUMBER = "oldVersionNumber";
public static final String PREFS_NEW_VERSION_NUMBER = "newVersionNumber";
/**
* Intent String
*/
public static final String DATA_DATE_AND_TIME_PICKER_TITLE = "title";
......
package com.vsoft.uoflservicenow.utils;
public interface DBConstants {
//Tables
String TABLE_CATALOGUE = "catalogue_category";
String ID = "_id";
String SYS_ID = "sys_id";
String SYNC_DIRTY = "sync_dirty";
int SYNC_FLAG_NONE = 0;
int SYNC_FLAG_CREATE = 1;
int SYNC_FLAG_UPDATE = 2;
int SYNC_FLAG_DELETE = 3;
/**
* Catalogue table
*/
String CATALOGUE_ID = ID;
String CATALOGUE_SYS_ID = SYS_ID;
String CATALOGUE_TITLE = "title";
String CATALOGUE_DESCRIPTION = "description";
String CATALOGUE_ICON= "icon";
String CATALOGUE_SYNC_DIRTY = SYNC_DIRTY;
/*
* Indices for Catalogue table. *Use these only if you fetch all columns*
*/
int INDEX_CATALOGUE_ID = 0;
int INDEX_CATALOGUE_SYS_ID = 1;
int INDEX_CATALOGUE_TITLE = 2;
int INDEX_CATALOGUE_DESCRIPTION = 3;
int INDEX_CATALOGUE_ICON = 4;
int INDEX_CATALOGUE_SYNC_DIRTY = 5;
int CATALOGUE_COLUMN_COUNT = 6;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment