Search in sources :

Example 26 with Procedure

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

the class ProcedureColumnLoader method processResultSetRow.

@Override
protected void processResultSetRow(CatalogFilter catalog, SchemaFilter schema, DbLoadDataStore map, ResultSet rs) throws SQLException {
    String procSchema = rs.getString("PROCEDURE_SCHEM");
    String procCatalog = rs.getString("PROCEDURE_CAT");
    String name = rs.getString("PROCEDURE_NAME");
    String key = Procedure.generateFullyQualifiedName(procCatalog, procSchema, name);
    Procedure procedure = map.getProcedure(key);
    if (procedure == null) {
        return;
    }
    ProcedureParameter column = loadProcedureParams(rs, key, procedure);
    if (column == null) {
        return;
    }
    procedure.addCallParameter(column);
}
Also used : ProcedureParameter(org.apache.cayenne.map.ProcedureParameter) Procedure(org.apache.cayenne.map.Procedure)

Example 27 with Procedure

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

the class ProcedureLoader method processResultSetRow.

@Override
protected void processResultSetRow(CatalogFilter catalog, SchemaFilter schema, DbLoadDataStore map, ResultSet rs) throws SQLException {
    PatternFilter filter = config.getFiltersConfig().proceduresFilter(catalog.name, schema.name);
    String name = rs.getString("PROCEDURE_NAME");
    if (!filter.isIncluded(name)) {
        LOGGER.info("skipping Cayenne PK procedure: " + name);
        return;
    }
    Procedure procedure = new Procedure(name);
    procedure.setCatalog(rs.getString("PROCEDURE_CAT"));
    procedure.setSchema(rs.getString("PROCEDURE_SCHEM"));
    switch(rs.getShort("PROCEDURE_TYPE")) {
        case DatabaseMetaData.procedureNoResult:
        case DatabaseMetaData.procedureResultUnknown:
            procedure.setReturningValue(false);
            break;
        case DatabaseMetaData.procedureReturnsResult:
            procedure.setReturningValue(true);
            break;
    }
    map.addProcedureSafe(procedure);
}
Also used : PatternFilter(org.apache.cayenne.dbsync.reverse.filters.PatternFilter) Procedure(org.apache.cayenne.map.Procedure)

Example 28 with Procedure

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

the class ProcedureTab method setSchema.

void setSchema(String text) {
    if (text != null && text.trim().length() == 0) {
        text = null;
    }
    Procedure procedure = eventController.getCurrentProcedure();
    if (procedure != null && !Util.nullSafeEquals(procedure.getSchema(), text)) {
        procedure.setSchema(text);
        eventController.fireProcedureEvent(new ProcedureEvent(this, procedure));
    }
}
Also used : ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent) Procedure(org.apache.cayenne.map.Procedure)

Example 29 with Procedure

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

the class ProcedureTab method initController.

private void initController() {
    returnsValue.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            Procedure procedure = eventController.getCurrentProcedure();
            if (procedure != null && !ignoreChange) {
                procedure.setReturningValue(returnsValue.isSelected());
                eventController.fireProcedureEvent(new ProcedureEvent(ProcedureTab.this, procedure));
            }
        }
    });
    eventController.addProcedureDisplayListener(this);
}
Also used : ItemEvent(java.awt.event.ItemEvent) ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent) Procedure(org.apache.cayenne.map.Procedure) ItemListener(java.awt.event.ItemListener)

Example 30 with Procedure

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

the class ProcedureTab method setCatalog.

void setCatalog(String text) {
    if (text != null && text.trim().length() == 0) {
        text = null;
    }
    Procedure procedure = eventController.getCurrentProcedure();
    if (procedure != null && !Util.nullSafeEquals(procedure.getCatalog(), text)) {
        procedure.setCatalog(text);
        eventController.fireProcedureEvent(new ProcedureEvent(this, procedure));
    }
}
Also used : ProcedureEvent(org.apache.cayenne.configuration.event.ProcedureEvent) Procedure(org.apache.cayenne.map.Procedure)

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