javax.faces.event.AbortProcessingException Java Examples

The following examples show how to use javax.faces.event.AbortProcessingException. 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 File: ResetDeliveryListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * ACTION.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  DeliveryBean bean = (DeliveryBean) cu.lookupBean("delivery");
  if (!("takeAssessmentViaUrl").equals(bean.getActionString()))
    bean.setPublishedAssessment(null);
  bean.setPublishedItemHash(new HashMap());
  bean.setPublishedItemTextHash(new HashMap());
  bean.setPublishedAnswerHash(new HashMap());
  // reset timer before begin
  bean.setTimeElapse("0");
  bean.setTimeElapseAfterFileUpload(null);
  bean.setLastTimer(0);
  bean.setTimeLimit("0");
  bean.setNumberRetake(-1);
  bean.setActualNumberRetake(-1);
  bean.setHasShowTimeWarning(false);
  bean.setShowTimeWarning(false);
  bean.setTurnIntoTimedAssessment(false);
  bean.setSkipFlag(false);
  bean.setSubmitFromTimeoutPopup(false);
}
 
Example #2
Source File: StudentScoreUpdateListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * 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 #3
Source File: RemoveAttachmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
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 #4
Source File: TemplateLoadListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * 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 #5
Source File: TotalScoreUpdateListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * 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 #6
Source File: SortPublishedAssessmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  // get service and managed bean
  PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService();
  AuthorBean author = (AuthorBean) ContextUtil.lookupBean(
                     "author");
  AuthorizationBean authorization = (AuthorizationBean) ContextUtil.lookupBean("authorization");

  processSortInfo(author);
  
  // Refresh the inactive published assessment list.
  AuthorActionListener authorActionListener = new AuthorActionListener();
  GradingService gradingService = new GradingService();

  List publishedAssessmentList = publishedAssessmentService.getBasicInfoOfAllPublishedAssessments2(
	   this.getPublishedOrderBy(author), author.isPublishedAscending(), AgentFacade.getCurrentSiteId());
  authorActionListener.prepareAllPublishedAssessmentsList(author, authorization, gradingService, publishedAssessmentList);
  author.setJustPublishedAnAssessment(true);
}
 
Example #7
Source File: StudentScoreListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * 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 #8
Source File: RetakeAssessmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
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 #9
Source File: ConfirmRemoveMediaListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
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 #10
Source File: SavePartAttachmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException {
   SectionBean sectionBean = (SectionBean) ContextUtil.lookupBean("sectionBean");
   AssessmentService assessmentService = null;
AssessmentIfc assessment = null;
if (isForAuthorSettings) {
	assessmentService = new AssessmentService();
}
else {
	assessmentService = new PublishedAssessmentService();
}  
List attachmentList = prepareSectionAttachment(sectionBean, assessmentService);
   sectionBean.setAttachmentList(attachmentList);
   if (attachmentList != null && attachmentList.size() >0){
     sectionBean.setHasAttachment(true);
   }
   else{
     sectionBean.setHasAttachment(false);
   }
 }
 
Example #11
Source File: ConfirmCopyAssessmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
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 #12
Source File: FakeBeginDeliveryActionListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * 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 #13
Source File: UpdateAssessmentQuestionsOrder.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
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 #14
Source File: UpdateAssessmentTotalPointsListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
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
Source File: ConfirmRemoveAttachmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  String attachmentId = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("attachmentId");
  String attachmentLocation = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("attachmentLocation");
  String attachmentFilename = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("attachmentFilename");
  String attachmentType = (String) FacesContext.getCurrentInstance().
      getExternalContext().getRequestParameterMap().get("attachmentType");

  AttachmentBean attachmentBean = (AttachmentBean) ContextUtil.lookupBean(
      "attachmentBean");
  attachmentBean.setAttachmentId(new Long(attachmentId));
  attachmentBean.setLocation(attachmentLocation);
  attachmentBean.setFilename(attachmentFilename);
  attachmentBean.setAttachmentType(new Long(attachmentType));
}
 
Example #16
Source File: ConfirmDeleteTemplateListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
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 #17
Source File: ResetPartAttachmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException {
  SectionBean sectionBean = (SectionBean) ContextUtil.lookupBean("sectionBean");
  AssessmentService assessmentService = null;
  AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");
  boolean isEditPendingAssessmentFlow = author.getIsEditPendingAssessmentFlow();
  if (isEditPendingAssessmentFlow) {
  	assessmentService = new AssessmentService();
  }
  else {
  	assessmentService = new PublishedAssessmentService();
  }
  String sectionId = sectionBean.getSectionId();
  if (sectionId !=null && !("").equals(sectionId)){
  	SectionDataIfc section = assessmentService.getSection(sectionId);
  	resetSectionAttachment(assessmentService, sectionBean.getResourceHash(), section.getSectionAttachmentList());
  }
  else{
  	resetSectionAttachment(assessmentService, sectionBean.getResourceHash(), new ArrayList());
  }
}
 
