All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.smartclient.public.sc.schema.DataSourceStore.ds.xml Maven / Gradle / Ivy

The newest version!
isc.DataSource.create({
    ID:"DataSourceStore",
    fields:{
        ID:{
            name:"ID",
            primaryKey:true
        },
        version:{
            name:"version"
        },
        dsXML:{
            length:50000,
            name:"dsXML",
            type:"text"
        },
        config:{
            hidden:true,
            name:"config"
        },
        dbName:{
            hidden:true,
            name:"dbName"
        },
        tableName:{
            hidden:true,
            name:"tableName"
        },
        schema:{
            hidden:true,
            name:"schema"
        },
        sql:{
            hidden:true,
            name:"sql"
        },
        ds:{
            hidden:true,
            name:"ds",
            type:"DataSource"
        }
    },
    operationBindings:[
        {
            language:"groovy",
            operationId:"dsFromSQL",
            operationType:"custom",
            script:"\n            if (!com.isomorphic.auth.DevModeAuthFilter.devModeAuthorized(request)) throw new Exception(\"Not Authorized\");\n            import com.isomorphic.sql.*;\n           \n            def dsId = values.dbName+\"_devSqlBrowser_\"+System.currentTimeMillis();\n            def conn = SQLConnectionManager.getConnection(values.dbName);\n            def ds = SQLDataSource.fromTable(conn, null, values.schema, dsId, \"sql\", values.dbName,\n                        [operationType:\"fetch\", customSQL: values.sql], true, null);\n            SQLConnectionManager.free(conn);\n\n/*\n            def ds = DataSource.fromConfig([\n                ID: dsId,\n                dbName: values.dbName,\n                serverType: \"sql\",\n                autoDeriveSchema: \"true\",\n                operationBindings: [\n                    [type: \"fetch\", autoDeriveSchemaOperation: \"true\", tableClause: values.sql]\n                ]\n            ]);\n*/\n            return [ds:ds];\n	    "
        },
        {
            language:"groovy",
            operationId:"dsFromTable",
            operationType:"custom",
            script:"\n            if (!com.isomorphic.auth.DevModeAuthFilter.devModeAuthorized(request)) throw new Exception(\"Not Authorized\");\n            import com.isomorphic.sql.*;\n\n            def dsId = values.dbName+\"_\"+values.tableName+\"_devTableBrowser_\"+System.currentTimeMillis();\n            def ds = SQLDataSource.fromTable(null, values.tableName, values.schema, dsId, \"sql\", values.dbName);\n            return [ds:ds, dsXML:ds.toXML()];\n	    "
        },
        {
            language:"groovy",
            operationId:"dsFromConfig",
            operationType:"custom",
            script:"\n            if (!com.isomorphic.auth.DevModeAuthFilter.devModeAuthorized(request)) throw new Exception(\"Not Authorized\");\n            import com.isomorphic.store.*;\n            import com.isomorphic.datasource.*;\n\n            def ds = DataSource.fromConfig(values.config, dsRequest);\n            if (ds != null) {\n                DataStructCache.addCachedObjectWithNoConfigFile(ds.getName(), ds);\n            }\n            return [ds:ds, dsXML: ds.toXML()];\n	    "
        }
    ]
})




© 2015 - 2024 Weber Informatics LLC | Privacy Policy