當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionMapping.findForwardConfig方法代碼示例

本文整理匯總了Java中org.apache.struts.action.ActionMapping.findForwardConfig方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionMapping.findForwardConfig方法的具體用法?Java ActionMapping.findForwardConfig怎麽用?Java ActionMapping.findForwardConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.struts.action.ActionMapping的用法示例。


在下文中一共展示了ActionMapping.findForwardConfig方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showGroupLearning

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
public ActionForward showGroupLearning(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

setupService();

String toolSessionID = WebUtil.readStrParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER);

ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(KalturaConstants.GROUP_LEARNING));
//to distinguish from opening learning page from monitor's Learners tab pass this parameter
redirect.addParameter(KalturaConstants.ATTR_IS_GROUP_MONITORING, true);
redirect.addParameter(AttributeNames.PARAM_MODE, "teacher");
redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionID);
redirect.addParameter(AttributeNames.PARAM_USER_ID, user.getUserID());
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:MonitoringAction.java

示例2: deleteImage

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Save file or url imageGallery item into database.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward deleteImage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
IImageGalleryService service = getImageGalleryService();

Long imageUid = new Long(request.getParameter(ImageGalleryConstants.PARAM_IMAGE_UID));
String sessionMapID = request.getParameter(ImageGalleryConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
Long sessionId = (Long) sessionMap.get(ImageGalleryConstants.ATTR_TOOL_SESSION_ID);

service.deleteImage(sessionId, imageUid);

// redirect
ForwardConfig redirectConfig = mapping.findForwardConfig(ImageGalleryConstants.SUCCESS);
ActionRedirect redirect = new ActionRedirect(redirectConfig);
redirect.addParameter(AttributeNames.ATTR_MODE, mode);
redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:29,代碼來源:LearningAction.java

示例3: displayAnswers

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * displayAnswers
    */
   public ActionForward displayAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException {
IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);

McContent mcContent = mcService.getMcContent(new Long(strToolContentID));
mcContent.setDisplayAnswers(new Boolean(true));
mcService.updateMc(mcContent);

// use redirect to prevent resubmition of the same request
ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("monitoringStarterRedirect"));
redirect.addParameter(McAppConstants.TOOL_CONTENT_ID, strToolContentID);
redirect.addParameter(AttributeNames.PARAM_CONTENT_FOLDER_ID, contentFolderID);
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:20,代碼來源:McMonitoringAction.java

示例4: submitAll

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Display same entire authoring page content from HttpSession variable.
    * @throws NoSuchMethodException 
    * @throws InvocationTargetException 
    * @throws IllegalAccessException 
    */
   private ActionForward submitAll(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
int pageNumber = (Integer) sessionMap.get(AssessmentConstants.ATTR_PAGE_NUMBER);

//get user answers from request and store them into sessionMap
storeUserAnswersIntoSessionMap(request, pageNumber);

boolean isTimelimitExpired = WebUtil.readBooleanParam(request, "isTimelimitExpired", false);
if (!isTimelimitExpired) {

    // check all required questions got answered
    int pageNumberWithUnasweredQuestions = validateAnswers(sessionMap);
    // if some were not then forward to nextPage()
    if (pageNumberWithUnasweredQuestions != 0) {
	return nextPage(mapping, request, true, pageNumberWithUnasweredQuestions);
    }
}

//store results from sessionMap into DB
boolean isResultsStored = storeUserAnswersIntoDatabase(sessionMap, false);
// result was not stored in case user was prohibited from submitting (or autosubmitting) answers (e.g. when
// using 2 browsers). Then show last stored results
if (!isResultsStored) {
    loadupLastAttempt(sessionMap);
}

sessionMap.put(AssessmentConstants.ATTR_SHOW_RESULTS, true);

// populate info for displaying results page
showResults(mapping, sessionMap);

//use redirect to prevent form resubmission
ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(AssessmentConstants.SHOW_RESULTS));
redirect.addParameter(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID);
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:46,代碼來源:LearningAction.java

示例5: updateImage

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Update image's title and description set by monitor
    */
   private ActionForward updateImage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