Example #18
Source File: FavoriteColChoiceListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processValueChange(ValueChangeEvent ae) throws AbortProcessingException
{
  log.debug("FavoriteColChoiceListener: valueChangeLISTENER.");
  ItemAuthorBean itemauthorbean = (ItemAuthorBean) ContextUtil.lookupBean("itemauthor");


  String selectedvalue= (String) ae.getNewValue();
  
  if ((selectedvalue!=null) && (!selectedvalue.equals("")) ){
  	ItemBean curritem = itemauthorbean.getCurrentItem();
  	if(curritem != null){
  		curritem.setCurrentFavorite(selectedvalue);
  		curritem.setColumnChoicesFromFavorite(selectedvalue);
  		curritem.setFavoriteName(selectedvalue);
  	}

  }
}
 
Example #19
Source File: AudioUploadActionListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * ACTION. add audio recording to item grading
 * @param ae the action event triggering the processAction method
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.info("AudioUploadActionListener.processAction() ");

  try {
    // get managed bean
    DeliveryBean delivery = (DeliveryBean) cu.lookupBean("delivery");

    // look for the correct file upload path information
    String audioMediaUploadPath = getAudioMediaUploadPath(ae);
    log.info("audioMediaUploadPath: " + audioMediaUploadPath);

    // now use utility method to fetch the file
    delivery.addMediaToItemGrading(audioMediaUploadPath);
    log.info("delivery.addMediaToItemGrading(audioMediaUploadPath)");


  } catch (Exception e) {
      log.error(e.getMessage(), e);
  }
}
 
Example #20
Source File: SortInactivePublishedAssessmentListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  // get service and managed bean
  PublishedAssessmentService publishedAssessmentService = new PublishedAssessmentService();
  AuthorBean author = (AuthorBean) ContextUtil.lookupBean(
                     "author");
  AuthorizationBean authorization = (AuthorizationBean) ContextUtil.lookupBean("authorization");

 processSortInfo(author);
 
 // Refresh the inactive published assessment list.
 AuthorActionListener authorActionListener = new AuthorActionListener();
 GradingService gradingService = new GradingService();
 List publishedAssessmentList = publishedAssessmentService.getBasicInfoOfAllPublishedAssessments2(
   this.getInactivePublishedOrderBy(author),author.isInactivePublishedAscending(), AgentFacade.getCurrentSiteId());
 authorActionListener.prepareAllPublishedAssessmentsList(author, authorization, gradingService, publishedAssessmentList);
 author.setJustPublishedAnAssessment(true);
}
 
Example #21
Source File: TranslationBean.java    From development with Apache License 2.0 6 votes vote down vote up
/**
 * This methods is used as a callback for value-changed-event of the select
 * marketplace facelet.
 */
public void processValueChange(ValueChangeEvent event)
        throws AbortProcessingException {
	
	String selectedMarketplaceId = (String) event.getNewValue();
	
	if (selectedMarketplaceId.equals("0")) {
		marketplaceBean.setMarketplaceId(null);
	} else{
		marketplaceBean.setMarketplaceId(selectedMarketplaceId);
	}
	
    resetMembers();
    resetStage();
    this.marketplaceBean.processValueChange(event);
}
 
Example #22
Source File: CalculatedQuestionExtractListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * This listener will read in the instructions, parse any variables and 
 * formula names it finds, and then check to see if there are any errors 
 * in the configuration for the question.  
 * 
 * <p>Errors include <ul><li>no variables or formulas named in the instructions</li>
 * <li>variables and formulas sharing a name</li>
 * <li>variables with invalid ranges of values</li>
 * <li>formulas that are syntactically wrong</li></ul>
 * Any errors are written to the context messager
 * <p>The validate formula is also called directly from the ItemAddListner, before
 * saving a calculated question, to ensure any last minute changes are caught.
 */
public void processAction(ActionEvent arg0) throws AbortProcessingException {
    ItemAuthorBean itemauthorbean = (ItemAuthorBean) ContextUtil.lookupBean("itemauthor");
    ItemBean item = itemauthorbean.getCurrentItem();
            
    List<String> errors = this.validate(item,true);        
    
    if (errors.size() > 0) {
        item.setOutcome("calculatedQuestion");
        item.setPoolOutcome("calculatedQuestion");
        FacesContext context=FacesContext.getCurrentInstance();
        for (String error : errors) {
            context.addMessage(null, new FacesMessage(error));
        }
        context.renderResponse();                         
    }
}
 
Example #23
Source File: RestoreAssessmentsListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processAction(ActionEvent event) throws AbortProcessingException {
    try {
        log.debug("RestoreAssessmentsListener: processAction()");
        RestoreAssessmentsBean bean = (RestoreAssessmentsBean) ContextUtil.lookupBean("restoreAssessmentsBean");
        bean.init();
    }catch(Exception e){
        log.error("Failed to get archived published assessments.", e);
        throw new RuntimeException("failed to get archived published assessments");
    }
}
 
