Example usage for java.util Calendar MONDAY

List of usage examples for java.util Calendar MONDAY

Introduction

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

Prototype

int MONDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Monday.

Usage

From source file:de.tor.tribes.ui.components.DatePicker.java

/**
 * remaps the days of week of gregorian Calendar to internal values
 *///from ww  w .j a v  a 2s  .  co  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
    }
}

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  av  a  2  s  .c  om*/
    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:/*w  w w .ja  va 2  s  . com*/
        return "sabado";
    }
}

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:/*  w  ww .  j a  va 2  s  . com*/
        return Calendar.SATURDAY;
    }
}

From source file:com.kongwu.insweb.utils.DateUtils.java

/***
 * //from www  .  j  ava 2 s  .c  om
 * @Title: getMonday
 * @param date
 * @throws
 */
public static Date getMonday(Date date) {
    Calendar cal = date2Calendar(date);
    cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
    return cal.getTime();
}

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:org.projectforge.core.ConfigXml.java

private void reset() {
    resourceDir = "resources";
    jiraConfig = null;//from  w ww  . j  av  a2  s  .  c om
    jiraBrowseBaseUrl = null;
    telephoneSystemUrl = null;
    telephoneSystemNumber = null;
    telephoneSystemOperatorPanelUrl = null;
    smsUrl = null;
    receiveSmsKey = null;
    phoneLookupKey = null;
    mebMailAccount = new MailAccountConfig();
    currencySymbol = "";
    defaultLocale = Locale.ENGLISH;
    defaultTimeNotation = null;
    firstDayOfWeek = Calendar.MONDAY;
    excelDefaultPaperSize = "DINA4";
    holidays = null;
    contractTypes = null;
    databaseDirectory = "database";
    loggingDirectory = "logs";
    workingDirectory = "work";
    fontsDirectory = resourceDir + File.separator + "fonts";
    tempDirectory = "tmp";
    servletContextPath = null;
    domain = null;
    logoFile = null;
    keystoreFile = null;
    keystorePassphrase = null;
    cronExpressionHourlyJob = null;
    cronExpressionNightlyJob = null;
    cronExpressionMebPollingJob = null;
    menuConfig = null;
    webConfig = null;
    sendMailConfiguration = new SendMailConfig();
    accountingConfig = new AccountingConfig();
    accountingConfig.reset();
    ldapConfig = new LdapConfig();
}

From source file:fr.paris.lutece.plugins.calendar.service.Utils.java

/**
 * Returns the first monday of a week as a formatted string corresponding to
 * the date code//from   w w w .  java2s  . com
 * @param strDate The date code
 * @return The first day label
 */
public static Calendar getFirstDayOfWeek(String strDate) {
    Calendar calendar = new GregorianCalendar();
    Calendar calendarFirstDay = new GregorianCalendar();
    calendar.set(Utils.getYear(strDate), Utils.getMonth(strDate), Utils.getDay(strDate));

    int nDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);

    if (nDayOfWeek == 1) {
        nDayOfWeek = 8;
    }

    calendarFirstDay = calendar;
    calendarFirstDay.add(Calendar.DATE, Calendar.MONDAY - nDayOfWeek);

    return calendarFirstDay;
}

From source file:com.hangum.tadpole.commons.admin.core.dialogs.users.ModifyUserDialog.java

/**
 *  ??  .//from   w w w .  j ava2  s.co  m
 */
private void initData() {

    textEmail.setText(userDAO.getEmail());
    textName.setText(userDAO.getName());
    textAllowIP.setText(userDAO.getAllow_ip());
    textCreateDate.setText(userDAO.getCreate_time());

    comboIsRegistDB.setText(userDAO.getIs_regist_db());

    comboIsSharedDB.setText(userDAO.getIs_shared_db());
    textIntLimtCnt.setText("" + userDAO.getLimit_add_db_cnt());
    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(userDAO.getService_end().getTime());
    endDate.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH));
    endTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));

    comboApproval.setText(userDAO.getApproval_yn());
    comboUserConfirm.setText(userDAO.getIs_email_certification());
    comboDel.setText(userDAO.getDelYn());
}

From source file:org.projectforge.business.humanresources.HRPlanningDao.java

/**
 * <ul>//from  w w  w  .  jav  a 2s .  c  om
 * <li>Checks week date on: monday, 0:00:00.000 and if check fails then the date will be set to.</li>
 * <li>Check deleted entries and re-adds them instead of inserting a new entry, if exist.</li>
 * <ul>
 * 
 * @see org.projectforge.framework.persistence.api.BaseDao#onSaveOrModify(org.projectforge.core.ExtendedBaseDO)
 */
@Override
protected void onSaveOrModify(final HRPlanningDO obj) {
    final DateHolder date = new DateHolder(obj.getWeek(), DateHelper.UTC, Locale.GERMANY);
    if (date.getDayOfWeek() != Calendar.MONDAY || date.getMilliSecond() != 0 || date.getMinute() != 0
            || date.getHourOfDay() != 0) {
        log.error("Date is not begin of week, try to change date: " + DateHelper.formatAsUTC(date.getDate()));
        obj.setFirstDayOfWeek(date.getSQLDate());
    }
    super.onSaveOrModify(obj);
}