summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakefeasel <jfeasel@gmail.com>2014-09-25 16:44:35 -0700
committerjakefeasel <jfeasel@gmail.com>2014-09-25 16:44:35 -0700
commitbd97040704fa1cf9d4dce9ff4ef13bd8a3a8d30f (patch)
tree9278fd5041354a20cb4fb03d246bdab28d4058d6
parente1ef10278c4dc4fbcf4e836d9975f5644a6f9677 (diff)
downloadsqlfiddle2-bd97040704fa1cf9d4dce9ff4ef13bd8a3a8d30f.zip
sqlfiddle2-bd97040704fa1cf9d4dce9ff4ef13bd8a3a8d30f.tar.gz
sqlfiddle2-bd97040704fa1cf9d4dce9ff4ef13bd8a3a8d30f.tar.bz2
Flattening objectTypes for fiddles, now that the proper technique is
known
-rw-r--r--src/main/resources/conf/provisioner.openicf-fiddles.json120
-rw-r--r--src/main/resources/script/executeQuery.groovy8
-rw-r--r--src/main/resources/tools/fiddles/SearchScript.groovy16
-rw-r--r--src/main/resources/tools/fiddles/UpdateScript.groovy2
4 files changed, 67 insertions, 79 deletions
diff --git a/src/main/resources/conf/provisioner.openicf-fiddles.json b/src/main/resources/conf/provisioner.openicf-fiddles.json
index a2d8a3c..be0e80c 100644
--- a/src/main/resources/conf/provisioner.openicf-fiddles.json
+++ b/src/main/resources/conf/provisioner.openicf-fiddles.json
@@ -202,38 +202,34 @@
"nativeName" : "statement_separator",
"nativeType" : "string"
},
- "relationships" : {
+ "db_type" : {
"type" : "object",
- "required" : false,
+ "nativeName" : "db_type",
+ "nativeType" : "object",
"properties" : {
- "db_type" : {
- "type" : "object",
- "properties" : {
- "id" : {
- "type" : "integer"
- },
- "context" : {
- "type" : "string"
- },
- "execution_plan_prefix" : {
- "type" : "string"
- },
- "execution_plan_suffix" : {
- "type" : "string"
- },
- "execution_plan_xslt" : {
- "type" : "string"
- },
- "simple_name" : {
- "type" : "string"
- },
- "full_name" : {
- "type" : "string"
- },
- "batch_separator" : {
- "type" : "string"
- }
- }
+ "id" : {
+ "type" : "integer"
+ },
+ "context" : {
+ "type" : "string"
+ },
+ "execution_plan_prefix" : {
+ "type" : "string"
+ },
+ "execution_plan_suffix" : {
+ "type" : "string"
+ },
+ "execution_plan_xslt" : {
+ "type" : "string"
+ },
+ "simple_name" : {
+ "type" : "string"
+ },
+ "full_name" : {
+ "type" : "string"
+ },
+ "batch_separator" : {
+ "type" : "string"
}
}
}
@@ -278,40 +274,36 @@
"nativeName" : "query_id",
"nativeType" : "integer"
},
- "relationships" : {
- "type" : "object",
- "required" : false,
- "properties" : {
- "query_sets" : {
- "type": "array",
- "items" : {
- "type" : "object",
- "properties" : {
- "id" : {
- "type" : "integer"
- },
- "row_count" : {
- "type" : "integer"
- },
- "execution_time" : {
- "type" : "string"
- },
- "execution_plan" : {
- "type" : "string"
- },
- "succeeded" : {
- "type" : "string"
- },
- "error_message" : {
- "type" : "string"
- },
- "sql" : {
- "type" : "string"
- },
- "columns_list" : {
- "type" : "string"
- }
- }
+ "query_sets" : {
+ "type": "array",
+ "nativeName" : "query_sets",
+ "nativeType" : "object",
+ "items" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "integer"
+ },
+ "row_count" : {
+ "type" : "integer"
+ },
+ "execution_time" : {
+ "type" : "string"
+ },
+ "execution_plan" : {
+ "type" : "string"
+ },
+ "succeeded" : {
+ "type" : "string"
+ },
+ "error_message" : {
+ "type" : "string"
+ },
+ "sql" : {
+ "type" : "string"
+ },
+ "columns_list" : {
+ "type" : "string"
}
}
}
diff --git a/src/main/resources/script/executeQuery.groovy b/src/main/resources/script/executeQuery.groovy
index 9be4faf..7cd387d 100644
--- a/src/main/resources/script/executeQuery.groovy
+++ b/src/main/resources/script/executeQuery.groovy
@@ -90,7 +90,7 @@ def schema_def = openidm.read("system/fiddles/schema_defs/" + content.db_type_id
assert schema_def != null
-def db_type = schema_def.relationships.db_type
+def db_type = schema_def.db_type
// Update the timestamp for the schema_def each time this instance is used, so we know if it should stay running longer
schema_def.last_used = (new Date().format("yyyy-MM-dd HH:mm:ss.S"))
@@ -234,9 +234,9 @@ if (db_type.context == "host") {
hostConnection.close()
- if (query.relationships.query_sets.size() != sets.size()) {
+ if (query.query_sets.size() != sets.size()) {
int i = 0
- query.relationships.query_sets = []
+ query.query_sets = []
sets.each {
String columns_list = it.RESULTS?.COLUMNS?.join(",")
@@ -245,7 +245,7 @@ if (db_type.context == "host") {
}
i++
- query.relationships.query_sets.add([
+ query.query_sets.add([
id : i,
row_count : it.RESULTS?.DATA?.size() ?: 0,
execution_time : it.EXECUTIONTIME ?: 0,
diff --git a/src/main/resources/tools/fiddles/SearchScript.groovy b/src/main/resources/tools/fiddles/SearchScript.groovy
index b2e91ec..715d356 100644
--- a/src/main/resources/tools/fiddles/SearchScript.groovy
+++ b/src/main/resources/tools/fiddles/SearchScript.groovy
@@ -25,6 +25,7 @@
*/
import groovy.sql.Sql
import groovy.sql.DataSet
+import org.identityconnectors.framework.common.objects.AttributeBuilder
import org.identityconnectors.framework.common.objects.filter.Filter
import org.forgerock.openicf.misc.scriptedcommon.MapFilterVisitor
@@ -189,8 +190,7 @@ switch ( objectClass.objectClassValue ) {
attribute 'minutes_since_last_used', (row.minutes_since_last_used != null ? row.minutes_since_last_used.toInteger(): null)
attribute 'short_code', row.short_code
attribute 'statement_separator', row.statement_separator
- attribute 'relationships', [
- 'db_type' : [
+ attribute 'db_type', [
id : row.db_type_id.toInteger(),
context : row.context,
simple_name : row.simple_name,
@@ -200,7 +200,7 @@ switch ( objectClass.objectClassValue ) {
execution_plan_xslt : row.execution_plan_xslt,
batch_separator : row.batch_separator
]
- ]
+
}
}
@@ -223,9 +223,7 @@ switch ( objectClass.objectClassValue ) {
attribute 'schema_def_id', dataCollector.schema_def_id
attribute 'sql', dataCollector.sql
attribute 'statement_separator', dataCollector.statement_separator
- attribute 'relationships', [
- 'query_sets' : dataCollector.relationships.query_sets
- ]
+ attributes AttributeBuilder.build('query_sets', dataCollector.query_sets)
}
}
@@ -273,14 +271,12 @@ switch ( objectClass.objectClassValue ) {
schema_def_id : row.schema_def_id.toInteger(),
sql : row.sql,
statement_separator : row.statement_separator,
- relationships : [
- query_sets : [ ]
- ]
+ query_sets : [ ]
]
}
if (row.query_set_id) {
- dataCollector.relationships.query_sets.add([
+ dataCollector.query_sets.add([
id : row.query_set_id.toInteger(),
row_count : row.row_count,
execution_time : row.execution_time,
diff --git a/src/main/resources/tools/fiddles/UpdateScript.groovy b/src/main/resources/tools/fiddles/UpdateScript.groovy
index 9a1e8c0..e6ca8d8 100644
--- a/src/main/resources/tools/fiddles/UpdateScript.groovy
+++ b/src/main/resources/tools/fiddles/UpdateScript.groovy
@@ -79,7 +79,7 @@ switch ( operation ) {
int i = 0;
- updateAttributes.findMap("relationships").query_sets.each {
+ updateAttributes.findMap("query_sets").each {
i++;
sql.execute("""
INSERT INTO