Example usage for java.util Calendar WEDNESDAY

List of usage examples for java.util Calendar WEDNESDAY

Introduction

In this page you can find the example usage for java.util Calendar WEDNESDAY.

Prototype

int WEDNESDAY

To view the source code for java.util Calendar WEDNESDAY.

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Wednesday.

Usage

From source file:com.clustercontrol.jobmanagement.factory.JobPlanSchedule.java

/**
 * ????Cron??/*from   w ww .ja  va 2 s.c o m*/
 * 
 * @param cron
 */
private void createPlan(String cron) {

    /*
     * cron
     *       
     */

    // * 0 15 * * ? *         1500
    // * 0 23 ? * 1 *         2300
    // * */10 * * * ? *       10??

    String[] planSplit = cron.split(" ");
    String aster = "*";
    String question = "?";
    String slash = "/";
    if (!aster.equals(planSplit[0])) {
        secondType = 0;
        second = Integer.parseInt(planSplit[0]);
    }
    if (!aster.equals(planSplit[1])) {
        String[] slashSplit = planSplit[1].split(slash);
        int num = 0;
        for (String str : slashSplit) {
            m_log.trace("slashSplit[ " + num + " ] =" + str);
            num++;
        }
        //p?q????
        if (slashSplit.length == 2) {
            minuteType = 3;
            minute = Integer.parseInt(slashSplit[0]);
            fromMinutes = Integer.parseInt(slashSplit[0]);
            everyMinutes = Integer.parseInt(slashSplit[1]);
        } else {
            minuteType = 0;
            minute = Integer.parseInt(planSplit[1]);
            m_log.debug("minuteType=" + minuteType);
            m_log.debug("minute=" + minute);
        }
    }
    if (!aster.equals(planSplit[2])) {
        hourType = 0;
        hour = Integer.parseInt(planSplit[2]);
    }
    if (question.equals(planSplit[3])) {
        dayType = 2;
    } else if (!aster.equals(planSplit[3])) {
        dayType = 0;
        day = Integer.parseInt(planSplit[3]);
    }
    if (!aster.equals(planSplit[4])) {
        monthType = 0;
        month = Integer.parseInt(planSplit[4]);
    }
    if (question.equals(planSplit[5])) {
        weekType = 2;
    } else if (!aster.equals(planSplit[5])) {
        weekType = 0;
        week = Integer.parseInt(planSplit[5]);
    }
    switch (week) {
    case 1:
        weekCalendar = Calendar.SUNDAY;
        break;
    case 2:
        weekCalendar = Calendar.MONDAY;
        break;
    case 3:
        weekCalendar = Calendar.TUESDAY;
        break;
    case 4:
        weekCalendar = Calendar.WEDNESDAY;
        break;
    case 5:
        weekCalendar = Calendar.THURSDAY;
        break;
    case 6:
        weekCalendar = Calendar.FRIDAY;
        break;
    case 7:
        weekCalendar = Calendar.SATURDAY;
        break;
    default:
        weekCalendar = Calendar.SUNDAY;
    }
    // weekType?0??????????
    // ??????????*????0?? 
    if (weekType == 0 && isFireDayOfWeek() == false) {
        nextFireDay();
        if (hourType == 1) {
            hour = 0;
        }
    }
}

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/*from  w  w w  .j  av  a  2  s  .  c  o  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.pressurelabs.flowopensource.TheHubActivity.java

private void generateDrawerGreeting(NavigationView view) {
    View header = view.getHeaderView(0);
    TextView greeting = (TextView) header.findViewById(R.id.ndrawer_date_greeting);
    String[] array = this.getResources().getStringArray(R.array.drawer_greeting);

    switch (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {
    case Calendar.MONDAY:
        greeting.setText(array[0]);// www  . j a  v  a2  s .  c o m
        break;

    case Calendar.TUESDAY:
        greeting.setText(array[1]);
        break;

    case Calendar.WEDNESDAY:
        greeting.setText(array[2]);
        break;
    case Calendar.THURSDAY:
        greeting.setText(array[3]);
        break;
    case Calendar.FRIDAY:
        greeting.setText(array[4]);
        break;
    case Calendar.SATURDAY:
        greeting.setText(array[5]);
        break;

    case Calendar.SUNDAY:
        greeting.setText(array[6]);
        break;

    default:
        greeting.setText(array[7]);
        break;

    }

}

From source file:com.mb.framework.util.DateTimeUtil.java

/**
 * This method is used for getting day of week short description
 * //w ww .ja va2  s. c  o  m
 * @param dayOfWeek
 * @return
 */
public static String getDayOfWeekShortDesc(int dayOfWeek) {
    String dayOfWeekShortDesc;

    switch (dayOfWeek) {
    case Calendar.SUNDAY: {
        dayOfWeekShortDesc = DateTimeConstants.SHORT_SUNDAY;
        break;
    }
    case Calendar.MONDAY: {
        dayOfWeekShortDesc = DateTimeConstants.SHORT_MONDAY;
        break;
    }
    case Calendar.TUESDAY: {
        dayOfWeekShortDesc = DateTimeConstants.SHORT_TUESDAY;
        break;
    }
    case Calendar.WEDNESDAY: {
        dayOfWeekShortDesc = DateTimeConstants.SHORT_WEDNESDAY;
        break;
    }
    case Calendar.THURSDAY: {
        dayOfWeekShortDesc = DateTimeConstants.SHORT_THURSDAY;
        break;
    }
    case Calendar.FRIDAY: {
        dayOfWeekShortDesc = DateTimeConstants.SHORT_FRIDAY;
        break;
    }
    case Calendar.SATURDAY: {
        dayOfWeekShortDesc = DateTimeConstants.SHORT_SATURDAY;
        break;
    }
    default: {
        dayOfWeekShortDesc = "";
        break;
    }
    }
    return dayOfWeekShortDesc;
}

From source file:com.eryansky.common.utils.SysUtils.java

public static String getNowDateStr() {
     String result = dateFormat(getNowDate(), CHS_DATEFORMAT);
     Calendar c = Calendar.getInstance();
     for (int i = 0; i < 8; i++) {
         c.add(Calendar.DAY_OF_MONTH, 1);
         @SuppressWarnings("unused")
         int e = c.get(Calendar.DAY_OF_WEEK);
     }//from   w  w  w.ja va2s . c  o m
     result += "  ";
     switch (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {
     case Calendar.SUNDAY:
         return result + "";
     case Calendar.MONDAY:
         return result + "";
     case Calendar.TUESDAY:
         return result + "";
     case Calendar.WEDNESDAY:
         return result + "";
     case Calendar.THURSDAY:
         return result + "";
     case Calendar.FRIDAY:
         return result + "";
     case Calendar.SATURDAY:
         return result + "";
     default:
         return result;
     }
 }

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";
    }//w  w w.ja v a  2  s.  co 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 a2s .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  av  a2s  . c o  m*/
 * 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: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);
    }//  ww w.j ava2  s .c  o  m
    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: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));
}