List of usage examples for java.util Calendar AUGUST
int AUGUST
To view the source code for java.util Calendar AUGUST.
Click Source Link
From source file:org.hephaestus.fixedformat.impl.TestRecordFactoryBase.java
public void testDetail1Scan() { Object vo = recordFactory.createRecord(DETAIL_RECORD_1); assertNotNull(vo);/*from w w w. j a v a2s. co m*/ assertTrue(vo instanceof TstDetailRecord); TstDetailRecord tdr = (TstDetailRecord) vo; assertEquals(2L, tdr.getRecordType()); assertEquals("Item 1", tdr.getDescription()); assertEquals(303L, tdr.getAmount().longValue()); Date dt = tdr.getDate(); Calendar cal = Calendar.getInstance(); cal.setTime(dt); assertEquals(Calendar.AUGUST, cal.get(Calendar.MONTH)); assertEquals(31, cal.get(Calendar.DAY_OF_MONTH)); dt = tdr.getTime(); cal = Calendar.getInstance(); cal.setTime(dt); assertEquals(23, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(33, cal.get(Calendar.MINUTE)); }
From source file:one.GanttDemo1.java
/** * Creates a sample dataset for a Gantt chart. * * @return The dataset./*w w w . ja va2s .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)))); s1.add(new Task("Database set up", new SimpleTimePeriod(date(15, Calendar.OCTOBER, 2001), date(30, Calendar.OCTOBER, 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:de.forsthaus.backend.dao.impl.ChartDataDAOImpl.java
@Override public List<ChartData> getChartDataForCustomer(long kunId) { List<ChartData> result = new ArrayList<ChartData>(); if (kunId == 20) { Calendar calendar = new GregorianCalendar(); calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30))); calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.10))); calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(654.00))); calendar.set(2009, Calendar.MAY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30))); calendar.set(2009, Calendar.JULY, 22, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(20.30))); calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(480.30))); calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30))); calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.70))); calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(1220.90))); } else if (kunId == 21) { Calendar calendar = new GregorianCalendar(); calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30))); calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.10))); calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(154.00))); calendar.set(2009, Calendar.MAY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.30))); calendar.set(2009, Calendar.JULY, 22, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(920.30))); calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(680.30))); calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(580.30))); calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.70))); calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(220.90))); }//from w w w. j a va 2s .c om return result; }
From source file:util.MyUtils.java
public static String getMonthString(int month) { switch (month - 1) { case Calendar.JANUARY: return "Jan"; case Calendar.FEBRUARY: return "Feb"; case Calendar.MARCH: return "Mar"; case Calendar.APRIL: return "Apr"; case Calendar.MAY: return "May"; case Calendar.JUNE: return "Jun"; case Calendar.JULY: return "Jul"; case Calendar.AUGUST: return "Aug"; case Calendar.SEPTEMBER: return "Sep"; case Calendar.OCTOBER: return "Oct"; case Calendar.NOVEMBER: return "Nov"; case Calendar.DECEMBER: return "Dec"; }// www. j a v a 2s .co m return ""; }
From source file:ch.cyberduck.core.ftp.parser.StingrayFTPEntryParserTest.java
/** * http://trac.cyberduck.ch/ticket/1198//from w w w. j a va 2s . c o m */ @Test public void testFolder() { FTPFile parsed; parsed = parser.parseFTPEntry("dr--r--r-- folder 0 Aug 1 10:18 TestCyberduck"); assertNotNull(parsed); assertEquals("TestCyberduck", parsed.getName()); assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType()); assertEquals(Calendar.AUGUST, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(1, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); assertEquals(10, parsed.getTimestamp().get(Calendar.HOUR_OF_DAY)); assertEquals(18, parsed.getTimestamp().get(Calendar.MINUTE)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)); }
From source file:org.openmhealth.shim.fatsecret.FatsecretShim.java
@Override public ShimDataResponse getData(ShimDataRequest shimDataRequest) throws ShimException { long numToSkip = 0; long numToReturn = 3; Calendar cal = Calendar.getInstance(); cal.set(2014, Calendar.AUGUST, 1); Date endDate = new Date(cal.getTimeInMillis()); cal.add(Calendar.DATE, -1);/*from w ww. j a va 2s. c o m*/ Date startDate = new Date(cal.getTimeInMillis()); DateTime startTime = new DateTime(startDate.getTime()); DateTime endTime = new DateTime(endDate.getTime()); MutableDateTime epoch = new MutableDateTime(); epoch.setDate(0); int days = 16283; //Days.daysBetween(epoch, new DateTime()).getDays() - 1; String endPoint = "food_entries.get"; String accessToken = shimDataRequest.getAccessParameters().getAccessToken(); String tokenSecret = shimDataRequest.getAccessParameters().getTokenSecret(); URL url = signUrl(DATA_URL + "?date=" + days + "&format=json&method=" + endPoint, accessToken, tokenSecret, null); System.out.println("Signed URL is: \n\n" + url); // Fetch and decode the JSON data. ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonData; HttpGet get = new HttpGet(url.toString()); HttpResponse response; try { response = httpClient.execute(get); HttpEntity responseEntity = response.getEntity(); jsonData = objectMapper.readTree(responseEntity.getContent()); return ShimDataResponse.result(FatsecretShim.SHIM_KEY, jsonData); } catch (IOException e) { throw new ShimException("Could not fetch data", e); } finally { get.releaseConnection(); } }
From source file:com.xing.api.JsonSerializationTest.java
@Test public void user() throws Exception { JsonAdapter<XingUser> adapter = api.converter.adapter(XingUser.class); String json = file("user.json"); // Test that the user object reflects the json. XingUser user = adapter.fromJson(json); // General info. assertThat(user.id()).isEqualTo("123456_abcdef"); assertThat(user.academicTitle()).isNull(); assertThat(user.firstName()).isEqualTo("Max"); assertThat(user.lastName()).isEqualTo("Mustermann"); assertThat(user.displayName()).isEqualTo("Max Mustermann"); assertThat(user.pageName()).isEqualTo("Max_Mustermann"); assertThat(user.permalink()).isEqualTo("https://www.xing.com/profile/Max_Mustermann"); assertThat(user.employmentStatus()).isEqualTo(EmploymentStatus.EMPLOYEE); assertThat(user.gender()).isEqualTo(Gender.MALE); assertThat(user.birthDate()).isEqualTo(new SafeCalendar(1963, Calendar.AUGUST, 12)); assertThat(user.activeEmail()).isEqualTo("max.mustermann@xing.com"); assertThat(user.timeZone()).isEqualTo(new TimeZone("Europe/Copenhagen", 2.0f)); assertThat(user.premiumServices()).containsExactly(PremiumService.SEARCH, PremiumService.PRIVATE_MESSAGES); assertThat(user.badges()).containsExactly(Badge.PREMIUM, Badge.MODERATOR); assertThat(user.wants()).containsExactly("einen neuen Job", "android"); assertThat(user.haves()).containsExactly("viele tolle Skills"); assertThat(user.interests()).containsExactly("Flitzebogen schieen and so on"); assertThat(user.organizations()).containsExactly("ACM", "GI"); assertThat(user.languages()).containsExactly(MapEntry.entry(Language.DE, LanguageSkill.NATIVE), MapEntry.entry(Language.EN, LanguageSkill.FLUENT), MapEntry.entry(Language.FR, null), MapEntry.entry(Language.ZH, LanguageSkill.BASIC)); // Addresses. assertPrivateAddress(user);/*from w w w . j a v a 2 s . co m*/ assertBusinessAddress(user); // Web profiles. assertThat(user.webProfiles().keySet()).containsExactly(WebProfile.QYPE, WebProfile.GOOGLE_PLUS, WebProfile.OTHER, WebProfile.HOMEPAGE); assertThat(user.webProfiles().get(WebProfile.QYPE)).containsExactly("http://qype.de/users/foo"); assertThat(user.webProfiles().get(WebProfile.GOOGLE_PLUS)).containsExactly("http://plus.google.com/foo"); assertThat(user.webProfiles().get(WebProfile.OTHER)).containsExactly("http://blog.example.org"); assertThat(user.webProfiles().get(WebProfile.HOMEPAGE)).containsExactly("http://example.org", "http://other-example.org"); // Messaging accounts. assertThat(user.messagingAccounts()).containsExactly(MapEntry.entry(MessagingAccount.SKYPE, "1122334455"), MapEntry.entry(MessagingAccount.GOOGLE_TALK, "max.mustermann")); // Professional experience. assertPrimaryCompany(user); assertCompanies(user); assertThat(user.professionalExperience().awards()) .containsExactly(new Award("Awesome Dude Of The Year", new SafeCalendar(2007), null)); // Education background. assertThat(user.educationBackground().degree()).isEqualTo("MSc CE/CS"); assertSchools(user); assertThat(user.educationBackground().qualifications()).containsExactly("TOEFLS", "PADI AOWD"); // Photos. assertPhotoUrls(user); // Check that the object with all it's set fields is serializable. // NOTE: This is NOT fool proof and may be unreliable if a field is not java.util.Serializable // and is null. XingUser clone = SerializationUtils.clone(user); assertThat(clone).isEqualTo(user); assertThat(clone.hashCode()).isEqualTo(user.hashCode()); assertThat(clone.toString()).isEqualTo(user.toString()); }
From source file:org.hephaestus.fixedformat.impl.TestRecordFactoryBase.java
public void testDetail1Format() { TstDetailRecord tdr = new TstDetailRecord(); tdr.setRecordType(2L);//from w w w .j a v a2 s. c o m tdr.setDescription("Item 1"); tdr.setAmount(new BigDecimal("3.03").setScale(2, BigDecimal.ROUND_HALF_EVEN)); Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, Calendar.AUGUST); cal.set(Calendar.DAY_OF_MONTH, 31); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 33); tdr.setDate(cal.getTime()); tdr.setTime(cal.getTime()); assertEquals(DETAIL_RECORD_1, recordFactory.formatRecord(tdr)); }
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 ww . j ava 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; }