Package org.opencustomer.db.vo.calendar

Examples of org.opencustomer.db.vo.calendar.EventVO


    private static Logger log = Logger.getLogger(PageStandardAction.class);

    @Override
    public void writeForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
    {
        EventVO event = (EventVO) getPanel().getEntity();

        form.setTitle(event.getTitle());
        form.setDescription(event.getDescription());
        form.setLocation(event.getLocation());

        String format = null;
        if (form.isAllDay())
            format = MessageUtil.message(request, "default.format.input.date");
        else
            format = MessageUtil.message(request, "default.format.input.dateTime");
       
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        if (event.getStartDate() != null)
            form.setStartTime(sdf.format(event.getStartDate()));
        if (event.getEndDate() != null)
            form.setEndTime(sdf.format(event.getEndDate()));
       
        SimpleDateFormat reminderFormat = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.dateTime"));
        if (event.getReminderDate() != null)
            form.setReminderDate(reminderFormat.format(event.getReminderDate()));

        form.setAllDay(event.isAllDay());
        form.setOccupied(event.isOccupied());
    }
View Full Code Here


    }
   
    @Override
    public void readForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
    {
        EventVO event = (EventVO) getPanel().getEntity();

        event.setTitle(form.getTitle());
        event.setDescription(form.getDescription());
        event.setLocation(form.getLocation());

        String format = null;
        if (form.isAllDay())
            format = MessageUtil.message(request, "default.format.input.date");
        else
            format = MessageUtil.message(request, "default.format.input.dateTime");
        SimpleDateFormat sdf = new SimpleDateFormat(format);
       
        try {
            event.setStartDate(sdf.parse(form.getStartTime()));

            if (form.isAllDay()) {
                Calendar endDate = GregorianCalendar.getInstance();
                endDate.setTime(sdf.parse(form.getEndTime()));
                endDate.add(Calendar.DAY_OF_MONTH, 1);
                endDate.add(Calendar.MILLISECOND, -1);

                event.setEndDate(endDate.getTime());
            } else {
                event.setEndDate(sdf.parse(form.getEndTime()));
            }
           
            SimpleDateFormat reminderFormat = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.dateTime"));
            if(form.getReminderDate() != null) {
                event.setReminderDate(reminderFormat.parse(form.getReminderDate()));
            } else {
                event.setReminderDate(null);
            }
        } catch (ParseException e) {
            log.error("problems parsing event time start/end", e);
        }

        event.setOccupied(form.isOccupied());
        event.setAllDay(form.isAllDay());
    }
