@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 { UIMeetingDetail detail = event.getSource(); UIMeetingSchedulePortlet portlet = detail.getAncestorOfType(UIMeetingSchedulePortlet.class); detail.setRendered(false); portlet.getChild(UIListMeetingSchedule.class).setRendered(true); event.getRequestContext().addUIComponentToUpdateByAjax(portlet); }
@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); }