List of usage examples for java.util Calendar APRIL
int APRIL
To view the source code for java.util Calendar APRIL.
Click Source Link
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:com.mycompany.CRMFly.serviceLayer.ClientsServiceImpl.java
@Transactional public Map<Date, Double> getSumsFotDates(Clients client) { Long id = client.getId();/*from w w w .ja v a 2 s. c om*/ 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:gov.nih.nci.ncicb.tcga.dcc.annotations.web.AnnotationExportControllerImplFastTest.java
@Before public void setUp() throws Exception { context = new JUnit4Mockery(); annotationExportController = new AnnotationExportControllerImpl(); mockSession = context.mock(HttpSession.class); modelMap = new ModelMap(); searchResults = new ArrayList<DccAnnotation>(); DccAnnotation annotation = new DccAnnotation(); DccAnnotationCategory category = new DccAnnotationCategory(); DccAnnotationClassification classification = new DccAnnotationClassification(); final DccAnnotationNote note1 = new DccAnnotationNote(); final DccAnnotationNote note2 = new DccAnnotationNote(); note1.setNoteText("this is my note1"); note2.setNoteText("this\nis\tmy note2"); List<DccAnnotationNote> notes = new LinkedList<DccAnnotationNote>() { {//from ww w . j av a2 s.co m add(note1); add(note2); } }; annotation.setNotes(notes); classification.setAnnotationClassificationName("this is a classification"); category.setCategoryName("this is a category"); category.setAnnotationClassification(classification); annotation.setAnnotationCategory(category); annotation.setApproved(true); annotation.setCreatedBy("me"); Calendar march142011 = Calendar.getInstance(); march142011.set(Calendar.MONTH, Calendar.APRIL); march142011.set(Calendar.DAY_OF_MONTH, 14); march142011.set(Calendar.YEAR, 2011); annotation.setDateCreated(march142011.getTime()); annotation.setId(123L); DccAnnotationItem item1 = new DccAnnotationItem(); DccAnnotationItemType itemType1 = new DccAnnotationItemType(); itemType1.setItemTypeName("type1"); item1.setItem("item1"); item1.setItemType(itemType1); Tumor disease1 = new Tumor(); disease1.setTumorName("dis1"); item1.setDisease(disease1); annotation.addItem(item1); annotation.setId(123L); DccAnnotationItem item2 = new DccAnnotationItem(); DccAnnotationItemType itemType2 = new DccAnnotationItemType(); itemType2.setItemTypeName("type2"); item2.setItemType(itemType2); item2.setItem("item2"); Tumor disease2 = new Tumor(); disease2.setTumorName("dis2"); item2.setDisease(disease2); annotation.addItem(item2); searchResults.add(annotation); context.checking(new Expectations() { { one(mockSession).getAttribute(AnnotationControllerImpl.ATTRIBUTE_LAST_SEARCH_RESULTS); will(returnValue(searchResults)); } }); }
From source file:ubic.gemma.core.analysis.preprocess.batcheffects.BatchInfoPopulationServiceTest.java
@Test public void testDatesToBatchC() { BatchInfoPopulationHelperServiceImpl ser = new BatchInfoPopulationHelperServiceImpl(); Calendar cal = Calendar.getInstance(); cal.set(2004, Calendar.APRIL, 10, 10, 1, 1); Date d = cal.getTime();/*from www . j a va 2s .c om*/ Collection<Date> dates = new HashSet<>(); dates.add(d); dates.add(DateUtils.addHours(d, 2)); // should be merged back. dates.add(DateUtils.addHours(d, 3)); // merged back. dates.add(DateUtils.addHours(d, 4)); // merged back. dates.add(DateUtils.addHours(d, 5)); // merged back. dates.add(DateUtils.addHours(d, 6)); // merged back. dates.add(DateUtils.addHours(d, 7)); // merged back. dates.add(DateUtils.addHours(d, 8)); // merged back. Map<String, Collection<Date>> actual = ser.convertDatesToBatches(dates); this.debug(actual); Set<String> s = new HashSet<>(actual.keySet()); assertEquals(1, s.size()); }
From source file:org.spring.data.gemfire.cache.SpringGemfireTemplateTests.java
@Before public void setup() { assertNotNull("The '/Customers' Region was not properly configured and initialized!", customers); if (customers.isEmpty()) { assertEquals(0, customers.size()); put("Jon", "Doe", createDate(1959, Calendar.FEBRUARY, 14)); put("Jane", "Doe", createDate(1966, Calendar.APRIL, 4)); put("Fro", "Doe", createDate(2002, Calendar.DECEMBER, 16)); expectedCustomers = new ArrayList<>(3); expectedCustomers.add(put("Sour", "Doe", createDate(1983, Calendar.OCTOBER, 31))); expectedCustomers.add(put("Pie", "Doe", createDate(1988, Calendar.NOVEMBER, 22))); expectedCustomers.add(put("Cookie", "Doe", createDate(1991, Calendar.MAY, 27))); assertFalse(expectedCustomers.isEmpty()); assertEquals(3, expectedCustomers.size()); }//from ww w . jav a2 s . c o m }
From source file:org.caleydo.data.importer.tcga.FirehoseProvider.java
public boolean isPost20140416() { return relevantDate.get(Calendar.YEAR) >= 2014 && relevantDate.get(Calendar.MONTH) >= Calendar.APRIL; }
From source file:com.mycompany.CRMFly.serviceLayer.ProductsServiceImpl.java
@Transactional public Map<Date, Double> getSumsFotDates(Products product) { Long id = product.getId();/*from www .j a va 2 s. com*/ 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.openmeetings.test.calendar.TestSendIcalMessage.java
public void simpleInvitionIcalLink() { // Create a TimeZone TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); TimeZone timezone = registry.getTimeZone("America/Mexico_City"); VTimeZone tz = timezone.getVTimeZone(); // Start Date is on: April 1, 2008, 9:00 am java.util.Calendar startDate = new GregorianCalendar(); startDate.setTimeZone(timezone);/*from w w w .j ava2 s . c o m*/ startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL); startDate.set(java.util.Calendar.DAY_OF_MONTH, 1); startDate.set(java.util.Calendar.YEAR, 2008); startDate.set(java.util.Calendar.HOUR_OF_DAY, 9); startDate.set(java.util.Calendar.MINUTE, 0); startDate.set(java.util.Calendar.SECOND, 0); // End Date is on: April 1, 2008, 13:00 java.util.Calendar endDate = new GregorianCalendar(); endDate.setTimeZone(timezone); endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL); endDate.set(java.util.Calendar.DAY_OF_MONTH, 1); endDate.set(java.util.Calendar.YEAR, 2008); endDate.set(java.util.Calendar.HOUR_OF_DAY, 13); endDate.set(java.util.Calendar.MINUTE, 0); endDate.set(java.util.Calendar.SECOND, 0); // Create the event String eventName = "Progress Meeting"; DateTime start = new DateTime(startDate.getTime()); DateTime end = new DateTime(endDate.getTime()); VEvent meeting = new VEvent(start, end, eventName); // add timezone info.. meeting.getProperties().add(tz.getTimeZoneId()); // generate unique identifier.. UidGenerator ug; try { ug = new UidGenerator("uidGen"); Uid uid = ug.generateUid(); meeting.getProperties().add(uid); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } // add attendees.. Attendee dev1 = new Attendee(URI.create("mailto:dev1@mycompany.com")); dev1.getParameters().add(Role.REQ_PARTICIPANT); dev1.getParameters().add(new Cn("Developer 1")); meeting.getProperties().add(dev1); Attendee dev2 = new Attendee(URI.create("mailto:dev2@mycompany.com")); dev2.getParameters().add(Role.OPT_PARTICIPANT); dev2.getParameters().add(new Cn("Developer 2")); meeting.getProperties().add(dev2); // Create a calendar net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar(); icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN")); icsCalendar.getProperties().add(CalScale.GREGORIAN); icsCalendar.getProperties().add(Version.VERSION_2_0); // Add the event and print icsCalendar.getComponents().add(meeting); Organizer orger = new Organizer(URI.create("seba.wagner@gmail.com")); orger.getParameters().add(new Cn("Sebastian Wagner")); meeting.getProperties().add(orger); icsCalendar.getProperties().add(Method.REQUEST); System.out.println(icsCalendar); ByteArrayOutputStream bout = new ByteArrayOutputStream(); CalendarOutputter outputter = new CalendarOutputter(); try { outputter.output(icsCalendar, bout); iCalMimeBody = bout.toByteArray(); sendIcalMessage(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ValidationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
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://from w ww.j ava2s . com 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:/*from w w w . jav a2 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()); }