Example usage for java.util Calendar JULY

List of usage examples for java.util Calendar JULY

Introduction

In this page you can find the example usage for java.util Calendar JULY.

Prototype

int JULY

To view the source code for java.util Calendar JULY.

Click Source Link

Document

Value of the #MONTH field indicating the seventh month of the year in the Gregorian and Julian calendars.

Usage

From source file:org.jrimum.bopepo.TestFatorDeVencimento.java

@Test
public final void testToDate() {

    data.set(2000, Calendar.JULY, 3);
    Date date = DateUtils.truncate(data.getTime(), Calendar.DATE);
    assertEquals(date, FatorDeVencimento.toDate(1000));

    data.set(2000, Calendar.JULY, 5);
    date = DateUtils.truncate(data.getTime(), Calendar.DATE);
    assertEquals(date, FatorDeVencimento.toDate(1002));

    data.set(2025, Calendar.FEBRUARY, 21);
    date = DateUtils.truncate(data.getTime(), Calendar.DATE);
    assertEquals(date, FatorDeVencimento.toDate(9999));
}

From source file:nl.utwente.bigdata.MapReduce5.java

private static int translateMonthCalendar(String month) {
    int monthOut = 0;
    if (month.equals("Jul")) {
        monthOut = Calendar.JULY;
    }/*  w ww . ja  v  a2s  . co m*/
    if (month.equals("Jun")) {
        monthOut = Calendar.JUNE;
    }
    return monthOut;
}

From source file:ch.ralscha.extdirectspring.provider.RemoteProviderSimple.java

@ExtDirectMethod
public FormInfo method8(double d) {
    FormInfo info = new FormInfo();
    info.setBack(d);//from   w  ww. j a v  a 2  s . c  o  m
    info.setAdmin(false);
    info.setAge(32);
    info.setBirthday(new GregorianCalendar(1986, Calendar.JULY, 22).getTime());
    info.setName("John");
    info.setSalary(new BigDecimal("8720.20"));
    return info;
}

From source file:com.mycompany.CRMFly.serviceLayer.ClientsServiceImpl.java

@Transactional
public Map<Date, Double> getSumsFotDates(Clients client) {
    Long id = client.getId();//w  w  w  . ja  va 2  s .  c o  m

    Calendar calendar = new GregorianCalendar();
    Integer monthDifference = 0;
    if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL
            || calendar.get(Calendar.MONTH) == Calendar.JULY
            || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) {
        monthDifference = 0;
    } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY
            || calendar.get(Calendar.MONTH) == Calendar.AUGUST
            || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) {
        monthDifference = -1;
    } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE
            || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER
            || calendar.get(Calendar.MONTH) == Calendar.DECEMBER)
        monthDifference = -2;
    //     Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH);
    calendar.add(Calendar.MONTH, monthDifference);
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    //      calendar.add(Calendar.DAY_OF_MONTH, dayDifference-1);

    Date beginningOfQuarter = calendar.getTime();
    Double thisQuarterSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackOne = calendar.getTime();
    Double QuarterBackOneSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackTwo = calendar.getTime();
    Double QuarterBackTwoSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackThree = calendar.getTime();
    Double QuarterBackThreeSum = 0.0;

    List<Contracts> contracts = clientsDAO.getContractsForClient(id);
    HashMap<Date, Double> sums = new HashMap<Date, Double>();
    for (Contracts contract : contracts) {
        Date date = contract.getBegin_date();
        if (date.after(beginningOfQuarter))
            thisQuarterSum += contract.getTotalSum();
        else if (date.after(QuarterBackOne))
            QuarterBackOneSum += contract.getTotalSum();
        else if (date.after(QuarterBackTwo))
            QuarterBackTwoSum += contract.getTotalSum();
        else if (date.after(QuarterBackThree))
            QuarterBackThreeSum += contract.getTotalSum();
    }
    sums.put(beginningOfQuarter, thisQuarterSum);
    sums.put(QuarterBackOne, QuarterBackOneSum);
    sums.put(QuarterBackTwo, QuarterBackTwoSum);
    sums.put(QuarterBackThree, QuarterBackThreeSum);
    return sums;
}

From source file:Negocio.Produccion.Planificacion.GanttDemo.java

