Package com.swrve.sdk.localstorage
Class SQLiteLocalStorage
- java.lang.Object
-
- com.swrve.sdk.localstorage.SQLiteLocalStorage
-
- All Implemented Interfaces:
LocalStorage
public class SQLiteLocalStorage extends java.lang.Object implements LocalStorage
Used internally to provide a persistent storage of data on the device.
-
-
Field Summary
Fields Modifier and Type Field Description protected android.database.sqlite.SQLiteDatabase
database
-
Fields inherited from interface com.swrve.sdk.localstorage.LocalStorage
SIGNATURE_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description SQLiteLocalStorage(android.content.Context context, java.lang.String dbName, long maxDbSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
addEvent(java.lang.String userId, java.lang.String eventJSON)
void
deleteNotificationsAuthenticated()
void
deleteUser(java.lang.String swrveUserId)
int
getAssetDownloadCount(java.lang.String assetName)
com.swrve.sdk.localstorage.SwrveCacheItem
getCacheItem(java.lang.String userId, java.lang.String category)
java.util.LinkedHashMap<java.lang.Long,java.lang.String>
getFirstNEvents(java.lang.Integer n, java.lang.String userId)
java.util.List<java.lang.Integer>
getNotificationsAuthenticated()
java.lang.String
getOfflineCampaign(java.lang.String userId, java.lang.String campaignId)
java.lang.String
getSecureCacheEntryForUser(java.lang.String userId, java.lang.String category, java.lang.String uniqueKey)
com.swrve.sdk.SwrveUser
getUserByExternalUserId(java.lang.String externalUserId)
com.swrve.sdk.SwrveUser
getUserBySwrveUserId(java.lang.String swrveUserId)
void
incrementAssetDownloadCount(java.lang.String assetName, long time)
void
removeEvents(java.lang.String userId, java.util.Collection<java.lang.Long> ids)
void
saveMultipleCacheItems(java.util.Map<java.lang.String,com.swrve.sdk.localstorage.SwrveCacheItem> cacheItemMap)
void
saveMultipleEventItems(java.util.List<com.swrve.sdk.localstorage.SwrveEventItem> eventList)
void
saveNotificationAuthenticated(int notificationId, long time)
void
saveOfflineCampaign(java.lang.String userId, java.lang.String campaignId, java.lang.String campaignData)
void
saveUser(com.swrve.sdk.SwrveUser swrveUser)
void
setCacheEntry(java.lang.String userId, java.lang.String category, java.lang.String rawData)
void
setSecureCacheEntryForUser(java.lang.String userId, java.lang.String category, java.lang.String rawData, java.lang.String signature)
void
truncateAssetLogs(int rows)
void
truncateNotificationsAuthenticated(int rows)
-
-
-
Method Detail
-
addEvent
public long addEvent(java.lang.String userId, java.lang.String eventJSON) throws android.database.SQLException
- Specified by:
addEvent
in interfaceLocalStorage
- Throws:
android.database.SQLException
-
removeEvents
public void removeEvents(java.lang.String userId, java.util.Collection<java.lang.Long> ids)
- Specified by:
removeEvents
in interfaceLocalStorage
-
getFirstNEvents
public java.util.LinkedHashMap<java.lang.Long,java.lang.String> getFirstNEvents(java.lang.Integer n, java.lang.String userId)
- Specified by:
getFirstNEvents
in interfaceLocalStorage
-
setCacheEntry
public void setCacheEntry(java.lang.String userId, java.lang.String category, java.lang.String rawData)
- Specified by:
setCacheEntry
in interfaceLocalStorage
-
setSecureCacheEntryForUser
public void setSecureCacheEntryForUser(java.lang.String userId, java.lang.String category, java.lang.String rawData, java.lang.String signature)
- Specified by:
setSecureCacheEntryForUser
in interfaceLocalStorage
-
getCacheItem
public com.swrve.sdk.localstorage.SwrveCacheItem getCacheItem(java.lang.String userId, java.lang.String category)
- Specified by:
getCacheItem
in interfaceLocalStorage
-
getSecureCacheEntryForUser
public java.lang.String getSecureCacheEntryForUser(java.lang.String userId, java.lang.String category, java.lang.String uniqueKey) throws java.lang.SecurityException
- Specified by:
getSecureCacheEntryForUser
in interfaceLocalStorage
- Throws:
java.lang.SecurityException
-
saveMultipleEventItems
public void saveMultipleEventItems(java.util.List<com.swrve.sdk.localstorage.SwrveEventItem> eventList) throws android.database.SQLException
- Throws:
android.database.SQLException
-
saveMultipleCacheItems
public void saveMultipleCacheItems(java.util.Map<java.lang.String,com.swrve.sdk.localstorage.SwrveCacheItem> cacheItemMap) throws android.database.SQLException
- Throws:
android.database.SQLException
-
saveUser
public void saveUser(com.swrve.sdk.SwrveUser swrveUser) throws android.database.SQLException
- Specified by:
saveUser
in interfaceLocalStorage
- Throws:
android.database.SQLException
-
getUserByExternalUserId
public com.swrve.sdk.SwrveUser getUserByExternalUserId(java.lang.String externalUserId) throws android.database.SQLException
- Specified by:
getUserByExternalUserId
in interfaceLocalStorage
- Throws:
android.database.SQLException
-
getUserBySwrveUserId
public com.swrve.sdk.SwrveUser getUserBySwrveUserId(java.lang.String swrveUserId) throws android.database.SQLException
- Specified by:
getUserBySwrveUserId
in interfaceLocalStorage
- Throws:
android.database.SQLException
-
deleteUser
public void deleteUser(java.lang.String swrveUserId)
- Specified by:
deleteUser
in interfaceLocalStorage
-
truncateNotificationsAuthenticated
public void truncateNotificationsAuthenticated(int rows)
- Specified by:
truncateNotificationsAuthenticated
in interfaceLocalStorage
-
saveNotificationAuthenticated
public void saveNotificationAuthenticated(int notificationId, long time)
- Specified by:
saveNotificationAuthenticated
in interfaceLocalStorage
-
deleteNotificationsAuthenticated
public void deleteNotificationsAuthenticated()
- Specified by:
deleteNotificationsAuthenticated
in interfaceLocalStorage
-
getNotificationsAuthenticated
public java.util.List<java.lang.Integer> getNotificationsAuthenticated()
- Specified by:
getNotificationsAuthenticated
in interfaceLocalStorage
-
saveOfflineCampaign
public void saveOfflineCampaign(java.lang.String userId, java.lang.String campaignId, java.lang.String campaignData)
- Specified by:
saveOfflineCampaign
in interfaceLocalStorage
-
getOfflineCampaign
public java.lang.String getOfflineCampaign(java.lang.String userId, java.lang.String campaignId)
- Specified by:
getOfflineCampaign
in interfaceLocalStorage
-
getAssetDownloadCount
public int getAssetDownloadCount(java.lang.String assetName)
- Specified by:
getAssetDownloadCount
in interfaceLocalStorage
-
incrementAssetDownloadCount
public void incrementAssetDownloadCount(java.lang.String assetName, long time)
- Specified by:
incrementAssetDownloadCount
in interfaceLocalStorage
-
truncateAssetLogs
public void truncateAssetLogs(int rows)
- Specified by:
truncateAssetLogs
in interfaceLocalStorage
-
-