Search in sources :

Example 6 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class CreateAttributeAction method createEmbAttribute.

public void createEmbAttribute(Embeddable embeddable, EmbeddableAttribute attr) {
    ProjectController mediator = getProjectController();
    embeddable.addAttribute(attr);
    fireEmbeddableAttributeEvent(this, mediator, embeddable, attr);
}
Also used : ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 7 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class CreateDataMapAction method createDataMap.

/**
 * Calls addDataMap() or creates new data map if no data node selected.
 */
public void createDataMap(DataMap map) {
    ProjectController mediator = getProjectController();
    mediator.addDataMap(this, map);
}
Also used : ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 8 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class CreateDbEntityAction method performAction.

/**
 * Creates new DbEntity, adds it to the current DataMap, fires DbEntityEvent and DbEntityDisplayEvent.
 */
public void performAction(ActionEvent e) {
    ProjectController mediator = getProjectController();
    DataMap map = mediator.getCurrentDataMap();
    DbEntity entity = new DbEntity();
    entity.setName(NameBuilder.builder(entity, map).name());
    createEntity(map, entity);
    application.getUndoManager().addEdit(new CreateDbEntityUndoableEdit(map, entity));
}
Also used : CreateDbEntityUndoableEdit(org.apache.cayenne.modeler.undo.CreateDbEntityUndoableEdit) DbEntity(org.apache.cayenne.map.DbEntity) ProjectController(org.apache.cayenne.modeler.ProjectController) DataMap(org.apache.cayenne.map.DataMap)

Example 9 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class CreateDbEntityAction method createEntity.

/**
 * Constructs and returns a new DbEntity. Entity returned is added to the
 * DataMap.
 */
public void createEntity(DataMap map, DbEntity entity) {
    ProjectController mediator = getProjectController();
    entity.setCatalog(map.getDefaultCatalog());
    entity.setSchema(map.getDefaultSchema());
    map.addDbEntity(entity);
    fireDbEntityEvent(this, mediator, entity);
}
Also used : ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 10 with ProjectController

use of org.apache.cayenne.modeler.ProjectController in project cayenne by apache.

the class CreateNodeAction method buildDataNode.

/**
 * Creates a new DataNode, adding to the current domain, but doesn't send
 * any events.
 */
public DataNodeDescriptor buildDataNode() {
    ProjectController mediator = getProjectController();
    DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
    DataNodeDescriptor node = buildDataNode(domain);
    DataSourceInfo src = new DataSourceInfo();
    node.setDataSourceDescriptor(src);
    // by default create JDBC Node
    node.setDataSourceFactoryType(XMLPoolingDataSourceFactory.class.getName());
    node.setSchemaUpdateStrategyType(SkipSchemaUpdateStrategy.class.getName());
    return node;
}
Also used : DataSourceInfo(org.apache.cayenne.conn.DataSourceInfo) DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) XMLPoolingDataSourceFactory(org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory) SkipSchemaUpdateStrategy(org.apache.cayenne.access.dbsync.SkipSchemaUpdateStrategy) DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor) ProjectController(org.apache.cayenne.modeler.ProjectController)

Aggregations

ProjectController (org.apache.cayenne.modeler.ProjectController)59 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)12 ObjEntity (org.apache.cayenne.map.ObjEntity)10 DbEntity (org.apache.cayenne.map.DbEntity)8 DataMap (org.apache.cayenne.map.DataMap)7 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)6 EntityEvent (org.apache.cayenne.map.event.EntityEvent)6 DataNodeEvent (org.apache.cayenne.configuration.event.DataNodeEvent)5 ObjAttribute (org.apache.cayenne.map.ObjAttribute)5 ProcedureParameter (org.apache.cayenne.map.ProcedureParameter)5 ArrayList (java.util.ArrayList)4 DbAttribute (org.apache.cayenne.map.DbAttribute)4 DbRelationship (org.apache.cayenne.map.DbRelationship)4 Embeddable (org.apache.cayenne.map.Embeddable)4 EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)4 ObjRelationship (org.apache.cayenne.map.ObjRelationship)4 RelationshipEvent (org.apache.cayenne.map.event.RelationshipEvent)4 ComponentAdapter (java.awt.event.ComponentAdapter)3 ComponentEvent (java.awt.event.ComponentEvent)3 EntityMergeSupport (org.apache.cayenne.dbsync.merge.context.EntityMergeSupport)3