}
protected Object transformEntity(Entity entity) {
log.debug("transforming group variable...");
DJGroupVariable columnsGroupVariable = (DJGroupVariable) entity;
AbstractColumn col = columnsGroupVariable.getColumnToApplyOperation();
DJCalculation op = columnsGroupVariable.getOperation();
JRDesignExpression expression = new JRDesignExpression();
//only variables from the last registered group are important now
List groupsList = getDjd().getGroupsList();
JRDesignGroup registeredGroup = (JRDesignGroup)groupsList.get(groupsList.size()-1);
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());
}
String variableName = col.getGroupVariableName(type, columnToGroupByProperty);
JRDesignVariable variable = new JRDesignVariable();
variable.setExpression(expression);
variable.setCalculation(columnsGroupVariable.getOperation().getValue());
variable.setName(variableName);
variable.setResetType(JRDesignVariable.RESET_TYPE_GROUP);
variable.setResetGroup(registeredGroup);