IImageGalleryService service = getImageGalleryService();
ImageGalleryItemForm imageForm = (ImageGalleryItemForm) form;

// get back sessionMAP
String sessionMapID = imageForm.getSessionMapID();
request.setAttribute(ImageGalleryConstants.ATTR_SESSION_MAP_ID, sessionMapID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(imageForm.getSessionMapID());
Long contentId = (Long) sessionMap.get(ImageGalleryConstants.ATTR_TOOL_CONTENT_ID);
ImageGallery imageGallery = service.getImageGalleryByContentId(contentId);

int imageUid = NumberUtils.stringToInt(imageForm.getImageUid(), -1);
ImageGalleryItem image = service.getImageGalleryItemByUid(new Long(imageUid));

String title = imageForm.getTitle();
if (StringUtils.isBlank(title)) {
    Long nextImageTitleNumber = imageGallery.getNextImageTitle();
    imageGallery.setNextImageTitle(nextImageTitleNumber + 1);
    service.saveOrUpdateImageGallery(imageGallery);
    
    title = getImageGalleryService().generateNextImageTitle(nextImageTitleNumber);
}
image.setTitle(title);

image.setDescription(imageForm.getDescription());
image.setHide(false);
service.saveOrUpdateImageGalleryItem(image);

ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(ImageGalleryConstants.SUCCESS));
   	redirect.addParameter(ImageGalleryConstants.ATTR_TOOL_CONTENT_ID, contentId);
   	String contentFolderID = (String) sessionMap.get(AttributeNames.PARAM_CONTENT_FOLDER_ID);
   	redirect.addParameter(AttributeNames.PARAM_CONTENT_FOLDER_ID, contentFolderID);
   	return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:39,代碼來源:MonitoringAction.java

示例6: getNextQuestion

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * moves to the next question and modifies the map ActionForward
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws IOException
    * @throws ServletException
    * @throws ToolException
    */
   public ActionForward getNextQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException, ToolException {
initializeQAService();
QaLearningForm qaLearningForm = (QaLearningForm) form;

LearningUtil.saveFormRequestData(request, qaLearningForm);

String toolSessionID = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID);
qaLearningForm.setToolSessionID(toolSessionID);
String httpSessionID = qaLearningForm.getHttpSessionID();
qaLearningForm.setHttpSessionID(httpSessionID);

QaSession qaSession = QaLearningAction.qaService.getSessionById(new Long(toolSessionID).longValue());
QaContent qaContent = qaSession.getQaContent();

QaQueUsr qaQueUsr = getCurrentUser(toolSessionID);
//prohibit users from submitting answers after response is finalized but Resubmit button is not pressed (e.g. using 2 browsers)
if (qaQueUsr.isResponseFinalized()) {
    ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("learningStarter"));
    redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionID);
    redirect.addParameter(QaAppConstants.MODE, "learner");
    return redirect;
}

GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent);

storeSequentialAnswer(qaLearningForm, request, generalLearnerFlowDTO, true);

qaLearningForm.resetAll();
return (mapping.findForward(QaAppConstants.LOAD_LEARNER));
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:44,代碼來源:QaLearningAction.java

示例7: getPreviousQuestion

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * moves to the previous question and modifies the map ActionForward
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    * @throws IOException
    * @throws ServletException
    * @throws ToolException
    */
   public ActionForward getPreviousQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException, ToolException {

initializeQAService();
QaLearningForm qaLearningForm = (QaLearningForm) form;
LearningUtil.saveFormRequestData(request, qaLearningForm);

String httpSessionID = qaLearningForm.getHttpSessionID();
qaLearningForm.setHttpSessionID(httpSessionID);
String toolSessionID = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID);
qaLearningForm.setToolSessionID(toolSessionID);
QaSession qaSession = QaLearningAction.qaService.getSessionById(new Long(toolSessionID).longValue());
QaContent qaContent = qaSession.getQaContent();