View Full Code Here

    private static final long serialVersionUID = 1324748422328371702L;

    @Override
    protected EntityAccess getEntityAccess(HttpServletRequest request)
    {
        EventVO event = (EventVO)getPanel().getEntity();
        CalendarVO calendar = (CalendarVO)getPanel().getAttribute("calendar");
       
        for(EventCalendarVO eventCalendar : event.getEventCalendars()) {
            if(calendar.equals(eventCalendar.getCalendar())) {
                return eventCalendar;
            }
        }
       
View Full Code Here

   
    private String inMonth = EventVO.RecurrenceInMonth.DAY_OF_WEEK.toString();
   
    public void validate(ActionMapping mapping, ActionMessages errors, HttpServletRequest request)
    {
        EventVO event = (EventVO)getPanel().getAttribute("event");
       
        untilDate = FormUtility.adjustParameter(untilDate);

        EventVO.RecurrenceType type = EnumUtility.valueOf(EventVO.RecurrenceType.class, recurrenceType);
       
        if(recurrence)
        {
            // add the missing startDate
            HashSet<String> newInWeek = new HashSet<String>();
            for(String day : inWeek) {
                newInWeek.add(day);
            }
            newInWeek.add(EventVO.RecurrenceInWeek.getForDate(event.getStartDate()).toString());           
            inWeek = newInWeek.toArray(new String[newInWeek.size()]);
           
            if(cycle < 1)
                errors.add("cycle", new ActionMessage("module.calendar.event.error.invalidCycle", MessageUtil.message(request, "entity.calendar.event.recurrence.cycle")));
           
            if(EventVO.RecurrenceType.NUMBER_OF_TIMES.equals(type))
            {
                if(numberOfTimes < 1)
                    errors.add("numberOfTimes", new ActionMessage("module.calendar.event.error.invalidNumberOfTimes", MessageUtil.message(request, "entity.calendar.event.recurrence.numberOfTimes")));
            }
            else if(EventVO.RecurrenceType.UNTIL_DATE.equals(type))
            {
                if (untilDate == null)
                {
                    errors.add("untilDate", new ActionMessage("default.error.missingInput", MessageUtil.message(request, "entity.calendar.event.recurrence.untilDate")));
                }
                else
                {
                    String format = MessageUtil.message(request, "default.format.input.date");
                    try
                    {
                        untilDate = DateUtility.adjustDate(format, untilDate);
                       
                        if(!event.getStartDate().before(DateUtility.getEndOfDay(new SimpleDateFormat(format).parse(untilDate))))
                            errors.add("untilDate", new ActionMessage("module.calendar.event.error.untilDateBeforeStart", MessageUtil.message(request, "entity.calendar.event.recurrence.untilDate")));
                    }
                    catch (ParseException e)
                    {
                        errors.add("untilDate", new ActionMessage("default.error.invalidFormat", MessageUtil.message(request, "entity.calendar.event.recurrence.untilDate"), format));
View Full Code Here

    private static Logger log = Logger.getLogger(PageParticipiantsAction.class);
   
    @Override
    public void writeForm(PageParticipiantsForm form, ActionMessages errors, HttpServletRequest request)
    {       
        EventVO event = (EventVO) getPanel().getEntity();
       
        form.setUnknownParticipiants(event.getUnknownParticipiants());
       
        updateView(form, errors, request);
       
        List<EventPersonVO> eventPersons = (List<EventPersonVO>)getPanel().getAttribute("eventPersons");
       
View Full Code Here

    }
   
    @Override
    public void readForm(PageParticipiantsForm form, ActionMessages errors, HttpServletRequest request)
    {
        EventVO event = (EventVO) getPanel().getEntity();
       
        event.setUnknownParticipiants(form.getUnknownParticipiants());
       
        List<EventPersonVO> eventPersons = (List<EventPersonVO>)getPanel().getAttribute("eventPersons");
        for(int i=0; i<form.getInvitationStatus().size(); i++)
        {
            String value = form.getInvitationStatus(i);
View Full Code Here

    protected void updateView(PageParticipiantsForm form, ActionMessages errors, HttpServletRequest request) {
        if(log.isDebugEnabled())
            log.debug("post operations");
       
        EventVO event = (EventVO)getPanel().getEntity();
       
        ArrayList<EventCalendarVO> eventCalendars = new ArrayList<EventCalendarVO>(event.getEventCalendars());
        Collections.sort(eventCalendars, Utils.getComparatorForEventCalendar());
        getPanel().setAttribute("eventCalendars", eventCalendars);
       
        ArrayList<EventPersonVO> eventPersons = new ArrayList<EventPersonVO>(event.getEventPersons());
        Collections.sort(eventPersons, Utils.getComparatorForEventPerson());
        getPanel().setAttribute("eventPersons", eventPersons);
    }
View Full Code Here

    private static Logger log = Logger.getLogger(DeleteAction.class);

    @Override
    protected void deleteEntity(DeletePanel panel, HttpServletRequest request, HttpServletResponse response, ActionMessages errors) {
        UserVO user         = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
        EventVO event       = (EventVO)panel.getEntity();
       
        try {
            if(log.isDebugEnabled()) {
                log.debug("delete event: "+event);
            }
View Full Code Here

    @Override
    protected void saveEntity(EditPanel panel, ActionMessages errors, HttpServletRequest request)
    {
        UserVO user = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
       
        EventVO event = (EventVO) panel.getEntity();
        try
        {
            HibernateContext.getSession().clear();
           
            HibernateContext.beginTransaction();
           
            if (event.getId() == null)
            {
                if (log.isDebugEnabled())
                    log.debug("create event");
                new EventDAO().insert(event);
            }
            else
            {
                if (log.isDebugEnabled())
                    log.debug("save event (ID:" + event.getId() + ")");
                new EventDAO().update(event);
            }
           
            HibernateContext.commitTransaction();
        }
View Full Code Here

   
    @Override
    protected boolean validateData(EditPanel panel, ActionMessages errors, HttpServletRequest request)
    {
        UserVO user            = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
        EventVO event          = (EventVO) panel.getAttribute("event");
        CalendarVO calendar    = (CalendarVO) panel.getAttribute("calendar");
       
        EntityAccess testEntity = null;
        if (event.getId() == null)
            testEntity = calendar;
        else {
            EventCalendarVO myEventCalendar = null;
           
            for(EventCalendarVO eventCalendar : event.getEventCalendars()) {
                if(calendar.equals(eventCalendar.getCalendar())) {
                    testEntity = eventCalendar;
                    break;
                }
            }
           
        }
        if (!EntityAccessUtility.isAccessGranted(user, testEntity, EntityAccess.Access.WRITE))
            errors.add("globalAccess", new ActionMessage("default.error.noEntityAccess"));

        if(event.isOccupied()) { // validiere Termin, wenn dieser besetzt ist
            for(EventCalendarVO eventCalendar : event.getEventCalendars()) { // pr�fe jeden Kalender, von dem es Beteiligte gibt
                if(log.isDebugEnabled())
                    log.debug("validate calendar with id="+eventCalendar.getCalendar().getId());
               
                EventBeanCalculator calc = new EventBeanCalculator(eventCalendar.getCalendar(), event.getStartDate(), event.getEndDate());
                for(EventBean eventBean : calc.getEventBeans()) {
                    if(!eventBean.getEvent().equals(event)
                            && eventBean.getEvent().isOccupied()
                            && isEventValid(eventBean.getEvent(), eventCalendar.getCalendar())) { // mu� der Termin gepr�ft werden? (abgelehnte und gel�schte interessieren nicht)
                        if(DateUtility.isMatching(eventBean.getStartDate(), eventBean.getEndDate(), event.getStartDate(), event.getEndDate())) {
                            if(eventCalendar.getCalendar().getUser() != null) {
                                if(eventCalendar.getCalendar().getUser().equals(user)) {
                                    errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.calendar.event.error.isOccupied"));
                                } else {
                                    errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.calendar.event.error.userIsOccupied", eventCalendar.getCalendar().getUser().getUserName()));
View Full Code Here

TOP

Related Classes of org.opencustomer.db.vo.calendar.EventVO

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.