use of org.apache.cayenne.map.DataMap in project cayenne by apache.
the class ProjectUtil method findObjRelationshipsForDbRelationship.
public static Collection<ObjRelationship> findObjRelationshipsForDbRelationship(ProjectController mediator, DbRelationship relationship) {
DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
List<ObjRelationship> objRelationships = new ArrayList<>();
if (domain != null) {
for (DataMap map : domain.getDataMaps()) {
for (ObjEntity entity : map.getObjEntities()) {
for (ObjRelationship objRelationship : entity.getRelationships()) {
if (objRelationship.getDbRelationships().contains(relationship)) {
objRelationships.add(objRelationship);
}
}
}
}
}
return objRelationships;
}
use of org.apache.cayenne.map.DataMap in project cayenne by apache.
the class AttributeDisplayEventType method fireLastDisplayEvent.
@Override
public void fireLastDisplayEvent() {
DataChannelDescriptor dataChannel = (DataChannelDescriptor) controller.getProject().getRootNode();
if (!dataChannel.getName().equals(preferences.getDomain())) {
return;
}
DataNodeDescriptor dataNode = dataChannel.getNodeDescriptor(preferences.getNode());
DataMap dataMap = dataChannel.getDataMap(preferences.getDataMap());
if (dataMap == null) {
return;
}
Entity entity = getLastEntity(dataMap);
if (entity == null) {
return;
}
Attribute[] attributes = getLastEntityAttributes(entity);
EntityDisplayEvent entityDisplayEvent = new EntityDisplayEvent(this, entity, dataMap, dataNode, dataChannel);
AttributeDisplayEvent attributeDisplayEvent = new AttributeDisplayEvent(this, attributes, entity, dataMap, dataChannel);
if (entity instanceof ObjEntity) {
controller.fireObjEntityDisplayEvent(entityDisplayEvent);
controller.fireObjAttributeDisplayEvent(attributeDisplayEvent);
} else if (entity instanceof DbEntity) {
controller.fireDbEntityDisplayEvent(entityDisplayEvent);
controller.fireDbAttributeDisplayEvent(attributeDisplayEvent);
}
}
use of org.apache.cayenne.map.DataMap 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.map.DataMap 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.map.DataMap 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);
}
Aggregations