QaQueUsr qaQueUsr = getCurrentUser(toolSessionID);
//prohibit users from submitting answers after response is finalized but Resubmit button is not pressed (e.g. using 2 browsers)
if (qaQueUsr.isResponseFinalized()) {
    ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("learningStarter"));
    redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionID);
    redirect.addParameter(QaAppConstants.MODE, "learner");
    return redirect;
}

GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaService, qaContent);

storeSequentialAnswer(qaLearningForm, request, generalLearnerFlowDTO, false);

qaLearningForm.resetAll();
return (mapping.findForward(QaAppConstants.LOAD_LEARNER));
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:43,代碼來源:QaLearningAction.java

示例8: submitReflection

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Submit reflection form input database. Only leaders can submit reflections.
    */
   private ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ScratchieApplicationException {
initializeScratchieService();
ReflectionForm refForm = (ReflectionForm) form;
final Integer userId = refForm.getUserID();
final String entryText = refForm.getEntryText();

String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
final Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);

// check for existing notebook entry
final NotebookEntry entry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
	ScratchieConstants.TOOL_SIGNATURE, userId);

if (entry == null) {
    // create new entry
    service.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
	    ScratchieConstants.TOOL_SIGNATURE, userId, entryText);
} else {
    // update existing entry
    entry.setEntry(entryText);
    entry.setLastModified(new Date());
    service.updateEntry(entry);
}
sessionMap.put(ScratchieConstants.ATTR_REFLECTION_ENTRY, entryText);

ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("showResults"));
redirect.addParameter(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:36,代碼來源:LearningAction.java

示例9: complete

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Mark taskList item as complete status.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward complete(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
String mode = request.getParameter(AttributeNames.ATTR_MODE);
String sessionMapID = request.getParameter(TaskListConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);
Long sessionId = (Long) sessionMap.get(TaskListConstants.ATTR_TOOL_SESSION_ID);

doComplete(request);

ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(TaskListConstants.SUCCESS));
redirect.addParameter(AttributeNames.ATTR_MODE, mode);
redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:LearningAction.java

示例10: nextPage

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Auxiliary method to be called by nextPage(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    * HttpServletResponse response) or submitAll. 
    * 
    * @param mapping
    * @param request
    * @param isAnswersValidationFailed submitAll() method may set it as true in case some of the pages miss required answers
    * @param pageNumberWithUnasweredQuestions page number with questions required to be answered
    * @return
    */
   private ActionForward nextPage(ActionMapping mapping, HttpServletRequest request, boolean isAnswersValidationFailed,
    int pageNumberWithUnasweredQuestions)
    throws ServletException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
IAssessmentService service = getAssessmentService();
String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
Assessment assessment = (Assessment) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT);
AssessmentUser user = (AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER);
int oldPageNumber = (Integer) sessionMap.get(AssessmentConstants.ATTR_PAGE_NUMBER);

//if AnswersValidationFailed - get pageNumber as request parameter and as method parameter otherwise
int pageNumberToOpen;
if (isAnswersValidationFailed) {
    pageNumberToOpen = pageNumberWithUnasweredQuestions;
} else {
    pageNumberToOpen = WebUtil.readIntParam(request, AssessmentConstants.ATTR_PAGE_NUMBER);
}

int questionNumberingOffset = 0;
List<Set<QuestionDTO>> pagedQuestionDtos = (List<Set<QuestionDTO>>) sessionMap
	.get(AssessmentConstants.ATTR_PAGED_QUESTION_DTOS);
for (int i = 0; i < pageNumberToOpen - 1; i++) {
    Set<QuestionDTO> questionsForOnePage = pagedQuestionDtos.get(i);
    questionNumberingOffset += questionsForOnePage.size();
}
sessionMap.put(AssessmentConstants.ATTR_QUESTION_NUMBERING_OFFSET, ++questionNumberingOffset);
sessionMap.put(AssessmentConstants.ATTR_PAGE_NUMBER, pageNumberToOpen);

