本文整理汇总了Java中com.hannesdorfmann.sqlbrite.dao.Dao类的典型用法代码示例。如果您正苦于以下问题:Java Dao类的具体用法?Java Dao怎么用?Java Dao使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dao类属于com.hannesdorfmann.sqlbrite.dao包,在下文中一共展示了Dao类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadInstalledFileIndex
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static HashMap<String, ExpansionIndexItem> loadInstalledFileIndex(Context context, Dao dao) {
ArrayList<ExpansionIndexItem> indexList = loadIndex(context, installedIndexName, dao);
HashMap<String, ExpansionIndexItem> indexMap = new HashMap<String, ExpansionIndexItem>();
for (ExpansionIndexItem item : indexList) {
// construct names (index by main and patch file names)
String mainName = buildFileName(item, Constants.MAIN);
indexMap.put(mainName, item);
String patchName = buildFileName(item, Constants.MAIN);
indexMap.put(patchName, item);
}
return indexMap;
}
示例2: loadAvailableFileIndex
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static HashMap<String, ExpansionIndexItem> loadAvailableFileIndex(Context context, Dao dao) {
ArrayList<ExpansionIndexItem> indexList = loadIndex(context, getAvailableVersionName(), dao);
HashMap<String, ExpansionIndexItem> indexMap = new HashMap<String, ExpansionIndexItem>();
for (ExpansionIndexItem item : indexList) {
// construct name (index by main file names)
String fileName = buildFileName(item, Constants.MAIN);
indexMap.put(fileName, item);
}
return indexMap;
}
示例3: loadAvailableIdIndex
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static HashMap<String, ExpansionIndexItem> loadAvailableIdIndex(Context context, Dao dao) {
ArrayList<ExpansionIndexItem> indexList = loadIndex(context, getAvailableVersionName(), dao);
HashMap<String, ExpansionIndexItem> indexMap = new HashMap<String, ExpansionIndexItem>();
for (ExpansionIndexItem item : indexList) {
indexMap.put(item.getExpansionId(), item);
}
return indexMap;
}
示例4: loadInstalledIdIndex
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static HashMap<String, ExpansionIndexItem> loadInstalledIdIndex(Context context, Dao dao) {
ArrayList<ExpansionIndexItem> indexList = loadIndex(context, installedIndexName, dao);
HashMap<String, ExpansionIndexItem> indexMap = new HashMap<String, ExpansionIndexItem>();
for (ExpansionIndexItem item : indexList) {
indexMap.put(item.getExpansionId(), item);
}
return indexMap;
}
示例5: loadInstanceIndexAsList
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static ArrayList<InstanceIndexItem> loadInstanceIndexAsList(Context context, Dao dao) {
// REPLACING FILE ACCESS WITH DB ACCESS
if (dao instanceof InstanceIndexItemDao) {
InstanceIndexItemDao instanceDao = (InstanceIndexItemDao) dao;
instanceDao.getInstanceIndexItems().subscribe(new Action1<List<InstanceIndexItem>>() {
@Override
public void call(List<InstanceIndexItem> instanceIndexItems) {
cachedInstances = new ArrayList<InstanceIndexItem>();
for (InstanceIndexItem item : instanceIndexItems) {
cachedInstances.add(item);
}
}
});
} else {
//error
}
// code downstream is not expecting a null
if (cachedInstances.size() > 0) {
return cachedInstances;
} else {
return new ArrayList<InstanceIndexItem>();
}
}
示例6: installedIndexAdd
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static void installedIndexAdd(Context context, InstalledIndexItem indexItem, Dao dao) {
HashMap<String, ExpansionIndexItem> indexMap = loadInstalledIdIndex(context, dao);
indexMap.put(indexItem.getExpansionId(), indexItem);
ArrayList<ExpansionIndexItem> indexList = new ArrayList<ExpansionIndexItem>();
for (ExpansionIndexItem eii : indexMap.values()) {
indexList.add(eii);
}
saveIndex(context, indexList, installedIndexName, dao);
return;
}
示例7: installedIndexRemove
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static void installedIndexRemove(Context context, InstalledIndexItem indexItem, Dao dao) {
HashMap<String, ExpansionIndexItem> indexMap = loadInstalledIdIndex(context, dao);
if (indexMap.keySet().contains(indexItem.getExpansionId())) {
indexMap.remove(indexItem.getExpansionId());
ArrayList<ExpansionIndexItem> indexList = new ArrayList<ExpansionIndexItem>();
for (ExpansionIndexItem eii : indexMap.values()) {
indexList.add(eii);
}
// need to actually delete item from db (saving updated list will not remove it)
if (dao instanceof InstalledIndexItemDao) {
InstalledIndexItemDao installedDao = (InstalledIndexItemDao) dao;
installedDao.removeInstalledIndexItem(indexItem);
Timber.d("UN-INSTALLED " + indexItem.getExpansionId() + " FROM INDEX");
} else {
Timber.e("FAILED TO UN-INSTALL " + indexItem.getExpansionId() + " (DAO CASTING ISSUE)");
}
saveIndex(context, indexList, installedIndexName, dao);
return;
}
}
示例8: instanceIndexRemoveFromDB
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static void instanceIndexRemoveFromDB(Context context, InstanceIndexItem removeItem, Dao dao) {
// need to actually delete item from db (saving updated list will not remove it)
if (dao instanceof InstanceIndexItemDao) {
InstanceIndexItemDao instanceDao = (InstanceIndexItemDao) dao;
instanceDao.removeInstanceIndexItem(removeItem);
Timber.d("UN-INSTALLED INSTANCE " + removeItem.getInstanceFilePath() + " FROM INDEX");
}
}
示例9: saveInstanceIndex
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static void saveInstanceIndex(Context context, ArrayList<InstanceIndexItem> indexList, String jsonFileName, Dao dao) {
// REPLACING FILE ACCESS WITH DB ACCESS
if (dao instanceof InstanceIndexItemDao) {
InstanceIndexItemDao instanceDao = (InstanceIndexItemDao) dao;
for (InstanceIndexItem item : indexList) {
instanceDao.addInstanceIndexItem(item, true);
}
} else {
//error
}
}
示例10: loadAvailableIdIndexKeyMap
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static IndexKeyMap loadAvailableIdIndexKeyMap(Context context, Dao dao) {
final IndexKeyMap indexKeyMap = new IndexKeyMap();
ArrayList<ExpansionIndexItem> indexList = loadIndex(context, getAvailableVersionName(), dao);
HashMap<String, ExpansionIndexItem> indexMap = new HashMap<String, ExpansionIndexItem>();
ArrayList<String> indexKeys = new ArrayList<String>();
for (ExpansionIndexItem item : indexList) {
indexMap.put(item.getExpansionId(), item);
indexKeys.add(item.getExpansionId());
}
indexKeyMap.indexKeys = indexKeys;
indexKeyMap.indexMap = indexMap;
return indexKeyMap;
}
示例11: loadInstalledIdIndexKeyMap
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static IndexKeyMap loadInstalledIdIndexKeyMap(Context context, Dao dao) {
final IndexKeyMap indexKeyMap = new IndexKeyMap();
ArrayList<ExpansionIndexItem> indexList = loadIndex(context, installedIndexName, dao);
HashMap<String, ExpansionIndexItem> indexMap = new HashMap<String, ExpansionIndexItem>();
ArrayList<String> indexKeys = new ArrayList<String>();
for (ExpansionIndexItem item : indexList) {
indexMap.put(item.getExpansionId(), item);
indexKeys.add(item.getExpansionId());
}
indexKeyMap.indexKeys = indexKeys;
indexKeyMap.indexMap = indexMap;
return indexKeyMap;
}
示例12: loadAvailableOrderIndex
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static HashMap<String, ExpansionIndexItem> loadAvailableOrderIndex(Context context, Dao dao) {
ArrayList<ExpansionIndexItem> indexList = loadIndex(context, getAvailableVersionName(), dao);
HashMap<String, ExpansionIndexItem> indexMap = new HashMap<String, ExpansionIndexItem>();
for (ExpansionIndexItem item : indexList) {
indexMap.put(item.getPatchOrder(), item);
}
return indexMap;
}
示例13: loadInstalledOrderIndex
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static HashMap<String, ExpansionIndexItem> loadInstalledOrderIndex(Context context, Dao dao) {
ArrayList<ExpansionIndexItem> indexList = loadIndex(context, installedIndexName, dao);
HashMap<String, ExpansionIndexItem> indexMap = new HashMap<String, ExpansionIndexItem>();
for (ExpansionIndexItem item : indexList) {
indexMap.put(item.getPatchOrder(), item);
}
return indexMap;
}
示例14: instanceIndexAdd
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static void instanceIndexAdd(Context context, InstanceIndexItem addItem, HashMap<String, InstanceIndexItem> indexList, Dao dao) {
indexList.put(addItem.getInstanceFilePath(), addItem);
ArrayList<InstanceIndexItem> indexArray = new ArrayList<InstanceIndexItem>(indexList.values());
saveInstanceIndex(context, indexArray, instanceIndexName, dao);
}
示例15: instanceIndexRemove
import com.hannesdorfmann.sqlbrite.dao.Dao; //导入依赖的package包/类
public static void instanceIndexRemove(Context context, InstanceIndexItem removeItem, HashMap<String, InstanceIndexItem> indexList, boolean deleteFiles, boolean deleteMedia, Dao dao) {
indexList.remove(removeItem.getInstanceFilePath());
ArrayList<InstanceIndexItem> indexArray = new ArrayList<InstanceIndexItem>(indexList.values());
saveInstanceIndex(context, indexArray, instanceIndexName, dao);
if (deleteFiles) {
removeItem.deleteAssociatedFiles(context, deleteMedia);
}
}