Source:
private int writeConditions(final int currentRowNum, final HSSFWorkbook xlsBook, final HSSFSheet xlsSheet, final List<MeasurementVariable> conditions, final MeasurementRow trialObservation, final Workbook workbook) { final List<MeasurementVariable> arrangedConditions = new ArrayList<>(); List<MeasurementVariable> filteredConditions = new ArrayList<>(); if (conditions != null) { arrangedConditions.addAll(conditions); Collections.sort(arrangedConditions, new Comparator<MeasurementVariable>() { @Override public int compare(final MeasurementVariable var1, final MeasurementVariable var2) { return var1.getName().compareToIgnoreCase(var2.getName()); } }); for (final MeasurementVariable variable : arrangedConditions) { if (!ExcelExportStudyServiceImpl.STUDY_DETAILS_IDS.contains(variable.getTermId())) { filteredConditions.add(variable); if (PhenotypicType.TRIAL_ENVIRONMENT == this.getRoleOfVariableInTrialObservations(variable, trialObservation)) { if (variable.getTermId() == 8190) { final String locationAlias = variable.getName(); variable.setName("LOCATION_ID"); final Integer locationId = new Integer( trialObservation.getMeasurementDataValue(variable.getTermId())); filteredConditions.add(createLocationNameVariable(locationId,locationAlias)); } variable.setValue(trialObservation.getMeasurementDataValue(variable.getTermId())); if (variable.getDataTypeId() == TermId.CATEGORICAL_VARIABLE.getId()) { variable.setPossibleValues(this.fieldbookService.getAllPossibleValues(variable.getTermId())); } } } } } filteredConditions = workbook.arrangeMeasurementVariables(filteredConditions); return this.writeSection(currentRowNum, xlsBook, xlsSheet, filteredConditions, "export.study.description.column.condition", 51, 153, 102); }

Target:
private int writeConditions(final int currentRowNum, final HSSFWorkbook xlsBook, final HSSFSheet xlsSheet, final List<MeasurementVariable> conditions, final MeasurementRow trialObservation, final Workbook workbook) { final List<MeasurementVariable> arrangedConditions = new ArrayList<>(); List<MeasurementVariable> filteredConditions = new ArrayList<>(); if (conditions != null) { arrangedConditions.addAll(conditions); Collections.sort(arrangedConditions, new Comparator<MeasurementVariable>() { @Override public int compare(final MeasurementVariable var1, final MeasurementVariable var2) { return var1.getName().compareToIgnoreCase(var2.getName()); } }); for (final MeasurementVariable variable : arrangedConditions) { if (!ExcelExportStudyServiceImpl.STUDY_DETAILS_IDS.contains(variable.getTermId())) { filteredConditions.add(variable); if (PhenotypicType.TRIAL_ENVIRONMENT == this.getRoleOfVariableInTrialObservations(variable, trialObservation)) { if (variable.getTermId() == TermId.LOCATION_ID.getId()) { final String locationAlias = variable.getName(); variable.setName(TermId.LOCATION_ID.name()); final Integer locationId = new Integer( trialObservation.getMeasurementDataValue(variable.getTermId())); filteredConditions.add(createLocationNameVariable(locationId,locationAlias)); } variable.setValue(trialObservation.getMeasurementDataValue(variable.getTermId())); if (variable.getDataTypeId() == TermId.CATEGORICAL_VARIABLE.getId()) { variable.setPossibleValues(this.fieldbookService.getAllPossibleValues(variable.getTermId())); } } } } } filteredConditions = workbook.arrangeMeasurementVariables(filteredConditions); return this.writeSection(currentRowNum, xlsBook, xlsSheet, filteredConditions, "export.study.description.column.condition", 51, 153, 102); }