Search in sources :

Example 16 with DataChannelDescriptor

use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.

the class ProjectController method updateEntityResolver.

public void updateEntityResolver() {
    Collection<DataMap> dataMaps = ((DataChannelDescriptor) project.getRootNode()).getDataMaps();
    entityResolver.setDataMaps(dataMaps);
    for (DataMap dataMap : dataMaps) {
        dataMap.setNamespace(entityResolver);
    }
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) DataMap(org.apache.cayenne.map.DataMap)

Example 17 with DataChannelDescriptor

use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.

the class ProjectController method setProject.

public void setProject(Project currentProject) {
    if (this.project != currentProject) {
        this.project = currentProject;
        this.projectControllerPreferences = null;
        if (project == null) {
            this.entityResolver = null;
            if (fileChangeTracker != null) {
                fileChangeTracker.interrupt();
                fileChangeTracker = null;
            }
        } else {
            if (fileChangeTracker == null) {
                fileChangeTracker = new ProjectFileChangeTracker(this);
                fileChangeTracker.setDaemon(true);
                fileChangeTracker.start();
            }
            fileChangeTracker.reconfigure();
            entityResolver = new EntityResolver(((DataChannelDescriptor) currentProject.getRootNode()).getDataMaps());
            updateEntityResolver();
        }
    }
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) EntityResolver(org.apache.cayenne.map.EntityResolver)

Example 18 with DataChannelDescriptor

use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.

the class ProjectController method getEmbeddablesInCurrentDataDomain.

public ArrayList<Embeddable> getEmbeddablesInCurrentDataDomain() {
    DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) getProject().getRootNode();
    Collection<DataMap> maps = dataChannelDescriptor.getDataMaps();
    Iterator<DataMap> it = maps.iterator();
    ArrayList<Embeddable> embs = new ArrayList<>();
    while (it.hasNext()) {
        embs.addAll(it.next().getEmbeddables());
    }
    return embs;
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) ArrayList(java.util.ArrayList) DataMap(org.apache.cayenne.map.DataMap) Embeddable(org.apache.cayenne.map.Embeddable)

Example 19 with DataChannelDescriptor

use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.

the class ProjectTreeView method dataMapAdded.

public void dataMapAdded(DataMapEvent e) {
    DefaultMutableTreeNode domainNode = getProjectModel().getNodeForObjectPath(new Object[] { e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator.getProject().getRootNode() });
    DefaultMutableTreeNode newMapNode = ProjectTreeFactory.wrapProjectNode(e.getDataMap());
    mediator.getEntityResolver().addDataMap(e.getDataMap());
    positionNode(domainNode, newMapNode, Comparators.getDataDomainChildrenComparator());
    showNode(newMapNode);
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 20 with DataChannelDescriptor

use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.

the class ProjectTreeView method dataNodeAdded.

public void dataNodeAdded(DataNodeEvent e) {
    if (e.getSource() == this) {
        return;
    }
    DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(new Object[] { e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator.getProject().getRootNode() });
    if (node == null) {
        return;
    }
    DataNodeDescriptor dataNode = e.getDataNode();
    DefaultMutableTreeNode currentNode = ProjectTreeFactory.wrapProjectNode(dataNode);
    positionNode(node, currentNode, Comparators.getDataDomainChildrenComparator());
    showNode(currentNode);
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor)

Aggregations

DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)100 DataMap (org.apache.cayenne.map.DataMap)50 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)28 Test (org.junit.Test)20 ObjEntity (org.apache.cayenne.map.ObjEntity)18 DbEntity (org.apache.cayenne.map.DbEntity)12 ProjectController (org.apache.cayenne.modeler.ProjectController)12 URL (java.net.URL)11 Embeddable (org.apache.cayenne.map.Embeddable)11 ArrayList (java.util.ArrayList)10 URLResource (org.apache.cayenne.resource.URLResource)10 ObjAttribute (org.apache.cayenne.map.ObjAttribute)8 QueryDescriptor (org.apache.cayenne.map.QueryDescriptor)8 EntityDisplayEvent (org.apache.cayenne.modeler.event.EntityDisplayEvent)8 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)7 DataNodeEvent (org.apache.cayenne.configuration.event.DataNodeEvent)6 Injector (org.apache.cayenne.di.Injector)6 Procedure (org.apache.cayenne.map.Procedure)6 ProcedureDisplayEvent (org.apache.cayenne.modeler.event.ProcedureDisplayEvent)6 Resource (org.apache.cayenne.resource.Resource)6