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


Java DataChannelDescriptor类代码示例

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


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

示例1: createDefaultNodeDescriptor

import org.apache.cayenne.configuration.DataChannelDescriptor; //导入依赖的package包/类
private DataNodeDescriptor createDefaultNodeDescriptor(DataDomain dataDomain) {

        DataChannelDescriptor channelDescriptor = new DataChannelDescriptor();
        DataNodeDescriptor defaultDescriptor = new DataNodeDescriptor(createSyntheticDataNodeName(dataDomain));
        channelDescriptor.getNodeDescriptors().add(defaultDescriptor);

        for (DataMap map : dataDomain.getDataMaps()) {
            channelDescriptor.getDataMaps().add(map);
            defaultDescriptor.getDataMapNames().add(map.getName());
        }

        defaultDescriptor.setDataChannelDescriptor(channelDescriptor);
        return defaultDescriptor;
    }
 
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:15,代码来源:SyntheticNodeDataDomainProvider.java

示例2: CayenneProject

import org.apache.cayenne.configuration.DataChannelDescriptor; //导入依赖的package包/类
public CayenneProject(String path) throws MalformedURLException
    {
//        this.path = path;
//        URL url = CayenneModeler.class.getResource(path);
        URL url = new File(path).toURI().toURL();
        Resource rootSource = new URLResource(url);
        ProjectUpgrader upgrader = Injection.getInjector().getInstance(ProjectUpgrader.class);
        UpgradeHandler handler = upgrader.getUpgradeHandler(rootSource);
        UpgradeMetaData md = handler.getUpgradeMetaData();

        this.path = url.getPath();

        // FIXME: These should be handled better.
        if (UpgradeType.DOWNGRADE_NEEDED == md.getUpgradeType())
        {
            LOGGER.error("Can't open project - it was created using a newer version of Cayenne Modeler");
        }
        else if (UpgradeType.INTERMEDIATE_UPGRADE_NEEDED == md.getUpgradeType())
        {
            LOGGER.error("Can't open project - it was created using an older version of Cayenne Modeler");
        }
        else if (UpgradeType.UPGRADE_NEEDED == md.getUpgradeType())
        {
            LOGGER.error("Can't open project - it was created using an older version of Cayenne Modeler");
        }
        else
        {
            // openProjectResourse(rootSource, controller);
            project = openProjectResourse(rootSource);
            root    = (DataChannelDescriptor) project.getRootNode();

//            System.out.println(root.getName());
//
//            for (DataNodeDescriptor dataNodeDescriptor : root.getNodeDescriptors())
//                System.out.println("Node: " + dataNodeDescriptor.getName());
//
//            for (DataMap dataMap : root.getDataMaps())
//                for (DbEntity dbEntity : dataMap.getDbEntities())
//                    System.out.println("DbEntity: " + dbEntity.getName());
        }

        dataDomainAdapter = new DataDomainAdapter(this);
    }
 
开发者ID:apache,项目名称:cayenne-modeler,代码行数:44,代码来源:CayenneProject.java

示例3: getDataDomain

import org.apache.cayenne.configuration.DataChannelDescriptor; //导入依赖的package包/类
public DataChannelDescriptor getDataDomain()
{
    return root;
}
 
开发者ID:apache,项目名称:cayenne-modeler,代码行数:5,代码来源:CayenneProject.java

示例4: CayenneProject

