Search in sources :

Example 1 with Embeddable

use of org.apache.cayenne.map.Embeddable in project cayenne by apache.

the class CayenneGeneratorEntityFilterAction method getFilteredEmbeddables.

Collection<Embeddable> getFilteredEmbeddables(DataMap mainDataMap) {
    Collection<Embeddable> embeddables = new ArrayList<>(mainDataMap.getEmbeddables());
    // filter out excluded entities...
    Iterator<Embeddable> it = embeddables.iterator();
    while (it.hasNext()) {
        Embeddable e = it.next();
        // have a symbolic name...
        if (!nameFilter.isIncluded(e.getClassName())) {
            it.remove();
        }
    }
    return embeddables;
}
Also used : ArrayList(java.util.ArrayList) Embeddable(org.apache.cayenne.map.Embeddable)

Example 2 with Embeddable

use of org.apache.cayenne.map.Embeddable in project cayenne by apache.

the class EmbeddableTab method setComment.

void setComment(String comment) {
    Embeddable embeddable = mediator.getCurrentEmbeddable();
    if (embeddable == null) {
        return;
    }
    ObjectInfo.putToMetaData(mediator.getApplication().getMetaData(), embeddable, ObjectInfo.COMMENT, comment);
    mediator.fireEmbeddableEvent(new EmbeddableEvent(this, embeddable), mediator.getCurrentDataMap());
}
Also used : EmbeddableEvent(org.apache.cayenne.map.event.EmbeddableEvent) Embeddable(org.apache.cayenne.map.Embeddable)

Example 3 with Embeddable

use of org.apache.cayenne.map.Embeddable in project cayenne by apache.

the class ProjectController method getEmbeddableNamesInCurrentDataDomain.

public Set<String> getEmbeddableNamesInCurrentDataDomain() {
    ArrayList<Embeddable> embs = getEmbeddablesInCurrentDataDomain();
    Set<String> embNames = new HashSet<>(embs.size());
    for (Embeddable emb : embs) {
        embNames.add(emb.getClassName());
    }
    return embNames;
}
Also used : Embeddable(org.apache.cayenne.map.Embeddable) HashSet(java.util.HashSet)

Example 4 with Embeddable

use of org.apache.cayenne.map.Embeddable 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 5 with Embeddable

use of org.apache.cayenne.map.Embeddable in project cayenne by apache.

the class ProjectTreeView method embeddableAdded.

public void embeddableAdded(EmbeddableEvent e, DataMap map) {
    Embeddable embeddable = e.getEmbeddable();
    DefaultMutableTreeNode mapNode = getProjectModel().getNodeForObjectPath(new Object[] { e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator.getProject().getRootNode(), map });
    if (mapNode == null) {
        return;
    }
    DefaultMutableTreeNode currentNode = new DefaultMutableTreeNode(embeddable, false);
    positionNode(mapNode, currentNode, Comparators.getDataMapChildrenComparator());
    showNode(currentNode);
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Embeddable(org.apache.cayenne.map.Embeddable)

Aggregations

Embeddable (org.apache.cayenne.map.Embeddable)33 DataMap (org.apache.cayenne.map.DataMap)14 ObjEntity (org.apache.cayenne.map.ObjEntity)14 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)11 EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)11 DbEntity (org.apache.cayenne.map.DbEntity)8 ArrayList (java.util.ArrayList)7 ObjAttribute (org.apache.cayenne.map.ObjAttribute)7 QueryDescriptor (org.apache.cayenne.map.QueryDescriptor)6 DbAttribute (org.apache.cayenne.map.DbAttribute)5 Procedure (org.apache.cayenne.map.Procedure)5 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)4 ObjRelationship (org.apache.cayenne.map.ObjRelationship)4 ProjectController (org.apache.cayenne.modeler.ProjectController)4 HashMap (java.util.HashMap)3 DbRelationship (org.apache.cayenne.map.DbRelationship)3 EmbeddableDisplayEvent (org.apache.cayenne.modeler.event.EmbeddableDisplayEvent)3 RemoveAttributeUndoableEdit (org.apache.cayenne.modeler.undo.RemoveAttributeUndoableEdit)3 File (java.io.File)2 LinkedList (java.util.LinkedList)2