boolean showResults = (Boolean) sessionMap.get(AssessmentConstants.ATTR_SHOW_RESULTS);
if (showResults) {
    request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID);
    return mapping.findForward(AssessmentConstants.SHOW_RESULTS);
    
} else {
    //get user answers from request and store them into sessionMap
    storeUserAnswersIntoSessionMap(request, oldPageNumber);
    // store results from sessionMap into DB
    storeUserAnswersIntoDatabase(sessionMap, true);

    long secondsLeft = service.getSecondsLeft(assessment, user);
    sessionMap.put(AssessmentConstants.ATTR_SECONDS_LEFT, secondsLeft);
    
    // use redirect to prevent form resubmission
    ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(AssessmentConstants.LEARNING));
    redirect.addParameter(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID);
    redirect.addParameter(AssessmentConstants.ATTR_IS_ANSWERS_VALIDATION_FAILED, isAnswersValidationFailed);
    return redirect;
}
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:61,代碼來源:LearningAction.java

示例11: resubmit

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * User pressed Resubmit button.
    */
   private ActionForward resubmit(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
IAssessmentService service = getAssessmentService();

String sessionMapID = WebUtil.readStrParam(request, AssessmentConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
Long toolSessionId = (Long) sessionMap.get(AssessmentConstants.ATTR_TOOL_SESSION_ID);
ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
Assessment assessment = service.getAssessmentBySessionId(toolSessionId);
AssessmentUser assessmentUser = (AssessmentUser) sessionMap.get(AssessmentConstants.ATTR_USER);
Long userId = assessmentUser.getUserId();
service.unsetSessionFinished(toolSessionId, userId);

Date lastAttemptStartingDate = service.getLastAssessmentResult(assessment.getUid(), userId).getStartDate();

// set attempt started: create a new one + mark previous as not being the latest any longer
service.setAttemptStarted(assessment, assessmentUser, toolSessionId);

// in case of content was modified in monitor - redirect to start.do in order to refresh info from the DB
if (assessment.isContentModifiedInMonitor(lastAttemptStartingDate)) {
    ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("learningStartMethod"));
    redirect.addParameter(AttributeNames.PARAM_MODE, mode.toString());
    redirect.addParameter(AssessmentConstants.PARAM_TOOL_SESSION_ID, toolSessionId);
    return redirect;

//otherwise use data from SessionMap
} else {

    sessionMap.put(AssessmentConstants.ATTR_SHOW_RESULTS, false);
    sessionMap.put(AssessmentConstants.ATTR_PAGE_NUMBER, 1);
    sessionMap.put(AssessmentConstants.ATTR_QUESTION_NUMBERING_OFFSET, 1);
    request.setAttribute(AssessmentConstants.ATTR_SESSION_MAP_ID, sessionMapID);
    // clear isUserFailed indicator
    sessionMap.put(AssessmentConstants.ATTR_IS_USER_FAILED, false);

    // time limit feature
    sessionMap.put(AssessmentConstants.ATTR_IS_TIME_LIMIT_NOT_LAUNCHED, true);
    sessionMap.put(AssessmentConstants.ATTR_SECONDS_LEFT, assessment.getTimeLimit() * 60);

    return mapping.findForward(AssessmentConstants.LEARNING);
}

   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:48,代碼來源:LearningAction.java

示例12: saveUserSpreadsheet

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Finish learning session.
    * 
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward saveUserSpreadsheet(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

//get back SessionMap
String sessionMapID = request.getParameter(SpreadsheetConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);

//get mode and ToolSessionID from sessionMAP
ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
boolean userFinished = (Boolean) sessionMap.get(SpreadsheetConstants.ATTR_USER_FINISHED);

//save learner changes in spreadsheet if such option is activated in spreadsheet
ISpreadsheetService service = getSpreadsheetService();
Spreadsheet spreadsheet = (Spreadsheet) sessionMap.get(SpreadsheetConstants.ATTR_RESOURCE);
Spreadsheet spreadsheetPO = service.getSpreadsheetByContentId(spreadsheet.getContentId());
if (spreadsheetPO.isLearnerAllowedToSave() && !mode.isTeacher()
	&& !(spreadsheet.getLockWhenFinished() && userFinished)) {

    SpreadsheetUser spreadsheetUser = getCurrentUser(service, sessionId);
    UserModifiedSpreadsheet userModifiedSpreadsheet = spreadsheetUser.getUserModifiedSpreadsheet();

    if ( spreadsheetUser.getUserModifiedSpreadsheet() == null || spreadsheetUser.getUserModifiedSpreadsheet().getMark() == null ) {
	if ( userModifiedSpreadsheet == null ) {
	    userModifiedSpreadsheet = new UserModifiedSpreadsheet();
	}
	String code = WebUtil.readStrParam(request, SpreadsheetConstants.ATTR_CODE);
	userModifiedSpreadsheet.setUserModifiedSpreadsheet(code);
	spreadsheetUser.setUserModifiedSpreadsheet(userModifiedSpreadsheet);
	service.saveOrUpdateUser(spreadsheetUser);
    } 
}

String typeOfAction = WebUtil.readStrParam(request, "typeOfAction");
ForwardConfig conf;
if ("finishSession".equals(typeOfAction)) {
    conf = mapping.findForwardConfig("finishSession");
} else if ("continueReflect".equals(typeOfAction)) {
    conf = mapping.findForwardConfig("continueReflect");
} else {
    conf = mapping.findForwardConfig("start");
}
ActionRedirect redirect = new ActionRedirect(conf);
redirect.addParameter(SpreadsheetConstants.ATTR_SESSION_MAP_ID, sessionMapID);
redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
redirect.addParameter(AttributeNames.ATTR_MODE, mode);
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:58,代碼來源:LearningAction.java

示例13: addNewComment

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Adds new user commment.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward addNewComment(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
TaskListItemForm taskListItemForm = (TaskListItemForm) form;
String mode = request.getParameter(AttributeNames.ATTR_MODE);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(taskListItemForm.getSessionMapID());
request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
Long sessionId = (Long) sessionMap.get(TaskListConstants.ATTR_TOOL_SESSION_ID);

boolean isTestHarness = Boolean.valueOf(request.getParameter("testHarness"));
String commentMessage = isTestHarness ? request.getParameter("comment__textarea")
	: taskListItemForm.getComment();
if (commentMessage == null || StringUtils.isBlank(commentMessage)) {
    return mapping.findForward("refresh");
}

TaskListItemComment comment = new TaskListItemComment();
comment.setComment(commentMessage);
UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER);
ITaskListService service = getTaskListService();
TaskListUser taskListUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()), sessionId);
comment.setCreateBy(taskListUser);
comment.setCreateDate(new Timestamp(new Date().getTime()));

