List of usage examples for java.util Calendar JULY
int JULY
To view the source code for java.util Calendar JULY.
Click Source Link
From source file:ch.ralscha.extdirectspring.provider.RemoteProviderSimpleNamed.java
@ExtDirectMethod(value = ExtDirectMethodType.SIMPLE_NAMED, group = "named") public FormInfo method5(double d) { FormInfo info = new FormInfo(); info.setBack(d);//from w ww. j av a 2s . com 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.mb.framework.util.DateTimeUtil.java
/** * This method is used for getting short description of month by the number * of month/*from w ww . j a v a2 s . c om*/ * * @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; }
From source file:org.polymap.kaps.ui.filter.VertraegeStabuFilter.java
protected Query<VertragComposite> createFilterQuery(final IFilterEditorSite site, final KapsRepository repository) { Integer quartal = null;// w w w . ja v a2 s . com 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:com.netflix.simianarmy.basic.BasicCalendar.java
/** * Load holidays./*from ww w.j a va2 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:net.sf.sze.model.stammdaten.Klasse.java
private int calculateSchuljahresEnde() { final Calendar cal = GregorianCalendar.getInstance(); final int year = cal.get(Calendar.YEAR); final int month = cal.get(Calendar.MONTH); if (month <= Calendar.JULY) { return year; } else {// ww w . j ava2 s . c o m return year + 1; } }
From source file:org.spring.data.gemfire.cache.SpringGemfireTemplateTests.java
@Test public void query() { String query;//from ww w . java 2 s .c o m // METHOD 1 - the following OQL query syntax absolutely does not work for a peer application cache scenario; // developer must use METHOD 2 if (System.getProperty("spring.profiles.active").contains("client")) { query = String.format( "SELECT * FROM %1$s c WHERE c.birthDate >= DATE '%2$s' and c.birthDate <= DATE '%3$s'", customersTemplate.getRegion().getFullPath(), format(createDate(1980, Calendar.JULY, 1)), format(createDate(1995, Calendar.JUNE, 30))); assertEquals( "SELECT * FROM /Customers c WHERE c.birthDate >= DATE '1980-07-01' and c.birthDate <= DATE '1995-06-30'", query); } // METHOD 2 use for peer application cache else { query = String.format("birthDate >= DATE '%1$s' and birthDate <= DATE '%2$s'", format(createDate(1980, Calendar.JULY, 1)), format(createDate(1995, Calendar.JUNE, 30))); assertEquals("birthDate >= DATE '1980-07-01' and birthDate <= DATE '1995-06-30'", query); } System.out.printf("GemFire OQL Query is (%1$s)", query); SelectResults<Customer> customerResults = customersTemplate.query(query); assertNotNull(customerResults); List<Customer> actualCustomers = customerResults.asList(); assertNotNull(actualCustomers); assertFalse(actualCustomers.isEmpty()); assertEquals(expectedCustomers.size(), actualCustomers.size()); assertTrue(String.format("Expected (%1$s); But was (%2$s)", expectedCustomers, actualCustomers), actualCustomers.containsAll(expectedCustomers)); }
From source file:org.apache.logging.log4j.core.util.datetime.FastDateParserTest.java
@Test public void testParseZone() throws ParseException { final Calendar cal = Calendar.getInstance(NEW_YORK, Locale.US); cal.clear();/*from w ww. ja v a 2s. c o m*/ cal.set(2003, Calendar.JULY, 10, 16, 33, 20); final DateParser fdf = getInstance(yMdHmsSZ, NEW_YORK, Locale.US); assertEquals(cal.getTime(), fdf.parse("2003-07-10T15:33:20.000 -0500")); assertEquals(cal.getTime(), fdf.parse("2003-07-10T15:33:20.000 GMT-05:00")); assertEquals(cal.getTime(), fdf.parse("2003-07-10T16:33:20.000 Eastern Daylight Time")); assertEquals(cal.getTime(), fdf.parse("2003-07-10T16:33:20.000 EDT")); cal.setTimeZone(TimeZone.getTimeZone("GMT-3")); cal.set(2003, Calendar.FEBRUARY, 10, 9, 0, 0); assertEquals(cal.getTime(), fdf.parse("2003-02-10T09:00:00.000 -0300")); cal.setTimeZone(TimeZone.getTimeZone("GMT+5")); cal.set(2003, Calendar.FEBRUARY, 10, 15, 5, 6); assertEquals(cal.getTime(), fdf.parse("2003-02-10T15:05:06.000 +0500")); }
From source file:org.sakaiproject.util.CalendarUtil.java
void initDates() { Calendar calendarSunday = Calendar.getInstance(); Calendar calendarMonday = Calendar.getInstance(); Calendar calendarTuesday = Calendar.getInstance(); Calendar calendarWednesday = Calendar.getInstance(); Calendar calendarThursday = Calendar.getInstance(); Calendar calendarFriday = Calendar.getInstance(); Calendar calendarSaturday = Calendar.getInstance(); calendarSunday.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); calendarMonday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); calendarTuesday.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); calendarWednesday.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); calendarThursday.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); calendarFriday.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); calendarSaturday.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); dateSunday = calendarSunday.getTime(); dateMonday = calendarMonday.getTime(); dateTuesday = calendarTuesday.getTime(); dateWednesday = calendarWednesday.getTime(); dateThursday = calendarThursday.getTime(); dateFriday = calendarFriday.getTime(); dateSaturday = calendarSaturday.getTime(); Calendar calendarJanuary = Calendar.getInstance(); Calendar calendarFebruary = Calendar.getInstance(); Calendar calendarMarch = Calendar.getInstance(); Calendar calendarApril = Calendar.getInstance(); Calendar calendarMay = Calendar.getInstance(); Calendar calendarJune = Calendar.getInstance(); Calendar calendarJuly = Calendar.getInstance(); Calendar calendarAugust = Calendar.getInstance(); Calendar calendarSeptember = Calendar.getInstance(); Calendar calendarOctober = Calendar.getInstance(); Calendar calendarNovember = Calendar.getInstance(); Calendar calendarDecember = Calendar.getInstance(); calendarJanuary.set(Calendar.MONTH, Calendar.JANUARY); calendarFebruary.set(Calendar.MONTH, Calendar.FEBRUARY); calendarMarch.set(Calendar.MONTH, Calendar.MARCH); calendarApril.set(Calendar.MONTH, Calendar.APRIL); calendarMay.set(Calendar.MONTH, Calendar.MAY); calendarJune.set(Calendar.MONTH, Calendar.JUNE); calendarJuly.set(Calendar.MONTH, Calendar.JULY); calendarAugust.set(Calendar.MONTH, Calendar.AUGUST); calendarSeptember.set(Calendar.MONTH, Calendar.SEPTEMBER); calendarOctober.set(Calendar.MONTH, Calendar.OCTOBER); calendarNovember.set(Calendar.MONTH, Calendar.NOVEMBER); calendarDecember.set(Calendar.MONTH, Calendar.DECEMBER); dateJanuary = calendarJanuary.getTime(); dateFebruary = calendarFebruary.getTime(); dateMarch = calendarMarch.getTime(); dateApril = calendarApril.getTime(); dateMay = calendarMay.getTime();// w w w. ja va2 s . co m dateJune = calendarJune.getTime(); dateJuly = calendarJuly.getTime(); dateAugust = calendarAugust.getTime(); dateSeptember = calendarSeptember.getTime(); dateOctober = calendarOctober.getTime(); dateNovember = calendarNovember.getTime(); dateDecember = calendarDecember.getTime(); }
From source file:ch.ralscha.extdirectspring.controller.RouterControllerSimpleTest.java
@Test public void testReturnsObject() { FormInfo info = (FormInfo) ControllerUtil.sendAndReceive(mockMvc, "remoteProviderSimple", "method8", FormInfo.class, 7.34); assertThat(info.getBack()).isEqualTo(7.34); assertThat(info.isAdmin()).isEqualTo(false); assertThat(info.getAge()).isEqualTo(32); assertThat(info.getName()).isEqualTo("John"); assertThat(info.getSalary()).isEqualTo(new BigDecimal("8720.2")); assertThat(info.getBirthday()).isEqualTo(new GregorianCalendar(1986, Calendar.JULY, 22).getTime()); }
From source file:com.linkedin.drelephant.mapreduce.fetchers.MapReduceFSFetcherHadoop2Test.java
@Test public void testGetHistoryDir() { FetcherConfiguration fetcherConf = new FetcherConfiguration(document9.getDocumentElement()); try {/*from w w w .ja va 2 s. c om*/ MapReduceFSFetcherHadoop2 fetcher = new MapReduceFSFetcherHadoop2( fetcherConf.getFetchersConfigurationData().get(0)); Calendar timestamp = Calendar.getInstance(); timestamp.set(2016, Calendar.JULY, 30); AnalyticJob job = new AnalyticJob().setAppId("application_1461566847127_84624") .setFinishTime(timestamp.getTimeInMillis()); String expected = StringUtils.join( new String[] { fetcher.getHistoryLocation(), "2016", "07", "30", "000084", "" }, File.separator); Assert.assertEquals("Error history directory", expected, fetcher.getHistoryDir(job)); } catch (IOException e) { Assert.assertNull("Failed to initialize FileSystem", e); } }