/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset./*ww w  .j  a v  a 2 s. co m*/
 */
public static IntervalCategoryDataset createDataset() {

    final TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
            new SimpleTimePeriod(date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(3, Calendar.JUNE, 2001), date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
            new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001), date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
            new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001), date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
            new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001))));

    final TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
            new SimpleTimePeriod(date(15, Calendar.MAY, 2001), date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(30, Calendar.JUNE, 2001), date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(1, Calendar.JULY, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
            new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001), date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001), date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001), date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
            new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001), date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001), date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
            new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001), date(11, Calendar.DECEMBER, 2001))));

    final TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}

From source file:com.mycompany.CRMFly.serviceLayer.ProductsServiceImpl.java

@Transactional
public Map<Date, Double> getSumsFotDates(Products product) {
    Long id = product.getId();//from  w  ww .ja  va 2 s. c o m

    Calendar calendar = new GregorianCalendar();
    Integer monthDifference = 0;
    if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL
            || calendar.get(Calendar.MONTH) == Calendar.JULY
            || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) {
        monthDifference = 0;
    } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY
            || calendar.get(Calendar.MONTH) == Calendar.AUGUST
            || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) {
        monthDifference = -1;
    } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE
            || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER
            || calendar.get(Calendar.MONTH) == Calendar.DECEMBER)
        monthDifference = -2;
    Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH);
    calendar.add(Calendar.MONTH, monthDifference);
    calendar.add(Calendar.DAY_OF_MONTH, dayDifference - 1);

    Date beginningOfQuarter = calendar.getTime();
    Double thisQuarterSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackOne = calendar.getTime();
    Double QuarterBackOneSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackTwo = calendar.getTime();
    Double QuarterBackTwoSum = 0.0;
    calendar.add(Calendar.MONTH, -3);
    Date QuarterBackThree = calendar.getTime();
    Double QuarterBackThreeSum = 0.0;

    List<PositionsInContract> positions = productsDAO.getContractPositionsForProduct(id);
    HashMap<Date, Double> sums = new HashMap<Date, Double>();
    for (PositionsInContract position : positions) {
        Long posID = position.getId();
        Contracts contract = productsDAO.getContractForPosition(posID);
        Date date = contract.getBegin_date();
        if (date.after(beginningOfQuarter))
            thisQuarterSum += position.getPrice() * position.getQuantity();
        else if (date.after(QuarterBackOne))
            QuarterBackOneSum += position.getPrice() * position.getQuantity();
        else if (date.after(QuarterBackTwo))
            QuarterBackTwoSum += position.getPrice() * position.getQuantity();
        else if (date.after(QuarterBackThree))
            QuarterBackThreeSum += position.getPrice() * position.getQuantity();
    }
    sums.put(beginningOfQuarter, thisQuarterSum);
    sums.put(QuarterBackOne, QuarterBackOneSum);
    sums.put(QuarterBackTwo, QuarterBackTwoSum);
    sums.put(QuarterBackThree, QuarterBackThreeSum);
    return sums;
}

From source file:org.pentaho.metaverse.util.VfsDateRangeFilterTest.java

@Test
public void testParseDateString() throws Exception {
    filter = new VfsDateRangeFilter(format);
    Date date = filter.parseDateString(start);
    assertNotNull(date);/*w ww  . j  ava  2  s  . c o m*/

    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    assertEquals(2015, cal.get(Calendar.YEAR));
    assertEquals(Calendar.JULY, cal.get(Calendar.MONTH));
    assertEquals(8, cal.get(Calendar.DAY_OF_MONTH));
}

From source file:org.pivotal.gemfire.cache.CacheRegionQueryUsingToDateTest.java

