if ((this.getListingTypeValue().equals("0") && unit.isActive(currentDate)) || (this.getListingTypeValue().equals("1") && !unit.isActive(currentDate))) getUnitTree(buffer, unit);
if (this.getListingTypeValue().equals("0") && (unit.isActive(currentDate) || !unit.getActiveSubUnits(currentDate).isEmpty())) { getUnitTree(buffer, unit, unit.getActiveSubUnits(currentDate), currentDate, true); } else if (this.getListingTypeValue().equals("1") && (!unit.isActive(currentDate) || !unit.getInactiveSubUnits(currentDate).isEmpty())) { getUnitTree(buffer, unit, unit.getInactiveSubUnits(currentDate), currentDate, false); }
    public String getUnits() throws FenixFilterException, FenixServiceException {        StringBuffer buffer = new StringBuffer();        List<IUnit> allUnitsWithoutParent = getAllUnitsWithoutParent();        Collections.sort(allUnitsWithoutParent, new BeanComparator("name"));        Date currentDate = prepareCurrentDate();        for (IUnit unit : allUnitsWithoutParent) {            if ((this.getListingTypeValue().equals("0") && unit.isActive(currentDate))                    || (this.getListingTypeValue().equals("1") && !unit.isActive(currentDate)))                getUnitTree(buffer, unit);        }        return buffer.toString();    }