// persist TaskListItem changes in DB
Long itemUid = new Long(request.getParameter(TaskListConstants.PARAM_ITEM_UID));
TaskListItem dbItem = service.getTaskListItemByUid(itemUid);
Set<TaskListItemComment> dbComments = dbItem.getComments();
dbComments.add(comment);
service.saveOrUpdateTaskListItem(dbItem);

// to make available new changes be visible in jsp page
sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM, dbItem);

// form.reset(mapping, request);

ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(TaskListConstants.SUCCESS));
redirect.addParameter(AttributeNames.ATTR_MODE, mode);
redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:50,代碼來源:LearningAction.java

示例14: uploadFile

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Uploads specified file to repository and associates it with current TaskListItem.
    *
    * @param mapping
    * @param form
    * @param type
    * @param request
    * @return
    * @throws UploadTaskListFileException
    */
   private ActionForward uploadFile(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws UploadTaskListFileException {

TaskListItemForm taskListItemForm = (TaskListItemForm) form;
String mode = request.getParameter(AttributeNames.ATTR_MODE);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(taskListItemForm.getSessionMapID());
request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
Long sessionId = (Long) sessionMap.get(TaskListConstants.ATTR_TOOL_SESSION_ID);

FormFile file = taskListItemForm.getUploadedFile();

if (file == null || StringUtils.isBlank(file.getFileName())) {
    return mapping.findForward("refresh");
}

// validate file size
ActionMessages errors = new ActionMessages();
FileValidatorUtil.validateFileSize(file, false, errors);
if (!errors.isEmpty()) {
    this.addErrors(request, errors);
    this.saveErrors(request, errors);
    return mapping.findForward("refresh");
}

// upload to repository
ITaskListService service = getTaskListService();
UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER);
TaskListUser taskListUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()), sessionId);
TaskListItemAttachment att = service.uploadTaskListItemFile(file, taskListUser);

