Package java.util

Examples of java.util.Calendar


      Set elekey = ele.keySet();
      Iterator eleit = elekey.iterator();
      while (eleit.hasNext()) {
        CalendarMember calmember = (CalendarMember)ele.get(eleit.next());
        CalendarActivityObject activity = calmember.getActivityobject();
        Calendar start = activity.getStartTime();
        start.setTimeZone(tz);
        Calendar end = activity.getEndTime();
        end.setTimeZone(tz);
        String timeRange = dateTimeFormat.format(start.getTime()) + " - "
            + dateTimeFormat.format(end.getTime());
        String activityStartTime = timeFormat.format(start.getTime());
        // type is that stored in the activitytype database table.
        String activityType = activity.getActivityType();
        String icon = this.determineActivityIcon(activityType);
        activityType = this.convertActivityType(activityType);
View Full Code Here


      String detailtitle = requestForm.getTitle();
      String detaildetail = requestForm.getDescription();

      // startdate
      Calendar start = new GregorianCalendar(tz, locale);
      String activityStartDate = requestForm.getStartDateTime();
      if (activityStartDate != null && (!activityStartDate.equals(""))) {
        try {
          Date dd = simpleDateFormat.parse(activityStartDate);
          start.setTime(dd);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }
      activityForm.setActivityStartDate(df.format(start.getTime()));
      activityForm.setActivityStartTime(tf.format(start.getTime()));

      // enddate
      Calendar end = new GregorianCalendar(tz, locale);
      String activityenddate = requestForm.getEndDateTime();
      if (activityenddate != null && (!activityenddate.equals(""))) {
        try {
          Date dd = simpleDateFormat.parse(activityenddate);
          end.setTime(dd);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }
      activityForm.setActivityEndDate(df.format(end.getTime()));
      activityForm.setActivityEndTime(tf.format(end.getTime()));

      activityForm.setActivityPriority(detailpriority);
      activityForm.setActivityStatus(detailstatus);
      activityForm.setActivityTitle(detailtitle);
      activityForm.setActivityDetail(detaildetail);

      // alarm date time
      String alarmDateTime = requestForm.getAlarmDateTime(); // alarmDateTime
      // ="01/09/2003";
      if (alarmDateTime != null && (!alarmDateTime.equals(""))) {
        try {
          Date d = simpleDateFormat.parse(alarmDateTime);
          GregorianCalendar remind = new GregorianCalendar();
          remind.setTime(d);
          activityForm.setActivityRemindDate(df.format(remind.getTime()));
          activityForm.setActivityReminder("on");
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }

      // now, add the Activity to the database using our SyncFacade bean
      String linkCompany = requestForm.getLinkCompany();
      if (linkCompany == null) {
        activityForm.setLinkCompany(linkCompany);
      }

      // create an instance of our SyncFacade EJB
      SyncFacade syncfacade = new SyncFacade();
      syncfacade.setDataSource(dataSource);

      // now, add the Activity to the database using our SyncFacade bean
      String activitytype = requestForm.getType();
      if (activitytype == null) {
        activitytype = "Appointment";
      }
      String result = "";

      int individualID = userobjectd.getIndividualID();
      // Appointment
      if (activitytype.equals("Appointment")) {
        activityForm.setActivityType("1");
      }

      // Call
      if (activitytype.equals("Call")) {
        activityForm.setActivityType("2");
      }

      // Meeting
      if (activitytype.equals("Meeting")) {
        activityForm.setActivityType("5");
      }

      // ToDo
      if (activitytype.equals("To Do")) {
        activityForm.setActivityType("6");
      }

      // NextAction
      if (activitytype.equals("Next Action")) {
        activityForm.setActivityType("7");
      }

      result = syncfacade.addActivity(activityForm, individualID);

      com.centraview.syncfacade.SyncFacade sfremote = null;
      try {
        SyncFacadeHome syncHome = (SyncFacadeHome)CVUtility.getHomeObject(
            "com.centraview.syncfacade.SyncFacadeHome", "SyncFacade");
        sfremote = syncHome.create();
        sfremote.setDataSource(dataSource);
      } catch (Exception e) {
        logger.error("[execute]: Exception", e);
        writer.print("FAIL");
        return (null);
      }

      // Check to see if the user's preference is to create sync'ed
      // records as private. If so, delete all records from recordauthorisation
      // and publicrecords tables that link to the newly created records.
      if (syncAsPrivate) {
        ArrayList recordIDs = new ArrayList();
        try {
          recordIDs.add(new Integer(result));
        } catch (NumberFormatException nfe) {
          // don't need to do anything, because we obviously didn't add an
          // activity successfully.
          System.out.println("\n\n\nCAUGHT A NumberFormatException!!!!\n\n\n");
        }
        sfremote.markRecordsPrivate(3, recordIDs);
      }

      // we need to make all the Activities lists dirty, so that the next time
      // they are viewed, they are refreshed and contain the record we just
      // added
      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      lg.makeListDirty("MultiActivity");
      lg.makeListDirty("AllActivity");
      lg.makeListDirty("Appointment");
      lg.makeListDirty("Call");
      lg.makeListDirty("Meeting");
      lg.makeListDirty("NextAction");
      lg.makeListDirty("ToDo");

      // Now we check to see if this is a recurring activity.
      // Check the "recurrenceType" field. If it is not null,
      // then process the other recurring fields "every" and "on".
      // Then call the SyncFacadeEJB to add the recurring data
      // to the recurrence table.
      String recurrenceType = requestForm.getRecurrenceType();

      if (result != null && !result.equals("")) {
        // only do this if we actually created an activity above
        if (recurrenceType != null && !recurrenceType.equals("")) {
          // this is a recurring activity, get the other recurring fields
          String every = requestForm.getEvery();
          String recurrOn = requestForm.getOn();

          // NOTE: we do not care about recurringStartDate anymore, only copy
          // startDateTime into recurringStartDate
          String recurringStartDateString = requestForm.getStartDateTime();
          String recurringEndDateString = requestForm.getRecurrenceEndDate();

          Date recurringStartDate = null;
          Date recurringEndDate = null;

          try {
            recurringStartDate = simpleDateFormat.parse(recurringStartDateString);
            if (recurringEndDateString != null) {
              recurringEndDate = simpleDateFormat.parse(recurringEndDateString);
            } else {
              recurringEndDate = simpleDateFormat.parse("2099-12-31 00:00:00");
            }

            // NOTE: There is a bug in the CompanionLink Client API, that is
            // sending us the day of the month in the "every" field, instead of
            // the month of the year; when the recurring type is Yearly. To fix
            // this issue, we now get the month of the year from the start date,
            // and set every equal to that value. When CompanionLink addresses
            // this issue correctly, we can remove this hack.
            if (recurrenceType.equals("YEAR")) {
              Calendar recurStart = new GregorianCalendar(tz, locale);
              recurStart.setTime(recurringStartDate);
              every = String.valueOf(recurStart.get(Calendar.MONTH));
            }
            // END HACK for yearly bug from CompanionLink

            // next line returns boolean, but there's no real reason to check.
            // (since we can't ROLLBACK)
View Full Code Here

   
    X509Name  subject_dn = new X509Name(true,cert_dn);
   
    certificateGenerator.setSubjectDN(subject_dn);
   
    Calendar  not_after = Calendar.getInstance();
   
    not_after.add(Calendar.YEAR, 1);
   
    certificateGenerator.setNotAfter( not_after.getTime());
   
    certificateGenerator.setNotBefore(Calendar.getInstance().getTime());
   
    certificateGenerator.setPublicKey( pair.getPublic());
   
View Full Code Here

    return percentage_format.format(thousands / 1000.0);
  }

  public static String formatTimeStamp(long time) {
    StringBuffer sb = new StringBuffer();
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(time);
    sb.append('[');
    sb.append(formatIntToTwoDigits(calendar.get(Calendar.DAY_OF_MONTH)));
    sb.append('.');
    sb.append(formatIntToTwoDigits(calendar.get(Calendar.MONTH)+1))// 0 based
    sb.append('.');
    sb.append(calendar.get(Calendar.YEAR));
    sb.append(' ');
    sb.append(formatIntToTwoDigits(calendar.get(Calendar.HOUR_OF_DAY)));
    sb.append(':');
    sb.append(formatIntToTwoDigits(calendar.get(Calendar.MINUTE)));
    sb.append(':');
    sb.append(formatIntToTwoDigits(calendar.get(Calendar.SECOND)));
    sb.append(']');
    return sb.toString();
  }
View Full Code Here

      if ( first_write ){
       
        first_write = false;
       
        Calendar now = GregorianCalendar.getInstance();

        str.append( "\r\n[" );
        str.append( start_date );
        str.append( "] Log File Opened for " );
        str.appendConstants.APP_NAME );
View Full Code Here

   {
      String[] arr = dateTime.split(SPLIT_REGEX, 7);
      int valid = Integer.parseInt(arr[0]);
      if (valid < 1 || valid > 12)
         return false;
      Calendar date = new GregorianCalendar(Integer.parseInt(arr[2]), valid - 1, 1);
      if (Integer.parseInt(arr[1]) > date.getActualMaximum(Calendar.DAY_OF_MONTH))
         return false;
      if (arr.length > 3
         && (Integer.parseInt(arr[3]) > 23 || Integer.parseInt(arr[4]) > 59 || Integer.parseInt(arr[5]) > 59))
         return false;
      return true;
View Full Code Here

      else
      {
         getUIFormCheckBoxInput(VISIBLE).setChecked(pageNode_.isVisible());
         getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).setChecked(pageNode.isShowPublicationDate());
         setShowCheckPublicationDate(pageNode_.isVisible());
         Calendar cal = Calendar.getInstance();
         if (pageNode.getStartPublicationDate() != null)
         {
            cal.setTime(pageNode.getStartPublicationDate());
            getUIFormDateTimeInput(START_PUBLICATION_DATE).setCalendar(cal);
         }
         else
            getUIFormDateTimeInput(START_PUBLICATION_DATE).setValue(null);
         if (pageNode.getEndPublicationDate() != null)
         {
            cal.setTime(pageNode.getEndPublicationDate());
            getUIFormDateTimeInput(END_PUBLICATION_DATE).setCalendar(cal);
         }
         else
            getUIFormDateTimeInput(END_PUBLICATION_DATE).setValue(null);
      }
View Full Code Here

   public void invokeSetBindingBean(Object bean) throws Exception
   {
      super.invokeSetBindingBean(bean);
      PageNode node = (PageNode)bean;
      Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
      Date date = (cal != null) ? cal.getTime() : null;
      node.setStartPublicationDate(date);
      cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
      date = (cal != null) ? cal.getTime() : null;
      node.setEndPublicationDate(date);
   }
View Full Code Here

         WebuiRequestContext ctx = event.getRequestContext();
         UIPageNodeForm uiPageNodeForm = event.getSource();
         UIApplication uiPortalApp = ctx.getUIApplication();
         if (uiPageNodeForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked())
         {
            Calendar currentCalendar = Calendar.getInstance();
            currentCalendar.set(currentCalendar.get(Calendar.YEAR), currentCalendar.get(Calendar.MONTH), currentCalendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
            Date currentDate = currentCalendar.getTime();
           
            Calendar startCalendar =
               uiPageNodeForm.getUIFormDateTimeInput(UIWizardPageSetInfo.START_PUBLICATION_DATE).getCalendar();
            Date startDate = startCalendar != null ? startCalendar.getTime() : currentDate;
            Calendar endCalendar =
               uiPageNodeForm.getUIFormDateTimeInput(UIWizardPageSetInfo.END_PUBLICATION_DATE).getCalendar();
            Date endDate = endCalendar != null ? endCalendar.getTime() : null;
           
            // Case 1: current date after start date
            if (currentDate.after(startDate))
            {
               Object[] args = {};
View Full Code Here

      try {
        SOAPRequest soapRequest = new SOAPRequest(
                userName,
                IOUtilities.xorDecode(mProperties.getProperty("password", ""), SchedulesDirectSettingsPanel.PASSWORDSEED).trim(),
                SCHEDULESDIRECT_SERVICE);
        Calendar start = startDate.getCalendar();
        Calendar end = (Calendar) startDate.getCalendar().clone();
        end.add(Calendar.DAY_OF_MONTH, dateCount);

        final Xtvd xtvd = new Xtvd();
        soapRequest.getData(start, end, xtvd);

        monitor.setMessage(mLocalizer.msg("parsing", "Parsing SchedulesDirect Data"));

        Collection<Schedule> schedules = xtvd.getSchedules();

        HashMap<String, Channel> channelMap = new HashMap<String, Channel>();
        for (Channel ch : channelArr) {
          channelMap.put(ch.getId(), ch);
        }

        mChannelMap = new HashMap<Channel, Map<devplugin.Date, MutableChannelDayProgram>>();
        for (Schedule schedule : schedules) {
          Channel ch = channelMap.get(Integer.toString(schedule.getStation()));
          if (ch != null) {
            Calendar cal = Calendar.getInstance();
            cal.setTime(schedule.getTime().getLocalDate());
            devplugin.Date programDate = new Date(cal);
            MutableChannelDayProgram chDayProgram = getMutableDayProgram(ch, programDate);

            MutableProgram prog = new MutableProgram(ch, programDate, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true);
            net.sf.xtvdclient.xtvd.datatypes.Program xtvdProgram = xtvd.getPrograms().get(schedule.getProgram());

            int info = 0;
            if (schedule.getCloseCaptioned()) {
              info |= Program.INFO_SUBTITLE_FOR_AURALLY_HANDICAPPED;
            }
            if (schedule.getStereo()) {
              info |= Program.INFO_AUDIO_STEREO;
            }
            if (schedule.getSubtitled()) {
              info |= Program.INFO_ORIGINAL_WITH_SUBTITLE;
            }
            if (schedule.getHdtv()) {
              info |= Program.INFO_VISION_HD;
            }
            if (xtvdProgram.getColorCode() != null) {
              String code = xtvdProgram.getColorCode().toLowerCase();
              if (code.contains("black") || code.contains("bw")) {
                info |= Program.INFO_VISION_BLACK_AND_WHITE;
              }
              else if (!code.equalsIgnoreCase("Color and B & W")) {
                mLog.warning("Unknown color code: " + xtvdProgram.getColorCode());
              }
            }

            prog.setInfo(info);

            prog.setTitle(xtvdProgram.getTitle());

            if (xtvdProgram.getSyndicatedEpisodeNumber() != null) {
              try {
                prog.setIntField(ProgramFieldType.EPISODE_NUMBER_TYPE, Integer.parseInt(xtvdProgram.getSyndicatedEpisodeNumber()));
              } catch (NumberFormatException e) {
                // ignore, the syndicated episode number may also be an arbitrary string
              }
            }

            if (xtvdProgram.getSubtitle() != null) {
              prog.setTextField(ProgramFieldType.EPISODE_TYPE, xtvdProgram.getSubtitle());
            }

            if (xtvdProgram.getYear() != null) {
              try {
                prog.setIntField(ProgramFieldType.PRODUCTION_YEAR_TYPE, Integer.parseInt(xtvdProgram.getYear()));
                // year is only set for movies
                setMovieType(prog);
              } catch (NumberFormatException e) {
                e.printStackTrace();
              }
            } else if (xtvdProgram.getOriginalAirDate() != null) {
              Calendar aircal = Calendar.getInstance();
              java.util.Date date = xtvdProgram.getOriginalAirDate().getDate();
              aircal.setTime(date);
              prog.setIntField(ProgramFieldType.PRODUCTION_YEAR_TYPE, aircal.get(Calendar.YEAR));
              String repetition = new SimpleDateFormat().format(date);
              if (repetition.endsWith("00:00")) {
                repetition = repetition.substring(0, repetition.length() - "00:00".length()).trim();
              }
              prog.setTextField(ProgramFieldType.REPETITION_OF_TYPE, repetition);
View Full Code Here

TOP

Related Classes of java.util.Calendar

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.