Example usage for java.util Calendar SATURDAY

List of usage examples for java.util Calendar SATURDAY

Introduction

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

Prototype

int SATURDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Saturday.

Usage

From source file:Main.java

/**
 * This constructs an <code>Iterator</code> over each day in a date
 * range defined by a focus date and range style.
 *
 * For instance, passing Thursday, July 4, 2002 and a
 * <code>RANGE_MONTH_SUNDAY</code> will return an <code>Iterator</code>
 * that starts with Sunday, June 30, 2002 and ends with Saturday, August 3,
 * 2002, returning a Calendar instance for each intermediate day.
 *
 * This method provides an iterator that returns Calendar objects.
 * The days are progressed using {@link Calendar#add(int, int)}.
 *
 * @param focus  the date to work with//from  ww w.  j  av  a  2  s  .  co  m
 * @param rangeStyle  the style constant to use. Must be one of
 * {@link DateUtils#RANGE_MONTH_SUNDAY}, 
 * {@link DateUtils#RANGE_MONTH_MONDAY},
 * {@link DateUtils#RANGE_WEEK_SUNDAY},
 * {@link DateUtils#RANGE_WEEK_MONDAY},
 * {@link DateUtils#RANGE_WEEK_RELATIVE},
 * {@link DateUtils#RANGE_WEEK_CENTER}
 * @return the date iterator
 * @throws IllegalArgumentException if the date is <code>null</code>
 * @throws IllegalArgumentException if the rangeStyle is invalid
 */
public static Iterator iterator(Calendar focus, int rangeStyle) {
    if (focus == null) {
        throw new IllegalArgumentException("The date must not be null");
    }
    Calendar start = null;
    Calendar end = null;
    int startCutoff = Calendar.SUNDAY;
    int endCutoff = Calendar.SATURDAY;
    switch (rangeStyle) {
    case RANGE_MONTH_SUNDAY:
    case RANGE_MONTH_MONDAY:
        //Set start to the first of the month
        start = truncate(focus, Calendar.MONTH);
        //Set end to the last of the month
        end = (Calendar) start.clone();
        end.add(Calendar.MONTH, 1);
        end.add(Calendar.DATE, -1);
        //Loop start back to the previous sunday or monday
        if (rangeStyle == RANGE_MONTH_MONDAY) {
            startCutoff = Calendar.MONDAY;
            endCutoff = Calendar.SUNDAY;
        }
        break;
    case RANGE_WEEK_SUNDAY:
    case RANGE_WEEK_MONDAY:
    case RANGE_WEEK_RELATIVE:
    case RANGE_WEEK_CENTER:
        //Set start and end to the current date
        start = truncate(focus, Calendar.DATE);
        end = truncate(focus, Calendar.DATE);
        switch (rangeStyle) {
        case RANGE_WEEK_SUNDAY:
            //already set by default
            break;
        case RANGE_WEEK_MONDAY:
            startCutoff = Calendar.MONDAY;
            endCutoff = Calendar.SUNDAY;
            break;
        case RANGE_WEEK_RELATIVE:
            startCutoff = focus.get(Calendar.DAY_OF_WEEK);
            endCutoff = startCutoff - 1;
            break;
        case RANGE_WEEK_CENTER:
            startCutoff = focus.get(Calendar.DAY_OF_WEEK) - 3;
            endCutoff = focus.get(Calendar.DAY_OF_WEEK) + 3;
            break;
        }
        break;
    default:
        throw new IllegalArgumentException("The range style " + rangeStyle + " is not valid.");
    }
    if (startCutoff < Calendar.SUNDAY) {
        startCutoff += 7;
    }
    if (startCutoff > Calendar.SATURDAY) {
        startCutoff -= 7;
    }
    if (endCutoff < Calendar.SUNDAY) {
        endCutoff += 7;
    }
    if (endCutoff > Calendar.SATURDAY) {
        endCutoff -= 7;
    }
    while (start.get(Calendar.DAY_OF_WEEK) != startCutoff) {
        start.add(Calendar.DATE, -1);
    }
    while (end.get(Calendar.DAY_OF_WEEK) != endCutoff) {
        end.add(Calendar.DATE, 1);
    }
    return new DateIterator(start, end);
}

From source file:com.alkacon.opencms.calendar.CmsCalendarMonthBean.java

/**
 * Builds the HTML output to create a basic calendar month overview.<p>
 * //from www . j a v a 2 s. c  o  m
 * This method serves as a simple example to create a basic html calendar monthly view.<p>
 * 
 * @param year the year of the month to display
 * @param month the month to display 
 * @param calendarLocale the Locale for the calendar to determine the start day of the weeks
 * @param showNavigation if true, navigation links to switch the month are created, otherwise not
 * @return the HTML output to create a basic calendar month overview
 */
