Package org.opencustomer.db.vo.calendar

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


public class LoadAction extends EditLoadAction<LoadForm> {
    private static Logger log = Logger.getLogger(LoadAction.class);

    @Override
    public EditPanel createPanel(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        EventVO event = (EventVO)attributes.get("event");

        EditPanel panel = new EditPanel(Right.CALENDAR_CALENDAR_WRITE, event);
       
        if(event.getId() == null) {
            panel.setTitle(MessageUtil.message(request, "module.calendar.event.headLine.create"));
        } else {
            panel.setTitle(MessageUtil.message(request, "module.calendar.event.headLine.edit", event.getTitle()));
           
            panel.setAttribute(DeleteAction.TEXT_TITLE, MessageUtil.message(request, "module.calendar.event.delete.headLine", event.getTitle()));
            panel.setAttribute(DeleteAction.TEXT_QUESTION, MessageUtil.message(request, "module.calendar.event.delete.question", event.getTitle()));
        }
       
        boolean contentEditable = isContentEditable(panel, (CalendarVO)attributes.get("calendar"), request);
       
        if(contentEditable) {
View Full Code Here


    }
   
    @Override
    public void loadEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        try {
            EventVO event = new EventDAO().getById(form.getId());
            Hibernate.initialize(event.getEventCalendars());
            Hibernate.initialize(event.getEventPersons());
           
            attributes.put("event", event);
        } catch (Exception e) {
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.invalidEntity", form.getId()));
View Full Code Here

        UserVO user = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
        CalendarVO calendar = (CalendarVO)panel.getAttribute("calendar");
       
        EventCalendarVO myEventCalendar = null;
       
        EventVO event = (EventVO)panel.getEntity();

        for(EventCalendarVO eventCalendar : event.getEventCalendars()) {
            if(calendar.equals(eventCalendar.getCalendar())) {
                myEventCalendar = eventCalendar;
            }
        }
       
View Full Code Here

    @Override
    public void createEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        CalendarVO calendar = (CalendarVO) Panel.getPanelStack(request).peek().getAttribute("calendar");
       
        // create event
        EventVO event = new EventVO();

        Date choosenDate = null;
        if(form.getDate() != null) {
            try {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
                choosenDate = sdf.parse(form.getDate());
            } catch(ParseException e) {
                log.error("invalid date found ()", e);
            }
        }
        Calendar cal = GregorianCalendar.getInstance();
        if(choosenDate != null) {
            Calendar cal2 = GregorianCalendar.getInstance();
            cal2.setTime(choosenDate);
            cal.set(Calendar.DAY_OF_MONTH, cal2.get(Calendar.DAY_OF_MONTH));
            cal.set(Calendar.MONTH, cal2.get(Calendar.MONTH));
            cal.set(Calendar.YEAR, cal2.get(Calendar.YEAR));
        }
        event.setStartDate(cal.getTime());
        cal.add(Calendar.MINUTE, 30);
        event.setEndDate(cal.getTime());
        event.setRecurrenceType(EventVO.RecurrenceType.NONE);
        event.setOccupied(false);
       
        // create event calendar
        EventCalendarVO eventCalendar = new EventCalendarVO();
        eventCalendar.setCalendar(calendar);
        eventCalendar.setEvent(event);
        eventCalendar.setParticipiantType(EventCalendarVO.ParticipiantType.HOST);
        eventCalendar.setInvitationStatus(EventCalendarVO.InvitationStatus.ACCEPTED);
        eventCalendar.setOwnerUser(calendar.getOwnerUser());
        eventCalendar.setOwnerGroup(calendar.getOwnerGroup());
        eventCalendar.setAccessUser(calendar.getAccessUser());
        eventCalendar.setAccessGroup(calendar.getAccessGroup());
        eventCalendar.setAccessGlobal(calendar.getAccessGlobal());
       
        event.getEventCalendars().add(eventCalendar);
       
        attributes.put("event", event);
    }
View Full Code Here

    @Override
    protected boolean isEditable(EditPanel panel, HttpServletRequest request)
    {
        UserVO user         = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
        EventVO event       = (EventVO)panel.getEntity();
        CalendarVO calendar = (CalendarVO)panel.getAttribute("calendar");

        // active event calendar
        EventCalendarVO activeEventCalendar = null;
        for(EventCalendarVO eventCalendar : event.getEventCalendars()) {
            if(calendar.equals(eventCalendar.getCalendar())) {
                activeEventCalendar = eventCalendar;
            }
        }
       
View Full Code Here

       
        return participientCalendar && participientEvent;
    }
       
    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;
View Full Code Here

        ResourceBundle resourceBundle = ResourceBundle.getBundle("WebResources", user.getLocale());
       
        List<EventCalendarVO> eventcalendars = new EventCalendarDAO().getByCalendar(calendar, true);
        List<EventVO> eventList = new ArrayList<EventVO>();
       
        EventVO event = null;
           
        for(EventCalendarVO eventcalendar : eventcalendars)
        {
            event = eventcalendar.getEvent();
            if(EntityAccessUtility.isAccessGranted(user,eventcalendar,Access.READ) && !EntityAccessUtility.isAccessGranted(user,eventcalendar,Access.WRITE)){
                event.setTitle(event.getTitle() + " ["+resourceBundle.getString("entity.calendar.event.readonly")+"] ");
                if(log.isDebugEnabled())
                    log.debug("event readonly: " + event);
            }
            eventList.add(event);
        }
View Full Code Here

            if(log.isDebugEnabled())
                log.debug("start import: " + event);
           
            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);
View Full Code Here

