Search in sources :

Example 36 with Procedure

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

the class CreateProcedureParameterAction method performAction.

/**
 * Creates ProcedureParameter depending on context.
 */
@Override
public void performAction(ActionEvent e) {
    ProjectController mediator = getProjectController();
    if (getProjectController().getCurrentProcedure() != null) {
        Procedure procedure = getProjectController().getCurrentProcedure();
        ProcedureParameter parameter = new ProcedureParameter();
        parameter.setName(NameBuilder.builder(parameter, procedure).name());
        createProcedureParameter(procedure, parameter);
        application.getUndoManager().addEdit(new CreateProcedureParameterUndoableEdit((DataChannelDescriptor) mediator.getProject().getRootNode(), mediator.getCurrentDataMap(), procedure, parameter));
    }
}
Also used : ProcedureParameter(org.apache.cayenne.map.ProcedureParameter) DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) Procedure(org.apache.cayenne.map.Procedure) CreateProcedureParameterUndoableEdit(org.apache.cayenne.modeler.undo.CreateProcedureParameterUndoableEdit) ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 37 with Procedure

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

the class ProjectUtil method setProcedureParameterName.

public static void setProcedureParameterName(ProcedureParameter parameter, String newName) {
    String oldName = parameter.getName();
    // If name hasn't changed, just return
    if (Util.nullSafeEquals(oldName, newName)) {
        return;
    }
    Procedure procedure = parameter.getProcedure();
    procedure.removeCallParameter(parameter.getName());
    parameter.setName(newName);
    procedure.addCallParameter(parameter);
}
Also used : Procedure(org.apache.cayenne.map.Procedure)

Example 38 with Procedure

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

the class ProcedureParameterDisplayEventType 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);
    ProcedureParameter[] procedureParameters = getLastProcedureParameters(procedure);
    ProcedureParameterDisplayEvent procedureParameterDisplayEvent = new ProcedureParameterDisplayEvent(this, procedureParameters, procedure, dataMap, dataChannel);
    controller.fireProcedureParameterDisplayEvent(procedureParameterDisplayEvent);
}
Also used : ProcedureParameter(org.apache.cayenne.map.ProcedureParameter) ProcedureDisplayEvent(org.apache.cayenne.modeler.event.ProcedureDisplayEvent) ProcedureParameterDisplayEvent(org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent) DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) Procedure(org.apache.cayenne.map.Procedure) DataMap(org.apache.cayenne.map.DataMap)

Aggregations

Procedure (org.apache.cayenne.map.Procedure)38 DataMap (org.apache.cayenne.map.DataMap)14 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)8 DbEntity (org.apache.cayenne.map.DbEntity)7 ProcedureParameter (org.apache.cayenne.map.ProcedureParameter)7 ProcedureEvent (org.apache.cayenne.configuration.event.ProcedureEvent)6 QueryDescriptor (org.apache.cayenne.map.QueryDescriptor)6 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)5 Embeddable (org.apache.cayenne.map.Embeddable)5 ObjEntity (org.apache.cayenne.map.ObjEntity)5 ProcedureDisplayEvent (org.apache.cayenne.modeler.event.ProcedureDisplayEvent)5 Test (org.junit.Test)4 ProjectController (org.apache.cayenne.modeler.ProjectController)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 DataRow (org.apache.cayenne.DataRow)2 DataNode (org.apache.cayenne.access.DataNode)2 PatternFilter (org.apache.cayenne.dbsync.reverse.filters.PatternFilter)2 DbAttribute (org.apache.cayenne.map.DbAttribute)2 DbRelationship (org.apache.cayenne.map.DbRelationship)2 EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)2