public String buildCalendarMonth(int year, int month, Locale calendarLocale, boolean showNavigation) {

    StringBuffer result = new StringBuffer(1024);

    Map dates = getMonthDaysMatrix(year, month, calendarLocale);
    Map monthEntries = getEntriesForMonth(year, month);

    // calculate the start day of the week
    Calendar calendar = new GregorianCalendar(calendarLocale);
    int weekStart = calendar.getFirstDayOfWeek();
    // store current calendar date
    Calendar currentCalendar = (Calendar) calendar.clone();

    // init the date format symbols
    DateFormatSymbols calendarSymbols = new DateFormatSymbols(calendarLocale);

    // open the table
    result.append("<table class=\"");
    result.append(getStyle().getStyleTable());
    result.append("\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");

    // create the calendar navigation row
    result.append(buildMonthNavigation(year, month, currentCalendar, calendarLocale, showNavigation));

    // create the week day row
    result.append("<tr>\n");
    int currWeekDay = weekStart;
    for (int i = 1; i <= 7; i++) {

        result.append("\t<td class=\"");
        result.append(getStyle().getStyleWeekdays());
        result.append("\">");
        result.append(calendarSymbols.getShortWeekdays()[currWeekDay]);
        result.append("</td>\n");
        // check if we are at end of week
        if (currWeekDay == Calendar.SATURDAY) {
            currWeekDay = 0;
        }

        currWeekDay++;
    }
    result.append("</tr>\n");

    // now create the entry rows
    result.append("<tr>\n");

    // iterate the index entries of the matrix
    Iterator i = dates.keySet().iterator();
    while (i.hasNext()) {
        Integer index = (Integer) i.next();
        result.append("\t<td class=\"");
        Calendar currDay = (Calendar) dates.get(index);
        if (currDay != null) {
            // current index represents a day, create day output
            String styleDayCell = getStyle().getStyleDay();
            if (isCurrentDay(currentCalendar, currDay)) {
                // for the current day, use another cell style
                styleDayCell = getStyle().getStyleDayCurrent();
            }
            // get entries for the day
            List dayEntries = (List) monthEntries.get(currDay.getTime());
            if (dayEntries.size() > 0) {
                // current day has calendar entries
                int weekdayStatus = 0;
                int holidayEntries = 0;
                int commonEntries = dayEntries.size();
                StringBuffer dayText = new StringBuffer(128);
                // check all entries for special weekday status entries
                for (int k = 0; k < commonEntries; k++) {
                    CmsCalendarEntry entry = (CmsCalendarEntry) dayEntries.get(k);
                    int entryWeekdayStatus = entry.getEntryData().getWeekdayStatus();
                    if (entryWeekdayStatus > 0) {
                        // entry is a special weekday
                        holidayEntries++;
                        // append special day info to title info
                        dayText.append(entry.getEntryData().getTitle());
                        dayText.append(" - ");
                        if (entryWeekdayStatus > weekdayStatus) {
                            // increase the status of the weekday
                            weekdayStatus = entryWeekdayStatus;
                        }
                    }
                }
                // calculate the count of common calendar entries
                commonEntries = commonEntries - holidayEntries;
                // determine the CSS class to use
                String dayStyle = getWeekdayStyle(currDay.get(Calendar.DAY_OF_WEEK), weekdayStatus);
                result.append(styleDayCell);
                result.append("\" title=\"");
                result.append(dayText);
                // check the number of common entries and generate output of entry count
                if (commonEntries <= 0) {
                    // no entry found
                    result.append(getMessages().key("calendar.entries.count.none"));
                } else if (commonEntries == 1) {
                    // one entry found
                    result.append(getMessages().key("calendar.entries.count.one"));
                } else {
                    // more than one entry found
                    result.append(getMessages().key("calendar.entries.count.more",
                            new String[] { String.valueOf(commonEntries) }));
                }
                result.append("\">");
                if (commonEntries > 0) {
                    // common entries present, create link to the overview page 
                    result.append("<a href=\"");
                    result.append(createLink(currDay, m_viewUri, true, -1));
                    result.append("\" class=\"");
                    result.append(getStyle().getStyleDayEntryLink());
                    result.append("\">");
                }
                result.append("<span class=\"");
                result.append(dayStyle);
                result.append("\">");
                result.append(currDay.get(Calendar.DAY_OF_MONTH));
                result.append("</span>");
                if (commonEntries > 0) {
                    // common entries present, close link
                    result.append("</a>");
                }
            } else {
                // current day has no entries
                result.append(styleDayCell);
                result.append("\" title=\"");
                result.append(getMessages().key("calendar.entries.count.none"));
                result.append("\">");
                result.append("<span class=\"");
                result.append(getWeekdayStyle(currDay.get(Calendar.DAY_OF_WEEK),
                        I_CmsCalendarEntryData.WEEKDAYSTATUS_WORKDAY));
                result.append("\">");
                result.append(currDay.get(Calendar.DAY_OF_MONTH));
                result.append("</span>");
            }
        } else {
            // this is an empty cell
            result.append(getStyle().getStyleDayEmpty());
            result.append("\">");
        }
        result.append("</td>\n");
        if ((index.intValue() % 7) == 0) {
            // append closing row tag
            result.append("</tr>\n");
            if (i.hasNext()) {
                // open next row if more elements are present
                result.append("<tr>\n");
            }
        }
    }

    // close the table
    result.append("</table>");
    return result.toString();
}

