List of usage examples for java.util Calendar OCTOBER
int OCTOBER
To view the source code for java.util Calendar OCTOBER.
Click Source Link
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. ja v a 2 s.c o m*/ }
From source file:org.sipfoundry.sipxconfig.device.DeviceTimeZone.java
private void setDstParameters(String dstRule) { if (m_useDaylight) { // DST: Daylight Savings Time // LST: Local Standard Time - local time when DST is not in effect // LDT: Local Daylight Time - local time when DST is in effect if (dstRule.equals(DST_US)) { // http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world#North_America // into DST - 02:00 LST --> 03:00 LDT // out of DST - 02:00 LDT --> 01:00 LST m_startMonth = Calendar.MARCH; m_startWeek = 2;//from w ww. j a v a2s. c o m m_startDayOfWeek = Calendar.SUNDAY; m_startTime = 2/*am*/ * MINUTES_PER_HOUR; // 02:00 LST m_stopMonth = Calendar.NOVEMBER; m_stopWeek = 1; m_stopDayOfWeek = Calendar.SUNDAY; m_stopTime = 2/*am*/ * MINUTES_PER_HOUR; // 02:00 LDT } else if (dstRule.equals(DST_EU)) { // http://en.wikipedia.org/wiki/European_Summer_Time // into DST - 01:00 GMT --> 02:00 GMT // out of DST - 01:00 GMT --> 00:00 GMT m_startMonth = Calendar.MARCH; m_startWeek = DST_LASTWEEK; m_startDayOfWeek = Calendar.SUNDAY; // LST = 01:00 GMT + Time Zone Offset m_startTime = (1/*am*/ * MINUTES_PER_HOUR) + getOffset(); m_stopMonth = Calendar.OCTOBER; m_stopWeek = DST_LASTWEEK; m_stopDayOfWeek = Calendar.SUNDAY; // LDT = 01:00 GMT + Time Zone Offset + Daylight Savings m_stopTime = (1/*am*/ * MINUTES_PER_HOUR) + getOffset() + getDstSavings(); } } else { // if we don't use DST, set the parameters to 0 to not confuse the phones m_startMonth = 0; m_startWeek = 0; m_startDayOfWeek = 0; m_startTime = 0; m_stopMonth = 0; m_stopDayOfWeek = 0; m_stopWeek = 0; m_stopTime = 0; } }
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 a v a2 s. co 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://from w w w. java2s.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.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()); }
From source file:com.prowidesoftware.swift.model.field.Field11RTest.java
@Test public void testSetters() { Field11R f = new Field11R(); f.setComponent1("103"); f.setComponent2("151111"); f.setComponent3("4444666666"); assertEquals("103", f.getComponent1()); assertEquals("151111", f.getComponent2()); assertEquals("4444666666", f.getComponent3()); assertNull(f.getComponent4());//from w w w. j a va 2 s. c o m assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", f.getValue()); f = new Field11R(); f.setComponent1("103"); f.setComponent2("151111"); f.setComponent3("4444"); f.setComponent4("666666"); assertEquals("103", f.getComponent1()); assertEquals("151111", f.getComponent2()); assertEquals("4444", f.getComponent3()); assertEquals("666666", f.getComponent4()); assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", f.getValue()); f = new Field11R(); f.setComponent1("103"); Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2015); cal.set(Calendar.MONTH, Calendar.OCTOBER); cal.set(Calendar.DAY_OF_MONTH, 19); f.setComponent2(cal); f.setComponent3("4444"); f.setComponent4("666666"); assertEquals("103", f.getComponent1()); assertEquals("151019", f.getComponent2()); assertEquals("4444", f.getComponent3()); assertEquals("666666", f.getComponent4()); assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151019" + FINWriterVisitor.SWIFT_EOL + "4444666666", f.getValue()); f = new Field11R(); f.setComponent1("103"); f.setComponent2("151111"); f.setComponent3(4444); f.setComponent4(666666); assertEquals("103", f.getComponent1()); assertEquals("151111", f.getComponent2()); assertEquals("4444", f.getComponent3()); assertEquals("666666", f.getComponent4()); assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "4444666666", f.getValue()); f = new Field11R(); f.setComponent1("103"); f.setComponent2("151111"); f.setComponent3(4); f.setComponent4(6); assertEquals("103", f.getComponent1()); assertEquals("151111", f.getComponent2()); assertEquals("4", f.getComponent3()); assertEquals("6", f.getComponent4()); assertEquals("103" + FINWriterVisitor.SWIFT_EOL + "151111" + FINWriterVisitor.SWIFT_EOL + "46", f.getValue()); }
From source file:Negocio.Produccion.Planificacion.GanttDemo.java
/** * Creates a sample dataset for a Gantt chart. * * @return The dataset.// www . ja v a 2 s . c o 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:org.polymap.kaps.ui.filter.VertraegeStabuFilter.java
protected Query<VertragComposite> createFilterQuery(final IFilterEditorSite site, final KapsRepository repository) { Integer quartal = null;//from ww w.ja v a2s . c o m try { quartal = Integer.parseInt((String) site.getFieldValue("Quartal")); } catch (Exception e) { showError("Quartal fehlt", "Bitte whlen Sie ein Quartal aus."); return null; } Integer jahr = null; try { jahr = Integer.parseInt((String) site.getFieldValue("Jahr")); } catch (Exception e) { showError("Jahr fehlt", "Bitte whlen Sie ein Jahr aus."); return null; } 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: 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 = vExpr; if (nExpr != null) { expr = expr == null ? nExpr : QueryExpressions.and(expr, nExpr); } if (gExpr != null) { expr = expr == null ? gExpr : 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.openmrs.module.radiology.order.RadiologyOrderServiceImplComponentTest.java
/** * @see RadiologyOrderServiceImpl#saveRadiologyOrderEncounter(Patient,Provider,Date) * @verifies create radiology order encounter *///from w w w . j a v a 2s . c o m @Test public void saveRadiologyOrderEncounter_shouldCreateRadiologyOrderEncounter() throws Exception { // given Patient patient = patientService.getPatient(PATIENT_ID_WITH_ONLY_ONE_NON_RADIOLOGY_ORDER); Provider provider = providerService.getProviderByUuid(RADIOLOGY_ORDER_PROVIDER_UUID); Date encounterDatetime = new GregorianCalendar(2010, Calendar.OCTOBER, 10).getTime(); EncounterSearchCriteriaBuilder encounterSearchCriteria = new EncounterSearchCriteriaBuilder() .setPatient(patient); List<Encounter> matchingEncounters = encounterService .getEncounters(encounterSearchCriteria.createEncounterSearchCriteria()); assertThat(matchingEncounters, is(empty())); Encounter encounter = (Encounter) saveRadiologyOrderEncounterMethod.invoke(radiologyOrderServiceImpl, new Object[] { patient, provider, encounterDatetime }); assertNotNull(encounter); encounterSearchCriteria = new EncounterSearchCriteriaBuilder().setPatient(patient) .setProviders(Arrays.asList(provider)).setFromDate(encounterDatetime).setToDate(encounterDatetime) .setEncounterTypes(Arrays.asList(radiologyProperties.getRadiologyOrderEncounterType())); matchingEncounters = encounterService .getEncounters(encounterSearchCriteria.createEncounterSearchCriteria()); assertThat(matchingEncounters, hasItem(encounter)); assertThat(matchingEncounters.size(), is(1)); }
From source file:com.netflix.simianarmy.basic.BasicCalendar.java
/** * Load holidays./* w ww .j a v a 2 s. co m*/ * * @param year * the year */ protected void loadHolidays(int year) { holidays.clear(); // these aren't all strictly holidays, but days when engineers will likely // not be in the office to respond to rampaging monkeys // new years, or closest work day holidays.add(workDayInYear(year, Calendar.JANUARY, 1)); // 3rd monday == MLK Day holidays.add(dayOfYear(year, Calendar.JANUARY, Calendar.MONDAY, 3)); // 3rd monday == Presidents Day holidays.add(dayOfYear(year, Calendar.FEBRUARY, Calendar.MONDAY, 3)); // last monday == Memorial Day holidays.add(dayOfYear(year, Calendar.MAY, Calendar.MONDAY, -1)); // 4th of July, or closest work day holidays.add(workDayInYear(year, Calendar.JULY, 4)); // first monday == Labor Day holidays.add(dayOfYear(year, Calendar.SEPTEMBER, Calendar.MONDAY, 1)); // second monday == Columbus Day holidays.add(dayOfYear(year, Calendar.OCTOBER, Calendar.MONDAY, 2)); // veterans day, Nov 11th, or closest work day holidays.add(workDayInYear(year, Calendar.NOVEMBER, 11)); // 4th thursday == Thanksgiving holidays.add(dayOfYear(year, Calendar.NOVEMBER, Calendar.THURSDAY, 4)); // 4th friday == "black friday", monkey goes shopping! holidays.add(dayOfYear(year, Calendar.NOVEMBER, Calendar.FRIDAY, 4)); // christmas eve holidays.add(dayOfYear(year, Calendar.DECEMBER, 24)); // christmas day holidays.add(dayOfYear(year, Calendar.DECEMBER, 25)); // day after christmas holidays.add(dayOfYear(year, Calendar.DECEMBER, 26)); // new years eve holidays.add(dayOfYear(year, Calendar.DECEMBER, 31)); // mark the holiday set with the year, so on Jan 1 it will automatically // recalculate the holidays for next year holidays.add(year); }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for getting short description of month by the number * of month//from w w w . ja va 2 s. c o m * * @param mthNum * @return */ public static String getMonthShortDesc(int mthNum) { String mthShortDesc; switch (mthNum) { case Calendar.JANUARY: { mthShortDesc = DateTimeConstants.SHORT_JANUARY; break; } case Calendar.FEBRUARY: { mthShortDesc = DateTimeConstants.SHORT_FEBRUARY; break; } case Calendar.MARCH: { mthShortDesc = DateTimeConstants.SHORT_MARCH; break; } case Calendar.APRIL: { mthShortDesc = DateTimeConstants.SHORT_APRIL; break; } case Calendar.MAY: { mthShortDesc = DateTimeConstants.SHORT_MAY; break; } case Calendar.JUNE: { mthShortDesc = DateTimeConstants.SHORT_JUNE; break; } case Calendar.JULY: { mthShortDesc = DateTimeConstants.SHORT_JULY; break; } case Calendar.AUGUST: { mthShortDesc = DateTimeConstants.SHORT_AUGUST; break; } case Calendar.SEPTEMBER: { mthShortDesc = DateTimeConstants.SHORT_SEPTEMBER; break; } case Calendar.OCTOBER: { mthShortDesc = DateTimeConstants.SHORT_OCTOBER; break; } case Calendar.NOVEMBER: { mthShortDesc = DateTimeConstants.SHORT_NOVEMBER; break; } case Calendar.DECEMBER: { mthShortDesc = DateTimeConstants.SHORT_DECEMBER; break; } default: { mthShortDesc = ""; break; } } return mthShortDesc; }