Package java.util

Examples of java.util.Calendar$Builder


        CvFileFacade cvfile = new CvFileFacade();
        CvFileVO flvo = new CvFileVO();
        flvo.setTitle(fileName); //file name

        Calendar c = Calendar.getInstance();
        java.util.Date dt = c.getTime();
        DateFormat df = new SimpleDateFormat("MM_dd_yyyy_hh_mm_ss");
        String dateStamp = df.format(dt);

        flvo.setName("attachment_" + dateStamp +"_"+ fileName);
        flvo.setCreatedBy(userid);
View Full Code Here


          Timestamp startTimestamp = (Timestamp)oldEvent.getStartdate();
          Timestamp endTimestamp = (Timestamp)oldEvent.getEnddate();

          //This section SHOULD NOT NEED TO BE DONE.
          //The way Timestamps are currently handled means I have to do this this way.
          Calendar tempCalendar = new GregorianCalendar();
          //fix the start time
          tempCalendar.setTimeInMillis(startTimestamp.getTime());
          tempCalendar.add(Calendar.YEAR, 1900);
          startTimestamp.setTime(tempCalendar.getTimeInMillis());

          //fix the end time
          tempCalendar.setTimeInMillis(endTimestamp.getTime());
          tempCalendar.add(Calendar.YEAR, 1900);
          endTimestamp.setTime(tempCalendar.getTimeInMillis());
          //End of This section SHOULD NOT NEED TO BE DONE.

          newEventHashMap.put("StartDate", startTimestamp);
          newEventHashMap.put("EndDate", endTimestamp);
View Full Code Here

    ArrayList newResultList = new ArrayList();
    ArrayList curList = new ArrayList();


    //--- set up for the loop by holding the current unit value
    Calendar curCal = Calendar.getInstance();
    curCal.setTime( (Date)inputList.get(0) );
    int curVal = curCal.get(freqNumber);
    ArrayList curSet = new ArrayList();

    //--- for each date in the sorted list
    for(int ctr = 0; ctr<inputList.size() ; ctr++){
      curCal.setTime( (Date)inputList.get(ctr) );

      if(curCal.get(freqNumber) == curVal){
        //--- if we're still in the same set, add it to the current set
        curList.add((Date)inputList.get(ctr));
      }
      else{
        //--- if we've found a new set, process the old one  JJHNOTE
        newResultList.addAll( getSetPosItems(bspSet,curList) );
        curList.clear();
        curList.add((Date)inputList.get(ctr));
        curVal = curCal.get(freqNumber);
      }

    }
    //--- process the last set
    newResultList.addAll( getSetPosItems(bspSet,curList) );
View Full Code Here

            remoteFile.setDataSource(dataSource);

            CvFolderVO homeFld = remoteFile.getHomeFolder(individualID);

            int rn = (new Random()).nextInt();
            Calendar c = Calendar.getInstance();
            java.util.Date dt = c.getTime();
            DateFormat df = new SimpleDateFormat("MM_dd_yyyy");
            String dateStamp = df.format(dt);

            CvFileVO flvo = new CvFileVO();
            flvo.setTitle("Print Template_" + rn);
