當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。