Package org.opencustomer.db.vo.calendar

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


       
    private boolean isContentEditable(EditPanel panel, CalendarVO calendar, HttpServletRequest request) {
        EventVO event = (EventVO)panel.getEntity();
        UserVO user   = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);

        EventCalendarVO hostEventCalendar   = null;
        EventCalendarVO activeEventCalendar = null;
       
        // identify the host calendar
        for(EventCalendarVO eventCalendar : event.getEventCalendars()) {
            if(EventCalendarVO.ParticipiantType.HOST.equals(eventCalendar.getParticipiantType())) {
                hostEventCalendar = eventCalendar;
            }
            if(eventCalendar.getCalendar().equals(calendar)) {
                activeEventCalendar = eventCalendar;
            }
        }
       
        if(hostEventCalendar.equals(activeEventCalendar)) {
            if(log.isDebugEnabled())
                log.debug("see event as host");
           
            return EntityAccessUtility.isAccessGranted(user, hostEventCalendar.getCalendar(), EntityAccess.Access.WRITE)
                && EditPanel.checkEditable(request, panel, hostEventCalendar, user);
        } else {
            if(log.isDebugEnabled())
                log.debug("see event as participient");

            boolean hostCalendar = EntityAccessUtility.isAccessGranted(calendar.getUser(), hostEventCalendar.getCalendar(), EntityAccess.Access.WRITE)
            boolean hostEvent = EditPanel.checkEditable(request, panel, hostEventCalendar, calendar.getUser());
            boolean participientCalendar = EntityAccessUtility.isAccessGranted(user, activeEventCalendar.getCalendar(), EntityAccess.Access.WRITE);
            boolean participientEvent = EditPanel.checkEditable(request, panel, activeEventCalendar, user);
           
            if(log.isDebugEnabled()) {
                log.debug("editable(content): hostCalendar="+hostCalendar+", hostEvent="+hostEvent+", participientCalendar="+participientCalendar+", participientEvent="+participientEvent);
            }
View Full Code Here


            if(event.getId() != null// parser found oc id
            {    
                EventVO event2 = eventdao.getById(event.getId());
                if(event2 != null)
                {
                    EventCalendarVO hostEventCalendar = null;
                    EventCalendarVO myEventCalendar = null;
                   
                    for(EventCalendarVO eventCalendar : event2.getEventCalendars()) { // search for myEventCalendar
                        if(calendar.equals(eventCalendar.getCalendar())) {
                            myEventCalendar = eventCalendar;
                        }
                    }
                   
                    for(EventCalendarVO eventCalendar : event2.getEventCalendars()) { // search for the hostEventCalendar entity
                        if(EventCalendarVO.ParticipiantType.HOST.equals(eventCalendar.getParticipiantType())) {
                            hostEventCalendar = eventCalendar;
                        }
                    }
                   
                    if(EntityAccessUtility.isAccessGranted(user,myEventCalendar,Access.WRITE)
                            && EntityAccessUtility.isAccessGranted(calendar.getUser(),hostEventCalendar,Access.WRITE)) // write access ?
                    {
                        event2.setDescription(event.getDescription());
                        event2.setTitle(event.getTitle());
                        event2.setAllDay(event.isAllDay());
                        event2.setEndDate(event.getEndDate());
                        event2.setStartDate(event.getStartDate());
                        event2.setRecurrenceCycle(event.getRecurrenceCycle());
                        event2.setRecurrenceCycleUnit(event.getRecurrenceCycleUnit());
                        event2.setRecurrenceEndDate(event.getRecurrenceEndDate());
                        event2.setRecurrenceStartDate(event.getRecurrenceStartDate());
                        event2.setRecurrenceInMonth(event.getRecurrenceInMonth());
                        event2.setRecurrenceInWeek(event.getRecurrenceInWeek());
                        event2.setRecurrenceNumberOfTimes(event.getRecurrenceNumberOfTimes());
                        event2.setRecurrenceType(event.getRecurrenceType());
                        event2.setRecurrenceUntilDate(event.getRecurrenceUntilDate());
                                              
                        if(log.isDebugEnabled())
                            log.debug("event updated: " + event2);
                       
                        eventdao.update(event2);
                        insertList.add(event2);
                    }
                    else
                    {
                        if(log.isDebugEnabled())
                            log.debug("event update denied: " + event2);
                        insertList.add(event2);
                        throw new AccessDeniedException(calendar.getName(),user.getUserName(),"WRITE");
                    }
                }
                else
                {
                    if(log.isInfoEnabled())
                        log.info("event " + event.getId() + " not found, id incorrect?");
                }
            }
            else
            {     
                // create new Event, no eventid found
                if(EntityAccessUtility.isAccessGranted(user,calendar,Access.WRITE))
                {
                    EventCalendarVO ecvo = new EventCalendarVO(event,calendar);
                    ecvo.setParticipiantType(ParticipiantType.HOST);
                    ecvo.setInvitationStatus(InvitationStatus.ACCEPTED);
                   
                    ecvo.setOwnerUser(calendar.getOwnerUser());
                    ecvo.setOwnerGroup(calendar.getOwnerGroup());
                    ecvo.setAccessUser(calendar.getAccessUser());
                    ecvo.setAccessGroup(calendar.getAccessGroup());
                    ecvo.setAccessGlobal(calendar.getAccessGlobal());
                   
                    event.getEventCalendars().add(ecvo);
                   
                    if(log.isDebugEnabled())
                        log.debug("new event created: " + event);
View Full Code Here

TOP

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

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.