Example #24
Source File: AuthorPartListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  // #1a. prepare sectionBean
  AssessmentBean assessmentBean = (AssessmentBean) ContextUtil.lookupBean(
                       "assessmentBean");
  SectionBean sectionBean = (SectionBean) ContextUtil.lookupBean(
                                        "sectionBean");
  // clean it
  sectionBean.setSectionTitle("");
  sectionBean.setAssessmentTitle(assessmentBean.getTitle());
  sectionBean.setSectionDescription("");
  sectionBean.setSectionId("");
  sectionBean.setSection(null);

  // #1b. goto editPart.jsp
  //sectionBean.setPoolsAvailable(itemauthorbean.getPoolSelectList());
  sectionBean.setHideRandom(false);
  sectionBean.setNumberSelected("");
  sectionBean.setRandomizationType(SectionDataIfc.PER_SUBMISSION);
  sectionBean.setSelectedPool("");
  
  sectionBean.setPointValueHasOverrided(false);
  sectionBean.setRandomPartScore(null);
  sectionBean.setDiscountValueHasOverrided(false);
  sectionBean.setRandomPartDiscount(null);
  // new part has no attachment, VERY IMPORTANT to clean up any leftover
  // before modifying a new part
  sectionBean.setResourceHash(null);
  sectionBean.setAttachmentList(null);
  sectionBean.setHasAttachment(false);
  sectionBean.setKeyword(null);
  sectionBean.setObjective(null);
  sectionBean.setRubric(null);
  // set default
  sectionBean.setType(SectionDataIfc.QUESTIONS_AUTHORED_ONE_BY_ONE.toString());
  sectionBean.setQuestionOrdering(SectionDataIfc.AS_LISTED_ON_ASSESSMENT_PAGE.toString());
  log.debug("**** sectionBean.getTitle="+sectionBean.getSectionTitle());
}
 
Example #25
Source File: ImportAssessmentListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
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
Source File: DeleteTemplateListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException
{
  FacesContext context = FacesContext.getCurrentInstance();

  String deleteId = this.lookupTemplateBean(context).getIdString();
  if(!deleteTemplate(deleteId))
  {
    // todo: define package specific RuntimeException
    throw new RuntimeException("Cannot delete template.");
  }
  // reset template list
  TemplateListener lis = new TemplateListener();
  lis.processAction(null); 
}
 
Example #27
Source File: SaveAssessmentAttachmentListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processAction(ActionEvent ae) throws AbortProcessingException {
 AssessmentService assessmentService = null;
 AssessmentIfc assessment = null;
 List attachmentList = new ArrayList();
 if (isForAuthorSettings) {
  assessmentService = new AssessmentService();
  AssessmentSettingsBean assessmentSettingsBean = (AssessmentSettingsBean) ContextUtil.lookupBean("assessmentSettings");
  if (assessmentSettingsBean.getAssessment() != null){
	  assessment = assessmentSettingsBean.getAssessment();
	  // attach item attachemnt to assessmentBean
	  attachmentList = prepareAssessmentAttachment(assessment, assessmentService);
	  
  }
  assessmentSettingsBean.setAttachmentList(attachmentList);
 }
 else {
  assessmentService = new PublishedAssessmentService();
  PublishedAssessmentSettingsBean publishedAssessmentSettingsBean = (PublishedAssessmentSettingsBean) ContextUtil.lookupBean(
  "publishedSettings");
  if (publishedAssessmentSettingsBean.getAssessment() != null){
	  assessment = publishedAssessmentSettingsBean.getAssessment();
      // attach item attachemnt to assessmentBean
	  attachmentList = prepareAssessmentAttachment(assessment, assessmentService);
  }
  publishedAssessmentSettingsBean.setAttachmentList(attachmentList);
 }  
}
 
Example #28
Source File: UpdateTimerFromTOCListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * ACTION.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  DeliveryBean delivery = (DeliveryBean) ContextUtil.lookupBean("delivery");
  delivery.syncTimeElapsedWithServer();
}
 
Example #29
Source File: TableOfContentsActionListener.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * ACTION.
 * @param ae
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("TableOfContentsActionListener.processAction() ");

  // get managed bean and set its action accordingly
  DeliveryBean delivery = (DeliveryBean) cu.lookupBean("delivery");
  String nextAction = delivery.checkBeforeProceed();
  if (!("safeToProceed").equals(nextAction)) {
    delivery.setOutcome(nextAction);
  }
  else{
    UpdateTimerListener u = new UpdateTimerListener();
    u.processAction(ae);
    
    SubmitToGradingActionListener s = new SubmitToGradingActionListener();
    try {
  s.processAction(ae);
 }
 catch (FinFormatException e) {
  log.debug(e.getMessage());
  delivery.setOutcome("takeAssessment");
  return;
 }
 catch (SaLengthException sae) {
  log.debug(sae.getMessage());
  delivery.setOutcome("takeAssessment");
  return;
 }
 
    DeliveryActionListener d = new DeliveryActionListener();
    delivery.setSkipFlag(true);
    d.processAction(ae);
    delivery.setOutcome("tableOfContents");
  }
}
 
Example #30
Source File: CancelSearchQuestion.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * 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("");
}