Package org.opencustomer.db.vo.calendar

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


            return;
        }
       
        if(saveOrUpdateEvent.getEntity() instanceof EventVO)
        {
            EventVO event = (EventVO) saveOrUpdateEvent.getEntity();
            CalendarVO mainCalendar = null;
            for(EventCalendarVO vo : event.getEventCalendars()) {
                if(EventCalendarVO.ParticipiantType.HOST.equals(vo.getParticipiantType())) {
                    mainCalendar = vo.getCalendar();
                }
            }
           
           
            Calendar startDate = GregorianCalendar.getInstance();
            Calendar endDate = GregorianCalendar.getInstance();
            endDate.set(startDate.get(Calendar.YEAR),startDate.get(Calendar.MONTH),startDate.get(Calendar.DATE)+2,0,0);
           
            if(event.getReminderDate() != null && event.getReminderDate().after(startDate.getTime()) && event.getReminderDate().before(endDate.getTime()))
            {
                if(log.isDebugEnabled())
                    log.debug("reloading actual Jobs");
                SchedulingManager.getInstance().loadReminderJobsfromDB(startDate.getTime(), endDate.getTime());
            }
            else if(event.getReminderDate() != null && event.getRecurrenceType() != EventVO.RecurrenceType.NONE)
            {
                List<EventBean> events = EventUtility.calculateRecurrences(mainCalendar, endDate.getTime(), event, true);
                for(EventBean eventBean : events)
                {
                    if(eventBean.getReminderDate().after(startDate.getTime()) && eventBean.getReminderDate().before(endDate.getTime()))
View Full Code Here


                log.debug("reminder mail disabled");
            return;
        }
        if(event.getObject() instanceof EventVO)
        {
            EventVO eventVO = (EventVO) event.getObject();
            SchedulingManager manager = SchedulingManager.getInstance();
           
            for(Object obj :  manager.getAlarmManager().getAllAlarms())
            {
                AlarmEntry alarmEntry = (AlarmEntry) obj;
                if(alarmEntry.getName().contains("EVENT"+eventVO.getId())){
                    if(log.isDebugEnabled())
                        log.debug("removing mail job for: " + eventVO);
                    manager.getAlarmManager().removeAlarm(alarmEntry);
                }
            }
View Full Code Here

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

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

        if(!EventVO.RecurrenceType.NONE.equals(event.getRecurrenceType()))
        {
            form.setRecurrence(true);
            form.setRecurrenceType(event.getRecurrenceType().toString());
        }

        if(event.getRecurrenceNumberOfTimes() != null)
            form.setNumberOfTimes(event.getRecurrenceNumberOfTimes());

        SimpleDateFormat sdfDate = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.date"));
        if (event.getRecurrenceUntilDate() != null)
            form.setUntilDate(sdfDate.format(event.getRecurrenceUntilDate()));
        else
            form.setUntilDate(sdfDate.format(event.getStartDate()));

        if(event.getRecurrenceCycle() != null)
            form.setCycle(event.getRecurrenceCycle())
       
        if(event.getRecurrenceCycleUnit() != null)
            form.setCycleUnit(event.getRecurrenceCycleUnit().toString());
       
        if(event.getRecurrenceInMonth() != null)
            form.setInMonth(event.getRecurrenceInMonth().toString());
        else
            form.setInMonth(RecurrenceInMonth.DAY_OF_MONTH.toString());
       
        HashSet<String> values = new HashSet<String>();
        if(event.getRecurrenceInWeek() != null)
        {
            for(EventVO.RecurrenceInWeek value : event.getRecurrenceInWeek())
                values.add(value.toString());
        }
        // add default value
        values.add(EventVO.RecurrenceInWeek.getForDate(event.getStartDate()).toString());

        form.setInWeek(values.toArray(new String[values.size()]));
    }
View Full Code Here

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

        EventVO.RecurrenceType type = EnumUtility.valueOf(EventVO.RecurrenceType.class, form.getRecurrenceType());
       
        if(!form.isRecurrence())
        {
            event.setRecurrenceType(EventVO.RecurrenceType.NONE);
            event.setRecurrenceNumberOfTimes(null);
            event.setRecurrenceUntilDate(null);
            event.setRecurrenceCycle(null);
            event.setRecurrenceCycleUnit(null);
            event.setRecurrenceInMonth(null);
            event.getRecurrenceInWeek().clear();
        }
        else
        {               
            event.setRecurrenceType(EnumUtility.valueOf(EventVO.RecurrenceType.class, form.getRecurrenceType()));
           
            if(type.equals(EventVO.RecurrenceType.NUMBER_OF_TIMES))
            {
                event.setRecurrenceNumberOfTimes(form.getNumberOfTimes());
                event.setRecurrenceUntilDate(null);
            }
            else if(type.equals(EventVO.RecurrenceType.UNTIL_DATE))
            {
                try
                {
                    SimpleDateFormat sdf = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.date"));
                   
                    Calendar cal = GregorianCalendar.getInstance();
                    cal.setTime(sdf.parse(form.getUntilDate()));
                    cal.add(Calendar.DAY_OF_YEAR, 1);
                    cal.add(Calendar.MILLISECOND, -1);
                   
                    event.setRecurrenceUntilDate(cal.getTime());
                }
                catch (ParseException e)
                {
                    log.error("problems parsing recurrence until date", e);
                }
                event.setRecurrenceNumberOfTimes(null);
            }
            else if(type.equals(EventVO.RecurrenceType.FOREVER))
            {
                event.setRecurrenceNumberOfTimes(null);
                event.setRecurrenceUntilDate(null);
            }
           
            event.setRecurrenceCycle(form.getCycle());
            event.setRecurrenceCycleUnit(EnumUtility.valueOf(EventVO.RecurrenceUnit.class, form.getCycleUnit()));
           
            if(EventVO.RecurrenceUnit.WEEK.equals(event.getRecurrenceCycleUnit()))
            {
                event.getRecurrenceInWeek().clear();
                for(int i=0; i<form.getInWeek().length; i++)
                    event.getRecurrenceInWeek().add(EnumUtility.valueOf(EventVO.RecurrenceInWeek.class, form.getInWeek()[i]));
               
                event.setRecurrenceInMonth(null);
            }
            else if(EventVO.RecurrenceUnit.MONTH.equals(event.getRecurrenceCycleUnit()))
            {
                event.setRecurrenceInMonth(EnumUtility.valueOf(EventVO.RecurrenceInMonth.class, form.getInMonth()));
                event.getRecurrenceInWeek().clear();
            }
        }

    }
View Full Code Here

            log.error("problems loading calendar for user (ID:" + form.getId() + ")");
        }
        else
        {
            EventVO event = (EventVO) panel.getEntity();
           
            EventCalendarVO eventCalendar = new EventCalendarVO();
            eventCalendar.setEvent(event);
            eventCalendar.setCalendar(user.getCalendar());
            eventCalendar.setInvitationStatus(EventCalendarVO.InvitationStatus.NEW);
            eventCalendar.setParticipiantType(EventCalendarVO.ParticipiantType.GUEST);
           
            eventCalendar.setOwnerUser(user.getCalendar().getOwnerUser());
            eventCalendar.setOwnerGroup(user.getCalendar().getOwnerGroup());
            eventCalendar.setAccessUser(user.getCalendar().getAccessUser());
            eventCalendar.setAccessGroup(user.getCalendar().getAccessGroup());
            eventCalendar.setAccessGlobal(user.getCalendar().getAccessGlobal());
           
            if (!event.getEventCalendars().contains(eventCalendar))
                event.getEventCalendars().add(eventCalendar);
        }
    }
