use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class EmbeddableDisplayEventType method fireLastDisplayEvent.
@Override
public void fireLastDisplayEvent() {
DataChannelDescriptor dataChannel = (DataChannelDescriptor) controller.getProject().getRootNode();
if (!dataChannel.getName().equals(preferences.getDomain())) {
return;
}
DataMap dataMap = dataChannel.getDataMap(preferences.getDataMap());
if (dataMap == null) {
return;
}
Embeddable embeddable = dataMap.getEmbeddable(preferences.getEmbeddable());
if (embeddable == null) {
return;
}
EmbeddableDisplayEvent embeddableDisplayEvent = new EmbeddableDisplayEvent(this, embeddable, dataMap, dataChannel);
controller.fireEmbeddableDisplayEvent(embeddableDisplayEvent);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor 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.DataChannelDescriptor in project cayenne by apache.
the class ProcedureDisplayEventType method fireLastDisplayEvent.
@Override
public void fireLastDisplayEvent() {
DataChannelDescriptor dataChannel = (DataChannelDescriptor) controller.getProject().getRootNode();
if (!dataChannel.getName().equals(preferences.getDomain())) {
return;
}
DataMap dataMap = dataChannel.getDataMap(preferences.getDataMap());
if (dataMap == null) {
return;
}
Procedure procedure = dataMap.getProcedure(preferences.getProcedure());
if (procedure == null) {
return;
}
ProcedureDisplayEvent procedureDisplayEvent = new ProcedureDisplayEvent(this, procedure, dataMap, dataChannel);
controller.fireProcedureDisplayEvent(procedureDisplayEvent);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class QueryDisplayEventType method fireLastDisplayEvent.
@Override
public void fireLastDisplayEvent() {
DataChannelDescriptor dataChannel = (DataChannelDescriptor) controller.getProject().getRootNode();
if (!dataChannel.getName().equals(preferences.getDomain())) {
return;
}
DataMap dataMap = dataChannel.getDataMap(preferences.getDataMap());
if (dataMap == null) {
return;
}
QueryDescriptor query = dataMap.getQueryDescriptor(preferences.getQuery());
if (query == null) {
return;
}
QueryDisplayEvent queryDisplayEvent = new QueryDisplayEvent(this, query, dataMap, dataChannel);
controller.fireQueryDisplayEvent(queryDisplayEvent);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor 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());
}
Aggregations