From source file:com.surevine.alfresco.repo.action.delete.DeleteActionJob.java

/**
 * Separated into a separate method to allow for optimisation etc.
 * @return//  w ww .  j  av a  2  s. c o m
 */
protected String assembleLuceneQuery() {
    final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));

    // Attempt to delete items that have previously failed to delete if the
    // day of the week is a saturday and it's between midnight and 1am.
    if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && calendar.get(Calendar.HOUR_OF_DAY) == 0) {
        if (_logger.isDebugEnabled()) {
            _logger.debug("Not filtering items that have failed to delete.");
        }
        return _itemsToDeleteQuery;
    } else {
        if (_logger.isDebugEnabled()) {
            _logger.debug("Filtering items that have failed to delete.");
        }
        return _itemsToDeleteFilterFailedQuery;
    }
}

From source file:com.adobe.acs.commons.http.headers.impl.WeeklyExpiresHeaderFilterTest.java

@Test(expected = ConfigurationException.class)
public void testDoActivateInvalidHighDayOfWeek() throws Exception {
    properties.put(WeeklyExpiresHeaderFilter.PROP_EXPIRES_DAY_OF_WEEK, Calendar.SATURDAY + 1);
    filter.doActivate(componentContext);
}

From source file:org.jasig.schedassist.model.AvailableBlockBuilderTest.java

/**
 * Every week day from June 24 2008 to August 6 2008.
 * /*from w  w w  .ja va  2s  .  c o  m*/
 * @throws Exception
 */
@Test
public void testCreateBlocksExample2() throws Exception {
    SimpleDateFormat dateFormat = CommonDateOperations.getDateFormat();
    Date startDate = dateFormat.parse("20080624");
    Date endDate = dateFormat.parse("20080806");
    Set<AvailableBlock> blocks = AvailableBlockBuilder.createBlocks("9:00 AM", "11:30 AM", "MTWRF", startDate,
            endDate);
    // 32 weekdays between June 24 2008 and August 6 2008 (including Aug 6 2008)
    assertEquals(32, blocks.size());
    for (AvailableBlock block : blocks) {
        assertEquals(150, block.getDurationInMinutes());
        Calendar cal = Calendar.getInstance();
        cal.setTime(block.getStartTime());
        assertEquals(9, cal.get(Calendar.HOUR_OF_DAY));
        assertEquals(0, cal.get(Calendar.MINUTE));
        cal.setTime(block.getEndTime());
        assertEquals(11, cal.get(Calendar.HOUR_OF_DAY));
        assertEquals(30, cal.get(Calendar.MINUTE));
        assertNotSame(Calendar.SATURDAY, cal.get(Calendar.DAY_OF_WEEK));
        assertNotSame(Calendar.SUNDAY, cal.get(Calendar.DAY_OF_WEEK));
        assertEquals(1, block.getVisitorLimit());
    }

    blocks = AvailableBlockBuilder.createBlocks("9:00 AM", "11:30 AM", "MTWRF", startDate, endDate, 64);
    // 32 weekdays between June 24 2008 and August 6 2008 (including Aug 6 2008)
    assertEquals(32, blocks.size());
    for (AvailableBlock block : blocks) {
        assertEquals(150, block.getDurationInMinutes());
        Calendar cal = Calendar.getInstance();
        cal.setTime(block.getStartTime());
        assertEquals(9, cal.get(Calendar.HOUR_OF_DAY));
        assertEquals(0, cal.get(Calendar.MINUTE));
        cal.setTime(block.getEndTime());
        assertEquals(11, cal.get(Calendar.HOUR_OF_DAY));
        assertEquals(30, cal.get(Calendar.MINUTE));
        assertNotSame(Calendar.SATURDAY, cal.get(Calendar.DAY_OF_WEEK));
        assertNotSame(Calendar.SUNDAY, cal.get(Calendar.DAY_OF_WEEK));
        assertEquals(64, block.getVisitorLimit());
    }
}

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 w  w  . j a v  a2 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();/*  w  w w  .  jav a  2 s.  com*/
    } 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:org.b3log.symphony.processor.ActivityProcessor.java

