Examples of GregorianCalendar


Examples of java.util.GregorianCalendar

      dateFormat= "M/d/yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
        timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);

      String typeOfSave = null;
View Full Code Here

Examples of java.util.GregorianCalendar

      dateFormat= "M/d/yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
        timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);


      if(request.getParameter("rowId") != null)
View Full Code Here

Examples of java.util.GregorianCalendar

  protected java.sql.Date getDate(String day, String month, String year, String timeZone)
  {
    int startday = Integer.parseInt(day);
    int startmonth = Integer.parseInt(month) - 1;
    int startyear = Integer.parseInt(year);
    GregorianCalendar calendar = new GregorianCalendar(startyear, startmonth, startday);
    return CVUtility.convertTimeZone(new java.sql.Date(calendar.getTimeInMillis()), java.util.TimeZone.getTimeZone(timeZone), java.util.TimeZone.getTimeZone("GMT"));
  }
View Full Code Here

Examples of java.util.GregorianCalendar

    Locale locale = request.getLocale();
    // If current time requested get the system instance
    if (current) {
      calendar = Calendar.getInstance(tz, locale);
    } else {
      calendar = new GregorianCalendar(tz, locale);
    }
    return calendar;
  }
View Full Code Here

Examples of java.util.GregorianCalendar

    }
    if (tz != null) {
      if (current) {
        calendar = Calendar.getInstance(tz);
      } else {
        calendar = new GregorianCalendar(tz);
      }
    } else {
      if (current) {
        calendar = Calendar.getInstance();
      } else {
        calendar = new GregorianCalendar();
      }
    }
    return calendar;
  }
View Full Code Here

Examples of java.util.GregorianCalendar

   * @param min
   * @return
   */
  public static Timestamp createTimestamp(String year, String month, String day, String hour, String min)
  {
    Calendar calendar = new GregorianCalendar(Integer.parseInt(year), Integer.parseInt(month) - 1,
        Integer.parseInt(day), Integer.parseInt(hour), Integer.parseInt(min));
    return new Timestamp(calendar.getTimeInMillis());
  }
View Full Code Here

