当前位置: 首页>>代码示例>>Java>>正文


Java DataAccess类代码示例

本文整理汇总了Java中net.canarymod.database.DataAccess的典型用法代码示例。如果您正苦于以下问题:Java DataAccess类的具体用法?Java DataAccess怎么用?Java DataAccess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataAccess类属于net.canarymod.database包,在下文中一共展示了DataAccess类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateParentNameReferences

import net.canarymod.database.DataAccess; //导入依赖的package包/类
private void updateParentNameReferences(final String oldName, final String newName)
        throws DatabaseReadException, DatabaseWriteException {
    ZownDao zownDao = new ZownDao();
    final Map<String, Object> filters = new HashMap<String, Object>();
    filters.put(WORLD_NAME, worldName);
    filters.put(PARENT_ZOWN_NAME, oldName);
    final List<DataAccess> datasets = new ArrayList<DataAccess>();
    database.loadAll(zownDao, datasets, filters);

    for (final DataAccess da : datasets) {
        zownDao = (ZownDao) da;
        zownDao.parentZownName = newName;
        if (!zownDao.save()) {
            ZownPlugin.LOG.error("Error saving parent name update to zown " + zownDao.id);
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:18,代码来源:ZownDao.java

示例2: loadTemplates

import net.canarymod.database.DataAccess; //导入依赖的package包/类
public void loadTemplates(final TemplateManager templateManager) throws DatabaseReadException {
    TemplateDao templateDao = new TemplateDao();
    final List<DataAccess> datasets = new ArrayList<DataAccess>();
    final Map<String, Object> filters = new HashMap<String, Object>();
    database.loadAll(templateDao, datasets, filters);

    for (final DataAccess dataset : datasets) {
        templateDao = (TemplateDao) dataset;

        final Template template = templateManager.addTemplate(templateDao.templateName);
        if (template == null) {
            // Attempted to create duplicate template
            ZownPlugin.LOG.warn("Tried to load a duplicate template: " + templateDao.templateName);
        } else {
            loadConfiguration(template, templateDao);
            ZownPlugin.LOG.debug("Loaded template " + templateDao.templateName);
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:20,代码来源:DataManager.java

示例3: updateTemplateNameReferences

import net.canarymod.database.DataAccess; //导入依赖的package包/类
private void updateTemplateNameReferences(final String oldName, final String newName)
        throws DatabaseReadException, DatabaseWriteException {
    ZownDao zownDao = new ZownDao();
    final Map<String, Object> filters = new HashMap<String, Object>();
    filters.put(ZownDao.TEMPLATE_NAME, oldName);
    final List<DataAccess> datasets = new ArrayList<DataAccess>();
    database.loadAll(zownDao, datasets, filters);

    for (final DataAccess da : datasets) {
        zownDao = (ZownDao) da;
        zownDao.templateName = newName;
        if (!zownDao.save()) {
            ZownPlugin.LOG.error("Error saving template name update to zown " + zownDao.id);
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:17,代码来源:TemplateDao.java

示例4: removeTemplateReferences

import net.canarymod.database.DataAccess; //导入依赖的package包/类
private void removeTemplateReferences(final String template) throws DatabaseReadException,
        DatabaseWriteException {
    ZownDao zownDao = new ZownDao();
    final Map<String, Object> filters = new HashMap<String, Object>();
    filters.put(ZownDao.TEMPLATE_NAME, template);
    final List<DataAccess> datasets = new ArrayList<DataAccess>();
    database.loadAll(zownDao, datasets, filters);

    for (final DataAccess da : datasets) {
        zownDao = (ZownDao) da;
        zownDao.templateName = null;
        copyConfiguration(zownDao);
        if (!zownDao.save()) {
            ZownPlugin.LOG.error("Error saving template removal to zown " + zownDao.id);
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:18,代码来源:TemplateDao.java

示例5: removeChildZowns

import net.canarymod.database.DataAccess; //导入依赖的package包/类
private void removeChildZowns(final String parent) throws DatabaseReadException,
        DatabaseWriteException {
    ZownDao zownDao = new ZownDao();
    final Map<String, Object> filters = new HashMap<String, Object>();
    filters.put(WORLD_NAME, worldName);
    filters.put(PARENT_ZOWN_NAME, parent);
    final List<DataAccess> datasets = new ArrayList<DataAccess>();
    database.loadAll(zownDao, datasets, filters);

    for (final DataAccess da : datasets) {
        zownDao = (ZownDao) da;
        zownDao.delete();
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:15,代码来源:ZownDao.java

示例6: getInstance

import net.canarymod.database.DataAccess; //导入依赖的package包/类
@Override
public DataAccess getInstance() {
    return new ZownDao();
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:5,代码来源:ZownDao.java

示例7: loadZowns

import net.canarymod.database.DataAccess; //导入依赖的package包/类
private void loadZowns(final World world, final ITemplateManager templateManager,
                       final ZownManager zownManager, final ZownDao zownDao) throws DatabaseReadException {
    if (zownDao != null && zownDao.hasData()) {
        // Load the referenced template
        ITemplate template = null;
        if (zownDao.templateName != null && !zownDao.templateName.equals("null")) {
            template = templateManager.getTemplate(zownDao.templateName);
            if (template == null) {
                ZownPlugin.LOG.warn("The specified template " + zownDao.templateName + " doesn't exist");
            }
        }

        // Parse bounds
        Point p1 = null;
        if (zownDao.minPointString != null) {
            p1 = Point.parse(zownDao.minPointString);
        }
        Point p2 = null;
        if (zownDao.maxPointString != null) {
            p2 = Point.parse(zownDao.maxPointString);
        }

        // Add the zown to the manager
        final Tree<Zown> zownTree = zownManager.addZown(world, zownDao.parentZownName,
                zownDao.zownName, template, p1, p2);
        if (zownTree == null) {
            // Attempted to create duplicate zown
            ZownPlugin.LOG.warn("Tried to load a bad zown: " + zownDao.zownName);
        } else {
            final Zown zown = zownTree.getData();

            if (template != null) {
                if (zownDao.templateOverride != null && zownDao.templateOverride) {
                    zown.setTemplate((Template) template, true);
                    loadConfiguration(zown, zownDao);
                } else {
                    zown.setTemplate((Template) template, false);
                }
            } else {
                loadConfiguration(zown, zownDao);
            }

            if (zownDao.ownerList != null) {
                zown.getOwnerUUIDs().addAll(zownDao.ownerList);
            }
            if (zownDao.memberList != null) {
                zown.getMemberUUIDs().addAll(zownDao.memberList);
            }
            if (zownDao.entryExclusions != null) {
                zown.getEntryExclusionUUIDs().addAll(zownDao.entryExclusions);
            }

            zown.setWelcomeMessage(zownDao.welcomeMessage);
            zown.setFarewellMessage(zownDao.farewellMessage);

            ZownPlugin.LOG.debug("Loaded zown " + zownDao.zownName);

            // Load child zowns recursively
            final ZownDao childZownDao = new ZownDao();
            final List<DataAccess> datasets = new ArrayList<DataAccess>();
            final Map<String, Object> filters = new HashMap<String, Object>();
            filters.put(ZownDao.WORLD_NAME, zownDao.worldName);
            filters.put(ZownDao.PARENT_ZOWN_NAME, zownDao.zownName);
            database.loadAll(childZownDao, datasets, filters);
            for (final DataAccess da : datasets) {
                loadZowns(world, templateManager, zownManager, (ZownDao) da);
            }
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:71,代码来源:DataManager.java

示例8: getInstance

import net.canarymod.database.DataAccess; //导入依赖的package包/类
@Override
public DataAccess getInstance() {
    return new TemplateDao();
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:5,代码来源:TemplateDao.java

示例9: getInstance

import net.canarymod.database.DataAccess; //导入依赖的package包/类
@Override
public DataAccess getInstance() {
    return new LatchDataAccess();
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:5,代码来源:LatchDataAccess.java


注:本文中的net.canarymod.database.DataAccess类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。