Example usage for java.util Calendar THURSDAY

List of usage examples for java.util Calendar THURSDAY

Introduction

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

Prototype

int THURSDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Thursday.

Usage

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);
    }/*  w w w . ja  v a  2 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:org.davidmendoza.esu.service.impl.InicioServiceImpl.java

private String obtieneDia(int dia) {
    switch (dia) {
    case Calendar.SUNDAY:
        return "domingo";
    case Calendar.MONDAY:
        return "lunes";
    case Calendar.TUESDAY:
        return "martes";
    case Calendar.WEDNESDAY:
        return "miercoles";
    case Calendar.THURSDAY:
        return "jueves";
    case Calendar.FRIDAY:
        return "viernes";
    default:/*from   w  w  w. ja  va2  s .  co  m*/
        return "sabado";
    }
}

From source file:paarmann.physikprofil.MainActivity.java

public void onBtnAfterTomorrowClick(View view) {
    Calendar cal = Calendar.getInstance();
    int offset;/*  w  w w . j  a  va 2  s. c om*/
    if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY
            || cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) {
        offset = 4;
    } else if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
        offset = 3;
    } else {
        offset = 2;
    }
    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:org.davidmendoza.esu.service.impl.InicioServiceImpl.java

private Integer obtieneDia(String dia) {
    switch (dia) {
    case "domingo":
        return Calendar.SUNDAY;
    case "lunes":
        return Calendar.MONDAY;
    case "martes":
        return Calendar.TUESDAY;
    case "miercoles":
        return Calendar.WEDNESDAY;
    case "jueves":
        return Calendar.THURSDAY;
    case "viernes":
        return Calendar.FRIDAY;
    default:/*www.  j  ava 2  s.  c o  m*/
        return Calendar.SATURDAY;
    }
}

From source file:com.autentia.jsf.component.ocupation.HtmlOcupationCalendarRenderer.java

private static String[] mapShortWeekdays(DateFormatSymbols symbols) {
    String[] weekdays = new String[7];

    String[] localeWeekdays = symbols.getShortWeekdays();

    weekdays[0] = localeWeekdays[Calendar.MONDAY];
    weekdays[1] = localeWeekdays[Calendar.TUESDAY];
    weekdays[2] = localeWeekdays[Calendar.WEDNESDAY];
    weekdays[3] = localeWeekdays[Calendar.THURSDAY];
    weekdays[4] = localeWeekdays[Calendar.FRIDAY];
    weekdays[5] = localeWeekdays[Calendar.SATURDAY];
    weekdays[6] = localeWeekdays[Calendar.SUNDAY];

    return weekdays;
}

From source file:net.sourceforge.fenixedu.presentationTier.TagLib.sop.examsMapNew.renderers.ExamsMapContentRenderer.java

/**
 * @param infoExam/*from  w  w  w  .  j a  v  a2 s .  co  m*/
 * @return
 */
private boolean atValidHour(InfoExam infoExam) {
    int curricularYear = infoExam.getInfoExecutionCourse().getCurricularYear().intValue();
    int beginning = infoExam.getBeginning().get(Calendar.HOUR_OF_DAY);
    int weekDay = infoExam.getDay().get(Calendar.DAY_OF_WEEK);

    return ((curricularYear == 1 || curricularYear == 2) && (beginning == 9))
            || (curricularYear == 3 && beginning == 17)
            || (curricularYear == 4
                    && (((weekDay == Calendar.TUESDAY || weekDay == Calendar.THURSDAY) && beginning == 17)
                            || (weekDay == Calendar.SATURDAY && beginning == 9)))
            || (curricularYear == 5 && beginning == 13);
}

From source file:org.eevolution.form.CRP.java

/**
 * Create Category Dataset based on date start and resource
 * @param start//w  ww  .  j a  va  2 s  . c  o  m
 * @param resource
 * @return CategoryDataset
 */
