use of org.apache.cayenne.configuration.DataNodeDescriptor in project cayenne by apache.
the class MultipleObjectsDisplayEventType method fireLastDisplayEvent.
@Override
public void fireLastDisplayEvent() {
DataChannelDescriptor dataChannel = (DataChannelDescriptor) controller.getProject().getRootNode();
String parentObjectName = preferences.getParentObject();
ConfigurationNode parentObject;
ConfigurationNode[] multipleObjects;
if (dataChannel.getDataMap(parentObjectName) != null) {
DataMap dataMap = dataChannel.getDataMap(parentObjectName);
parentObject = dataMap;
multipleObjects = getLastMultipleObjects(dataMap);
} else if (dataChannel.getNodeDescriptor(parentObjectName) != null) {
DataNodeDescriptor dataNode = dataChannel.getNodeDescriptor(parentObjectName);
parentObject = dataNode;
multipleObjects = getLastMultipleObjects(dataNode);
} else {
parentObject = dataChannel;
multipleObjects = getLastMultipleObjects(dataChannel);
}
MultipleObjectsDisplayEvent multipleDisplayEvent = new MultipleObjectsDisplayEvent(this, multipleObjects, parentObject);
controller.fireMultipleObjectsDisplayEvent(multipleDisplayEvent);
}
use of org.apache.cayenne.configuration.DataNodeDescriptor in project cayenne by apache.
the class DataNodeEventTest method testNoNameChange.
@Test
public void testNoNameChange() throws Exception {
MapEvent event = new DataNodeEvent(new Object(), new DataNodeDescriptor("someName"));
assertFalse(event.isNameChange());
event.setOldName("someOldName");
assertTrue(event.isNameChange());
}
use of org.apache.cayenne.configuration.DataNodeDescriptor in project cayenne by apache.
the class DataNodeEventTest method testNewName.
@Test
public void testNewName() throws Exception {
MapEvent event = new DataNodeEvent(new Object(), new DataNodeDescriptor("someName"));
assertEquals("someName", event.getNewName());
}
use of org.apache.cayenne.configuration.DataNodeDescriptor in project cayenne by apache.
the class CreateNodeActionTest method testCreateDataNode.
@Test
public void testCreateDataNode() {
CreateNodeAction action;
try {
action = new CreateNodeAction(null);
} catch (InternalError e) {
// TODO: setup test environment DISPLAY variable
return;
}
DataChannelDescriptor domain = new DataChannelDescriptor();
domain.setName("aa");
DataNodeDescriptor node = action.buildDataNode(domain);
assertNotNull(node);
assertNotNull(node.getName());
DataSourceInfo ds1 = new DataSourceInfo();
node.setDataSourceDescriptor(ds1);
assertSame("Project DataNode must not wrap the DataSource", ds1, node.getDataSourceDescriptor());
}
use of org.apache.cayenne.configuration.DataNodeDescriptor in project cayenne by apache.
the class CayenneTask method getAdapter.
protected DbAdapter getAdapter(Injector injector, DataSource dataSource) throws Exception {
DbAdapterFactory adapterFactory = injector.getInstance(DbAdapterFactory.class);
DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
nodeDescriptor.setAdapterType(adapter);
return adapterFactory.createAdapter(nodeDescriptor, dataSource);
}
Aggregations