@Before
public void setupPeople() {
    Region<Long, Person> localPeople = gemfireCache.getRegion("/People");

    put(localPeople, createPerson("Jon", "Doe", createDate(1979, Calendar.MAY, 15)));
    put(localPeople, createPerson("Jane", "Doe", createDate(1981, Calendar.APRIL, 21)));
    put(localPeople, createPerson("Pie", "Doe", createDate(1997, Calendar.NOVEMBER, 22)));
    put(localPeople, createPerson("Cookie", "Doe", createDate(2008, Calendar.AUGUST, 16)));
    put(localPeople, createPerson("Sour", "Doe", createDate(2012, Calendar.DECEMBER, 1)));
    put(localPeople, createPerson("Jack", "Handy", createDate(1977, Calendar.MAY, 10)));
    put(localPeople, createPerson("Sandy", "Handy", createDate(1977, Calendar.MARCH, 3)));
    put(localPeople, createPerson("Jack", "Black", createDate(1972, Calendar.JUNE, 26)));
    put(localPeople, createPerson("Ben", "Dover", createDate(1969, Calendar.MAY, 5)));
    put(localPeople, createPerson("Ima", "Pigg", createDate(1975, Calendar.JULY, 17)));

    assertThat(localPeople.size(), is(equalTo(10)));
}

From source file:org.polymap.kaps.ui.filter.VertraegeStalaAgrarFilter.java

protected Query<VertragComposite> createFilterQuery(final IFilterEditorSite site,
        final KapsRepository repository) {

    Integer quartal = Integer.parseInt((String) site.getFieldValue("Quartal"));
    Integer jahr = Integer.parseInt((String) site.getFieldValue("Jahr"));

    Calendar lowerCal = new GregorianCalendar();
    lowerCal.set(Calendar.YEAR, jahr);
    lowerCal.set(Calendar.DAY_OF_MONTH, 1);
    lowerCal.set(Calendar.HOUR_OF_DAY, 0);
    lowerCal.set(Calendar.MINUTE, 0);
    lowerCal.set(Calendar.SECOND, 0);
    lowerCal.set(Calendar.MILLISECOND, 0);

    Calendar upperCal = new GregorianCalendar();
    upperCal.setTime(lowerCal.getTime());

    switch (quartal) {
    case 1://  www  . j  a v  a 2 s  .  c  o m
        lowerCal.set(Calendar.MONTH, Calendar.JANUARY);
        upperCal.set(Calendar.MONTH, Calendar.APRIL);
        break;
    case 2:
        lowerCal.set(Calendar.MONTH, Calendar.APRIL);
        upperCal.set(Calendar.MONTH, Calendar.JULY);
        break;
    case 3:
        lowerCal.set(Calendar.MONTH, Calendar.JULY);
        upperCal.set(Calendar.MONTH, Calendar.OCTOBER);
        break;
    case 4:
        lowerCal.set(Calendar.MONTH, Calendar.OCTOBER);
        upperCal.roll(Calendar.YEAR, true);
        upperCal.set(Calendar.MONTH, Calendar.JANUARY);
        break;
    default:
        throw new IllegalStateException("Quartal " + quartal + " unbekannt!");
    }

    FlurstueckComposite flurstueckTemplate = QueryExpressions.templateFor(FlurstueckComposite.class);
    VertragComposite vertragTemplate = QueryExpressions.templateFor(VertragComposite.class);

    BooleanExpression dExpr = null;
    BooleanExpression vExpr = null;
    {
        Query<VertragComposite> vertraege = repository().findEntities(VertragComposite.class,
                QueryExpressions.and(QueryExpressions.ge(vertragTemplate.vertragsDatum(), lowerCal.getTime()),
                        QueryExpressions.lt(vertragTemplate.vertragsDatum(), upperCal.getTime())),
                0, -1);

        for (VertragComposite kv : vertraege) {
            BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.vertrag(), kv);
            if (vExpr == null) {
                vExpr = newExpr;
            } else {
                vExpr = QueryExpressions.or(vExpr, newExpr);
            }
        }

    }
    // falls keine Vertrge gefunden werden, wrden spter alle Flurstcke
    // selektiert -> StackOverFlow
    if (vExpr != null) {
        BooleanExpression nExpr = null;
        {
            Query<NutzungComposite> nutzungen = repository().findEntities(NutzungComposite.class, null, 0, -1);
            for (NutzungComposite nutzung : nutzungen) {
                if (nutzung.isAgrar().get() != null && nutzung.isAgrar().get() == Boolean.TRUE) {
                    BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.nutzung(), nutzung);
                    if (nExpr == null) {
                        nExpr = newExpr;
                    } else {
                        nExpr = QueryExpressions.or(nExpr, newExpr);
                    }
                }
            }
        }

        GemeindeComposite gemeinde = (GemeindeComposite) site.getFieldValue("gemeinde");
        BooleanExpression gExpr = null;
        if (gemeinde != null) {
            GemarkungComposite gemarkungTemplate = QueryExpressions.templateFor(GemarkungComposite.class);
            Query<GemarkungComposite> gemarkungen = repository().findEntities(GemarkungComposite.class,
                    QueryExpressions.eq(gemarkungTemplate.gemeinde(), gemeinde), 0, -1);
            for (GemarkungComposite gemarkung : gemarkungen) {
                BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.gemarkung(), gemarkung);
                if (gExpr == null) {
                    gExpr = newExpr;
                } else {
                    gExpr = QueryExpressions.or(gExpr, newExpr);
                }
            }
        }

        BooleanExpression expr = QueryExpressions.gt(flurstueckTemplate.verkaufteFlaeche(), 1000d);
        if (vExpr != null) {
            expr = QueryExpressions.and(expr, vExpr);
        }
        if (nExpr != null) {
            expr = QueryExpressions.and(expr, nExpr);
        }
        if (gExpr != null) {
            expr = QueryExpressions.and(expr, gExpr);
        }

        Query<FlurstueckComposite> allFlurstuecke = repository().findEntities(FlurstueckComposite.class, expr,
                0, getMaxResults());

        for (FlurstueckComposite flurstueck : allFlurstuecke) {
            BooleanExpression newExpr = QueryExpressions.eq(vertragTemplate.identity(),
                    flurstueck.vertrag().get().identity().get());
            if (dExpr == null) {
                dExpr = newExpr;
            } else {
                dExpr = QueryExpressions.or(dExpr, newExpr);
            }
        }
        // flurstcksfilter angegeben und keine flurstcke gefunden
        if (dExpr == null) {
            dExpr = QueryExpressions.eq(vertragTemplate.identity(), "nothing");
        }
    } else {
        dExpr = QueryExpressions.eq(vertragTemplate.identity(), "nothing");
    }

    BooleanExpression geeignetExpr = QueryExpressions.eq(vertragTemplate.fuerAuswertungGeeignet(),
            Boolean.TRUE);

    if (dExpr != null) {
        dExpr = QueryExpressions.and(dExpr, geeignetExpr);
    } else {
        dExpr = geeignetExpr;
    }

    return repository().findEntities(VertragComposite.class, dExpr, 0, getMaxResults());
}