protected CategoryDataset createDataset(Timestamp start, MResource resource) {
    GregorianCalendar gc1 = new GregorianCalendar();
    gc1.setTimeInMillis(start.getTime());
    gc1.clear(Calendar.MILLISECOND);
    gc1.clear(Calendar.SECOND);
    gc1.clear(Calendar.MINUTE);
    gc1.clear(Calendar.HOUR_OF_DAY);

    Timestamp date = start;
    String namecapacity = Msg.translate(Env.getCtx(), "Capacity");
    String nameload = Msg.translate(Env.getCtx(), "Load");
    String namesummary = Msg.translate(Env.getCtx(), "Summary");
    MResourceType t = MResourceType.get(Env.getCtx(), resource.getS_ResourceType_ID());
    int days = 1;
    long hours = t.getTimeSlotHours();

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    //      Long Hours = new Long(hours);                            
    int C_UOM_ID = DB.getSQLValue(null, "SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? ",
            resource.getS_Resource_ID());
    MUOM uom = MUOM.get(Env.getCtx(), C_UOM_ID);
    if (!uom.isHour()) {
        return dataset;
    }
    long summary = 0;

    while (days < 32) {
        String day = new String(new Integer(date.getDate()).toString());
        long HoursLoad = getLoad(resource, date).longValue();
        Long Hours = new Long(hours);

        switch (gc1.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.SUNDAY:
            days++;
            if (t.isOnSunday()) {
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.MONDAY:
            days++;
            if (t.isOnMonday()) {
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.TUESDAY:
            days++;
            if (t.isOnTuesday()) {
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.WEDNESDAY:
            days++;
            if (t.isOnWednesday()) {
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.THURSDAY:
            days++;
            if (t.isOnThursday()) {
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.FRIDAY:
            days++;
            if (t.isOnFriday()) {
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {

                dataset.addValue(0, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        case Calendar.SATURDAY:
            days++;
            if (t.isOnSaturday()) {
                dataset.addValue(hours, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary + Hours.intValue() - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            } else {
                dataset.addValue(0, namecapacity, day);
                dataset.addValue(HoursLoad, nameload, day);
                dataset.addValue(summary, namesummary, day);
                summary = summary - (HoursLoad);
                gc1.add(Calendar.DATE, 1);
                date = new Timestamp(gc1.getTimeInMillis());
                break;
            }
        }

    }
    return dataset;
}

From source file:it.dbCleaner.PurgeTest.java

/**
 * SONAR-7175// www.java  2  s  . c o  m
 */
@Test
public void keep_latest_snapshot() {
    // Keep all snapshots from last 4 weeks
    setServerProperty(orchestrator, "sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByWeek", "4");

    Date oneWeekAgo = addDays(new Date(), -7);

    // Execute an analysis wednesday last week
    Calendar lastWednesday = Calendar.getInstance();
    lastWednesday.setTime(oneWeekAgo);
    lastWednesday.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
    String lastWednesdayFormatted = formatDate(lastWednesday.getTime());
    runProjectAnalysis(orchestrator, PROJECT_SAMPLE_PATH, "sonar.projectDate", lastWednesdayFormatted);

    // Execute an analysis thursday last week
    Calendar lastThursday = Calendar.getInstance();
    lastThursday.setTime(oneWeekAgo);
    lastThursday.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
    String lastThursdayFormatted = formatDate(lastThursday.getTime());
    runProjectAnalysis(orchestrator, PROJECT_SAMPLE_PATH, "sonar.projectDate", lastThursdayFormatted);

    // Now only keep 1 snapshot per week
    setServerProperty(orchestrator, "sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByWeek", "0");

    // Execute an analysis today to execute the purge of previous weeks snapshots
    runProjectAnalysis(orchestrator, PROJECT_SAMPLE_PATH);

    // Check that only analysis from last thursday is kept (as it's the last one from previous week)
    WsMeasures.SearchHistoryResponse response = newAdminWsClient(orchestrator).measures()
            .searchHistory(SearchHistoryRequest.builder().setComponent(PROJECT_KEY)
                    .setMetrics(singletonList("ncloc")).build());
    assertThat(response.getMeasuresCount()).isEqualTo(1);
    assertThat(response.getMeasuresList().get(0).getHistoryList()).extracting(HistoryValue::getDate)
            .doesNotContain(lastWednesdayFormatted, lastThursdayFormatted);
}

From source file:com.autentia.jsf.component.ocupation.HtmlOcupationCalendarRenderer.java

private int mapCalendarDayToCommonDay(int day) {
    switch (day) {
    case Calendar.TUESDAY:
        return 1;
    case Calendar.WEDNESDAY:
        return 2;
    case Calendar.THURSDAY:
        return 3;
    case Calendar.FRIDAY:
        return 4;
    case Calendar.SATURDAY:
        return 5;
    case Calendar.SUNDAY:
        return 6;
    default://  w w  w . j a va2  s  .  co m
        return 0;
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.TagLib.sop.examsMapNew.renderers.ExamsMapContentRenderer.java

private boolean onValidWeekDay(InfoExam infoExam) {
    int curricularYear = infoExam.getInfoExecutionCourse().getCurricularYear().intValue();
    int weekDay = infoExam.getDay().get(Calendar.DAY_OF_WEEK);

    return ((curricularYear == 1 || curricularYear == 3 || curricularYear == 5)
            && (weekDay == Calendar.MONDAY || weekDay == Calendar.WEDNESDAY || weekDay == Calendar.FRIDAY))
            || ((curricularYear == 2 || curricularYear == 4) && (weekDay == Calendar.TUESDAY
                    || weekDay == Calendar.THURSDAY || weekDay == Calendar.SATURDAY));
}