List of usage examples for java.util Calendar THURSDAY
int THURSDAY
To view the source code for java.util Calendar THURSDAY.
Click Source Link
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//from w w w .ja v a2s.c o m */ 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(); }
From source file:org.kuali.student.r2.core.scheduling.service.impl.TestSchedulingServiceImpl.java
@Test public void getValidDaysOfWeekByTimeSlotType() throws Exception { List<Integer> valid_days_act_off = schedulingService.getValidDaysOfWeekByTimeSlotType( SchedulingServiceConstants.TIME_SLOT_TYPE_ACTIVITY_OFFERING_STANDARD_FULLTERM_FALL, contextInfo); // should return days Monday through Saturday assertTrue(valid_days_act_off.contains(Calendar.MONDAY)); assertTrue(valid_days_act_off.contains(Calendar.TUESDAY)); assertTrue(valid_days_act_off.contains(Calendar.WEDNESDAY)); assertTrue(valid_days_act_off.contains(Calendar.THURSDAY)); assertTrue(valid_days_act_off.contains(Calendar.FRIDAY)); assertTrue(valid_days_act_off.contains(Calendar.SATURDAY)); assertTrue(valid_days_act_off.contains(Calendar.SUNDAY)); List<Integer> valid_days_final = schedulingService .getValidDaysOfWeekByTimeSlotType(SchedulingServiceConstants.TIME_SLOT_TYPE_EXAM, contextInfo); // should not return any days assertFalse(valid_days_final.contains(Calendar.MONDAY)); assertFalse(valid_days_final.contains(Calendar.TUESDAY)); assertFalse(valid_days_final.contains(Calendar.WEDNESDAY)); assertFalse(valid_days_final.contains(Calendar.THURSDAY)); assertFalse(valid_days_final.contains(Calendar.FRIDAY)); assertFalse(valid_days_final.contains(Calendar.SATURDAY)); assertFalse(valid_days_final.contains(Calendar.SUNDAY)); }
From source file:com.layernet.thaidatetimepicker.date.MonthView.java
/** * Return a 1 or 2 letter String for use as a weekday label * * @param day The day for which to generate a label * @return The weekday label/*from w ww . j av a2 s . c o m*/ */ private String getWeekDayLabel(Calendar day) { // Localised short version of the string is not available on API < 18 if (Build.VERSION.SDK_INT < 18) { String dayName = new SimpleDateFormat("E", locale).format(day.getTime()); String dayLabel = dayName.substring(0, 1); // Thai labels should select 1 or 2 letter if (mDayLabelCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.THURSDAY || mDayLabelCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { dayLabel = dayName.substring(0, 1); } else { dayName.substring(0, 2); } return dayLabel; } // Getting the short label is a one liner on API >= 18 return new SimpleDateFormat("EEEEE", locale).format(day.getTime()); }
From source file:org.kuali.student.r2.core.scheduling.service.impl.TestSchedulingServiceImpl.java
@Test public void testgetTimeSlotsByDaysAndStartTime() throws Exception { // should return records ts103, ts5, ts104 List<Integer> dow = new ArrayList<Integer>(); dow.add(Calendar.TUESDAY);//from www . java 2 s . c o m dow.add(Calendar.THURSDAY); TimeOfDayInfo startTime; startTime = SchedulingServiceDataLoader.TOD_8_00_AM; List<TimeSlotInfo> tsi = schedulingService.getTimeSlotsByDaysAndStartTime( SchedulingServiceConstants.TIME_SLOT_TYPE_ACTIVITY_OFFERING_STANDARD_FULLTERM_FALL, dow, startTime, contextInfo); assertEquals(3, tsi.size()); assertEquals("ts103", tsi.get(0).getId()); TimeSlot ts = tsi.get(0); List<Integer> ts_dow = ts.getWeekdays(); // should not contain Monday, Wednesday, Friday assertFalse(ts_dow.contains(Calendar.MONDAY)); assertFalse(ts_dow.contains(Calendar.WEDNESDAY)); assertFalse(ts_dow.contains(Calendar.FRIDAY)); // should contain Tuesday or Thursday assertTrue(ts_dow.contains(Calendar.TUESDAY)); assertTrue(ts_dow.contains(Calendar.THURSDAY)); assertEquals(ts.getStartTime(), TOD_8_AM); assertEquals("ts5", tsi.get(1).getId()); ts = tsi.get(1); ts_dow = ts.getWeekdays(); // should not contain Monday, Wednesday, Friday assertFalse(ts_dow.contains(Calendar.MONDAY)); assertFalse(ts_dow.contains(Calendar.WEDNESDAY)); assertFalse(ts_dow.contains(Calendar.FRIDAY)); // should contain Tuesday or Thursday assertTrue(ts_dow.contains(Calendar.TUESDAY)); assertTrue(ts_dow.contains(Calendar.THURSDAY)); assertEquals(ts.getStartTime(), TOD_8_AM); assertEquals("ts104", tsi.get(2).getId()); ts = tsi.get(2); ts_dow = ts.getWeekdays(); // should not contain Monday, Wednesday, Friday assertFalse(ts_dow.contains(Calendar.MONDAY)); assertFalse(ts_dow.contains(Calendar.WEDNESDAY)); assertFalse(ts_dow.contains(Calendar.FRIDAY)); // should contain Tuesday or Thursday assertTrue(ts_dow.contains(Calendar.TUESDAY)); assertTrue(ts_dow.contains(Calendar.THURSDAY)); assertEquals(ts.getStartTime(), TOD_8_AM); }
From source file:com.commander4j.util.JUtility.java
/** * Method getDayOfWeekString1./*from w w w .j av a 2 s . c om*/ * * @param currentDate * Calendar * @return int */ public static String getDayOfWeekString1(Calendar currentDate) { int temp = getDayOfWeek(currentDate); String result = ""; switch (temp) { case Calendar.MONDAY: result = "A"; break; case Calendar.TUESDAY: result = "B"; break; case Calendar.WEDNESDAY: result = "C"; break; case Calendar.THURSDAY: result = "D"; break; case Calendar.FRIDAY: result = "E"; break; case Calendar.SATURDAY: result = "F"; break; case Calendar.SUNDAY: result = "G"; break; } return result; }
From source file:org.kuali.student.r2.core.scheduling.service.impl.TestSchedulingServiceImpl.java
@Test public void testgetTimeSlotsByDaysAndStartTimeAndEndTime() throws Exception { // should return record ts103 List<Integer> dow = new ArrayList<Integer>(); dow.add(Calendar.TUESDAY);/*from w w w . j a va2 s . c o m*/ dow.add(Calendar.THURSDAY); TimeOfDayInfo startTime = SchedulingServiceDataLoader.TOD_8_00_AM; TimeOfDayInfo endTime = SchedulingServiceDataLoader.TOD_8_50_AM; List<TimeSlotInfo> tsi = schedulingService.getTimeSlotsByDaysAndStartTimeAndEndTime( SchedulingServiceConstants.TIME_SLOT_TYPE_ACTIVITY_OFFERING_STANDARD_FULLTERM_FALL, dow, startTime, endTime, contextInfo); assertEquals(1, tsi.size()); assertEquals("ts103", tsi.get(0).getId()); TimeSlot ts = tsi.get(0); List<Integer> ts_dow = ts.getWeekdays(); // should not contain Monday, Wednesday, Friday assertFalse(ts_dow.contains(Calendar.MONDAY)); assertFalse(ts_dow.contains(Calendar.WEDNESDAY)); assertFalse(ts_dow.contains(Calendar.FRIDAY)); // should contain Tuesday or Thursday assertTrue(ts_dow.contains(Calendar.TUESDAY)); assertTrue(ts_dow.contains(Calendar.THURSDAY)); assertEquals(ts.getStartTime(), TOD_8_AM); assertEquals(ts.getEndTime(), TOD_8_50_AM); // should return record 10 dow = new ArrayList<Integer>(); dow.add(Calendar.MONDAY); dow.add(Calendar.WEDNESDAY); dow.add(Calendar.FRIDAY); startTime = SchedulingServiceDataLoader.TOD_1_00_PM; endTime = SchedulingServiceDataLoader.TOD_2_10_PM; tsi = schedulingService.getTimeSlotsByDaysAndStartTimeAndEndTime( SchedulingServiceConstants.TIME_SLOT_TYPE_ACTIVITY_OFFERING_STANDARD_FULLTERM_FALL, dow, startTime, endTime, contextInfo); assertEquals(1, tsi.size()); assertEquals("ts110", tsi.get(0).getId()); ts = tsi.get(0); ts_dow = ts.getWeekdays(); // should contain Monday, Wednesday, Friday assertTrue(ts_dow.contains(Calendar.MONDAY)); assertTrue(ts_dow.contains(Calendar.WEDNESDAY)); assertTrue(ts_dow.contains(Calendar.FRIDAY)); // should not contain Tuesday or Thursday assertFalse(ts_dow.contains(Calendar.TUESDAY)); assertFalse(ts_dow.contains(Calendar.THURSDAY)); assertEquals(ts.getStartTime(), TOD_1_PM); assertEquals(ts.getEndTime(), TOD_2_10_PM); }
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 ww. ja v a2s . c o m 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:org.eevolution.form.VCRP.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. ja va2s . co m 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 cont = 1; DateFormat formatter = DateFormat.getDateInstance(); /* * Vit4B Modificado para que tome 28 dias y * * */ while (days < 29) { /* * VIT4B MODIFICACION PARA ACUMULADO DE DIAS * * * //System.out.println("Day Number" + days); String strday = formatter.format(date); //String day = new String(new Integer (date.getDate()).toString()); String day = new String(formatter.format(date)); //day = day.substring(0,5); int index = day.indexOf("/"); String str = day.substring(0,index); System.out.println("str: " + str + " index de / " + index); String str2 = day.substring(index+1,day.length()); System.out.println("str2 resto: " + str2); index = str2.indexOf("/"); System.out.println(index); String str3 = str2.substring(0,index); System.out.println("str3: " + str3 + " index de / " + index); String str4 = str2.substring(index+1,str2.length()); System.out.println(str4); System.out.println("dia: " + str); System.out.println("mes: " + str3); System.out.println("ao: " + str4); //day = str + str3; day = new String(str + str3); //day = day.substring(0,day.lastIndexOf("/")); //day =day.substring(0,3); //cont++; System.out.println("r.getS_Resource_ID()" + r.getS_Resource_ID()); System.out.println("Date: " + date + " day: " + day); 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); /* * * VIT4B MODIFICACION PARA ACUMULADO DE DIAS * * */ /* * ORIGINAL COMPIERE */ 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); /* * VIT4B - Modificacin para calcular como se calcula el reporte CCRP * en funcion de la carga parcial * * */ int seconds = getLoad(r.getS_Resource_ID(), date, date); //BigDecimal value = calculateLoad(date, r, null); //int seconds = value.intValue(); Long Hours = new Long(hours); System.out.println("Summary " + summary); System.out.println("Load " + seconds); /* * FIN ORIGINAL COMPIERE * */ switch (gc1.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: days++; if (t.isOnSunday()) { //System.out.println("si Sunday"); //Msg.translate(Env.getCtx(), "OnSunday"); dataset.addValue(hours, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (seconds / 3600); //+ (Hours.intValue() - ((seconds / 3600))); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } else { //System.out.println("no Sunday"); //String day = Msg.translate(Env.getCtx(), "OnSunday") ; dataset.addValue(0, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } case Calendar.MONDAY: days++; if (t.isOnMonday()) { //System.out.println("si Monday"); //String day = Msg.translate(Env.getCtx(), "OnMonday") ; dataset.addValue(hours, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } else { //System.out.println("no Monday"); //String day = Msg.translate(Env.getCtx(), "OnMonday") ; dataset.addValue(0, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } case Calendar.TUESDAY: days++; if (t.isOnTuesday()) { //System.out.println("si TuesDay"); //String day = Msg.translate(Env.getCtx(), "OnTuesday"); dataset.addValue(hours, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } else { //System.out.println("no TuesDay"); //String day = Msg.translate(Env.getCtx(), "OnTuesday"); dataset.addValue(0, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } case Calendar.WEDNESDAY: days++; if (t.isOnWednesday()) { //String day = Msg.translate(Env.getCtx(), "OnWednesday"); dataset.addValue(hours, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } else { //String day = Msg.translate(Env.getCtx(), "OnWednesday"); dataset.addValue(0, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } case Calendar.THURSDAY: days++; if (t.isOnThursday()) { //String day = Msg.translate(Env.getCtx(), "OnThursday"); dataset.addValue(hours, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } else { //String day = Msg.translate(Env.getCtx(), "OnThursday"); dataset.addValue(0, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } case Calendar.FRIDAY: days++; if (t.isOnFriday()) { //String day = Msg.translate(Env.getCtx(), "OnFriday"); dataset.addValue(hours, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } else { //String day = Msg.translate(Env.getCtx(), "OnFriday"); dataset.addValue(0, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } case Calendar.SATURDAY: days++; if (t.isOnSaturday()) { //String day = Msg.translate(Env.getCtx(), "OnSaturday"); dataset.addValue(hours, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } else { //String day = Msg.translate(Env.getCtx(), "OnSaturday"); dataset.addValue(0, namecapacity, day); dataset.addValue(seconds / 3600, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (seconds / 3600); gc1.add(Calendar.DATE, 1); date = org.compiere.util.TimeUtil.addDays(date, 1); break; } } } return dataset; }
From source file:org.unitime.timetable.action.PersonalizedExamReportAction.java
public int getDaysCode(Set meetings) { int daysCode = 0; for (Iterator i = meetings.iterator(); i.hasNext();) { Meeting meeting = (Meeting) i.next(); Calendar date = Calendar.getInstance(Locale.US); date.setTime(meeting.getMeetingDate()); switch (date.get(Calendar.DAY_OF_WEEK)) { case Calendar.MONDAY: daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break; case Calendar.TUESDAY: daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break; case Calendar.WEDNESDAY: daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break; case Calendar.THURSDAY: daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break; case Calendar.FRIDAY: daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break; case Calendar.SATURDAY: daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break; case Calendar.SUNDAY: daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break; }//from ww w.ja va2s . c om } return daysCode; }
From source file:com.alkacon.opencms.calendar.CmsSerialDateWidget.java
/** * Returns the macro resolver with initialized macros to generate the serial date input form.<p> * /*ww w .j a v a2 s. c o m*/ * @param cms an initialized instance of a CmsObject * @param widgetDialog the dialog where the widget is used on * @param param the widget parameter to generate the widget for * @return the macro resolver with initialized macros */ protected CmsMacroResolver getMacroResolverForForm(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { CmsMacroResolver resolver = CmsMacroResolver.newInstance(); // set cms object and localized messages in resolver resolver.setCmsObject(cms); CmsMessages messages = new CmsMessages(CmsSerialDateWidget.class.getPackage().getName() + ".messages", widgetDialog.getLocale()); resolver.setMessages(messages); // delete empty macros which were not replaced resolver.setKeepEmptyMacros(false); // create the serial entry date object String paramValue = param.getStringValue(cms); Map params = CmsStringUtil.splitAsMap(paramValue, String.valueOf(CmsProperty.VALUE_LIST_DELIMITER), String.valueOf(CmsProperty.VALUE_MAP_DELIMITER)); // create the entry date from the field values CmsCalendarEntryDateSerial entryDate = CmsCalendarSerialDateFactory.getSerialDate(params, widgetDialog.getLocale()); if (entryDate == null) { // no entry date created yet, build an empty default date Calendar start = new GregorianCalendar(widgetDialog.getLocale()); Calendar end = (Calendar) start.clone(); entryDate = new CmsCalendarEntryDateSerial(start, end); entryDate.setSerialEndType(I_CmsCalendarSerialDateOptions.END_TYPE_NEVER); } // vars for daily options String dayDailyInterval = "1"; boolean dayEveryWorkingDay = false; // vars for weekly options String weekWeeklyInterval = "1"; // vars for monthly options int monthSelectedIndexWeekDayOfMonth = 0; int monthSelectedWeekDay = -1; String monthDayOfMonth = "1"; String monthMonthlyInterval = "1"; String monthMonthlyIntervalWeekDay = "1"; boolean monthUseWeekday = false; // vars for yearly options String yearDayOfMonth = "1"; boolean yearUseWeekday = false; int yearSelectedIndexMonth = 0; int yearSelectedIndexWeekDayOfMonth = 0; int yearSelectedWeekDayDay = -1; int yearSelectedIndexWeekDayMonth = 0; if (entryDate.getSerialOptions() != null) { // fill the variables depending on the selected serial date type String serialTypeMacroPrefix = MACRO_PREFIX_PARAMVALUE + PARAM_SERIALTYPE + "."; // set serial type radio selection resolver.addMacro(serialTypeMacroPrefix + entryDate.getSerialOptions().getSerialType(), ATTR_CHECKED); switch (entryDate.getSerialOptions().getSerialType()) { // set values for the selected serial type case I_CmsCalendarSerialDateOptions.TYPE_DAILY: CmsCalendarSerialDateDailyOptions dailyOptions = (CmsCalendarSerialDateDailyOptions) entryDate .getSerialOptions(); dayEveryWorkingDay = dailyOptions.isEveryWorkingDay(); dayDailyInterval = String.valueOf(dailyOptions.getDailyInterval()); break; case I_CmsCalendarSerialDateOptions.TYPE_WEEKLY: CmsCalendarSerialDateWeeklyOptions weeklyOptions = (CmsCalendarSerialDateWeeklyOptions) entryDate .getSerialOptions(); weekWeeklyInterval = String.valueOf(weeklyOptions.getWeeklyInterval()); // check the chosen week day checkboxes serialTypeMacroPrefix = MACRO_PREFIX_PARAMVALUE + PARAM_WEEK_WEEKDAY + "."; if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.MONDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.MONDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.TUESDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.TUESDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.WEDNESDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.WEDNESDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.THURSDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.THURSDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.FRIDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.FRIDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.SATURDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.SATURDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.SUNDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.SUNDAY, ATTR_CHECKED); } break; case I_CmsCalendarSerialDateOptions.TYPE_MONTHLY: CmsCalendarSerialDateMonthlyOptions monthlyOptions = (CmsCalendarSerialDateMonthlyOptions) entryDate .getSerialOptions(); monthUseWeekday = monthlyOptions.isUseWeekDay(); if (!monthlyOptions.isUseWeekDay()) { monthDayOfMonth = String.valueOf(monthlyOptions.getDayOfMonth()); monthMonthlyInterval = String.valueOf(monthlyOptions.getMonthlyInterval()); } else { // set selected index of select boxes monthSelectedIndexWeekDayOfMonth = monthlyOptions.getDayOfMonth() - 1; monthSelectedWeekDay = monthlyOptions.getWeekDay(); monthMonthlyIntervalWeekDay = String.valueOf(monthlyOptions.getMonthlyInterval()); } break; case I_CmsCalendarSerialDateOptions.TYPE_YEARLY: CmsCalendarSerialDateYearlyOptions yearlyOptions = (CmsCalendarSerialDateYearlyOptions) entryDate .getSerialOptions(); yearUseWeekday = yearlyOptions.isUseWeekDay(); if (!yearlyOptions.isUseWeekDay()) { yearDayOfMonth = String.valueOf(yearlyOptions.getDayOfMonth()); yearSelectedIndexMonth = yearlyOptions.getMonth(); } else { yearSelectedIndexWeekDayOfMonth = yearlyOptions.getDayOfMonth() - 1; yearSelectedWeekDayDay = yearlyOptions.getWeekDay(); yearSelectedIndexWeekDayMonth = yearlyOptions.getMonth(); } break; default: // nothing do do here, should never happen } } else { // no serial entry created yet, add some defaults resolver.addMacro( MACRO_PREFIX_PARAMVALUE + PARAM_SERIALTYPE + "." + I_CmsCalendarSerialDateOptions.TYPE_DAILY, ATTR_CHECKED); resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_WEEK_WEEKDAY + "." + Calendar.MONDAY, ATTR_CHECKED); } // set time settings String startTime = getCalendarLocalizedTime(widgetDialog.getLocale(), widgetDialog.getMessages(), entryDate.getStartDate().getTimeInMillis(), false, true); resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_STARTTIME, startTime); String endTime = ""; if (!entryDate.getStartDate().equals(entryDate.getEndDate())) { // end time is different from start time, get localized value endTime = getCalendarLocalizedTime(widgetDialog.getLocale(), widgetDialog.getMessages(), entryDate.getEndDate().getTimeInMillis(), false, true); } resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_ENDTIME, endTime); resolver.addMacro("select.durationdays", buildSelectDurationDays(PARAM_DURATIONDAYS, messages, entryDate.getDuration())); // set found values to serial option tabs // daily options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_DAY_DAILYINTERVAL, dayDailyInterval); resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_DAY_EVERYWORKINGDAY + "." + dayEveryWorkingDay, ATTR_CHECKED); // weekly options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_WEEK_WEEKLYINTERVAL, weekWeeklyInterval); // monthly options // mark the correct radio resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_MONTH_SERIALMONTHDAY + "." + monthUseWeekday, ATTR_CHECKED); // set the macros for the day of month options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_MONTH_DAYOFMONTH, monthDayOfMonth); resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_MONTH_MONTHLYINTERVAL, monthMonthlyInterval); // set the macros for the week day of month options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_MONTH_MONTHLYINTERVALWEEKDAY, monthMonthlyIntervalWeekDay); // build the select boxes resolver.addMacro("select.monthnumberofweekday", buildSelectNumberOfWeekDayOfMonth( PARAM_MONTH_NUMBEROFWEEKDAYOFMONTH, "onfocus=\"document.getElementById('" + PARAM_MONTH_SERIALMONTHDAY + ".true').checked = true;\"", messages, monthSelectedIndexWeekDayOfMonth)); resolver.addMacro("select.monthweekday", buildSelectWeekDay(PARAM_MONTH_WEEKDAY, "onfocus=\"document.getElementById('" + PARAM_MONTH_SERIALMONTHDAY + ".true').checked = true;\"", messages, monthSelectedWeekDay)); // yearly options // mark the correct radio resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_YEAR_SERIALYEARDAY + "." + yearUseWeekday, ATTR_CHECKED); // set the macros for the day of month options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_YEAR_DAYOFMONTH, yearDayOfMonth); resolver.addMacro("select.yearmonth", buildSelectMonth(PARAM_YEAR_MONTH, "onfocus=\"document.getElementById('" + PARAM_YEAR_SERIALYEARDAY + ".false').checked = true;\"", messages, yearSelectedIndexMonth)); // set the macros for the week day of month options resolver.addMacro("select.yearnumberofweekday", buildSelectNumberOfWeekDayOfMonth(PARAM_YEAR_WEEKDAYOFMONTH, "onfocus=\"document.getElementById('" + PARAM_YEAR_SERIALYEARDAY + ".true').checked = true;\"", messages, yearSelectedIndexWeekDayOfMonth)); resolver.addMacro("select.yearweekday", buildSelectWeekDay(PARAM_YEAR_WEEKDAY, "onfocus=\"document.getElementById('" + PARAM_YEAR_SERIALYEARDAY + ".true').checked = true;\"", messages, yearSelectedWeekDayDay)); resolver.addMacro("select.yearmonthweekday", buildSelectMonth(PARAM_YEAR_WEEKDAYMONTH, "onfocus=\"document.getElementById('" + PARAM_YEAR_SERIALYEARDAY + ".true').checked = true;\"", messages, yearSelectedIndexWeekDayMonth)); // set serial duration values // set start date resolver.addMacro("calendar.startdate", buildDateInput("startdate", widgetDialog, entryDate.getStartDate())); Calendar serialEndDate = entryDate.getSerialEndDate(); if (serialEndDate == null) { serialEndDate = entryDate.getStartDate(); } resolver.addMacro("calendar.serialenddate", buildDateInput("serialenddate", widgetDialog, serialEndDate)); // set occurences int occurences = 10; if (entryDate.getSerialEndType() == I_CmsCalendarSerialDateOptions.END_TYPE_TIMES) { occurences = entryDate.getOccurences(); } resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_OCCURENCES, String.valueOf(occurences)); // set the end type radio buttons resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_ENDTYPE + "." + entryDate.getSerialEndType(), ATTR_CHECKED); return resolver; }