/**
 * Shows 1A0001.//from  w ww.j a v a  2 s  .c  o  m
 *
 * @param context the specified context
 * @param request the specified request
 * @param response the specified response
 * @throws Exception exception
 */
@RequestProcessing(value = "/activity/1A0001", method = HTTPRequestMethod.GET)
@Before(adviceClass = { StopwatchStartAdvice.class, LoginCheck.class })
@After(adviceClass = { CSRFToken.class, StopwatchEndAdvice.class })
public void show1A0001(final HTTPRequestContext context, final HttpServletRequest request,
        final HttpServletResponse response) throws Exception {
    request.setAttribute(Keys.TEMAPLTE_DIR_NAME, Symphonys.get("skinDirName"));
    final AbstractFreeMarkerRenderer renderer = new SkinRenderer();
    context.setRenderer(renderer);
    renderer.setTemplateName("/activity/1A0001.ftl");
    final Map<String, Object> dataModel = renderer.getDataModel();

    final JSONObject currentUser = (JSONObject) request.getAttribute(User.USER);
    final String userId = currentUser.optString(Keys.OBJECT_ID);

    final boolean closed = Symphonys.getBoolean("activity1A0001Closed");
    dataModel.put(Common.CLOSED, closed);

    final Calendar calendar = Calendar.getInstance();
    final int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
    final boolean closed1A0001 = dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY;
    dataModel.put(Common.CLOSED_1A0001, closed1A0001);

    final int hour = calendar.get(Calendar.HOUR_OF_DAY);
    final int minute = calendar.get(Calendar.MINUTE);
    final boolean end = hour > 14 || (hour == 14 && minute > 55);
    dataModel.put(Common.END, end);

    final boolean collected = activityQueryService.isCollected1A0001Today(userId);
    dataModel.put(Common.COLLECTED, collected);

    final boolean participated = activityQueryService.is1A0001Today(userId);
    dataModel.put(Common.PARTICIPATED, participated);

    while (true) {
        if (closed) {
            dataModel.put(Keys.MSG, langPropsService.get("activityClosedLabel"));
            break;
        }

        if (closed1A0001) {
            dataModel.put(Keys.MSG, langPropsService.get("activity1A0001CloseLabel"));
            break;
        }

        if (collected) {
            dataModel.put(Keys.MSG, langPropsService.get("activityParticipatedLabel"));
            break;
        }

        if (participated) {
            dataModel.put(Common.HOUR, hour);

            final List<JSONObject> records = pointtransferQueryService.getLatestPointtransfers(userId,
                    Pointtransfer.TRANSFER_TYPE_C_ACTIVITY_1A0001, 1);
            final JSONObject pointtransfer = records.get(0);
            final String data = pointtransfer.optString(Pointtransfer.DATA_ID);
            final String smallOrLarge = data.split("-")[1];
            final int sum = pointtransfer.optInt(Pointtransfer.SUM);
            String msg = langPropsService.get("activity1A0001BetedLabel");
            final String small = langPropsService.get("activity1A0001BetSmallLabel");
            final String large = langPropsService.get("activity1A0001BetLargeLabel");
            msg = msg.replace("{smallOrLarge}", StringUtils.equals(smallOrLarge, "0") ? small : large);
            msg = msg.replace("{point}", String.valueOf(sum));

            dataModel.put(Keys.MSG, msg);

            break;
        }

        if (end) {
            dataModel.put(Keys.MSG, langPropsService.get("activityEndLabel"));
            break;
        }

        break;
    }

    filler.fillHeaderAndFooter(request, response, dataModel);
    filler.fillRandomArticles(dataModel);
    filler.fillHotArticles(dataModel);
    filler.fillSideTags(dataModel);
    filler.fillLatestCmts(dataModel);
}

From source file:org.faster.util.DateTimes.java

/**
 * ?//  www .j a  v a2  s. com
 *
 * @param date
 *            
 * @return ?
 */
public static boolean isWeekend(Date date) {
    if (date == null) {
        throw new IllegalArgumentException("date must not be null!");
    }
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
    return dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY;
}

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 ww  w.j a va  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);
}