From 75e810a2d32d8aaad04d1432bbf22f36ea64ebbf Mon Sep 17 00:00:00 2001 From: Scott Gray Date: Sun, 24 Aug 2008 05:36:54 +0000 Subject: [PATCH] Converted the remaining framework bsh scripts to groovy git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@688450 13f79535-47bb-0310-9956-ffa450edef68 --- ...aFields.bsh => GetStarSchemaFields.groovy} | 38 +- ...tStarSchemas.bsh => GetStarSchemas.groovy} | 22 +- ...emaQuery.bsh => RunStarSchemaQuery.groovy} | 11 +- framework/bi/widget/BiForms.xml | 2 +- framework/bi/widget/BiScreens.xml | 4 +- .../org/ofbiz/common/GroovyServiceTest.groovy | 8 +- ...ons.bsh => FindAutocompleteOptions.groovy} | 10 +- framework/common/widget/CommonScreens.xml | 2 +- .../{ArtifactInfo.bsh => ArtifactInfo.groovy} | 33 +- .../actions/cache/EditUtilCache.groovy | 58 ++ .../actions/cache/FindUtilCache.groovy | 53 ++ .../cache/FindUtilCacheElements.groovy | 59 ++ .../WEB-INF/actions/cache/editUtilCache.bsh | 58 -- .../WEB-INF/actions/cache/findUtilCache.bsh | 64 -- .../actions/cache/findUtilCacheElements.bsh | 70 -- .../WEB-INF/actions/entity/CheckDb.bsh | 144 ----- .../WEB-INF/actions/entity/CheckDb.groovy | 120 ++++ .../{EntityMaint.bsh => EntityMaint.groovy} | 55 +- .../actions/entity/EntityPerformanceTest.bsh | 251 -------- .../entity/EntityPerformanceTest.groovy | 249 ++++++++ .../{EntityRef.bsh => EntityRef.groovy} | 26 +- .../WEB-INF/actions/entity/EntityRefList.bsh | 64 -- .../actions/entity/EntityRefList.groovy | 55 ++ ...rocessor.bsh => EntitySQLProcessor.groovy} | 53 +- .../WEB-INF/actions/entity/ViewRelations.bsh | 62 -- .../actions/entity/ViewRelations.groovy | 59 ++ .../WEB-INF/actions/entity/XmlDsDump.groovy | 332 ++++++++++ .../WEB-INF/actions/entity/xmldsdump.bsh | 352 ----------- .../WEB-INF/actions/log/LogConfiguration.bsh | 66 -- .../actions/log/LogConfiguration.groovy | 58 ++ .../log/{LogView.bsh => LogView.groovy} | 6 +- .../actions/period/EditCustomTimePeriod.bsh | 84 --- .../period/EditCustomTimePeriod.groovy | 77 +++ .../actions/service/AvailableServices.groovy | 540 ++++++++++++++++ .../{scheduleJob.bsh => ScheduleJob.groovy} | 51 +- ...serviceResult.bsh => ServiceResult.groovy} | 36 +- .../service/{services.bsh => Services.groovy} | 29 +- .../service/{threads.bsh => Threads.groovy} | 35 +- .../actions/service/availableservices.bsh | 597 ------------------ .../WEB-INF/actions/stats/StatBinsHistory.bsh | 67 -- .../actions/stats/StatBinsHistory.groovy | 59 ++ .../WEB-INF/actions/stats/StatsSinceStart.bsh | 108 ---- .../actions/stats/StatsSinceStart.groovy | 103 +++ .../{readxpdl.bsh => ReadXpdl.groovy} | 39 +- ...flowMonitor.bsh => WorkflowMonitor.groovy} | 29 +- .../webtools/artifactinfo/ArtifactInfo.ftl | 2 +- .../webapp/webtools/entity/xmldsrawdump.jsp | 11 +- .../webtools/widget/ArtifactInfoScreens.xml | 2 +- .../widget/AvailableServicesScreens.xml | 2 +- framework/webtools/widget/CacheScreens.xml | 6 +- framework/webtools/widget/EntityScreens.xml | 16 +- framework/webtools/widget/LogScreens.xml | 4 +- framework/webtools/widget/MiscScreens.xml | 6 +- framework/webtools/widget/ServiceScreens.xml | 14 +- framework/webtools/widget/StatsScreens.xml | 4 +- 55 files changed, 2078 insertions(+), 2287 deletions(-) rename framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/{getStarSchemaFields.bsh => GetStarSchemaFields.groovy} (56%) rename framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/{getStarSchemas.bsh => GetStarSchemas.groovy} (70%) rename framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/{runStarSchemaQuery.bsh => RunStarSchemaQuery.groovy} (81%) rename framework/common/webcommon/WEB-INF/actions/includes/{findAutocompleteOptions.bsh => FindAutocompleteOptions.groovy} (81%) rename framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/{ArtifactInfo.bsh => ArtifactInfo.groovy} (69%) create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/cache/EditUtilCache.groovy create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/cache/editUtilCache.bsh delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCache.bsh delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCacheElements.bsh delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.groovy rename framework/webtools/webapp/webtools/WEB-INF/actions/entity/{EntityMaint.bsh => EntityMaint.groovy} (54%) delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityPerformanceTest.bsh create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityPerformanceTest.groovy rename framework/webtools/webapp/webtools/WEB-INF/actions/entity/{EntityRef.bsh => EntityRef.groovy} (56%) delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityRefList.bsh create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityRefList.groovy rename framework/webtools/webapp/webtools/WEB-INF/actions/entity/{EntitySQLProcessor.bsh => EntitySQLProcessor.groovy} (59%) delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/ViewRelations.bsh create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/ViewRelations.groovy create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/XmlDsDump.groovy delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/entity/xmldsdump.bsh delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.bsh create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.groovy rename framework/webtools/webapp/webtools/WEB-INF/actions/log/{LogView.bsh => LogView.groovy} (91%) delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/period/EditCustomTimePeriod.bsh create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/period/EditCustomTimePeriod.groovy create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/service/AvailableServices.groovy rename framework/webtools/webapp/webtools/WEB-INF/actions/service/{scheduleJob.bsh => ScheduleJob.groovy} (51%) rename framework/webtools/webapp/webtools/WEB-INF/actions/service/{serviceResult.bsh => ServiceResult.groovy} (54%) rename framework/webtools/webapp/webtools/WEB-INF/actions/service/{services.bsh => Services.groovy} (62%) rename framework/webtools/webapp/webtools/WEB-INF/actions/service/{threads.bsh => Threads.groovy} (64%) delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/service/availableservices.bsh delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/stats/StatBinsHistory.bsh create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/stats/StatBinsHistory.groovy delete mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/stats/StatsSinceStart.bsh create mode 100644 framework/webtools/webapp/webtools/WEB-INF/actions/stats/StatsSinceStart.groovy rename framework/webtools/webapp/webtools/WEB-INF/actions/workflow/{readxpdl.bsh => ReadXpdl.groovy} (73%) rename framework/webtools/webapp/webtools/WEB-INF/actions/workflow/{workflowMonitor.bsh => WorkflowMonitor.groovy} (60%) diff --git a/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh b/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/GetStarSchemaFields.groovy similarity index 56% rename from framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh rename to framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/GetStarSchemaFields.groovy index 0ac1d752a5..25e0d59125 100644 --- a/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh +++ b/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/GetStarSchemaFields.groovy @@ -32,30 +32,30 @@ import org.ofbiz.entity.model.ModelViewEntity.ModelAlias; import javolution.util.FastList; import javolution.util.FastMap; -String starSchemaName = parameters.get("starSchemaName"); +starSchemaName = parameters.starSchemaName; -List starSchemaFields = FastList.newInstance(); -if (UtilValidate.isNotEmpty(starSchemaName)) { - ModelReader reader = delegator.getModelReader(); - ModelEntity starSchema = reader.getModelEntity(starSchemaName); - if (UtilValidate.isNotEmpty(starSchema)) { - Iterator fieldsIt = starSchema.getAliasesIterator(); - while (fieldsIt != null && fieldsIt.hasNext()) { - ModelAlias field = (ModelAlias)fieldsIt.next(); - Map fieldMap = FastMap.newInstance(); - fieldMap.put("name", field.getName()); - String description = field.getDescription(); - if (UtilValidate.isEmpty(description)) { - ModelEntity aliasedEntity = starSchema.getAliasedEntity(field.getEntityAlias(), reader); - if (aliasedEntity != null) { - ModelField aliasedField = starSchema.getAliasedField(aliasedEntity, field.getField(), reader); +starSchemaFields = FastList.newInstance(); +if (starSchemaName) { + reader = delegator.getModelReader(); + starSchema = reader.getModelEntity(starSchemaName); + if (starSchema) { + fieldsIt = starSchema.getAliasesIterator(); + while (fieldsIt.hasNext()) { + field = fieldsIt.next(); + fieldMap = FastMap.newInstance(); + fieldMap.name = field.getName(); + description = field.getDescription(); + if (!description) { + aliasedEntity = starSchema.getAliasedEntity(field.getEntityAlias(), reader); + if (aliasedEntity) { + aliasedField = starSchema.getAliasedField(aliasedEntity, field.getField(), reader); description = aliasedField.getDescription(); } } - fieldMap.put("description", description); + fieldMap.description = description; starSchemaFields.add(fieldMap); } } } -context.put("starSchemaName", starSchemaName); -context.put("starSchemaFields", starSchemaFields); +context.starSchemaName = starSchemaName; +context.starSchemaFields = starSchemaFields; diff --git a/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh b/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/GetStarSchemas.groovy similarity index 70% rename from framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh rename to framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/GetStarSchemas.groovy index 58797f7624..c6f7eba2d8 100644 --- a/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh +++ b/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/GetStarSchemas.groovy @@ -29,24 +29,24 @@ import org.ofbiz.entity.model.ModelViewEntity; import javolution.util.FastList; import javolution.util.FastMap; -ModelReader reader = delegator.getModelReader(); -Collection ec = reader.getEntityNames(); -TreeSet entities = new TreeSet(ec); -Iterator entitiesIt = entities.iterator(); +reader = delegator.getModelReader(); +ec = reader.getEntityNames(); +entities = new TreeSet(ec); +entitiesIt = entities.iterator(); List starSchemas = FastList.newInstance(); -while (entitiesIt != null && entitiesIt.hasNext()) { - ModelEntity entity = reader.getModelEntity((String)entitiesIt.next()); - String packageName = entity.getPackageName(); +while (entitiesIt.hasNext()) { + entity = reader.getModelEntity(entitiesIt.next()); + packageName = entity.getPackageName(); if (!packageName.contains("starschema")) { continue; } - Map entityMap = FastMap.newInstance(); - entityMap.put("name", entity.getEntityName()); - entityMap.put("title", entity.getTitle()); + entityMap = FastMap.newInstance(); + entityMap.name = entity.getEntityName(); + entityMap.title = entity.getTitle(); starSchemas.add(entityMap); } -context.put("starSchemas", starSchemas); +context.starSchemas = starSchemas; diff --git a/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh b/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/RunStarSchemaQuery.groovy similarity index 81% rename from framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh rename to framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/RunStarSchemaQuery.groovy index 10ab9d982b..ae88437f7a 100644 --- a/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh +++ b/framework/bi/webapp/bi/WEB-INF/actions/reportbuilder/RunStarSchemaQuery.groovy @@ -32,13 +32,12 @@ import org.ofbiz.entity.model.ModelViewEntity.ModelAlias; import javolution.util.FastList; import javolution.util.FastMap; -String starSchemaName = parameters.get("starSchemaName"); -String[] selectedFields = request.getParameterValues("selectedField"); -context.put("columnNames", selectedFields); +starSchemaName = parameters.starSchemaName; +selectedFields = parameters.selectedField as Set; +context.columnNames = selectedFields; List conditionList = null; EntityConditionList condition = null; -selectFields = UtilMisc.toSetArray(selectedFields); List orderByFields = null; EntityFindOptions findOptions = null; @@ -52,6 +51,6 @@ orderByFields = null; findOptions = new EntityFindOptions(); findOptions.setDistinct(false); -records = delegator.findList(starSchemaName, condition, selectFields, orderByFields, findOptions, false); +records = delegator.findList(starSchemaName, condition, selectedFields, orderByFields, findOptions, false); -context.put("records", records); +context.records = records; diff --git a/framework/bi/widget/BiForms.xml b/framework/bi/widget/BiForms.xml index 557978a3f4..a0b5cd05a4 100644 --- a/framework/bi/widget/BiForms.xml +++ b/framework/bi/widget/BiForms.xml @@ -24,7 +24,7 @@ under the License.
-