List of usage examples for java.util Calendar SUNDAY
int SUNDAY
To view the source code for java.util Calendar SUNDAY.
Click Source Link
From source file:com.aurel.track.linkType.MsProjectLinkTypeBL.java
/** * Returns number of sundays from interval. Start date included always, endDate only if includeLastDay == true! * @param startDateParam//from ww w. j a v a 2 s. c o m * @param endDateParam * @param includeLastDay * @return */ public static Integer getNumberOfSundaysFromInterval(Date startDateParam, Date endDateParam, boolean includeLastDay) { Date realEndDate = endDateParam; if (includeLastDay) { Calendar cal = Calendar.getInstance(); cal.setTime(realEndDate); cal.add(Calendar.DAY_OF_YEAR, 1); realEndDate = cal.getTime(); } Calendar calendar = Calendar.getInstance(); calendar.setTime(startDateParam); int numOfSunday = 0; while (!calendar.getTime().after(realEndDate)) { if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { numOfSunday++; } calendar.add(Calendar.DAY_OF_MONTH, 1); } return numOfSunday; }
From source file:org.ejbca.ui.web.admin.certprof.CertProfileBean.java
public boolean isExpirationRestrictionSunday() throws AuthorizationDeniedException { return getCertificateProfile().getExpirationRestrictionWeekday(Calendar.SUNDAY); }
From source file:com.embeddedlog.LightUpDroid.LightUpPiSync.java
private Alarm alarmFromJson(JSONObject aJson) { // If mSelectedAlarm is null then we're creating a new alarm. Alarm alarm = new Alarm(); alarm.alert = RingtoneManager.getActualDefaultRingtoneUri(mActivityContext, RingtoneManager.TYPE_ALARM); if (alarm.alert == null) { alarm.alert = Uri.parse("content://settings/system/alarm_alert"); }/*from w w w . ja va2 s.com*/ // Setting the vibrate option to always true, as there is no attribute in LightUpPi alarm.vibrate = true; // Setting the 'delete after use' option to always false, as there is no such feature in // the LightUpPi alarm system and all alarms are repeatable alarm.deleteAfterUse = false; // Parsing the JSON data try { alarm.hour = aJson.getInt("hour"); alarm.minutes = aJson.getInt("minute"); alarm.enabled = aJson.getBoolean("enabled"); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("monday"), Calendar.MONDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("tuesday"), Calendar.TUESDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("wednesday"), Calendar.WEDNESDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("thursday"), Calendar.THURSDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("friday"), Calendar.FRIDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("saturday"), Calendar.SATURDAY); alarm.daysOfWeek.setDaysOfWeek(aJson.getBoolean("sunday"), Calendar.SUNDAY); alarm.label = aJson.getString("label"); alarm.lightuppiId = aJson.getLong("id"); alarm.timestamp = aJson.getLong("timestamp"); } catch (JSONException e) { Log.w(LOG_TAG + " JSONException: " + e.toString()); alarm = null; } return alarm; }
From source file:com.evozon.evoportal.my_account.validator.UserAccountValidation.java
private boolean isWeekendDay(Calendar cal) { int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); boolean isSaturday = (dayOfWeek == Calendar.SATURDAY); boolean isSunday = (dayOfWeek == Calendar.SUNDAY); return isSaturday || isSunday; }
From source file:org.eevolution.form.VSCRP.java
public CategoryDataset createDataset(Timestamp start, MResource r) { //System.out.println("Create new data set"); GregorianCalendar gc1 = new GregorianCalendar(); gc1.setTimeInMillis(start.getTime()); gc1.clear(Calendar.MILLISECOND); gc1.clear(Calendar.SECOND);/*from w w w .j a v a 2s .c om*/ gc1.clear(Calendar.MINUTE); gc1.clear(Calendar.HOUR_OF_DAY); Timestamp date = start; String namecapacity = Msg.translate(Env.getCtx(), "Capacity"); System.out.println("\n Namecapacity :" + namecapacity); String nameload = Msg.translate(Env.getCtx(), "Load"); System.out.println("\n Nameload :" + nameload); String namesummary = Msg.translate(Env.getCtx(), "Summary"); System.out.println("\n Namesummary :" + namesummary); MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null); System.out.println("\n Resourcetype " + t); int days = 1; long hours = 0; if (t.isTimeSlot()) { hours = MMPCMRP.getHoursAvailable(t.getTimeSlotStart(), t.getTimeSlotEnd()); } else { //fjviejo e-evolution MachineQty if (r.getDailyCapacity().multiply(r.getMachineQty()).compareTo(Env.ZERO) != 0) hours = r.getDailyCapacity().multiply(r.getMachineQty()).longValue(); else //fjviejo e-evolution end hours = 24; } 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 = ? ", r.getS_Resource_ID()); MUOM uom = new MUOM(Env.getCtx(), C_UOM_ID, null); System.out.println("\n uom1 " + uom + "\n"); //System.out.println("um.isHour()"+ uom.isHour() ); if (!uom.isHour()) { System.out.println("\n uom2 " + uom + "\n"); return dataset; } System.out.println("\n Dataset " + dataset + "\n"); int summary = 0; int secondsAcum = 0; long hoursAcum = 0; while (days < 29) { //System.out.println("Day Number" + days); String day = new String(new Integer(date.getDate()).toString()); System.out.println("r.getS_Resource_ID()" + r.getS_Resource_ID()); System.out.println("Date:" + date); int seconds = getLoad(r.getS_Resource_ID(), date, date); Long Hours = new Long(hours); System.out.println("Summary " + summary); System.out.println("Capacity " + hours); System.out.println("Load " + seconds); /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** secondsAcum y hoursAcum llevan los acumulados para la semana ** los reinicio en cada nueva semana. ** ** VIT4B - 07/12/2006 */ if (days == 1 || days == 8 || days == 15 || days == 22) { secondsAcum = 0; hoursAcum = 0; } secondsAcum += seconds; hoursAcum += hours; switch (gc1.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: if (t.isOnSunday()) { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary + Hours.intValue() - (seconds / 3600); //+ (Hours.intValue() - ((seconds / 3600))); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.MONDAY: if (t.isOnMonday()) { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.TUESDAY: if (t.isOnTuesday()) { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.WEDNESDAY: if (t.isOnWednesday()) { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.THURSDAY: if (t.isOnThursday()) { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.FRIDAY: if (t.isOnFriday()) { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.SATURDAY: if (t.isOnSaturday()) { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { /* ** Realizo la verificacin sobre que da me encuentro ** para graficar cada 7 dias el estado de la semana. ** ** VIT4B - 07/12/2006 */ if (days == 7 || days == 14 || days == 21 || days == 28) { dataset.addValue(hoursAcum, namecapacity, day); dataset.addValue(secondsAcum / 3600, nameload, day); dataset.addValue(summary, namesummary, day); } summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } } days++; } return dataset; }
From source file:com.l2jfree.gameserver.model.entity.CCHSiege.java
private void setNextSiegeDate() { while (getSiegeDate().getTimeInMillis() < System.currentTimeMillis()) { if (getSiegeDate().get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && getSiegeDate().get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) getSiegeDate().set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); // set the next siege day to the next weekend getSiegeDate().add(Calendar.DAY_OF_MONTH, 7); getSiegeDate().set(Calendar.HOUR_OF_DAY, 20); }//from w ww .ja v a 2s. co m _isRegistrationOver = false; // Allow registration for next siege }
From source file:com.cognizant.trumobi.em.Email.java
public static String getWeekDays() { Calendar cal = Calendar.getInstance(); String string = Email.getPresentDay(); // Log.e("getPresentDay", ""+string); Date date = null;//from w w w .ja v a2s. c o m try { date = new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH).parse(string); } catch (ParseException e) { e.printStackTrace(); } cal.setTime(date); SimpleDateFormat format = new SimpleDateFormat("MMM dd", Locale.US); Calendar firstCal = (Calendar) cal.clone(); firstCal.add(Calendar.DAY_OF_WEEK, firstCal.getFirstDayOfWeek() - firstCal.get(Calendar.DAY_OF_WEEK)); // SharedPreferences prefs = PreferenceManager // .getDefaultSharedPreferences(appContext); SharedPreferences prefs = new SharedPreferences(appContext); String WeekStartsOn = prefs.getString(appContext.getString(R.string.key_list_preference), ""); if (WeekStartsOn.equalsIgnoreCase("2")) { firstCal.setFirstDayOfWeek(Calendar.SATURDAY); } else if (WeekStartsOn.equalsIgnoreCase("3")) { firstCal.setFirstDayOfWeek(Calendar.SUNDAY); } else if (WeekStartsOn.equalsIgnoreCase("4")) { firstCal.setFirstDayOfWeek(Calendar.MONDAY); } int firstDayOfWeek = firstCal.getFirstDayOfWeek(); int dayOfWeek = firstCal.get(Calendar.DAY_OF_WEEK); if (firstDayOfWeek == 7) { firstCal.add(Calendar.DAY_OF_WEEK, -dayOfWeek); } else firstCal.add(Calendar.DAY_OF_WEEK, firstCal.getFirstDayOfWeek() - firstCal.get(Calendar.DAY_OF_WEEK)); String[] days = new String[2]; days[0] = format.format(firstCal.getTime()); Calendar lastCal = (Calendar) firstCal.clone(); lastCal.add(Calendar.DAY_OF_YEAR, 6); days[1] = format.format(lastCal.getTime()); String[] weekDays = Arrays.toString(days).split(","); // String weekVal2=weekDays[1].substring(weekDays[1].length()-1); String weekVal2 = weekDays[1].replace("]", ""); String weekVal = weekDays[0].substring(1) + " - " + weekVal2; return weekVal; }
From source file:com.sonyericsson.hudson.plugins.gerrit.trigger.config.Config.java
/** * Adds the WatchTimeExceptionData from the form. * * @param formData the form.//from w w w .j av a 2s . co m * @return the WatchTimeExceptionData */ private WatchTimeExceptionData addWatchTimeExceptionData(JSONObject formData) { List<Integer> days = new LinkedList<Integer>(); List<TimeSpan> exceptionTimes = new LinkedList<TimeSpan>(); int[] daysAsInt = new int[] {}; if (formData.has("watchdogExceptions")) { JSONObject jsonObject = formData.getJSONObject(("watchdogExceptions")); if (jsonObject.getBoolean(String.valueOf(Calendar.MONDAY))) { days.add(Calendar.MONDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.TUESDAY))) { days.add(Calendar.TUESDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.WEDNESDAY))) { days.add(Calendar.WEDNESDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.THURSDAY))) { days.add(Calendar.THURSDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.FRIDAY))) { days.add(Calendar.FRIDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.SATURDAY))) { days.add(Calendar.SATURDAY); } if (jsonObject.getBoolean(String.valueOf(Calendar.SUNDAY))) { days.add(Calendar.SUNDAY); } daysAsInt = Ints.toArray(days); if (jsonObject.has("watchdogExceptionTimes")) { Object obj = jsonObject.get("watchdogExceptionTimes"); if (obj instanceof JSONArray) { for (Object json : (JSONArray) obj) { exceptionTimes.add(TimeSpan.createTimeSpanFromJSONObject((JSONObject) json)); } } else if (obj instanceof JSONObject) { exceptionTimes.add(TimeSpan.createTimeSpanFromJSONObject((JSONObject) obj)); } } } return new WatchTimeExceptionData(daysAsInt, exceptionTimes); }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for checking whether the target date is Sunday * /*from w w w .j a v a2 s .c o m*/ * @param tgtDate * @return */ public static boolean isSunday(Date tgtDate) { Calendar calendar = Calendar.getInstance(); calendar.setTime(tgtDate); return (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY ? true : false); }
From source file:com.silverpeas.scheduler.simple.SchedulerJob.java
/** * This method sets the scheduling parameter. It is given by a cron like string (currently ranges * are not allowed). So the string '* 3,21 * 3 0' starts the execution every Sunday in March on * 03:00 and 21:00. The allowed ranges are: minutes (0-59), hours (0-23), days of a month (1-31), * months (1-12; starts with 1 for January), day of a week (0-6; starts with 0 for Sunday). * Currently the parsing of the cron string ist not done by a state machine but by * StringTokenizers so this method is <B>very</B> sensitive for syntax failures! * @param aCronString/* w w w.j ava 2s . c om*/ */ protected synchronized void setSchedulingParameter(CronJobTrigger trigger) throws SchedulerException { setTrigger(trigger); String aCronString = trigger.getCronExpression(); StringTokenizer fieldSeparator; StringTokenizer fieldContentSeparator; String workString; int workInt; if (aCronString == null) { throw new SchedulerException("SchedulerShellJob.setCronString: Parameter 'aCronString' is null"); } if (aCronString.contains("-") || aCronString.contains("/")) { throw new SchedulerException( "This scheduler backend doesn't support yet the range and the increment instructions " + "in cron expressions"); } aCronString = aCronString.replaceAll("\\?", "*"); // Reset current values vMinutes = new ArrayList<Integer>(); vHours = new ArrayList<Integer>(); vDaysOfMonth = new ArrayList<Integer>(); vMonths = new ArrayList<Integer>(); vDaysOfWeek = new ArrayList<Integer>(); // This StringTokenizer splits the cron string into time fields fieldSeparator = new StringTokenizer(aCronString); // Get minute values if (fieldSeparator.hasMoreTokens()) { // This StringTokenizer splits each timefield list into single numbers fieldContentSeparator = new StringTokenizer(fieldSeparator.nextToken(), ","); while (fieldContentSeparator.hasMoreTokens()) { workString = fieldContentSeparator.nextToken(); // Check ingnore token if (workString.equals("*")) { vMinutes = new ArrayList<Integer>(); break; } // Check integer value try { workInt = Integer.parseInt(workString); } catch (NumberFormatException aException) { throw new SchedulerException("SchedulerShellJob.setCronString: Can't convert a minute value"); } if ((workInt < 0) || (workInt > 59)) { throw new SchedulerException("SchedulerShellJob.setCronString: A minute value is out of range"); } vMinutes.add(workInt); } } // Get hour values if (fieldSeparator.hasMoreTokens()) { fieldContentSeparator = new StringTokenizer(fieldSeparator.nextToken(), ","); while (fieldContentSeparator.hasMoreTokens()) { workString = fieldContentSeparator.nextToken(); // Check ingnore token if (workString.equals("*")) { vHours = new ArrayList<Integer>(); break; } // Check iteger value try { workInt = Integer.parseInt(workString); } catch (NumberFormatException aException) { throw new SchedulerException("SchedulerShellJob.setCronString: Can't convert a hour value"); } if ((workInt < 0) || (workInt > 23)) { throw new SchedulerException("SchedulerShellJob.setCronString: A hour value is out of range"); } vHours.add(workInt); } } // Get day of month values and normalize them for internal usage if (fieldSeparator.hasMoreTokens()) { fieldContentSeparator = new StringTokenizer(fieldSeparator.nextToken(), ","); while (fieldContentSeparator.hasMoreTokens()) { workString = fieldContentSeparator.nextToken(); // Check ingnore token if (workString.equals("*")) { vDaysOfMonth = new ArrayList<Integer>(); break; } // Check iteger value try { workInt = Integer.parseInt(workString); } catch (NumberFormatException aException) { throw new SchedulerException( "SchedulerShellJob.setCronString: Can't convert a day of month value"); } if ((workInt < 1) || (workInt > 31)) { throw new SchedulerException( "SchedulerShellJob.setCronString: A day of month value is out of range"); } vDaysOfMonth.add(workInt); } } // Get month values if (fieldSeparator.hasMoreTokens()) { fieldContentSeparator = new StringTokenizer(fieldSeparator.nextToken(), ","); while (fieldContentSeparator.hasMoreTokens()) { workString = fieldContentSeparator.nextToken(); // Check ingnore token if (workString.equals("*")) { vMonths = new ArrayList<Integer>(); break; } // Check iteger value try { workInt = Integer.parseInt(workString); } catch (NumberFormatException aException) { throw new SchedulerException("SchedulerShellJob.setCronString: Can't convert a month value"); } if ((workInt < 1) || (workInt > 12)) { throw new SchedulerException("SchedulerShellJob.setCronString: A month value is out of range"); } vMonths.add(workInt - 1); // Internal: zero based } } // Get day of week values if (fieldSeparator.hasMoreTokens()) { fieldContentSeparator = new StringTokenizer(fieldSeparator.nextToken(), ","); while (fieldContentSeparator.hasMoreTokens()) { workString = fieldContentSeparator.nextToken(); // Check ingnore token if (workString.equals("*")) { vDaysOfWeek = new ArrayList<Integer>(); break; } // Check iteger value try { workInt = Integer.parseInt(workString); } catch (NumberFormatException aException) { throw new SchedulerException( "SchedulerShellJob.setCronString: Can't convert a day of week value"); } if ((workInt < 0) || (workInt > 6)) { throw new SchedulerException( "SchedulerShellJob.setCronString: A day of week value is out of range"); } switch (workInt) { case 0: vDaysOfWeek.add(Calendar.SUNDAY); break; case 1: vDaysOfWeek.add(Calendar.MONDAY); break; case 2: vDaysOfWeek.add(Calendar.TUESDAY); break; case 3: vDaysOfWeek.add(Calendar.WEDNESDAY); break; case 4: vDaysOfWeek.add(Calendar.THURSDAY); break; case 5: vDaysOfWeek.add(Calendar.FRIDAY); break; case 6: vDaysOfWeek.add(Calendar.SATURDAY); break; } } } if (fieldSeparator.hasMoreTokens()) { throw new SchedulerException("SchedulerShellJob.setCronString: Too much time fields in cron string"); } if (vDaysOfWeek == null) { throw new SchedulerException("SchedulerShellJob.setCronString: Not enough time fields in cron string"); } // Sort the calculated vectors sortCronVectors(); }