Java Code Examples for javax.faces.event.ActionEvent

The following examples show how to use javax.faces.event.ActionEvent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: sakai   Source File: AssessmentListener.java    License: Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) {
	SamLiteBean samLiteBean = (SamLiteBean) ContextUtil.lookupBean("samLiteBean");
	
	Document doc = samLiteBean.createDocument();

	AssessmentFacade assessment = createImportedAssessment(doc, QTIVersion.VERSION_1_2, samLiteBean.getAssessmentTemplateId());
	
	String templateId = samLiteBean.getAssessmentTemplateId();
	if (null != templateId && !"".equals(templateId)) {
		try {
			assessment.setAssessmentTemplateId(Long.valueOf(templateId));
		} catch (NumberFormatException nfe) {
			// Don't worry about it.
			log.warn("Unable to set the assessment template id ", nfe);
		}
	}
	
	samLiteBean.createAssessment(assessment);
	samLiteBean.setData("");
	EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_CREATE, "siteId=" + AgentFacade.getCurrentSiteId() + ", assessmentId=" + assessment.getAssessmentId(), true));
}
 
Example 2
Source Project: sakai   Source File: SchedulerTool.java    License: Educational Community License v2.0 6 votes vote down vote up
public void editTriggersListener(ActionEvent e)
{
  FacesContext context = FacesContext.getCurrentInstance();
  Map requestParams = context.getExternalContext().getRequestParameterMap();
  String jobName = (String) requestParams.get("jobName");

  //loop through jobDetailWrapperList finding the one selected by user.
  for (Iterator i = jobDetailWrapperList.iterator(); i.hasNext();)
  {
    JobDetailWrapper jobDetailWrapper = (JobDetailWrapper) i.next();
    if (jobDetailWrapper.getJobDetail().getKey().getName().equals(jobName))
    {
      selectedJobDetailWrapper = jobDetailWrapper;
      break;
    }
  }
}
 
Example 3
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  String mediaId = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaId");
  String mediaUrl = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaUrl");
  String mediaFilename = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaFilename");
  String itemGradingId = (String) FacesContext.getCurrentInstance().
  	getExternalContext().getRequestParameterMap().get("itemGradingId");

  MediaBean mediaBean = (MediaBean) ContextUtil.lookupBean(
      "mediaBean");
  mediaBean.setMediaId(mediaId);
  mediaBean.setMediaUrl(mediaUrl);
  mediaBean.setFilename(mediaFilename);
  mediaBean.setItemGradingId(Long.valueOf(itemGradingId));

}
 