View Full Code Here

    reportForm.set("description", reportVO.getDescription());
    reportForm.set("moduleId", new Integer(moduleId));
    reportForm.set("name", reportVO.getName());
    reportForm.set("reportId", new Integer(reportVO.getReportId()));
    if (reportVO.getFrom() != null) {
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(reportVO.getFrom());
      reportForm.set("startday", String.valueOf(calendar.get(Calendar.DATE)));
      reportForm.set("startmonth", String.valueOf(calendar.get(Calendar.MONTH) + 1));
      reportForm.set("startyear", String.valueOf(calendar.get(Calendar.YEAR)));
    }
    if (reportVO.getTo() != null) {
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(reportVO.getTo());
      reportForm.set("endday", String.valueOf(calendar.get(Calendar.DATE)));
      reportForm.set("endmonth", String.valueOf(calendar.get(Calendar.MONTH) + 1));
      reportForm.set("endyear", String.valueOf(calendar.get(Calendar.YEAR)));
    }
    // fields for the search part of things.
    reportForm.set("ownerId", (String.valueOf(individualId)));
    SearchCriteriaVO[] searchCriteria = (SearchCriteriaVO[])reportForm.get("searchCriteria");
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
View Full Code Here

   * @param current if true return current time, if false return empty calendar
   * @return a calendar object for the locale and timezone
   */
  public static Calendar getCalendar(HttpServletRequest request, boolean current)
  {
    Calendar calendar;
    HttpSession session = request.getSession(true);
    UserObject user = (UserObject)session.getAttribute("userobject");
    UserPrefererences prefs = user.getUserPref();
    TimeZone tz = TimeZone.getTimeZone(prefs.getTimeZone());
    Locale locale = request.getLocale();
View Full Code Here

   * @param current
   * @return
   */
  public static Calendar getCalendar(int individualId, String dataSource, boolean current)
  {
    Calendar calendar;
    TimeZone tz = null;
    try {
      PreferenceHome prefHome = (PreferenceHome)CVUtility.getHomeObject(
          "com.centraview.preference.PreferenceHome", "Preference");
      Preference prefRemote = prefHome.create();
View Full Code Here

   * @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

        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();
        String userTimeZoneId = userPref.getTimeZone();
        TimeZone userTimeZone = TimeZone.getTimeZone(userTimeZoneId);
        Calendar now = Calendar.getInstance(userTimeZone, locale);
        // round up the hour if we are at the 1 minute mark of the hour or
        // higher. just clear the second and millisecond fields, its only
        // scheduling not physics.
        now.clear(Calendar.SECOND);
        now.clear(Calendar.MILLISECOND);
        if (now.get(Calendar.MINUTE) > 0) {
          now.clear(Calendar.MINUTE);
          now.add(Calendar.HOUR, 1);
        }
        activityForm.setActivityStartDate(df.format(now.getTime()));
        activityForm.setActivityStartTime(tf.format(now.getTime()));
        // Increment now by 1 hour to get the end time.
        now.add(Calendar.HOUR, 1);
        activityForm.setActivityEndDate(df.format(now.getTime()));
        activityForm.setActivityEndTime(tf.format(now.getTime()));
      }

      String typeOfActivity = "";
      if (request.getParameter(ConstantKeys.TYPEOFACTIVITY) == null) {
        typeOfActivity = ConstantKeys.APPOINTMENT;
View Full Code Here

   
    counter = 1;

    HolidayBooking booking = new HolidayBooking();
    booking.setTitle("Go to Alaska");
    Calendar cal = Calendar.getInstance();
    cal.set(2006, 5, 20);
    booking.setStartDate(cal.getTime());
    booking.setDays(5);
    addHolidayBooking(booking);

    booking = new HolidayBooking();
    booking.setTitle("Weekend break to Venice");
    cal = Calendar.getInstance();
    cal.set(2006, 2, 7);
    booking.setStartDate(cal.getTime());
    booking.setDays(5);
    addHolidayBooking(booking);

    booking = new HolidayBooking();
    booking.setTitle("Camping in Cornwall");
    cal = Calendar.getInstance();
    cal.set(2006, 8, 11);
    booking.setStartDate(cal.getTime());
    booking.setDays(7);
    addHolidayBooking(booking);

    booking = new HolidayBooking();
    booking.setTitle("Sailing to Holland");cal = Calendar.getInstance();
    cal.set(2006, 9, 21);
    booking.setStartDate(cal.getTime());
    booking.setDays(7);
    addHolidayBooking(booking);
  }
View Full Code Here

TOP

Related Classes of java.util.Calendar$Builder

Copyright © 2018 www.massapicom. 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.