Examples of java.util.GregorianCalendar

      dateFormat= "MMMMMMMMM dd, yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
      timeZone = "EST";
       
      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);
           
      String rowId = request.getParameter("rowId");
      if(rowId == null){
View Full Code Here

Examples of java.util.GregorianCalendar

    String yearParam = request.getParameter("YEAR");
    String monthParam = request.getParameter("MONTH");
    String dayParam = request.getParameter("DAY");

    GregorianCalendar startDate = new GregorianCalendar(tz, locale);
    GregorianCalendar endDate = null;
    String startDateString = activityForm.getActivityStartDate();
    if (CVUtility.empty(startDateString)) {
      startDate.setTime(Calendar.getInstance(tz, locale).getTime());
      startDate.set(Calendar.HOUR, 0);
      startDate.set(Calendar.MINUTE, 0);
      startDate.set(Calendar.SECOND, 0);
      startDate.set(Calendar.MILLISECOND, 0);
    } else if (CVUtility.notEmpty(yearParam) && CVUtility.notEmpty(monthParam) && CVUtility.notEmpty(dayParam)) {
      startDate.set(Calendar.MONTH, Integer.parseInt(monthParam) - 1);
      startDate.set(Calendar.DATE, Integer.parseInt(dayParam));
      startDate.set(Calendar.YEAR, Integer.parseInt(yearParam));
    } else {
      DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
      startDate.setTime(df.parse(startDateString));
    }
    endDate = new GregorianCalendar(tz, locale);
    endDate.setTime(startDate.getTime());
    endDate.add(Calendar.HOUR, 24);

    // user activities hashmap
    HashMap userActivities = null;
    // contains user name and id taken from string[]s from formbean
    HashMap userIdNames = new HashMap();
    // time span for hours
    int timespan = 60;

    // get the attendeerequired from the formbean
    String[] attendeesRequired = activityForm.getActivityAttendeesRequired();

    // get the attendeOptional from the formbean
    String[] attendeeOptional = activityForm.getActivityAttendeesOptional();

    // check for the optional and required users .if exist check for their
    // activities
    if ((attendeeOptional != null) || (attendeesRequired != null)) {
      Vector vec = new Vector();
      if (attendeeOptional != null) {
        for (int count = 0; count < attendeeOptional.length; count++) {
          int indexOfHash = attendeeOptional[count].indexOf("#");
          String idName = attendeeOptional[count].substring(0, indexOfHash);
          vec.add(idName);
          String displayName = attendeeOptional[count].substring(indexOfHash + 1,
              attendeeOptional[count].length());
          userIdNames.put(new Integer(idName), new AvailableList(Integer.parseInt(idName),
              displayName));
        }
      }

      if (attendeesRequired != null) {
        for (int reqCount = 0; reqCount < attendeesRequired.length; reqCount++) {
          int indexOfHash = attendeesRequired[reqCount].indexOf("#");
          String name = attendeesRequired[reqCount].substring(0, indexOfHash);
          vec.add(name);
          String dispName = attendeesRequired[reqCount].substring(indexOfHash + 1,
              attendeesRequired[reqCount].length());
          userIdNames.put(new Integer(name), new AvailableList(Integer.parseInt(name), dispName));
        }
      }

      int attendeeSize = userIdNames.size();
      int userId[] = new int[attendeeSize];

      Set availElement = userIdNames.keySet();
      Iterator userID = availElement.iterator();
      int toArr = 0;

      while (userID.hasNext()) {
        userId[toArr] = ((Integer)userID.next()).intValue();
        toArr++;
      }

      try {
        CvCalendarHome ch = (CvCalendarHome)CVUtility.getHomeObject(
            "com.centraview.calendar.CvCalendarHome", "CvCalendar");
        CvCalendar cr = ch.create();
        cr.setDataSource(dataSource);
        userActivities = cr.getAvailibility(1, userId, startDate, endDate);
      } catch (Exception e) {
        logger.error("[execute]: Exception", e);
      }

      // check for the users in the hashmap and get the vector of activities
      Set setElement = userActivities.keySet();
      Iterator allUsers = setElement.iterator();

      // check for all users
      while (allUsers.hasNext()) {
        // get user id
        Integer user = (Integer)allUsers.next();
        Vector activityObjects = (Vector)userActivities.get(user);
        AvailableList avlList = (AvailableList)userIdNames.get(user);
        boolean activityArray[] = avlList.getAvailable();
        Enumeration activityEnum = activityObjects.elements();

        while (activityEnum.hasMoreElements()) {
          CalendarActivityObject activityobject = (CalendarActivityObject)activityEnum
              .nextElement();

          GregorianCalendar starttime = activityobject.getStartTime();
          GregorianCalendar endtime = activityobject.getEndTime();

          GregorianCalendar endTimeuser = endDate;
          GregorianCalendar starttimeuser = startDate;

          if ((starttime.getTimeInMillis() > endTimeuser.getTimeInMillis())
              || (endtime.getTimeInMillis() < starttimeuser.getTimeInMillis())) {
            continue;
          }

          long timeInMillisStart = starttime.getTimeInMillis()
              + starttime.get(Calendar.ZONE_OFFSET) + starttime.get(Calendar.DST_OFFSET);
          long timeInMillisEnd = endtime.getTimeInMillis() + endtime.get(Calendar.ZONE_OFFSET)
              + endtime.get(Calendar.DST_OFFSET);

          long timeInMillisStartUser = starttimeuser.getTimeInMillis()
              + starttimeuser.get(Calendar.ZONE_OFFSET) + starttimeuser.get(Calendar.DST_OFFSET);
          long timeInMillisEndUser = endTimeuser.getTimeInMillis()
              + endTimeuser.get(Calendar.ZONE_OFFSET) + endTimeuser.get(Calendar.DST_OFFSET);

          int diffin_min = (int)(Math.min(timeInMillisEnd, timeInMillisEndUser) - Math.max(
              timeInMillisStart, timeInMillisStartUser)) / 60000;
View Full Code Here

Examples of java.util.GregorianCalendar

        String startDayString = request.getParameter("DAY");
        int startDay = Integer.parseInt(startDayString);
        String startYearString = request.getParameter("YEAR");
        int startYear = Integer.parseInt(startYearString);

        Calendar start = new GregorianCalendar(startYear, startMonth, startDay, 8, 0);
        String startTimeString = tf.format(start.getTime());
        if (CVUtility.notEmpty(request.getParameter("STIME"))) {
          startTimeString = request.getParameter("STIME");
        }
        Calendar passedTime = new GregorianCalendar();
        passedTime.setTime(tf.parse(startTimeString));
        start.set(Calendar.HOUR, passedTime.get(Calendar.HOUR));
        start.set(Calendar.MINUTE, passedTime.get(Calendar.MINUTE));
        start.set(Calendar.AM_PM, passedTime.get(Calendar.AM_PM));

        activityForm.setActivityStartDate(df.format(start.getTime()));
        activityForm.setActivityStartTime(tf.format(start.getTime()));
        // add an hour onto the start time for the default end time.
        Calendar end = new GregorianCalendar();
        end.setTime(start.getTime());
        end.add(Calendar.HOUR, 1);
        String endTimeString = tf.format(end.getTime());
        if (CVUtility.notEmpty(request.getParameter("ETIME"))) {
          endTimeString = request.getParameter("ETIME");
        }
        passedTime.setTime(tf.parse(endTimeString));
        end.set(Calendar.HOUR, passedTime.get(Calendar.HOUR));
        end.set(Calendar.MINUTE, passedTime.get(Calendar.MINUTE));
        end.set(Calendar.AM_PM, passedTime.get(Calendar.AM_PM));
        activityForm.setActivityEndDate(df.format(end.getTime()));
        activityForm.setActivityEndTime(tf.format(end.getTime()));
      } else if (unScheduleActivity != null && !(unScheduleActivity.equals("unSchedule"))) {
        // In the case the start time wasn't requested from the parent window,
        // set the start time to now() rounded up to the nearest hour, and the
        // end time to be the start time plus 1 hour.
        UserPrefererences userPref = userObject.getUserPref();
View Full Code Here

Examples of java.util.GregorianCalendar

      dateFormat= "MMMMMMMMM dd, yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
      timeZone = "EST";
       
      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);
           
      // forward to jsp page
      FORWARD_final = FORWARD_editinventory;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.