// persist TaskListItem changes in DB
Long itemUid = new Long(request.getParameter(TaskListConstants.PARAM_ITEM_UID));
TaskListItem dbItem = service.getTaskListItemByUid(itemUid);
Set<TaskListItemAttachment> dbAttachments = dbItem.getAttachments();
dbAttachments.add(att);
service.saveOrUpdateTaskListItem(dbItem);

// to make available new changes be visible in jsp page
sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM, dbItem);

// form.reset(mapping, request);

ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(TaskListConstants.SUCCESS));
redirect.addParameter(AttributeNames.ATTR_MODE, mode);
redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:58,代碼來源:LearningAction.java

示例15: startLesson

import org.apache.struts.action.ActionMapping; //導入方法依賴的package包/類
/**
    * Starts a lesson. Then prompts to learnerMonitor page.
    */
   public ActionForward startLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, UserAccessDeniedException, JSONException,
    RepositoryCheckedException, UserInfoValidationException, UserInfoFetchException {
initServices();
Integer userId = getUser().getUserID();
User user = getRealUser(getUser());

String consumerKey = request.getParameter(LtiUtils.OAUTH_CONSUMER_KEY);
String resourceLinkId = request.getParameter(BasicLTIConstants.RESOURCE_LINK_ID);
String title = request.getParameter(CentralConstants.PARAM_TITLE);
String desc = request.getParameter(CentralConstants.PARAM_DESC);
String ldIdStr = request.getParameter(CentralConstants.PARAM_LEARNING_DESIGN_ID);
String contextId = request.getParameter(BasicLTIConstants.CONTEXT_ID);
Integer organisationId = new Integer(WebUtil.readIntParam(request, CentralConstants.ATTR_COURSE_ID));
boolean enableLessonIntro = WebUtil.readBooleanParam(request, "enableLessonIntro", false);

//only monitors are allowed to create lesson
if (!securityService.isGroupMonitor(organisationId, userId, "add lesson", false)) {
    response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the organisation");
    return null;
}

ExtServer extServer = integrationService.getExtServer(consumerKey);
Organisation organisation = monitoringService.getOrganisation(organisationId);

// 1. init lesson
Lesson lesson = monitoringService.initializeLesson(title, desc, new Long(ldIdStr),
	organisation.getOrganisationId(), user.getUserId(), null, false, enableLessonIntro, false, false,
	true, true, false, false, true, null, null);
// 2. create lessonClass for lesson
List<User> staffList = new LinkedList<User>();
staffList.add(user);
List<User> learnerList = new LinkedList<User>();
Vector<User> learnerVector = userManagementService
	.getUsersFromOrganisationByRole(organisation.getOrganisationId(), Role.LEARNER, true);
learnerList.addAll(learnerVector);
monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation,
	organisation.getName() + "Learners", learnerList, organisation.getName() + "Staff", staffList,
	user.getUserId());
// 3. start lesson
monitoringService.startLesson(lesson.getLessonId(), user.getUserId());
// store information which extServer has started the lesson
integrationService.createExtServerLessonMap(lesson.getLessonId(), resourceLinkId, extServer);

//set roles to contain monitor so that the user can see monitor link
ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("learnerMonitorRedirect"));
redirect.addParameter(LtiUtils.OAUTH_CONSUMER_KEY, consumerKey);
redirect.addParameter(BasicLTIConstants.RESOURCE_LINK_ID, resourceLinkId);
redirect.addParameter(BasicLTIConstants.CONTEXT_ID, contextId);
return redirect;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:55,代碼來源:LtiAction.java


注:本文中的org.apache.struts.action.ActionMapping.findForwardConfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。