                HashMap<String,String> eventMap;
                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
                               
                for(EventBean eventBean : eventBeanList)
                {
                    EventVO event = eventBean.getEvent();
                    eventMap = new HashMap<String,String>();
                    eventMap.put("id",event.getId().toString());
                    eventMap.put("title",event.getTitle());
                    eventMap.put("description",event.getDescription());
                    eventMap.put("startDate",sdf.format(eventBean.getStartDate()));
                    eventMap.put("endDate",sdf.format(eventBean.getEndDate()));
                    eventMap.put("occupied",Boolean.toString(event.isOccupied()));
                    eventMap.put("allDay",Boolean.toString(event.isAllDay()));
                    eventMap.put("deeplink","http://localhost:8080/opencustomer/login.do"); //TODO: read URL from settings
                    if(eventBean.getReminderDate() != null)
                        eventMap.put("alarmDate",sdf.format(eventBean.getReminderDate()));
                    if(eventBean.getRecurrenceNumber() != null)
                        eventMap.put("recurrenceNumber", eventBean.getRecurrenceNumber().toString());
                    else
                        eventMap.put("recurrenceNumber", "0");
                    for(EventCalendarVO eventCalendar :event.getEventCalendars())
                    {
                        if(eventCalendar.getParticipiantType() == EventCalendarVO.ParticipiantType.HOST
                                && eventCalendar.getCalendar() == new CalendarDAO().getForUser(uservo))
                        {
                            eventMap.put("ownevent",Boolean.toString(true));
View Full Code Here

        List<EventVO> events = new ArrayList<EventVO>();
        Calendar icalendar = new CalendarBuilder().build(ical);
        List<Component> components = icalendar.getComponents();
        for(Component comp : components)
        {
            EventVO event = new EventVO();
            if(log.isDebugEnabled())
                log.debug("import component: " + comp);
            if(comp instanceof VEvent//only VEvent are parsed
            {
                if(comp.getProperties().getProperty((Property.DESCRIPTION)) != null)
                    event.setDescription(comp.getProperties().getProperty(Property.DESCRIPTION).getValue());
                if(comp.getProperties().getProperty((Property.SUMMARY)) != null)
                    event.setTitle(comp.getProperties().getProperty(Property.SUMMARY).getValue());
                else
                    event.setTitle("XXX");
                if(comp.getProperties().getProperty((Property.DTSTART)) != null)
                    if(comp.getProperties().getProperty(Property.DTSTART).getParameter("VALUE") != null
                       && comp.getProperties().getProperty(Property.DTSTART).getParameter("VALUE").getValue().equals("DATE"))
                    {
                        event.setStartDate(new Date(comp.getProperties().getProperty(Property.DTSTART).getValue()));
                        event.setAllDay(true);
                    }    
                    else
                        event.setStartDate(new DateTime(comp.getProperties().getProperty(Property.DTSTART).getValue()));
                if(comp.getProperties().getProperty((Property.DTEND)) != null)
                    if(comp.getProperties().getProperty(Property.DTEND).getParameter("VALUE") != null
                            && comp.getProperties().getProperty(Property.DTEND).getParameter("VALUE").getValue().equals("DATE"))
                         {
                             event.setEndDate(new Date(comp.getProperties().getProperty(Property.DTEND).getValue()));
                         }    
                         else
                             event.setEndDate(new DateTime(comp.getProperties().getProperty(Property.DTEND).getValue()));
                else
                    event.setEndDate(event.getStartDate());
                if(comp.getProperties().getProperty(Property.RRULE) != null)
                    readRecur(comp.getProperties().getProperty(Property.RRULE).getValue(),event);
                else
                    event.setRecurrenceType(RecurrenceType.NONE);
                if(comp.getProperties().getProperty("X-OC-ID") != null)
                    event.setId(Integer.parseInt(comp.getProperties().getProperty("X-OC-ID").getValue()));
                else if(comp.getProperties().getProperty(Property.UID) != null && comp.getProperties().getProperty(Property.UID).getValue().endsWith("@opencustomner"))
                    event.setId(Integer.parseInt(comp.getProperties().getProperty(Property.UID).getValue().split("@")[0]));
                events.add(event);
                if(log.isDebugEnabled())
                    log.debug("event parsed: " + event);
            }
            else
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.