Search in sources :

Example 21 with ProcedureParameter

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

the class ProcedureParameterDisplayEventType method getLastProcedureParameters.

protected ProcedureParameter[] getLastProcedureParameters(Procedure procedure) {
    List<ProcedureParameter> procedureParameterList = new ArrayList<ProcedureParameter>();
    ProcedureParameter[] parameters = new ProcedureParameter[0];
    String procedureParams = preferences.getProcedureParams();
    if (procedureParams.isEmpty()) {
        return procedureParameterList.toArray(parameters);
    }
    for (String procedureParamName : procedureParams.split(",")) {
        for (ProcedureParameter procedureParameter : procedure.getCallParameters()) {
            if (procedureParameter.getName().equals(procedureParamName)) {
                procedureParameterList.add(procedureParameter);
            }
        }
    }
    return procedureParameterList.toArray(parameters);
}
Also used : ProcedureParameter(org.apache.cayenne.map.ProcedureParameter) ArrayList(java.util.ArrayList)

Example 22 with ProcedureParameter

use of org.apache.cayenne.map.ProcedureParameter 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

ProcedureParameter (org.apache.cayenne.map.ProcedureParameter)22 Procedure (org.apache.cayenne.map.Procedure)7 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)5 ProjectController (org.apache.cayenne.modeler.ProjectController)5 DataMap (org.apache.cayenne.map.DataMap)4 ProcedureParameterEvent (org.apache.cayenne.configuration.event.ProcedureParameterEvent)3 ProcedureParameterDisplayEvent (org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent)3 ArrayList (java.util.ArrayList)2 DataRow (org.apache.cayenne.DataRow)2 ExtendedType (org.apache.cayenne.access.types.ExtendedType)2 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)2 DbAttribute (org.apache.cayenne.map.DbAttribute)2 DbEntity (org.apache.cayenne.map.DbEntity)2 DbRelationship (org.apache.cayenne.map.DbRelationship)2 Embeddable (org.apache.cayenne.map.Embeddable)2 EmbeddableAttribute (org.apache.cayenne.map.EmbeddableAttribute)2 ObjAttribute (org.apache.cayenne.map.ObjAttribute)2 ObjEntity (org.apache.cayenne.map.ObjEntity)2 ObjRelationship (org.apache.cayenne.map.ObjRelationship)2 QueryDescriptor (org.apache.cayenne.map.QueryDescriptor)2