List of usage examples for java.util Calendar FRIDAY
int FRIDAY
To view the source code for java.util Calendar FRIDAY.
Click Source Link
From source file:org.kuali.kfs.module.endow.document.service.impl.FrequencyDatesServiceImpl.java
/** * Method to calculate the next processing week date based on the frequency type * adds the appropriate number of days to the current date * @param dayOfWeek/* w w w .ja va2 s. co m*/ * @return next processing date */ protected Calendar calculateNextWeeklyDate(String dayOfWeekFromFrequencyCode, Date currentDate) { Calendar calendar = Calendar.getInstance(); calendar.setTime(currentDate); int daysToAdd = 0; int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // today's day of the week int maximumDaysInWeek = calendar.getActualMaximum(Calendar.DAY_OF_WEEK); if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.MONDAY)) { if (dayOfWeek < Calendar.MONDAY) daysToAdd = Calendar.MONDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.MONDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.TUESDAY)) { if (dayOfWeek < Calendar.TUESDAY) daysToAdd = Calendar.TUESDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.TUESDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.WEDNESDAY)) { if (dayOfWeek < Calendar.WEDNESDAY) daysToAdd = Calendar.WEDNESDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.WEDNESDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.THURSDAY)) { if (dayOfWeek < Calendar.THURSDAY) daysToAdd = Calendar.THURSDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.THURSDAY; } else if (dayOfWeekFromFrequencyCode.equalsIgnoreCase(EndowConstants.FrequencyWeekDays.FRIDAY)) { if (dayOfWeek < Calendar.FRIDAY) daysToAdd = Calendar.FRIDAY - dayOfWeek; else daysToAdd = maximumDaysInWeek - dayOfWeek + Calendar.FRIDAY; } calendar.add(Calendar.DAY_OF_MONTH, daysToAdd); return calendar; }
From source file:com.feilong.core.date.DateUtilTest.java
/** * Test get first week of specify date year. *//*from ww w. j ava2 s. co m*/ @Test public void testGetFirstWeekOfSpecifyDateYear() { logDate(DateUtil.getFirstWeekOfSpecifyDateYear(NOW, Calendar.FRIDAY)); logDate(DateUtil.getFirstWeekOfSpecifyDateYear(NOW, Calendar.MONDAY)); }
From source file:DateUtils.java
public static final String getDayString(int day) { switch (day) { case Calendar.SUNDAY: return "SUNDAY"; case Calendar.MONDAY: return "MONDAY"; case Calendar.TUESDAY: return "TUESDAY"; case Calendar.WEDNESDAY: return "WEDNESDAY"; case Calendar.THURSDAY: return "THURSDAY"; case Calendar.FRIDAY: return "FRIDAY"; case Calendar.SATURDAY: return "SATURDAY"; }/*from w ww. j a v a 2 s. c o m*/ return ""; }
From source file:in.suraj.timetableswipe.BTechFragment.java
private void init() { rgroup = (RadioGroup) rootView.findViewById(R.id.rbgrp); rbMon = (RadioButton) rootView.findViewById(R.id.rbMon); rbTue = (RadioButton) rootView.findViewById(R.id.rbTue); rbWed = (RadioButton) rootView.findViewById(R.id.rbWed); rbThur = (RadioButton) rootView.findViewById(R.id.rbThur); rbFri = (RadioButton) rootView.findViewById(R.id.rbFri); tvLect1Name = (TextView) rootView.findViewById(R.id.tvLect1Name); tvLect1Prof = (TextView) rootView.findViewById(R.id.tvLect1Prof); tvLect2Name = (TextView) rootView.findViewById(R.id.tvLect2Name); tvLect2Prof = (TextView) rootView.findViewById(R.id.tvLect2Prof); tvLect3Name = (TextView) rootView.findViewById(R.id.tvLect3Name); tvLect3Prof = (TextView) rootView.findViewById(R.id.tvLect3Prof); tvLect4Name = (TextView) rootView.findViewById(R.id.tvLect4Name); tvLect4Prof = (TextView) rootView.findViewById(R.id.tvLect4Prof); tvLect5Name = (TextView) rootView.findViewById(R.id.tvLect5Name); tvLect5Prof = (TextView) rootView.findViewById(R.id.tvLect5Prof); Calendar c = Calendar.getInstance(); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); if (Calendar.MONDAY == dayOfWeek) { setUpMonday();//from w w w. j a v a2 s.c o m } else if (Calendar.TUESDAY == dayOfWeek) { setUpTuesday(); } else if (Calendar.WEDNESDAY == dayOfWeek) { setUpWednesday(); } else if (Calendar.THURSDAY == dayOfWeek) { setUpThursday(); } else if (Calendar.FRIDAY == dayOfWeek) { setUpFriday(); } else if (Calendar.SATURDAY == dayOfWeek) { tvLect1Name.setText("Saturday :)"); tvLect1Name.setTextColor(Color.RED); } else if (Calendar.SUNDAY == dayOfWeek) { tvLect1Name.setText("Sunday :)"); tvLect1Name.setTextColor(Color.RED); } }
From source file:com.idega.block.cal.renderer.AbstractCompactScheduleRenderer.java
/** * <p>/*from w ww . j a va2 s .com*/ * Draw one day in the schedule * </p> * * @param context * the FacesContext * @param writer * the ResponseWriter * @param schedule * the schedule * @param day * the day that should be drawn * @param cellWidth * the width of the cell * @param dayOfWeek * the day of the week * @param dayOfMonth * the day of the month * @param isWeekend * is it a weekend day? * @param isCurrentMonth * is the day in the currently selected month? * @param rowspan * the rowspan for the table cell * * @throws IOException * when the cell could not be drawn */ protected void writeDayCell(FacesContext context, ResponseWriter writer, HtmlSchedule schedule, ScheduleDay day, float cellWidth, int dayOfWeek, int dayOfMonth, boolean isWeekend, boolean isCurrentMonth, int rowspan) throws IOException { final String clientId = schedule.getClientId(context); final Map<String, Object> attributes = schedule.getAttributes(); final FormInfo parentFormInfo = RendererUtils.findNestingForm(schedule, context); final String formId = parentFormInfo == null ? null : parentFormInfo.getFormName(); TimeZone tz = TimeZone.getDefault(); final String dayHeaderId = clientId + "_header_" + ScheduleUtil.getDateId(day.getDate(), tz); final String dayBodyId = clientId + "_body_" + ScheduleUtil.getDateId(day.getDate(), tz); boolean isMonthMode = false; boolean isWeekMode = false; boolean isFirstInARow = false; if (cellWidth == 100f / 6) { isMonthMode = true; } else if (cellWidth == 50f) { isWeekMode = true; } if ((dayOfWeek != Calendar.SUNDAY) && isMonthMode) { writer.startElement(HTML.DIV_ELEM, schedule); } if (isWeekMode && (dayOfWeek != Calendar.SUNDAY)) { writer.startElement(HTML.DIV_ELEM, schedule); } String dayClass = null; if (isWeekMode) { dayClass = ""; } else { dayClass = getStyleClass(schedule, isCurrentMonth ? "day" : "inactive-day") + " " + getStyleClass(schedule, isWeekend ? "weekend" : "workday"); } // add class for sunday if ((dayOfWeek == Calendar.MONDAY) || (dayOfWeek == Calendar.WEDNESDAY) || (dayOfWeek == Calendar.FRIDAY)// || ) { isFirstInARow = true; } if (dayOfWeek == Calendar.SUNDAY) { dayClass += " sunday"; } if (dayOfWeek == Calendar.SATURDAY) { dayClass += " saturday"; } if ((dayOfWeek != Calendar.SUNDAY) && isMonthMode) { writer.writeAttribute(HTML.CLASS_ATTR, "workdaytest", null); } if ((dayOfWeek != Calendar.SUNDAY) && isWeekMode) { if (isFirstInARow) { writer.writeAttribute(HTML.CLASS_ATTR, "weekTest firstInAWeekRow", null); } else { writer.writeAttribute(HTML.CLASS_ATTR, "weekTest secondInAWeekRow", null); } } // determine the height of the day in pixels StringBuffer styleBuffer = new StringBuffer(); int rowHeight = getRowHeight(attributes); String myRowHeight = "height: "; String myContentHeight = "height: "; if (rowHeight > 0) { if (isWeekend) { myRowHeight += (rowHeight / 2) + "px;"; myContentHeight += ((rowHeight / 2) - 19) + "px;"; } else { myRowHeight += (rowHeight + 1) + "px;"; //need to add 1 to get the weekends right myContentHeight += ((rowHeight + 1) - 18) + "px;"; //18 instead of 19, to get the weekends right } } else { myRowHeight += "100%;"; myContentHeight += "100%;"; } styleBuffer.append(myRowHeight); writer.startElement(HTML.DIV_ELEM, schedule); if (cellWidth == 50f) { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "day weekMode"), null); } else { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "day monthMode"), null); } // day header writer.startElement(HTML.DIV_ELEM, schedule); if (isMonthMode) { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "headerForMonthDay"), null); } else if (isWeekMode) { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "headerForWeekDay"), null); } writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "header"), null); writer.writeAttribute(HTML.STYLE_ATTR, "height: 18px; width: 100%; overflow: hidden", null); writer.writeAttribute(HTML.ID_ATTR, dayHeaderId, null); //register an onclick event listener to a day header which will capture //the date if (!schedule.isReadonly() && schedule.isSubmitOnClick()) { writer.writeAttribute(HTML.ONMOUSEUP_ATTR, "fireScheduleDateClicked(this, event, '" + formId + "', '" + clientId + "');", null); } writer.writeText(getDateString(context, schedule, day.getDate()), null); writer.endElement(HTML.DIV_ELEM); writer.endElement(HTML.DIV_ELEM); // day content writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "contentForMonthDay"), null); writer.startElement(HTML.DIV_ELEM, schedule); if (isMonthMode) { if ((dayOfWeek == Calendar.SUNDAY) || (dayOfWeek == Calendar.SATURDAY)) { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "weekendContent content"), null); } else { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "workdayContent content"), null); } } else { if ((dayOfWeek == Calendar.SUNDAY) || (dayOfWeek == Calendar.SATURDAY)) { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "weekendContentWeekMode content"), null); } else { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "workdayContentWeekMode content"), null); } } // determine the height of the day content in pixels StringBuffer contentStyleBuffer = new StringBuffer(); contentStyleBuffer.append(myContentHeight); // contentStyleBuffer.append(" width: 100%;"); writer.writeAttribute(HTML.STYLE_ATTR, contentStyleBuffer.toString(), null); writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "contentview"), null); //this extra div is required, because when a scrollbar is visible and //it is clicked, the fireScheduleTimeClicked() method is fired. writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.STYLE_ATTR, "height: 100%; vertical-align: top;", null); writer.writeAttribute(HTML.ID_ATTR, dayBodyId, null); //register an onclick event listener to a day cell which will capture //the date if (!schedule.isReadonly() && schedule.isSubmitOnClick()) { writer.writeAttribute(HTML.ONMOUSEUP_ATTR, "fireScheduleTimeClicked(this, event, '" + formId + "', '" + clientId + "');", null); } writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.STYLE_ATTR, "width: 100%;", null); writeEntries(context, schedule, day, writer); writer.endElement(HTML.DIV_ELEM); writer.endElement(HTML.DIV_ELEM); writer.endElement(HTML.DIV_ELEM); writer.endElement(HTML.DIV_ELEM); writer.endElement(HTML.DIV_ELEM); writer.endElement(HTML.DIV_ELEM); if ((dayOfWeek != Calendar.SATURDAY) && isMonthMode) { writer.endElement(HTML.DIV_ELEM); } if (cellWidth == 50f && dayOfWeek != Calendar.SATURDAY) { writer.endElement(HTML.DIV_ELEM); } }
From source file:com.ozpathway.sw.erms.webapp.action.schedule.ScheduleBean.java
public void addSampleEntries(ActionEvent event) { if (model == null) return;//from ww w.jav a 2 s .c o m Calendar calendar = GregorianCalendar.getInstance(); calendar.setTime(model.getSelectedDate()); calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); calendar.set(Calendar.HOUR_OF_DAY, 14); DefaultScheduleEntry entry1 = new DefaultScheduleEntry(); // every entry in a schedule must have a unique id entry1.setId(RandomStringUtils.randomNumeric(32)); entry1.setStartTime(calendar.getTime()); calendar.add(Calendar.MINUTE, 45); entry1.setEndTime(calendar.getTime()); entry1.setTitle("Test MyFaces schedule component"); entry1.setSubtitle("my office"); entry1.setDescription("We need to get this thing out of the sandbox ASAP"); model.addEntry(entry1); DefaultScheduleEntry entry2 = new DefaultScheduleEntry(); entry2.setId(RandomStringUtils.randomNumeric(32)); // entry2 overlaps entry1 calendar.add(Calendar.MINUTE, -20); entry2.setStartTime(calendar.getTime()); calendar.add(Calendar.HOUR, 2); entry2.setEndTime(calendar.getTime()); entry2.setTitle("Show schedule component to boss"); entry2.setSubtitle("my office"); entry2.setDescription("Convince him to get time to thoroughly test it"); model.addEntry(entry2); DefaultScheduleEntry entry3 = new DefaultScheduleEntry(); entry3.setId(RandomStringUtils.randomNumeric(32)); calendar.add(Calendar.DATE, 1); calendar.set(Calendar.HOUR_OF_DAY, 9); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); entry3.setStartTime(calendar.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 17); entry3.setEndTime(calendar.getTime()); entry3.setTitle("Thoroughly test schedule component"); model.addEntry(entry3); DefaultScheduleEntry entry4 = new DefaultScheduleEntry(); entry4.setId(RandomStringUtils.randomNumeric(32)); calendar.add(Calendar.MONTH, -1); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, 11); entry4.setStartTime(calendar.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 14); entry4.setEndTime(calendar.getTime()); entry4.setTitle("Long lunch"); model.addEntry(entry4); DefaultScheduleEntry entry5 = new DefaultScheduleEntry(); entry5.setId(RandomStringUtils.randomNumeric(32)); calendar.add(Calendar.MONTH, 2); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 1); entry5.setStartTime(calendar.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 5); entry5.setEndTime(calendar.getTime()); entry5.setTitle("Fishing trip"); model.addEntry(entry5); // Let's add a zero length entry... DefaultScheduleEntry entry6 = new DefaultScheduleEntry(); calendar.setTime(model.getSelectedDate()); calendar.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); calendar.set(Calendar.HOUR_OF_DAY, 16); entry6.setId(RandomStringUtils.randomNumeric(32)); entry6.setStartTime(calendar.getTime()); entry6.setEndTime(calendar.getTime()); entry6.setTitle("Zero length entry"); entry6.setDescription("Is only rendered when the 'renderZeroLengthEntries' attribute is 'true'"); model.addEntry(entry6); // And also an allday event DefaultScheduleEntry entry7 = new DefaultScheduleEntry(); entry7.setId(RandomStringUtils.randomNumeric(32)); entry7.setTitle("All day event"); entry7.setSubtitle("This event renders as an all-day event"); entry7.setAllDay(true); model.addEntry(entry7); model.refresh(); }
From source file:com.stratelia.webactiv.util.DateUtilTest.java
@Test public void testAddDays() { Calendar calend = Calendar.getInstance(); calend.set(Calendar.DATE, 27); calend.set(Calendar.MONTH, Calendar.JUNE); calend.set(Calendar.YEAR, 2012); calend.setTimeZone(TimeZone.getTimeZone("GMT+01")); assertThat(calend.get(Calendar.DAY_OF_WEEK), is(Calendar.WEDNESDAY)); DateUtil.addDaysExceptWeekEnds(calend, 2); assertThat(calend.get(Calendar.DAY_OF_WEEK), is(Calendar.FRIDAY)); assertThat(calend.get(Calendar.DATE), is(29)); assertThat(calend.get(Calendar.MONTH), is(Calendar.JUNE)); assertThat(calend.get(Calendar.YEAR), is(2012)); calend = Calendar.getInstance(); calend.set(Calendar.DATE, 27); calend.set(Calendar.MONTH, Calendar.JUNE); calend.set(Calendar.YEAR, 2012); calend.setTimeZone(TimeZone.getTimeZone("GMT+01")); assertThat(calend.get(Calendar.DAY_OF_WEEK), is(Calendar.WEDNESDAY)); DateUtil.addDaysExceptWeekEnds(calend, 4); assertThat(calend.get(Calendar.DAY_OF_WEEK), is(Calendar.TUESDAY)); assertThat(calend.get(Calendar.DATE), is(3)); assertThat(calend.get(Calendar.MONTH), is(Calendar.JULY)); assertThat(calend.get(Calendar.YEAR), is(2012)); }
From source file:paarmann.physikprofil.MainActivity.java
public void onBtnTomorrowClick(View view) { Calendar cal = Calendar.getInstance(); int offset;/*from ww w . j a va 2s.c o m*/ if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) { offset = 3; } else if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) { offset = 2; } else { offset = 1; } cal.add(Calendar.DAY_OF_MONTH, offset); Intent details = new Intent(this, HomeworkDetailActivity.class); String date = cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DAY_OF_MONTH); details.putExtra(HomeworkDetailActivity.EXTRA_DATE, date); startActivity(details); }
From source file:ru.VirtaMarketAnalyzer.main.Wizard.java
public static void collectToJsonTradeAtCities(final String realm) throws IOException { final String baseDir = Utils.getDir() + by_trade_at_cities + File.separator + realm + File.separator; final String serviceBaseDir = Utils.getDir() + by_service + File.separator + realm + File.separator; final File baseDirFile = new File(baseDir); if (baseDirFile.exists()) { logger.info("? {}", baseDirFile.getAbsolutePath()); FileUtils.deleteDirectory(baseDirFile); }//from w w w . j a v a 2s .com final File serviceBaseDirFile = new File(serviceBaseDir); if (serviceBaseDirFile.exists()) { logger.info("? {}", serviceBaseDirFile.getAbsolutePath()); FileUtils.deleteDirectory(serviceBaseDirFile); } //? final List<Country> countries = CityInitParser .getCountries(host + realm + "/main/common/main_page/game_info/world/"); Utils.writeToGson(baseDir + "countries.json", countries); final List<Country> countries_en = CityInitParser .getCountries(host_en + realm + "/main/common/main_page/game_info/world/"); Utils.writeToGson(baseDir + "countries_en.json", countries_en); // final List<Region> regions = CityInitParser.getRegions(host + realm + "/main/geo/regionlist/", countries); Utils.writeToGson(baseDir + "regions.json", regions); final List<Region> regions_en = CityInitParser.getRegions(host_en + realm + "/main/geo/regionlist/", countries); Utils.writeToGson(baseDir + "regions_en.json", regions_en); // ? final List<City> cities = CityListParser.fillWealthIndex(host + realm + "/main/geo/citylist/", regions); Utils.writeToGson(baseDir + "cities.json", cities); final List<City> cities_en = CityListParser.fillWealthIndex(host_en + realm + "/main/geo/citylist/", regions); Utils.writeToGson(baseDir + "cities_en.json", cities_en); logger.info("cities.size() = {}, realm = {}", cities.size(), realm); logger.info(" ?? ? "); final List<Product> products = ProductInitParser.getTradingProducts(host, realm); Utils.writeToGson(baseDir + "products.json", products); final List<Product> products_en = ProductInitParser.getTradingProducts(host_en, realm); Utils.writeToGson(baseDir + "products_en.json", products_en); logger.info("products.size() = {}, realm = {}", products.size(), realm); saveProductImg(products); logger.info(" ?? ? ??"); final List<UnitType> unitTypes = ServiceInitParser.getServiceUnitTypes(host, realm); Utils.writeToGson(serviceBaseDir + "service_unit_types.json", unitTypes); final List<UnitType> unitTypes_en = ServiceInitParser.getServiceUnitTypes(host_en, realm); Utils.writeToGson(serviceBaseDir + "service_unit_types_en.json", unitTypes_en); logger.info("service_unit_types.size() = {}, realm = {}", unitTypes.size(), realm); saveUnitTypeImg(unitTypes); final Calendar today = Calendar.getInstance(); if ("olga".equalsIgnoreCase(realm) && (today.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY || today.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)) { } else if ("anna".equalsIgnoreCase(realm) && today.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY) { } else if ("mary".equalsIgnoreCase(realm) && today.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) { } else if ("lien".equalsIgnoreCase(realm) && today.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) { } else if ("vera".equalsIgnoreCase(realm) && (today.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY || today.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)) { } else if ("fast".equalsIgnoreCase(realm)) { } else { return; } logger.info( " ?? ? "); final List<ProductCategory> product_categories = ProductInitParser.getProductCategories(products); Utils.writeToGson(baseDir + "product_categories.json", product_categories); final List<ProductCategory> product_categories_en = ProductInitParser.getProductCategories(products_en); Utils.writeToGson(baseDir + "product_categories_en.json", product_categories_en); logger.info(" ?"); final List<Product> materials = ProductInitParser.getProducts(host, realm); final Map<String, List<CountryDutyList>> countriesDutyList = CountryDutyListParser .getAllCountryDutyList(host + realm + "/main/geo/countrydutylist/", countries, materials); for (final Map.Entry<String, List<CountryDutyList>> entry : countriesDutyList.entrySet()) { Utils.writeToGson(baseDir + countrydutylist + File.separator + entry.getKey() + ".json", entry.getValue()); } logger.info("? "); final Map<String, List<TradeAtCity>> stats = CityParser.collectByTradeAtCities(host, realm, cities, products, countriesDutyList, regions); //?? json for (final Map.Entry<String, List<TradeAtCity>> entry : stats.entrySet()) { Utils.writeToGson(baseDir + "tradeAtCity_" + entry.getKey() + ".json", entry.getValue()); } logger.info(" ? "); final DateFormat df = new SimpleDateFormat("dd.MM.yyyy"); Utils.writeToGson(baseDir + "updateDate.json", new UpdateDate(df.format(new Date()))); logger.info("? "); final List<Shop> shops = TopRetailParser.getShopList(realm, stats, products); logger.info( " ?? ? "); final Map<String, List<RetailAnalytics>> retailAnalytics = PrepareAnalitics .getRetailAnalitincsByProducts(shops, stats, products); for (final Map.Entry<String, List<RetailAnalytics>> entry : retailAnalytics.entrySet()) { Utils.writeToGsonZip(baseDir + RetailSalePrediction.RETAIL_ANALYTICS_ + entry.getKey() + ".json", entry.getValue()); } logger.info(" ?? "); for (final UnitType ut : unitTypes) { final List<ServiceAtCity> serviceAtCity = ServiceAtCityParser.get(host, realm, cities, ut, regions); Utils.writeToGson(serviceBaseDir + "serviceAtCity_" + ut.getId() + ".json", serviceAtCity); } for (final UnitType ut : unitTypes_en) { final List<ServiceAtCity> serviceAtCity_en = ServiceAtCityParser.get(host_en, realm, cities_en, ut, regions_en); Utils.writeToGson(serviceBaseDir + "serviceAtCity_" + ut.getId() + "_en.json", serviceAtCity_en); } logger.info(" ? "); Utils.writeToGson(serviceBaseDir + "updateDate.json", new UpdateDate(df.format(new Date()))); // ? // RetailSalePrediction.createPrediction(realm, retailAnalytics, products); }
From source file:de.tor.tribes.ui.components.DatePicker.java
/** * remaps the days of week of gregorian Calendar to internal values *//*from w w w . j a v a 2 s.c o m*/ private int mapDayOfWeek(int cal) { switch (cal) { case Calendar.MONDAY: return 1; case Calendar.TUESDAY: return 2; case Calendar.WEDNESDAY: return 3; case Calendar.THURSDAY: return 4; case Calendar.FRIDAY: return 5; case Calendar.SATURDAY: return 6; case Calendar.SUNDAY: return 7; default: return 1; //should never happen } }