@Override public void execute(Event<UIMeetingDetail> event) throws Exception { UIMeetingDetail detail = event.getSource(); UIApplication uiApp = event.getRequestContext().getUIApplication(); if (detail.selectedOptions.isEmpty()) { uiApp.addMessage( new ApplicationMessage( "You need to select at least one option", new Object[0], AbstractApplicationMessage.ERROR)); return; } Identity identity = ConversationState.getCurrent().getIdentity(); if (!identity.getUserId().equals(detail.getMeeting().getOwner())) { uiApp.addMessage( new ApplicationMessage( "Only owner can make plan for this meeting", new Object[0], AbstractApplicationMessage.ERROR)); return; } MeetingService service = detail.getApplicationComponent(MeetingService.class); Meeting m = service.finalMeeting(detail.meeting, new ArrayList<String>(detail.selectedOptions)); detail.setMeeting(m); }
@Override public void execute(Event<UIMeetingDetail> event) throws Exception { String optionId = event.getRequestContext().getRequestParameter(OBJECTID); UIMeetingDetail detail = event.getSource(); Identity identity = ConversationState.getCurrent().getIdentity(); boolean isVoted = detail.meeting.isVotedOption(identity.getUserId(), optionId); MeetingService service = detail.getApplicationComponent(MeetingService.class); Map<String, String> voted = new HashMap<String, String>(); voted.put(optionId, isVoted ? "0" : "1"); Meeting meeting1 = service.updateVote(detail.meeting, identity.getUserId(), voted); detail.setMeeting(meeting1); }
@Override public void execute(Event<UIMeetingDetail> event) throws Exception { UIMeetingSchedulePortlet portlet = event.getSource().getAncestorOfType(UIMeetingSchedulePortlet.class); portlet.getChild(UIListMeetingSchedule.class).setRendered(false); UINewMeetingSchedule uiNewMeetingSchedule = portlet.getChild(UINewMeetingSchedule.class); String jcrPath = event.getRequestContext().getRequestParameter(OBJECTID); MeetingService meetingService = portlet.getApplicationComponent(MeetingService.class); uiNewMeetingSchedule.setEditMeeting(meetingService.getMeeting(jcrPath)); uiNewMeetingSchedule.init(); uiNewMeetingSchedule.setRendered(true); event.getRequestContext().addUIComponentToUpdateByAjax(portlet); }