Example 4
/**
 * ACTION.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  // get service
  PublishedAssessmentService publishedAssessmentService = new
    PublishedAssessmentService();
  // get managed bean
  DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery");
  // get assessment
  PublishedAssessmentFacade pub = null;
  pub = lookupPublishedAssessment(ID_TO_TEST, publishedAssessmentService);
  log.info("** FakeBeginDeliveryActionListener, pub = "+pub);
  log.info("** FakeBeginDeliveryActionListener, pub title = "+pub.getTitle());

  // populate backing bean from published assessment
  populateBeanFromPub(delivery, pub);

  // add in course management system info
  CourseManagementBean course = (CourseManagementBean) ContextUtil.lookupBean("course");
  populateBeanFromCourse(delivery, course);
}
 
Example 5
public void processAction(ActionEvent ae) throws AbortProcessingException {
	FacesContext context = FacesContext.getCurrentInstance();

	// #1 - read the assessmentId from the form
	String assessmentId = (String) FacesContext.getCurrentInstance()
			.getExternalContext().getRequestParameterMap().get("assessmentId");

	// #2 -  and use it to set author bean, goto removeAssessment.jsp
	AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean");
	AssessmentService assessmentService = new AssessmentService();
	AssessmentFacade assessment = assessmentService.getBasicInfoOfAnAssessment(assessmentId);

	// #3 - permission checking before proceeding - daisyf
	AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");
	author.setOutcome("confirmCopyAssessment");

	AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization");
	if (!authzBean.isUserAllowedToEditAssessment(assessmentId, assessment.getCreatedBy(), false)) {
		author.setOutcome("author");
		return;
	}

	assessmentBean.setAssessmentId(assessment.getAssessmentBaseId().toString());
	assessmentBean.setTitle(ComponentManager.get(FormattedText.class).convertFormattedTextToPlaintext(assessment.getTitle()));
}
 
Example 6
/**
 * Normal listener method.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  FacesContext context = FacesContext.getCurrentInstance();

  TemplateBean templateBean = lookupTemplateBean(context);
  String templateId = cu.lookupParam("templateId");

  AssessmentService assessmentService = new AssessmentService();
  AssessmentTemplateFacade template = assessmentService.getAssessmentTemplate(templateId);
  String author = template.getCreatedBy();
  if (!(author != null && author.equals(UserDirectoryService.getCurrentUser().getId())) && !template.getTypeId().equals(TypeIfc.TEMPLATE_SYSTEM_DEFINED)) {
      log.error("User attempted to load template owned by another author " + author + " " + UserDirectoryService.getCurrentUser().getId());
      throw new AbortProcessingException("Attempted to load template owned by another author " + author + " " + UserDirectoryService.getCurrentUser().getId());
   }

  loadAssessment(templateBean, templateId);
}
 
Example 7
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  FacesContext context = FacesContext.getCurrentInstance();
  //Map reqMap = context.getExternalContext().getRequestMap();
  //Map requestParams = context.getExternalContext().getRequestParameterMap();

  String templateId = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("templateId");
  AssessmentService assessmentService = new AssessmentService();
  AssessmentTemplateFacade template = assessmentService.getAssessmentTemplate(templateId);

  TemplateBean templateBean = lookupTemplateBean(context);

  String author =  (String)template.getCreatedBy();
  if (author == null || !author.equals(UserDirectoryService.getCurrentUser().getId())) {
      throw new AbortProcessingException("Attempted to delete template owned by another " + author + " " + UserDirectoryService.getCurrentUser().getId());
  }

  templateBean.setIdString(templateId);
  templateBean.setTemplateName(template.getTitle());
}
 
Example 8
/**
 * Normal listener method.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  FacesContext context = FacesContext.getCurrentInstance();

  TemplateBean templateBean = lookupTemplateBean(context);
  String templateId = cu.lookupParam("templateId");

  AssessmentService assessmentService = new AssessmentService();
  AssessmentTemplateFacade template = assessmentService.getAssessmentTemplate(templateId);
  String author = template.getCreatedBy();
  if (!(author != null && author.equals(UserDirectoryService.getCurrentUser().getId())) && !template.getTypeId().equals(TypeIfc.TEMPLATE_SYSTEM_DEFINED)) {
      log.error("User attempted to load template owned by another author " + author + " " + UserDirectoryService.getCurrentUser().getId());
      throw new AbortProcessingException("Attempted to load template owned by another author " + author + " " + UserDirectoryService.getCurrentUser().getId());
   }

  loadAssessment(templateBean, templateId);
}
 
Example 9
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("StudentScore LISTENER.");
  StudentScoresBean bean = (StudentScoresBean) ContextUtil.lookupBean("studentScores");

  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedIdd");
  
  log.debug("Calling studentScores.");
  if (!studentScores(publishedId, bean, false))
  {
    throw new RuntimeException("failed to call studentScores.");
  }

}
 
Example 10
public void processAction(ActionEvent ae) throws AbortProcessingException {

		FacesContext context = FacesContext.getCurrentInstance();
		AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");
		assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean");

		boolean isEditPendingAssessmentFlow = author.getIsEditPendingAssessmentFlow();

		if (isEditPendingAssessmentFlow) {
			assessmentService = new AssessmentService();
			itemService = new ItemService();
		} else {
			assessmentService = new PublishedAssessmentService();
			itemService = new PublishedItemService();
		}

		if(reorderItems()){
			String err = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "edit_order_warning");
			context.addMessage(null, new FacesMessage(err));
		}

		assessmentBean.setAssessment(assessmentService.getAssessment(Long.valueOf(assessmentBean.getAssessmentId())));
	}
 
Example 11
public void processDrop(ActionEvent event) {
	String sectionUuid = (String)FacesContext.getCurrentInstance().getExternalContext()
	.getRequestParameterMap().get("sectionUuid");
	CourseSection section = getSectionManager().getSection(sectionUuid);
	
	// The section might have been deleted
	if(section == null) {
		JsfUtil.addErrorMessage(JsfUtil.getLocalizedMessage("error_section_deleted"));
		return;
	}

	getSectionManager().dropSectionMembership(studentUid, sectionUuid);

	// Don't focus on this component, since it won't be there any more.  Focus on the join component
	String componentId = event.getComponent().getClientId(FacesContext.getCurrentInstance());
	elementToFocus = componentId.replaceAll(":unjoin", ":join");
}
 
Example 12
public void processAction(ActionEvent ae)
{
	log.debug("*****Log: inside EventLogPreviousPageListener =debugging ActionEvent: " + ae);

	EventLogBean eventLog = (EventLogBean) ContextUtil.lookupBean("eventLog");

	int pageNumber = eventLog.getPreviousPageNumber();
	eventLog.setPageNumber(pageNumber);
	Map pageDataMap = eventLog.getPageDataMap();
	List eventLogDataList = (List)pageDataMap.get(Integer.valueOf(pageNumber));
	eventLog.setEventLogDataList((ArrayList)eventLogDataList);
	
	if(pageNumber < 2) {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.FALSE);
	}
	else {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.TRUE);
	}
}
 
Example 13
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  AttachmentBean attachmentBean = (AttachmentBean) ContextUtil.lookupBean(
      "attachmentBean");
  AssessmentService assessmentService = new AssessmentService();

  // #1. get all the info need from bean
  String attachmentId = attachmentBean.getAttachmentId().toString();
  Long attachmentType = attachmentBean.getAttachmentType();
  if ((AttachmentIfc.ITEM_ATTACHMENT).equals(attachmentType))
    throw new UnsupportedOperationException();
  else if ((AttachmentIfc.SECTION_ATTACHMENT).equals(attachmentType))
    assessmentService.removeSectionAttachment(attachmentId);
  else if ((AttachmentIfc.ASSESSMENT_ATTACHMENT).equals(attachmentType))
    assessmentService.removeAssessmentAttachment(attachmentId);
}
 
Example 14
public void processAction(ActionEvent ae) throws AbortProcessingException
 {
AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean");

AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization");
AuthorBean authorBean = (AuthorBean) ContextUtil.lookupBean("author");

if (!authzBean.isUserAllowedToEditAssessment(assessmentBean.getAssessmentId(), assessmentBean.getAssessment().getCreatedBy(),
		!authorBean.getIsEditPendingAssessmentFlow()))
{
	FacesContext context = FacesContext.getCurrentInstance();
	String err = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "denied_edit_assessment_error");
	context.addMessage(null, new FacesMessage(err));
	return;
}

assessmentBean.setQuestionSizeAndTotalScore();
 }
 
Example 15
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  SubmissionStatusBean bean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus");
  TotalScoresBean totalScoresBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");

  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedId");

  // Reset the search field
  String defaultSearchString = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.EvaluationMessages", "search_default_student_search_string");
  bean.setSearchString(defaultSearchString);
  
  if (!submissionStatus(publishedId, bean, totalScoresBean, false))
  {
    throw new RuntimeException("failed to call submissionStatus.");
  }
}
 
Example 16
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  String mediaId = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaId");
  String mediaUrl = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaUrl");
  String mediaFilename = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("mediaFilename");
  String itemGradingId = (String) FacesContext.getCurrentInstance().
  	getExternalContext().getRequestParameterMap().get("itemGradingId");

  MediaBean mediaBean = (MediaBean) ContextUtil.lookupBean(
      "mediaBean");
  mediaBean.setMediaId(mediaId);
  mediaBean.setMediaUrl(mediaUrl);
  mediaBean.setFilename(mediaFilename);
  mediaBean.setItemGradingId(Long.valueOf(itemGradingId));

}
 
Example 17
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  SubmissionStatusBean bean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus");
  TotalScoresBean totalScoresBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");

  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedId");

  // Reset the search field
  String defaultSearchString = ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.EvaluationMessages", "search_default_student_search_string");
  bean.setSearchString(defaultSearchString);
  
  if (!submissionStatus(publishedId, bean, totalScoresBean, false))
  {
    throw new RuntimeException("failed to call submissionStatus.");
  }
}
 
Example 18
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("StudentScore LISTENER.");
  StudentScoresBean bean = (StudentScoresBean) ContextUtil.lookupBean("studentScores");

  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedIdd");
  
  log.debug("Calling studentScores.");
  if (!studentScores(publishedId, bean, false))
  {
    throw new RuntimeException("failed to call studentScores.");
  }

}
 
Example 19
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("Total Score Update LISTENER.");
  TotalScoresBean bean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
  if ("4".equals(bean.getAllSubmissions()) && ae != null && ae.getComponent() != null && "applyScoreButton".equals(ae.getComponent().getId()))
  {
      // We're looking at average scores and we're applying a score to participants with no submission
      log.debug("Calling saveTotalScoresAverage.");
      if (!saveTotalScoresAverage(bean))
      {
          throw new RuntimeException("failed to call saveTotalScoresAverage.");
      }
  }
  else
  {
      log.debug("Calling saveTotalScores.");
      if (!saveTotalScores(bean))
      {
          throw new RuntimeException("failed to call saveTotalScores.");
      }
   }
 

}
 
Example 20
public void processAction(ActionEvent ae)
{
	log.debug("*****Log: inside EventLogPreviousPageListener =debugging ActionEvent: " + ae);

	EventLogBean eventLog = (EventLogBean) ContextUtil.lookupBean("eventLog");

	int pageNumber = eventLog.getPreviousPageNumber();
	eventLog.setPageNumber(pageNumber);
	Map pageDataMap = eventLog.getPageDataMap();
	List eventLogDataList = (List)pageDataMap.get(Integer.valueOf(pageNumber));
	eventLog.setEventLogDataList((ArrayList)eventLogDataList);
	
	if(pageNumber < 2) {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.FALSE);
	}
	else {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.TRUE);
	}
}
 
Example 21
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("Student Score Update LISTENER.");
  StudentScoresBean bean = (StudentScoresBean) ContextUtil.lookupBean("studentScores");
  TotalScoresBean tbean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
  tbean.setAssessmentGradingHash(tbean.getPublishedAssessment().getPublishedAssessmentId());
  DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery");
  log.debug("Calling saveStudentScores.");
  try {
    if (!saveStudentScores(bean, tbean, delivery))
    {
      throw new RuntimeException("failed to call saveStudentScores.");
    }
  } catch (GradebookServiceException ge) {
     FacesContext context = FacesContext.getCurrentInstance();
     String err=(String)ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.AuthorMessages", "gradebook_exception_error");
     context.addMessage(null, new FacesMessage(err));

  }

}
 
Example 22
public void processAction(ActionEvent ae)
{
	log.debug("*****Log: inside EventLogNextPageListener =debugging ActionEvent: " + ae);

	EventLogBean eventLog = (EventLogBean) ContextUtil.lookupBean("eventLog");

	int pageNumber = eventLog.getNextPageNumber();
	eventLog.setPageNumber(pageNumber);
	Map pageDataMap = eventLog.getPageDataMap();
	List eventLogDataList = (List)pageDataMap.get(Integer.valueOf(pageNumber));
	eventLog.setEventLogDataList((ArrayList)eventLogDataList);
	
	if(pageNumber > (pageDataMap.size()-1)) {
		eventLog.setHasNextPage(Boolean.FALSE);
		eventLog.setHasPreviousPage(Boolean.TRUE);
	}
	else {
		eventLog.setHasNextPage(Boolean.TRUE);
		eventLog.setHasPreviousPage(Boolean.TRUE);
	}	
}
 
Example 23
public void processAction(ActionEvent ae) throws AbortProcessingException {
	RetakeAssessmentBean retakeAssessment = (RetakeAssessmentBean) ContextUtil.lookupBean("retakeAssessment");
	GradingService gradingService = new GradingService();
	StudentGradingSummaryData studentGradingSummaryData = (StudentGradingSummaryData) retakeAssessment.getStudentGradingSummaryDataMap().get(retakeAssessment.getAgentId());
	if (studentGradingSummaryData == null) {
		studentGradingSummaryData = new StudentGradingSummaryData();
		studentGradingSummaryData.setPublishedAssessmentId(retakeAssessment.getPublishedAssessmentId());
		studentGradingSummaryData.setAgentId(retakeAssessment.getAgentId());
		studentGradingSummaryData.setNumberRetake(Integer.valueOf(1));
	    studentGradingSummaryData.setCreatedBy(AgentFacade.getAgentString());
		studentGradingSummaryData.setCreatedDate(new Date());
		studentGradingSummaryData.setLastModifiedBy(AgentFacade.getAgentString());
		studentGradingSummaryData.setLastModifiedDate(new Date());
	}
	else {
		int updatedNumberRetake = studentGradingSummaryData.getNumberRetake().intValue() + 1;
		studentGradingSummaryData.setNumberRetake(Integer.valueOf(updatedNumberRetake));
		studentGradingSummaryData.setLastModifiedBy(AgentFacade.getAgentString());
		studentGradingSummaryData.setLastModifiedDate(new Date());
	}
	
	gradingService.saveStudentGradingSummaryData(studentGradingSummaryData);
}
 
Example 24
/**
 * Simply cancel and return
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws AbortProcessingException
{
    SearchQuestionBean  searchQuestionBean= (SearchQuestionBean) ContextUtil.lookupBean("searchQuestionBean");
    if (!(searchQuestionBean.isComesFromPool())) {
        ItemAuthorBean itemauthorbean = (ItemAuthorBean) ContextUtil.lookupBean("itemauthor");
        itemauthorbean.setItemTypeString("");
    }
    searchQuestionBean.setLastSearchType("");
}
 
Example 25
public void processAction(ActionEvent ae) throws
    AbortProcessingException
  {
    //Get the beans
    AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");
    AssessmentBean assessmentBean =
      (AssessmentBean) ContextUtil.lookupBean("assessmentBean");
    ItemAuthorBean itemauthorBean = (ItemAuthorBean) ContextUtil.lookupBean(
      "itemauthor");
    itemauthorBean.setTarget(ItemAuthorBean.FROM_ASSESSMENT); // save to assessment
    //XMLImportBean xmlImport = (XMLImportBean) ContextUtil.lookupBean("xmlImport");

    // Get the file name
//    String fileName = xmlImport.getUploadFileName();
    String fileName = testFileName;

    // Create an assessment based on the uploaded file
      AssessmentFacade assessment = createImportedAssessment(fileName);
    

    if (assessment!=null) {
    // import successful
    // Go to editAssessment.jsp, so prepare assessmentBean
      assessmentBean.setAssessment(assessment);
    // reset in case anything hanging around
      author.setAssessTitle("");
      author.setAssessmentDescription("");
      author.setAssessmentTypeId("");
      author.setAssessmentTemplateId(AssessmentTemplateFacade.
        DEFAULTTEMPLATE.toString());

    // update core AssessmentList: get the managed bean, author and set the list
      AssessmentService assessmentService = new AssessmentService();
      List list = assessmentService.getBasicInfoOfAllActiveAssessments(
                     AssessmentFacadeQueries.TITLE,true);
    //
      author.setAssessments(list);
    }
  }
 
Example 26
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws AbortProcessingException
// used by question pool's selectQuestionType.jsp
{
  log.debug("StartCreateItemListener actionLISTENER.");
  ItemAuthorBean itemauthorbean = (ItemAuthorBean) ContextUtil.lookupBean("itemauthor");

  if (!startCreateItem(itemauthorbean))
  {
    throw new RuntimeException("failed to startCreatItem.");
  }

}
 
Example 27
@Override
public void decode(FacesContext context) {
    Map paramMap = context.getExternalContext().getRequestParameterMap();

    UIForm parentForm = JsfRenderUtils.findForm(this);
    String parentFormClientId = parentForm.getClientId(context);
    String eventSenderHiddenFieldId = JsfRenderUtils.getEventSenderHiddenFieldId(parentFormClientId);

    String eventSenderId = (String) paramMap.get(eventSenderHiddenFieldId);

    if (eventSenderId != null && eventSenderId.equals(this.getClientId(context))) {
        this.queueEvent(new ActionEvent(this));
    }
}
 
Example 28
public void processAction(ActionEvent ae) throws AbortProcessingException {
 AssessmentService assessmentService = new AssessmentService();
 AssessmentSettingsBean assessmentSettingsBean = (AssessmentSettingsBean) ContextUtil.lookupBean("assessmentSettings");
 String assessmentId = assessmentSettingsBean.getAssessmentId().toString();

 log.debug("***assessmentId="+assessmentId);
 if (assessmentId !=null && !("").equals(assessmentId)){
  AssessmentIfc assessment = (AssessmentIfc) assessmentService.getAssessment(assessmentId);
  resetAssessmentAttachment(assessment.getAssessmentAttachmentList(), assessmentService);
 }
 else{
  resetAssessmentAttachment(new ArrayList(), assessmentService);
 }
}
 
Example 29
/**
 * Standard process action method.
 * 
 * @param event
 *            ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent event)
		throws AbortProcessingException {
	log.debug("QuestionScore LISTENER.");
	QuestionScoresBean bean = (QuestionScoresBean) ContextUtil
			.lookupBean("questionScores");

	// Reset the search field
	String defaultSearchString = ContextUtil.getLocalizedString(MSG_BUNDLE, "search_default_student_search_string");
	bean.setSearchString(defaultSearchString);

	// we probably want to change the poster to be consistent
	String publishedId = ContextUtil.lookupParam("publishedId");

	AuthorizationBean authzBean = (AuthorizationBean) ContextUtil.lookupBean("authorization");
	AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean");
	PublishedAssessmentService pubService = new PublishedAssessmentService();
	Long pubId = new Long(publishedId);
	String assessmentOwner = pubService.getPublishedAssessmentOwner(pubId);
	if (!authzBean.isUserAllowedToGradeAssessment(publishedId, assessmentOwner, true)) {
		throw new IllegalArgumentException("QuestionScoreListener unauthorized attempt to get scores for " + publishedId);
	}

	if (!questionScores(publishedId, bean, false)) {
		throw new RuntimeException("failed to call questionScores.");
	}

}
 
Example 30
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  PublishedAssessmentBeanie assessmentBean = (PublishedAssessmentBeanie) ContextUtil.lookupBean(
                                        "publishedAssessmentBean");

  // #1a - load the assessment
  String publishedAssessmentId = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("publishedAssessmentId");
  PublishedAssessmentService assessmentService = new PublishedAssessmentService();
  PublishedAssessmentFacade publishedAssessment = assessmentService.getPublishedAssessment(
      publishedAssessmentId);
  assessmentBean.setAssessment(publishedAssessment);

}