Example usage for java.util Calendar TUESDAY

List of usage examples for java.util Calendar TUESDAY

Introduction

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

Prototype

int TUESDAY

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

Click Source Link

Document

Value of the #DAY_OF_WEEK field indicating Tuesday.

Usage

From source file:org.kuali.student.r2.core.scheduling.service.impl.TestSchedulingServiceImpl.java

@Test
public void testgetTimeSlotsByIds() throws Exception {
    // test case: all valid ids
    List<String> valid_ids = new ArrayList<String>();
    valid_ids.add("ts102");
    valid_ids.add("ts115");
    List<TimeSlotInfo> l_valid_ts = schedulingService.getTimeSlotsByIds(valid_ids, contextInfo);
    assertEquals(2, valid_ids.size());/*from   w  w w .j  a v a  2  s .  c  om*/

    TimeSlot ts2 = null, ts15 = null;
    // ensure the list has only time slots with ids 2 and 15
    for (TimeSlotInfo ts : l_valid_ts) {
        assertTrue(valid_ids.contains(ts.getId()));
        if (ts.getId().equals("ts102")) {
            ts2 = ts;
        } else {
            ts15 = ts;
        }
    }

    assertNotNull(ts2);
    assertEquals("ts102", ts2.getId());
    List<Integer> dow = ts2.getWeekdays();
    // should contain Monday, Wednesday, Friday
    assertTrue(dow.contains(Calendar.MONDAY));
    assertTrue(dow.contains(Calendar.WEDNESDAY));
    assertTrue(dow.contains(Calendar.FRIDAY));
    // should not contain Tuesday or Thursday
    assertFalse(dow.contains(Calendar.TUESDAY));
    assertFalse(dow.contains(Calendar.THURSDAY));
    assertEquals(ts2.getStartTime(), TOD_8_AM);
    assertEquals(ts2.getEndTime(), TOD_9_10_AM);

    assertNotNull(ts15);
    assertEquals("ts115", ts15.getId());
    dow = ts15.getWeekdays();
    // should not contain Monday, Wednesday, Friday
    assertFalse(dow.contains(Calendar.MONDAY));
    assertFalse(dow.contains(Calendar.WEDNESDAY));
    assertFalse(dow.contains(Calendar.FRIDAY));
    // should contain Tuesday or Thursday
    assertTrue(dow.contains(Calendar.TUESDAY));
    assertTrue(dow.contains(Calendar.THURSDAY));
    assertEquals(ts15.getStartTime(), TOD_3_PM);
    assertEquals(ts15.getEndTime(), TOD_3_50_PM);

    // test case: all invalid ids
    List<String> invalid_ids = new ArrayList<String>();
    invalid_ids.add("bad1");
    invalid_ids.add("bad2");
    try {
        schedulingService.getTimeSlotsByIds(invalid_ids, contextInfo);
        fail("Should not be here - test invalid_ids");
    } catch (DoesNotExistException e) {
        assertNotNull(e.getMessage());
        assertEquals("No data was found for : bad1, bad2", e.getMessage());
    }

    // test case: mixture of valid and invalid
    List<String> mix_ids = new ArrayList<String>();
    mix_ids.add("ts110");
    mix_ids.add("bad1");
    try {
        schedulingService.getTimeSlotsByIds(mix_ids, contextInfo);
        fail("Should not be here - test mix_ids");
    } catch (DoesNotExistException e) {
        assertNotNull(e.getMessage());
        assertEquals("Missing data for : bad1", e.getMessage());
    }
}

From source file:org.ejbca.ui.web.admin.certprof.CertProfileBean.java

public boolean isExpirationRestrictionTuesday() throws AuthorizationDeniedException {
    return getCertificateProfile().getExpirationRestrictionWeekday(Calendar.TUESDAY);
}

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  www. j  a  v  a 2 s.c  o m*/
    // 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.sonyericsson.hudson.plugins.gerrit.trigger.config.Config.java

/**
 * Adds the WatchTimeExceptionData from the form.
 *
 * @param formData the form./*from   ww w  .j a v  a  2  s.  com*/
 * @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:org.ejbca.ui.web.admin.certprof.CertProfileBean.java

public void setExpirationRestrictionTuesday(final boolean enabled) throws AuthorizationDeniedException {
    getCertificateProfile().setExpirationRestrictionWeekday(Calendar.TUESDAY, enabled);
}

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 av 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: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);
    dow.add(Calendar.THURSDAY);//from w ww.  jav  a 2 s .com
    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: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  va 2  s .  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.commander4j.util.JUtility.java

/**
 * Method getDayOfWeekString1.// w w  w.ja v  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;
}