import org.apache.cayenne.configuration.DataChannelDescriptor; //导入依赖的package包/类
public CayenneProject(final String path) throws MalformedURLException
    {
//        this.path = path;
//        URL url = CayenneModeler.class.getResource(path);
        final URL url = new File(path).toURI().toURL();
        final Resource rootSource = new URLResource(url);
        final ProjectUpgrader upgrader = CayenneModeler.getInjector().getInstance(ProjectUpgrader.class);
        final UpgradeHandler handler = upgrader.getUpgradeHandler(rootSource);
        final UpgradeMetaData md = handler.getUpgradeMetaData();

        this.path = url.getPath();

        // FIXME: These should be handled better.
        if (UpgradeType.DOWNGRADE_NEEDED == md.getUpgradeType())
        {
            LOGGER.fatal("Can't open project - it was created using a newer version of Cayenne Modeler");
        }
        else if (UpgradeType.INTERMEDIATE_UPGRADE_NEEDED == md.getUpgradeType())
        {
            LOGGER.fatal("Can't open project - it was created using an older version of Cayenne Modeler");
        }
        else if (UpgradeType.UPGRADE_NEEDED == md.getUpgradeType())
        {
            LOGGER.fatal("Can't open project - it was created using an older version of Cayenne Modeler");
        }
        else
        {
            // openProjectResourse(rootSource, controller);
            project = openProjectResourse(rootSource);
            root    = (DataChannelDescriptor) project.getRootNode();

//            System.out.println(root.getName());
//
//            for (DataNodeDescriptor dataNodeDescriptor : root.getNodeDescriptors())
//                System.out.println("Node: " + dataNodeDescriptor.getName());
//
//            for (DataMap dataMap : root.getDataMaps())
//                for (DbEntity dbEntity : dataMap.getDbEntities())
//                    System.out.println("DbEntity: " + dbEntity.getName());
        }

        dataDomainAdapter = new DataDomainAdapter(this);
    }
 
开发者ID:mrg,项目名称:CMP,代码行数:44,代码来源:CayenneProject.java

示例5: createAndInitDataDomain

import org.apache.cayenne.configuration.DataChannelDescriptor; //导入依赖的package包/类
@Override
protected DataDomain createAndInitDataDomain() throws Exception {

    DataDomain dataDomain = super.createAndInitDataDomain();

    DataNodeDescriptor defaultNodeDescriptor = createDefaultNodeDescriptor(dataDomain);

    // add DataMaps that were explicitly configured in BQ config
    Map<String, Collection<DataMapConfig>> explicitConfigs = getDataMapConfigs();
    if (!explicitConfigs.isEmpty()) {

        XMLDataMapLoader dataMapLoader = new XMLDataMapLoader();
        explicitConfigs.forEach((datasource, configs) -> {

            DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor(createSyntheticDataNodeName(datasource));
            List<DataChannelDescriptor> channelDescriptors = new ArrayList<>();

            for (DataMapConfig config : configs) {

                URL url = config.getLocation().getUrl();
                String dataMapName = config.getName();
                if (dataMapName == null) {
                    dataMapName = url.toExternalForm();
                }

                Resource location = new URLResource(url);
                DataMap dataMap = dataMapLoader.load(location);

                config.setName(dataMapName);
                dataMap.setName(dataMapName);
                dataDomain.addDataMap(dataMap);

                DataChannelDescriptor channelDescriptor = new DataChannelDescriptor();
                channelDescriptor.getDataMaps().add(dataMap);
                channelDescriptor.getNodeDescriptors().add(nodeDescriptor);
                channelDescriptors.add(channelDescriptor);

                nodeDescriptor.getDataMapNames().add(dataMapName);
            }

            if (datasource.equals(defaultDatasource.getOptionalName())
                    && !defaultNodeDescriptor.getDataMapNames().isEmpty()) {
                channelDescriptors.add(defaultNodeDescriptor.getDataChannelDescriptor());
                nodeDescriptor.getDataMapNames().addAll(defaultNodeDescriptor.getDataMapNames());
            }

            nodeDescriptor.setDataChannelDescriptor(descriptorMerger.merge(
                    channelDescriptors.toArray(new DataChannelDescriptor[channelDescriptors.size()])));

            try {
                addDataNode(dataDomain, nodeDescriptor);
            } catch (Exception e) {

                // TODO: better exception handling
                e.printStackTrace();
            }
        });
    } else if (dataDomain.getDataNodes().isEmpty()) {
        // no nodes... add a synthetic node... it will become the default
        DataNode defaultNode = addDataNode(dataDomain, defaultNodeDescriptor);
        dataDomain.setDefaultNode(defaultNode);
    }

    return dataDomain;
}
 
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:66,代码来源:SyntheticNodeDataDomainProvider.java


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