From source file:org.polymap.kaps.ui.filter.VertraegeStalaBaulandFilter.java

protected Query<VertragComposite> createFilterQuery(final IFilterEditorSite site,
        final KapsRepository repository) {

    Integer quartal = Integer.parseInt((String) site.getFieldValue("Quartal"));
    Integer jahr = Integer.parseInt((String) site.getFieldValue("Jahr"));

    Calendar lowerCal = new GregorianCalendar();
    lowerCal.set(Calendar.YEAR, jahr);
    lowerCal.set(Calendar.DAY_OF_MONTH, 1);
    lowerCal.set(Calendar.HOUR_OF_DAY, 0);
    lowerCal.set(Calendar.MINUTE, 0);
    lowerCal.set(Calendar.SECOND, 0);
    lowerCal.set(Calendar.MILLISECOND, 0);

    Calendar upperCal = new GregorianCalendar();
    upperCal.setTime(lowerCal.getTime());

    switch (quartal) {
    case 1:// w w  w . jav  a  2  s .  c  om
        lowerCal.set(Calendar.MONTH, Calendar.JANUARY);
        upperCal.set(Calendar.MONTH, Calendar.APRIL);
        break;
    case 2:
        lowerCal.set(Calendar.MONTH, Calendar.APRIL);
        upperCal.set(Calendar.MONTH, Calendar.JULY);
        break;
    case 3:
        lowerCal.set(Calendar.MONTH, Calendar.JULY);
        upperCal.set(Calendar.MONTH, Calendar.OCTOBER);
        break;
    case 4:
        lowerCal.set(Calendar.MONTH, Calendar.OCTOBER);
        upperCal.roll(Calendar.YEAR, true);
        upperCal.set(Calendar.MONTH, Calendar.JANUARY);
        break;
    default:
        throw new IllegalStateException("Quartal " + quartal + " unbekannt!");
    }

    FlurstueckComposite flurstueckTemplate = QueryExpressions.templateFor(FlurstueckComposite.class);
    VertragComposite vertragTemplate = QueryExpressions.templateFor(VertragComposite.class);

    BooleanExpression dExpr = null;
    BooleanExpression vExpr = null;
    {
        Query<VertragComposite> vertraege = repository().findEntities(VertragComposite.class,
                QueryExpressions.and(QueryExpressions.ge(vertragTemplate.vertragsDatum(), lowerCal.getTime()),
                        QueryExpressions.lt(vertragTemplate.vertragsDatum(), upperCal.getTime())),
                0, -1);

        for (VertragComposite kv : vertraege) {
            BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.vertrag(), kv);
            if (vExpr == null) {
                vExpr = newExpr;
            } else {
                vExpr = QueryExpressions.or(vExpr, newExpr);
            }
        }

    }
    // falls keine Vertrge gefunden werden, wrden spter alle Flurstcke
    // selektiert -> StackOverFlow
    if (vExpr != null) {
        BooleanExpression nExpr = null;
        {
            Query<NutzungComposite> nutzungen = repository().findEntities(NutzungComposite.class, null, 0, -1);
            for (NutzungComposite nutzung : nutzungen) {
                if (nutzung.isAgrar().get() == null || nutzung.isAgrar().get() == Boolean.FALSE) {
                    BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.nutzung(), nutzung);
                    if (nExpr == null) {
                        nExpr = newExpr;
                    } else {
                        nExpr = QueryExpressions.or(nExpr, newExpr);
                    }
                }
            }
        }

        GemeindeComposite gemeinde = (GemeindeComposite) site.getFieldValue("gemeinde");
        BooleanExpression gExpr = null;
        if (gemeinde != null) {
            GemarkungComposite gemarkungTemplate = QueryExpressions.templateFor(GemarkungComposite.class);
            Query<GemarkungComposite> gemarkungen = repository().findEntities(GemarkungComposite.class,
                    QueryExpressions.eq(gemarkungTemplate.gemeinde(), gemeinde), 0, -1);
            for (GemarkungComposite gemarkung : gemarkungen) {
                BooleanExpression newExpr = QueryExpressions.eq(flurstueckTemplate.gemarkung(), gemarkung);
                if (gExpr == null) {
                    gExpr = newExpr;
                } else {
                    gExpr = QueryExpressions.or(gExpr, newExpr);
                }
            }
        }

        BooleanExpression expr = QueryExpressions.gt(flurstueckTemplate.verkaufteFlaeche(), 100d);
        if (vExpr != null) {
            expr = QueryExpressions.and(expr, vExpr);
        }
        if (nExpr != null) {
            expr = QueryExpressions.and(expr, nExpr);
        }
        if (gExpr != null) {
            expr = QueryExpressions.and(expr, gExpr);
        }

        Query<FlurstueckComposite> allFlurstuecke = repository().findEntities(FlurstueckComposite.class, expr,
                0, getMaxResults());

        for (FlurstueckComposite flurstueck : allFlurstuecke) {
            BooleanExpression newExpr = QueryExpressions.eq(vertragTemplate.identity(),
                    flurstueck.vertrag().get().identity().get());
            if (dExpr == null) {
                dExpr = newExpr;
            } else {
                dExpr = QueryExpressions.or(dExpr, newExpr);
            }
        }
        // flurstcksfilter angegeben und keine flurstcke gefunden
        if (dExpr == null) {
            dExpr = QueryExpressions.eq(vertragTemplate.identity(), "nothing");
        }
    } else {
        dExpr = QueryExpressions.eq(vertragTemplate.identity(), "nothing");
    }

    BooleanExpression geeignetExpr = QueryExpressions.eq(vertragTemplate.fuerAuswertungGeeignet(),
            Boolean.TRUE);

    if (dExpr != null) {
        dExpr = QueryExpressions.and(dExpr, geeignetExpr);
    } else {
        dExpr = geeignetExpr;
    }

    return repository().findEntities(VertragComposite.class, dExpr, 0, getMaxResults());
}