本文整理汇总了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;
}
示例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);
}
示例3: getDataDomain
import org.apache.cayenne.configuration.DataChannelDescriptor; //导入依赖的package包/类
public DataChannelDescriptor getDataDomain()
{
return root;
}
示例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);
}
示例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;
}