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.