View Full Code Here

    }
   
    @Override
    protected List<UserVO> getIgnoredUsers(EntityPanel panel)
    {
        EventVO event = (EventVO) panel.getEntity();
       
        List<UserVO> ignoredUsers = new ArrayList<UserVO>();
        for(EventCalendarVO eventCalendar : event.getEventCalendars()) {
            if(eventCalendar.getCalendar().getUser() != null)
                ignoredUsers.add(eventCalendar.getCalendar().getUser());
        }
       
        for(EventPersonVO eventPerson : event.getEventPersons()) {
            if(eventPerson.getPerson().getUser() != null)
                ignoredUsers.add(eventPerson.getPerson().getUser());
        }
       
        return ignoredUsers;
View Full Code Here

            log.error("problems loading person (ID:" + form.getId() + ")");
        }
        else
        {
            EventVO event = (EventVO) panel.getEntity();

            EventPersonVO eventPerson = new EventPersonVO();
            eventPerson.setEvent(event);
            eventPerson.setPerson(person);
            eventPerson.setInvitationStatus(EventPersonVO.InvitationStatus.NEW);
           
            if (!event.getEventPersons().contains(eventPerson))
                event.getEventPersons().add(eventPerson);
        }
    }
View Full Code Here

        }
    }
   
    @Override
    protected List<PersonVO> getIgnoredPersons(EntityPanel panel) {
        EventVO event = (EventVO) panel.getEntity();
       
        List<PersonVO> ignorePersons = new ArrayList<PersonVO>();
       
        // ignore persons already added to this event as user
        for(EventCalendarVO eventCalendar : event.getEventCalendars()) {
            if(eventCalendar.getCalendar().getUser() != null && eventCalendar.getCalendar().getUser().getPerson() != null) {
                ignorePersons.add(eventCalendar.getCalendar().getUser().getPerson());
            }
        }
       
        // ignore persons already added to this event as person
        for(EventPersonVO eventPerson : event.getEventPersons()) {
            if(eventPerson.getPerson().getUser() == null) {
                ignorePersons.add(eventPerson.getPerson());
            }
        }
       
View Full Code Here

public class PageSystemAction extends org.opencustomer.webapp.module.generic.PageSystemAction<PageSystemForm> {
    private static Logger log = Logger.getLogger(PageSystemAction.class);

    @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())) {
                if(log.isDebugEnabled())
                    log.debug("use for entity access: "+eventCalendar);
               
                return eventCalendar;
View Full Code Here

        return  null;
    }
   
    @Override
    protected boolean isEditable(EditPanel panel, UserVO user, EntityAccess ea, HttpServletRequest request) {
        EventVO event       = (EventVO)panel.getEntity();
        CalendarVO calendar = (CalendarVO)panel.getAttribute("calendar");

        boolean participientCalendar = EntityAccessUtility.isAccessGranted(user, ea, EntityAccess.Access.WRITE_SYSTEM);
        boolean participientEvent = EntityAccessUtility.isAccessGranted(user, calendar, EntityAccess.Access.WRITE_SYSTEM);
       
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.