}
}
protected Object transformEntity(Entity entity) {
log.debug("transforming group variable...");
DJGroupVariableDef columnsGroupVariable = (DJGroupVariableDef) entity;
DJCalculation op = columnsGroupVariable.getOperation();
JRDesignExpression expression = new JRDesignExpression();
String valueClassName = null;
String initialExpression = null;
if (columnsGroupVariable.getColumnProperty() != null) { //A variable that operates over a FIELD
ColumnProperty prop = columnsGroupVariable.getColumnProperty();
expression.setText("$F{" + prop.getProperty() + "}");
expression.setValueClassName(prop.getValueClassName());
registerField(prop);
valueClassName = ExpressionUtils.getValueClassNameForOperation(op, prop);
initialExpression = ExpressionUtils.getInitialValueExpressionForOperation(op,prop);
} else {
AbstractColumn col = columnsGroupVariable.getColumnToApplyOperation();
if (col instanceof ExpressionColumn && ((ExpressionColumn)col).getExpressionForCalculation() != null){
ExpressionColumn expcol = (ExpressionColumn)col;
expression.setText(expcol.getTextForExpressionForCalculartion());
expression.setValueClassName(expcol.getExpressionForCalculation().getClassName());
}
else {
expression.setText(col.getTextForExpression());
expression.setValueClassName(col.getValueClassNameForExpression());
}
valueClassName = col.getVariableClassName(op);
initialExpression = col.getInitialExpression(op);
}
JRDesignVariable variable = new JRDesignVariable();
variable.setExpression(expression);
variable.setCalculation(columnsGroupVariable.getOperation().getValue());
variable.setName(columnsGroupVariable.getName());
if (group != null) {
variable.setResetType(JRDesignVariable.RESET_TYPE_GROUP);
variable.setResetGroup(group);
}