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.kuali.kfs.module.endow.document.service.impl.FrequencyDatesServiceImpl.java
/** * This method will check the current month and set the calendar to that month * @param month month to set the calendar * @return calendar calendar is set to the month selected *///from ww w . ja v a 2 s . c o m protected Calendar setCalendarWithMonth(String month, Date currentDate) { Calendar calendar = Calendar.getInstance(); calendar.setTime(currentDate); int calendarMonth = Calendar.JANUARY; if (EndowConstants.FrequencyMonths.JANUARY.equalsIgnoreCase(month)) { calendarMonth = Calendar.JANUARY; } else if (EndowConstants.FrequencyMonths.FEBRUARY.equalsIgnoreCase(month)) { calendarMonth = Calendar.FEBRUARY; } else if (EndowConstants.FrequencyMonths.MARCH.equalsIgnoreCase(month)) { calendarMonth = Calendar.MARCH; } else if (EndowConstants.FrequencyMonths.APRIL.equalsIgnoreCase(month)) { calendarMonth = Calendar.APRIL; } else if (EndowConstants.FrequencyMonths.MAY.equalsIgnoreCase(month)) { calendarMonth = Calendar.MAY; } else if (EndowConstants.FrequencyMonths.JUNE.equalsIgnoreCase(month)) { calendarMonth = Calendar.JUNE; } else if (EndowConstants.FrequencyMonths.JULY.equalsIgnoreCase(month)) { calendarMonth = Calendar.JULY; } else if (EndowConstants.FrequencyMonths.AUGUST.equalsIgnoreCase(month)) { calendarMonth = Calendar.AUGUST; } else if (EndowConstants.FrequencyMonths.SEPTEMBER.equalsIgnoreCase(month)) { calendarMonth = Calendar.SEPTEMBER; } else if (EndowConstants.FrequencyMonths.OCTOBER.equalsIgnoreCase(month)) { calendarMonth = Calendar.OCTOBER; } else if (EndowConstants.FrequencyMonths.NOVEMBER.equalsIgnoreCase(month)) { calendarMonth = Calendar.NOVEMBER; } else if (EndowConstants.FrequencyMonths.DECEMBER.equalsIgnoreCase(month)) { calendarMonth = Calendar.DECEMBER; } calendar.set(Calendar.MONTH, calendarMonth); return calendar; }
From source file:gov.nih.nci.firebird.selenium2.tests.profile.credentials.TrainingCertificateCredentialsTest.java
private void checkForExpirationBeforeEffectiveDateError(final EditTrainingCertificateDialog certificateDialog) throws IOException { certificateDialog.getHelper().enterTrainingCertificateData(certificateWithExistingIssuer, certificateFile, false);//www .ja va 2 s. c om Date today = new Date(); certificateDialog.getHelper().setEffectiveDate(DateUtils.setMonths(today, Calendar.DECEMBER)); certificateDialog.getHelper().setExpirationDate(DateUtils.setMonths(today, Calendar.OCTOBER)); ExpectedValidationFailure expectedValidationFailure = new ExpectedValidationFailure( "error.expiration.date.before.effective"); expectedValidationFailure.assertFailureOccurs(new FailingAction() { @Override public void perform() { certificateDialog.clickSave(); } }); }
From source file:org.spring.data.gemfire.rest.GemFireRestInterfaceTest.java
@Test public void testRegionObjectWithDatePropertyAccessedWithRestApi() throws Exception { String key = "1"; Person jonDoe = createPerson("Jon", "Doe", createDate(1977, Calendar.OCTOBER, 31)); assertTrue(getPeopleRegion().isEmpty()); getPeopleRegion().put(key, jonDoe);/* w w w . j a v a2 s.c o m*/ assertFalse(getPeopleRegion().isEmpty()); assertEquals(1, getPeopleRegion().size()); assertTrue(getPeopleRegion().containsKey(key)); Object jonDoeRef = getPeopleRegion().get(key); assertTrue(jonDoeRef instanceof PdxInstance); assertEquals(jonDoe.getClass().getName(), ((PdxInstance) jonDoeRef).getClassName()); assertEquals(jonDoe.getFirstName(), ((PdxInstance) jonDoeRef).getField("firstName")); assertEquals(jonDoe.getLastName(), ((PdxInstance) jonDoeRef).getField("lastName")); assertEquals(jonDoe.getBirthDate(), ((PdxInstance) jonDoeRef).getField("birthDate")); RestTemplate restTemplate = createRestTemplate(); Person jonDoeResource = restTemplate.getForObject(getRegionGetRestApiEndpoint(getPeopleRegion(), key), Person.class); assertNotNull(jonDoeResource); assertNotSame(jonDoe, jonDoeResource); assertEquals(jonDoe, jonDoeResource); /* Object result = runQueryUsingApi(getPeopleRegion().getRegionService(), String.format("SELECT * FROM %1$s", getPeopleRegion().getFullPath())); System.out.printf("(OQL Query using API) Person is (%1$s)%n", result); */ String url = getAdhocQueryRestApiEndpoint( String.format("SELECT * FROM %1$s", getPeopleRegion().getFullPath())); System.out.printf("URL (%1$s)%n", url); List<?> queryResults = restTemplate.getForObject(url, List.class); assertNotNull(queryResults); assertFalse(queryResults.isEmpty()); assertEquals(1, queryResults.size()); jonDoeResource = objectMapper.convertValue(queryResults.get(0), Person.class); assertNotNull(jonDoeResource); assertNotSame(jonDoe, jonDoeResource); assertEquals(jonDoe, jonDoeResource); }
From source file:com.gemstone.gemfire.rest.internal.web.controllers.RestAPIsAndInterOpsDUnitTest.java
public static void doPutsInClientCache() { ClientCache cache = GemFireCacheImpl.getInstance(); assertNotNull(cache);/* w w w .ja v a 2 s . c o m*/ Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME); //put person object final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj", DateTimeUtils.createDate(1982, Calendar.DECEMBER, 4), Gender.FEMALE); final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar", DateTimeUtils.createDate(1975, Calendar.DECEMBER, 14), Gender.MALE); final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly", DateTimeUtils.createDate(1972, Calendar.AUGUST, 29), Gender.MALE); final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid", DateTimeUtils.createDate(1979, Calendar.MARCH, 17), Gender.MALE); final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami", DateTimeUtils.createDate(1983, Calendar.NOVEMBER, 25), Gender.FEMALE); region.put("1", person1); region.put("2", person2); region.put("3", person3); region.put("4", person4); region.put("5", person5); final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi", DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE); final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi", DateTimeUtils.createDate(1945, Calendar.DECEMBER, 24), Gender.MALE); final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee", DateTimeUtils.createDate(1920, Calendar.AUGUST, 9), Gender.MALE); final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi", DateTimeUtils.createDate(1929, Calendar.MARCH, 27), Gender.FEMALE); final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi", DateTimeUtils.createDate(1973, Calendar.APRIL, 15), Gender.FEMALE); final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi", DateTimeUtils.createDate(1923, Calendar.APRIL, 25), Gender.MALE); final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani", DateTimeUtils.createDate(1910, Calendar.JANUARY, 01), Gender.MALE); final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj", DateTimeUtils.createDate(1943, Calendar.AUGUST, 10), Gender.FEMALE); final Person person14 = new Person(104L, "Arun", "raman", "jetly", DateTimeUtils.createDate(1942, Calendar.OCTOBER, 27), Gender.MALE); final Person person15 = new Person(104L, "Amit", "kumar", "shah", DateTimeUtils.createDate(1958, Calendar.DECEMBER, 21), Gender.MALE); final Person person16 = new Person(104L, "Shila", "kumari", "Dixit", DateTimeUtils.createDate(1927, Calendar.FEBRUARY, 15), Gender.FEMALE); Map<String, Object> userMap = new HashMap<String, Object>(); userMap.put("6", person6); userMap.put("7", person7); userMap.put("8", person8); userMap.put("9", person9); userMap.put("10", person10); userMap.put("11", person11); userMap.put("12", person12); userMap.put("13", person13); userMap.put("14", person14); userMap.put("15", person15); userMap.put("16", person16); region.putAll(userMap); if (cache != null) cache.getLogger().info("Gemfire Cache Client: Puts successfully done"); }
From source file:edu.ucsb.nceas.metacattest.UploadIPCCDataTest.java
private String generateId() { int version = 1; StringBuffer docid = new StringBuffer(DATAIDPREFIX); docid.append(DOT);// w w w. ja va2 s.c o m // Create a calendar to get the date formatted properly String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000); SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]); pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000); pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000); Calendar calendar = new GregorianCalendar(pdt); Date trialTime = new Date(); calendar.setTime(trialTime); int time = 0; docid.append(calendar.get(Calendar.YEAR)); time = calendar.get(Calendar.DAY_OF_YEAR); if (time < 10) { docid.append("0"); docid.append("0"); docid.append(time); } else if (time < 100) { docid.append("0"); docid.append(time); } else { docid.append(time); } time = calendar.get(Calendar.HOUR_OF_DAY); if (time < 10) { docid.append("0"); docid.append(time); } else { docid.append(time); } time = calendar.get(Calendar.MINUTE); if (time < 10) { docid.append("0"); docid.append(time); } else { docid.append(time); } time = calendar.get(Calendar.SECOND); if (time < 10) { docid.append("0"); docid.append(time); } else { docid.append(time); } //sometimes this number is not unique, so we append a random number int random = (new Double(Math.random() * 100)).intValue(); docid.append(random); docid.append(DOT); docid.append(version); return docid.toString(); }
From source file:Time.java
/** * Return the 1-based month number of the month of this day. 1 = January, 2 = * February and so on.//from ww w. ja v a2 s .c o m * * @return Month number of this month */ public int getMonthNo() { // It is tempting to return getMonth() + 1 but this is conceptually // wrong, as Calendar month is an enumeration and the values are tags // only and can be anything. switch (getMonth()) { case Calendar.JANUARY: return 1; case Calendar.FEBRUARY: return 2; case Calendar.MARCH: return 3; case Calendar.APRIL: return 4; case Calendar.MAY: return 5; case Calendar.JUNE: return 6; case Calendar.JULY: return 7; case Calendar.AUGUST: return 8; case Calendar.SEPTEMBER: return 9; case Calendar.OCTOBER: return 10; case Calendar.NOVEMBER: return 11; case Calendar.DECEMBER: return 12; } // This will never happen return 0; }
From source file:org.apache.james.protocols.imap.utils.DecoderUtilsTest.java
@Test public void testDecodeMonth() throws Exception { assertEquals(Calendar.JANUARY, DecoderUtils.decodeMonth('J', 'A', 'N')); assertEquals(Calendar.JANUARY, DecoderUtils.decodeMonth('j', 'a', 'n')); assertEquals(Calendar.FEBRUARY, DecoderUtils.decodeMonth('F', 'E', 'B')); assertEquals(Calendar.FEBRUARY, DecoderUtils.decodeMonth('f', 'e', 'b')); assertEquals(Calendar.MARCH, DecoderUtils.decodeMonth('M', 'A', 'R')); assertEquals(Calendar.MARCH, DecoderUtils.decodeMonth('m', 'a', 'r')); assertEquals(Calendar.APRIL, DecoderUtils.decodeMonth('A', 'P', 'R')); assertEquals(Calendar.APRIL, DecoderUtils.decodeMonth('a', 'p', 'r')); assertEquals(Calendar.MAY, DecoderUtils.decodeMonth('M', 'A', 'Y')); assertEquals(Calendar.MAY, DecoderUtils.decodeMonth('m', 'a', 'y')); assertEquals(Calendar.JUNE, DecoderUtils.decodeMonth('J', 'U', 'N')); assertEquals(Calendar.JUNE, DecoderUtils.decodeMonth('j', 'u', 'n')); assertEquals(Calendar.JULY, DecoderUtils.decodeMonth('J', 'U', 'L')); assertEquals(Calendar.JULY, DecoderUtils.decodeMonth('j', 'u', 'l')); assertEquals(Calendar.AUGUST, DecoderUtils.decodeMonth('A', 'U', 'G')); assertEquals(Calendar.AUGUST, DecoderUtils.decodeMonth('a', 'u', 'g')); assertEquals(Calendar.SEPTEMBER, DecoderUtils.decodeMonth('S', 'E', 'P')); assertEquals(Calendar.SEPTEMBER, DecoderUtils.decodeMonth('s', 'e', 'p')); assertEquals(Calendar.OCTOBER, DecoderUtils.decodeMonth('O', 'C', 'T')); assertEquals(Calendar.OCTOBER, DecoderUtils.decodeMonth('o', 'c', 't')); assertEquals(Calendar.NOVEMBER, DecoderUtils.decodeMonth('N', 'O', 'V')); assertEquals(Calendar.NOVEMBER, DecoderUtils.decodeMonth('n', 'o', 'v')); assertEquals(Calendar.DECEMBER, DecoderUtils.decodeMonth('D', 'E', 'C')); assertEquals(Calendar.DECEMBER, DecoderUtils.decodeMonth('d', 'e', 'c')); }
From source file:de.gebatzens.sia.SIAApp.java
public String getSeasonTheme() { int m = Calendar.getInstance().get(Calendar.MONTH); switch (m) {//from w ww . ja v a 2s .c om case Calendar.OCTOBER: case Calendar.NOVEMBER: case Calendar.DECEMBER: case Calendar.JANUARY: case Calendar.FEBRUARY: case Calendar.MARCH: return "Winter"; default: return "Summer"; } }
From source file:org.hawkular.alerts.api.model.action.TimeConstraint.java
private int month(String sMonth) { if (isEmpty(sMonth)) { return -1; }/* ww w .j a va2 s . com*/ if (sMonth.length() < 3) { return -1; } String prefix = sMonth.substring(0, 3).toLowerCase(); MONTH m = MONTH.fromString(prefix); if (m == null) { return -1; } switch (m) { case JANUARY: return Calendar.JANUARY; case FEBRUARY: return Calendar.FEBRUARY; case MARCH: return Calendar.MARCH; case APRIL: return Calendar.APRIL; case MAY: return Calendar.MAY; case JUNE: return Calendar.JUNE; case JULY: return Calendar.JULY; case AUGUST: return Calendar.AUGUST; case SEPTEMBER: return Calendar.SEPTEMBER; case OCTOBER: return Calendar.OCTOBER; case NOVEMBER: return Calendar.NOVEMBER; case DECEMBER: return Calendar.DECEMBER; default: return -1; } }
From source file:org.openmrs.module.radiology.web.controller.PortletsControllerTest.java
/** * @see PortletsController#isEndDateBeforeStartDate(Date, Date) * @verifies return true if end date is after start date *///from w w w.j av a 2s .c o m @Test public void isEndDateBeforeStartDate_shouldReturnTrueIfEndDateIsAfterStartDate() throws Exception { Method isEndDateBeforeStartDateMethod = portletsController.getClass().getDeclaredMethod( "isEndDateBeforeStartDate", new Class[] { java.util.Date.class, java.util.Date.class }); isEndDateBeforeStartDateMethod.setAccessible(true); Date startDate = new GregorianCalendar(2010, Calendar.OCTOBER, 10).getTime(); Date endDate = new GregorianCalendar(2001, Calendar.JANUARY, 01).getTime(); Boolean isEndDateBeforeStartDate = (Boolean) isEndDateBeforeStartDateMethod.invoke(portletsController, new Object[] { startDate, endDate }); assertThat(isEndDateBeforeStartDate, is(true)); }