Java 类javax.portlet.ActionResponse 实例源码

项目:liferaylms-portlet    文件:ModuleTitleConfigurationAction.java   
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
        ActionResponse arg2) throws Exception {
    if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD))) 
        return;

    PortletPreferences prefs;
    String portletResource = ParamUtil.getString(actionRequest, "portletResource"); 
    if (Validator.isNotNull(portletResource)){
        prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
    } else {
        prefs = actionRequest.getPreferences();
    }
    prefs.setValue("numerateModules", actionRequest.getParameter("numerateModules"));

    prefs.store();
    SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure");

}
项目:ch-inofix-timetracker    文件:TimetrackerConfigurationAction.java   
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {

    String columns = ParamUtil.getString(actionRequest, "columns");
    String[] exportFileNames = actionRequest.getParameterValues("exportFileName"); 
    String[] exportNames = actionRequest.getParameterValues("exportName"); 
    String[] exportScripts = actionRequest.getParameterValues("exportScript");      

    setPreference(actionRequest, "columns", columns.split(","));
    setPreference(actionRequest, "exportFileName", exportFileNames);
    setPreference(actionRequest, "exportName", exportNames);
    setPreference(actionRequest, "exportScript", exportScripts);

    super.processAction(portletConfig, actionRequest, actionResponse);
}
项目:ch-inofix-timetracker    文件:ExportTaskRecordsMVCActionCommand.java   
@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    _log.info("doProcessAction()");

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    _log.info("cmd = " + cmd);

    if (cmd.equals(Constants.DELETE)) {
        deleteBackgroundTasks(actionRequest, actionResponse);
    } else if (cmd.equals(Constants.EXPORT)) {
        exportTaskRecords(actionRequest, actionResponse);
    }

    String redirect = ParamUtil.getString(actionRequest, "redirect");

    if (Validator.isNotNull(redirect)) {
        sendRedirect(actionRequest, actionResponse, redirect);
    }
}
项目:flashlight-search    文件:FlashlightSearchPortlet.java   
/**
 * Saves the global aspect of the configuration
 *
 * @param request  The request
 * @param response The response
 * @throws IOException      If something goes wrong
 * @throws PortletException If something goes wrong
 */
@ProcessAction(name = ACTION_NAME_SAVE_GLOBAL)
public void actionSaveGlobal(ActionRequest request, ActionResponse response) throws IOException, PortletException {
    String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);
    String adtUuid = ParamUtil.get(request, FORM_FIELD_ADT_UUID, StringPool.BLANK);
    boolean doSearchOnStartup = ParamUtil.getBoolean(request, FORM_FIELD_DO_SEARCH_ON_STARTUP, false);

    if (!PATTERN_UUID.matcher(adtUuid).matches()) {
        adtUuid = StringPool.BLANK;
    }

    String doSearchOnStartupKeywords = ParamUtil.getString(request, FORM_FIELD_DO_SEARCH_ON_STARTUP_KEYWORDS, FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS);
    this.searchService.saveGlobalSettings(adtUuid, doSearchOnStartup, doSearchOnStartupKeywords, request.getPreferences());

    SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);
    if (!redirectUrl.isEmpty()) {
        response.sendRedirect(redirectUrl);
    }
}
项目:flashlight-search    文件:FlashlightSearchPortlet.java   
/**
 * This action saves the Liferay facet configuration for a given tab
 *
 * @param request The request
 * @param response The response
 * @throws PortletException If something goes wrong
 * @throws IOException If something goes wrong
 */
@ProcessAction(name = ACTION_NAME_SAVE_FACET_CONFIG)
public void actionSaveFacetConfig(ActionRequest request, ActionResponse response) throws PortletException, IOException {
    String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK);
    String facetClassName = ParamUtil.get(request, FORM_FIELD_FACET_CLASS_NAME, StringPool.BLANK);
    String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);
    PortletPreferences preferences = request.getPreferences();
    FlashlightSearchConfiguration configuration = this.searchService.readConfiguration(preferences);
    SearchFacet targetFacet = this.getSearchFacetFromRequest(tabId, facetClassName, configuration);

    if(targetFacet != null) {
        JSONObject facetConfiguration = targetFacet.getJSONData(request);
        targetFacet.getFacetConfiguration().setDataJSONObject(facetConfiguration);
        this.searchService.saveSearchFacetConfig(configuration.getTabs().get(tabId), targetFacet, preferences);
        SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);
        response.sendRedirect(redirectUrl);
    }
}
项目:flashlight-search    文件:FlashlightSearchPortlet.java   
/**
 * Deletes a tab from the configuration
 *
 * @param request  The request
 * @param response The response
 * @throws PortletException If something goes wrong
 * @throws IOException      If something goes wrong
 */
@ProcessAction(name = ACTION_NAME_DELETE_TAB)
public void actionDeleteTab(ActionRequest request, ActionResponse response) throws PortletException, IOException {
    String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK);
    String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);

    if (tabId != null && PATTERN_UUID.matcher(tabId).matches()) {
        PortletPreferences preferences = request.getPreferences();
        Map<String, FlashlightSearchConfigurationTab> tabs = this.searchService.readConfiguration(preferences).getTabs();
        if (tabs.containsKey(tabId)) {
            this.searchService.deleteConfigurationTab(tabId, preferences);
        }
    }

    SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);

    if (!redirectUrl.isEmpty()) {
        response.sendRedirect(redirectUrl);
    }
}
项目:ch-inofix-contact-manager    文件:ExportContactsMVCActionCommand.java   
@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    if (cmd.equals(Constants.DELETE)) {
        deleteBackgroundTasks(actionRequest, actionResponse);
    } else if (cmd.equals(Constants.EXPORT)) {
        exportContacts(actionRequest, actionResponse);
    }

    String redirect = ParamUtil.getString(actionRequest, "redirect");

    if (Validator.isNotNull(redirect)) {
        sendRedirect(actionRequest, actionResponse, redirect);
    }
}
项目:liferay-dummy-factory    文件:OrganizationMVCActionCommand.java   
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {

    try {
        DummyGenerator<OrgContext> dummyGenerator = _orgDummyFactory.create(request);
        dummyGenerator.create(request);

    } catch (Exception e) {
        hideDefaultSuccessMessage(request);
        _log.error(e, e);
    }

    response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
    SessionMessages.add(request, "success");

}
项目:liferay-dummy-factory    文件:MBMVCActionCommand.java   
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) throws Exception {

    try {
        response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);

        DummyGenerator<MBContext> dummyGenerator = _MBDummyFactory.create(request);
        dummyGenerator.create(request);

        SessionMessages.add(request, "success");

    } catch (Exception e) {
        hideDefaultSuccessMessage(request);
        SessionErrors.add(request,Exception.class);
        _log.error(e, e);
    }

}
项目:liferay-dummy-factory    文件:CategoryMVCActionCommand.java   
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {

    try {
        DummyGenerator<CategoryContext> dummyGenerator = _categoryDummyFactory.create(request);
        dummyGenerator.create(request);

    } catch (Exception e) {
        hideDefaultSuccessMessage(request);
        _log.error(e, e);
        return;
    }

    response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
    SessionMessages.add(request, "success");

}
项目:liferay-dummy-factory    文件:DocumentMVCActionCommand.java   
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {

    try {
        DummyGenerator<DLContext> dummyGenerator = _dlDummyFactory.create(request);
        dummyGenerator.create(request);

    } catch (Exception e) {
        hideDefaultSuccessMessage(request);
        _log.error(e, e);
    }

    response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
    SessionMessages.add(request, "success");

}
项目:liferay-dummy-factory    文件:DummyFactoryConfigurationAction.java   
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {

    String linkList = ParamUtil.getString(actionRequest, DummyFactoryConfiguration.CONF_LINKLIST);
    String urlList = ParamUtil.getString(actionRequest, DummyFactoryConfiguration.CONF_URLLIST);

    if (_log.isDebugEnabled()) {
        _log.debug("Link List :" + linkList);
        _log.debug("URL List  :" + urlList);
    }

    List<String> errors = Lists.newArrayList();
    if (validate(linkList, errors)) {
        setPreference(actionRequest, DummyFactoryConfiguration.CONF_LINKLIST, linkList);
        setPreference(actionRequest, DummyFactoryConfiguration.CONF_URLLIST, urlList);

        SessionMessages.add(actionRequest, "prefs-success");
    }

    super.processAction(portletConfig, actionRequest, actionResponse);
}
项目:liferay-dummy-factory    文件:JournalMVCActionCommand.java   
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {

    try {
        DummyGenerator<JournalContext> dummyGenerator = _journalDummyFactory.create(request);
        dummyGenerator.create(request);

    } catch (Exception e) {
        hideDefaultSuccessMessage(request);
        _log.error(e, e);
    }

    response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
    SessionMessages.add(request, "success");

}
项目:liferay-dummy-factory    文件:PageMVCActionCommand.java   
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {

    try {
        DummyGenerator<PageContext> dummyGenerator = _pageDummyFactory.create(request);
        dummyGenerator.create(request);

    } catch (Exception e) {
        hideDefaultSuccessMessage(request);
        _log.error(e, e);
    }

    response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
    SessionMessages.add(request, "success");

}
项目:spring4-understanding    文件:AnnotationMethodHandlerAdapter.java   
private String determineDefaultPhase(Method handlerMethod) {
    if (void.class != handlerMethod.getReturnType()) {
        return PortletRequest.RENDER_PHASE;
    }
    for (Class<?> argType : handlerMethod.getParameterTypes()) {
        if (ActionRequest.class.isAssignableFrom(argType) || ActionResponse.class.isAssignableFrom(argType) ||
                InputStream.class.isAssignableFrom(argType) || Reader.class.isAssignableFrom(argType)) {
            return PortletRequest.ACTION_PHASE;
        }
        else if (RenderRequest.class.isAssignableFrom(argType) || RenderResponse.class.isAssignableFrom(argType) ||
                OutputStream.class.isAssignableFrom(argType) || Writer.class.isAssignableFrom(argType)) {
            return PortletRequest.RENDER_PHASE;
        }
        else if (ResourceRequest.class.isAssignableFrom(argType) || ResourceResponse.class.isAssignableFrom(argType)) {
            return PortletRequest.RESOURCE_PHASE;
        }
        else if (EventRequest.class.isAssignableFrom(argType) || EventResponse.class.isAssignableFrom(argType)) {
            return PortletRequest.EVENT_PHASE;
        }
    }
    return "";
}
项目:spring4-understanding    文件:AbstractController.java   
@Override
public void handleActionRequest(ActionRequest request, ActionResponse response) throws Exception {
    // Delegate to PortletContentGenerator for checking and preparing.
    check(request, response);

    // Execute in synchronized block if required.
    if (this.synchronizeOnSession) {
        PortletSession session = request.getPortletSession(false);
        if (session != null) {
            Object mutex = PortletUtils.getSessionMutex(session);
            synchronized (mutex) {
                handleActionRequestInternal(request, response);
                return;
            }
        }
    }

    handleActionRequestInternal(request, response);
}
项目:spring4-understanding    文件:DispatcherPortlet.java   
/**
 * Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
 * Will just invoke afterCompletion for all interceptors whose preHandle
 * invocation has successfully completed and returned true.
 * @param mappedHandler the mapped HandlerExecutionChain
 * @param interceptorIndex index of last interceptor that successfully completed
 * @param ex Exception thrown on handler execution, or null if none
 * @see HandlerInterceptor#afterRenderCompletion
 */
private void triggerAfterActionCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex,
        ActionRequest request, ActionResponse response, Exception ex)
        throws Exception {

    // Apply afterCompletion methods of registered interceptors.
    if (mappedHandler != null) {
        HandlerInterceptor[] interceptors = mappedHandler.getInterceptors();
        if (interceptors != null) {
            for (int i = interceptorIndex; i >= 0; i--) {
                HandlerInterceptor interceptor = interceptors[i];
                try {
                    interceptor.afterActionCompletion(request, response, mappedHandler.getHandler(), ex);
                }
                catch (Throwable ex2) {
                    logger.error("HandlerInterceptor.afterCompletion threw exception", ex2);
                }
            }
        }
    }
}
项目:lr7-test-project    文件:PortletRemover.java   
/**
 * Remove portlet from the page
 *
 * @param request The request
 * @param response The response
 */
@ProcessAction(name = "removePortlet")
public void removePortletAction(ActionRequest request, ActionResponse response) throws IOException {
    Layout currentLayout = (Layout) request.getAttribute(WebKeys.LAYOUT);
    String portletId = ParamUtil.getString(request, RQ_PARAM_PORTLET_ID, null);

    if(portletId != null) {
        Matcher m = PATTERN_PORTLET_ID.matcher(portletId);

        if(m.matches()) {
            try {
                this.serviceRef.removePortlet(currentLayout, portletId);
            } catch(PortalException e) {
                LOG.error("Unable to remove portlet", e);
            }
        }
    }

}
项目:arquillian-liferay    文件:SamplePortlet.java   
public void add(
    ActionRequest actionRequest, ActionResponse actionResponse) {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
        WebKeys.THEME_DISPLAY);

    int firstParameter = ParamUtil.getInteger(
        actionRequest, "firstParameter");
    int secondParameter = ParamUtil.getInteger(
        actionRequest, "secondParameter");

    int result = _sampleService.add(firstParameter, secondParameter);

    PortletURL portletURL = PortletURLFactoryUtil.create(
        actionRequest, "arquillian_sample_portlet", themeDisplay.getPlid(),
        PortletRequest.RENDER_PHASE);

    portletURL.setParameter(
        "firstParameter", String.valueOf(firstParameter));
    portletURL.setParameter(
        "secondParameter", String.valueOf(secondParameter));
    portletURL.setParameter("result", String.valueOf(result));

    actionRequest.setAttribute(WebKeys.REDIRECT, portletURL.toString());
}
项目:particity    文件:MainController.java   
/**
 * Approve sub.
 *
 * @param request the request
 * @param response the response
 * @param model the model
 */
@ActionMapping(params = "action=approveSub")
public void approveSub(final ActionRequest request,
        final ActionResponse response, final Model model) {
    final Long subId = this.getSubId(request);
    m_objLog.debug("approveSub::start(" + subId + ")");

    final String uuid = request.getParameter("uuid");
    if (uuid != null) {
        response.setRenderParameter("uuid", uuid);
    }
    if (subId != null) {
        AHSubscriptionLocalServiceUtil.setSubscriptionStatus(subId,
                E_SubscriptionStatus.VALIDATED);
    }

    m_objLog.debug("approveSub::end");
}
项目:OEPv2    文件:EbPartnerShipPortlet.java   
public void updateEbPartnerShip(ActionRequest actionRequest,
        ActionResponse actionResponse) throws PortletException {
    try {
        ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
        long ebPartnerShipId = ParamUtil.getLong(actionRequest, "ebPartnerShipId");

        String name = ParamUtil.getString(actionRequest, "name");
        String cpaId = ParamUtil.getString(actionRequest, "cpaId");
        String service = ParamUtil.getString(actionRequest, "service");

        EbPartnerShip ebPartnerShip = EbPartnerShipLocalServiceUtil.getEbPartnerShip(ebPartnerShipId);
        if (ebPartnerShip != null) {
            ebPartnerShip = EbPartnerShipLocalServiceUtil.updateEbPartnerShip(ebPartnerShipId, name, cpaId, service, serviceContext);                                       
        } else {
            _log.error("Could not find eb partner ship.");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:govapps    文件:ContentPortlet.java   
/**
    * This Action gets a regionId from the request and puts it as parentRegionId into the
    * request. It also sets the "jspPage" parameter to "contentAddRegionJSP" so that
    * processing is forwarded to add_region.jsp.
    *
    * @param request
    * @param response
    * @throws PortalException 
    * @throws java.lang.Exception
    */
@ProcessAction(name = "regionDisplayAddSubRegion")
public void regionDisplayAddSubRegion(ActionRequest request, ActionResponse response) {
    try {

        long parentRegionId = ParamUtil.getLong(request, "parentRegionId");
//        _log.debug("parentRegionId: " + parentRegionId);
        if (Validator.isNotNull(parentRegionId)) {
            request.setAttribute("parentRegionId", parentRegionId);
            response.setRenderParameter("jspPage", contentAddRegionJSP);
        }
    } catch (Exception e) {
        _log.debug(e.getMessage());
           request.setAttribute("languageId", ParamUtil.getLong(request, "languageId"));
    }
}
项目:OEPv2    文件:DossierProcessPortlet.java   
public void addDossierProcess(ActionRequest actionRequest,
        ActionResponse actionResponse) throws PortletException {
    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
    try {
        long dossierProcId = ParamUtil.getLong(actionRequest, "dossierProcId");
        String govAgencyId = ParamUtil.getString(actionRequest, "govAgencyId");
        String govAgencyName = ParamUtil.getString(actionRequest, "govAgencyName");
        long startStepTransitionId = 0;
        int daysDuration = ParamUtil.getInteger(actionRequest, "daysDuration");
        int fee = ParamUtil.getInteger(actionRequest, "fee");

        DossierProcess dossierProcess = DossierProcessLocalServiceUtil.addDossierProcess(dossierProcId, govAgencyId, govAgencyName, startStepTransitionId, daysDuration, fee, serviceContext);

        actionResponse.setRenderParameter("mvcPath",
                "/html/processmgt/portlet/dossierprocess/edit_dossierprocess.jsp");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:OEPv2    文件:DossierProcessPortlet.java   
public void updateDossierProcess(ActionRequest actionRequest,
        ActionResponse actionResponse) throws PortletException {
    try {
        ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
        long dossierProcessId = ParamUtil.getLong(actionRequest, "dossierProcessId");
        long dossierProcId = ParamUtil.getLong(actionRequest, "dossierProcId");
        String govAgencyId = ParamUtil.getString(actionRequest, "govAgencyId");
        String govAgencyName = ParamUtil.getString(actionRequest, "govAgencyName");
        long startStepTransitionId = 0;
        int daysDuration = ParamUtil.getInteger(actionRequest, "daysDuration");
        int fee = ParamUtil.getInteger(actionRequest, "fee");
        DossierProcess dossierProcess = DossierProcessLocalServiceUtil.getDossierProcess(dossierProcessId);
        dossierProcess = DossierProcessLocalServiceUtil.updateDossierProcess(dossierProcessId, dossierProcId, govAgencyId, govAgencyName, startStepTransitionId, daysDuration, fee, serviceContext);                    
        actionResponse.setRenderParameter("mvcPath",
                "/html/processmgt/portlet/dossierprocess/list_dossierprocess.jsp");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:particity    文件:SearchController.java   
/**
 * Show offer.
 *
 * @param request the request
 * @param response the response
 * @param model the model
 */
@ActionMapping(params = "action=showOffer")
public void showOffer(final ActionRequest request,
        final ActionResponse response, final Model model) {
    m_objLog.debug("showOffer::start()");

    final Long offerId = this.getOfferId(request);
    if (offerId != null) {
        // OfferForm form = CustomServiceHandler.getOffer(offerId);
        // model.addAttribute("data",form);
        this.copyRenderParameter("offerId", request, response);
        this.copyRenderParameter("modal", request, response);
        response.setRenderParameter("jspPage", "searchresult");
    }

    m_objLog.debug("showOffer::end");
}
项目:liferaylms-portlet    文件:CourseAdmin.java   
public void deleteExportedCourse(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    long groupId  = ParamUtil.getLong(actionRequest, "groupId", 0);
    String fileName = ParamUtil.getString(actionRequest, "fileName", StringPool.BLANK);
    String redirect = ParamUtil.getString(actionRequest, "redirect", StringPool.BLANK);
    File f = new File(PropsUtil.get("liferay.home")+"/data/lms_exports/courses/"+themeDisplay.getCompanyId()+"/"+groupId+"/"+fileName);
    if (themeDisplay.getPermissionChecker().hasPermission(groupId, Course.class.getName(), groupId, ActionKeys.DELETE) && f != null && f.isFile()) {
        FileUtil.delete(f);
        SessionMessages.add(actionRequest, "courseadmin.delete.exported.confirmation.success");
    } else {
        SessionMessages.add(actionRequest, "courseadmin.delete.exported.confirmation.error");
    }
    if (Validator.isNotNull(redirect)) {
        actionResponse.sendRedirect(redirect);
    }
}
项目:liferaylms-portlet    文件:modulePortlet.java   
@ProcessAction(name = "editmodule")
public void editmodule(ActionRequest request, ActionResponse response)
        throws Exception {
    long key = ParamUtil.getLong(request, "resourcePrimKey");
    if (Validator.isNotNull(key)) {
        response.setRenderParameter("moduleId", Long.toString(key));
        try {
            response.setWindowState(LiferayWindowState.POP_UP);
        } catch (WindowStateException e) {
            if(log.isDebugEnabled())e.printStackTrace();
            if(log.isErrorEnabled())log.error(e.getMessage());
        }
        response.setRenderParameter("view", "editmodule");
        response.setRenderParameter("editType", "edit");
    }
}
项目:liferaylms-portlet    文件:BaseCourseAdminPortlet.java   
public void closeCourse(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

        log.debug("******CloseCourse**********");


        ServiceContext serviceContext = ServiceContextFactory.getInstance(Course.class.getName(), actionRequest);

        long courseId = ParamUtil.getLong(actionRequest, "courseId", 0);
        if (courseId > 0) { 
            List<Course> editions = CourseLocalServiceUtil.getChildCourses(courseId);
            for(Course edition : editions){
                CourseLocalServiceUtil.closeCourse(edition.getCourseId());
                AuditingLogFactory.audit(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), Course.class.getName(), edition.getCourseId(), serviceContext.getUserId(), AuditConstants.CLOSE, null);
            }

            CourseLocalServiceUtil.closeCourse(courseId);
            AuditingLogFactory.audit(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), Course.class.getName(), courseId, serviceContext.getUserId(), AuditConstants.CLOSE, null);
        }
    }
项目:liferaylms-portlet    文件:ExecActivity.java   
public void upquestion(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker=themeDisplay.getPermissionChecker();

    long actId = ParamUtil.getLong(actionRequest, "actId",0);
    long testQuestionId = ParamUtil.getLong(actionRequest, "questionId");

    if(actId>0)
    {   
        LearningActivity larn = LearningActivityLocalServiceUtil.getLearningActivity(actId);

        if(permissionChecker.hasPermission(larn.getGroupId(), LearningActivity.class.getName(), larn.getActId(),
                ActionKeys.UPDATE)|| permissionChecker.hasOwnerPermission(larn.getCompanyId(), LearningActivity.class.getName(), larn.getActId(),larn.getUserId(),
                        ActionKeys.UPDATE))
        {
        TestQuestionLocalServiceUtil.goUpTestQuestion(testQuestionId);
        }
    }
}
项目:liferaylms-portlet    文件:FinalCourseResultConfigurationAction.java   
public void processAction( 
        PortletConfig portletConfig, ActionRequest actionRequest, 
        ActionResponse actionResponse) 
    throws Exception { 

    PortletPreferences portletPreferences =
    PortletPreferencesFactoryUtil.getPortletSetup( 
            actionRequest, ParamUtil.getString(actionRequest, "portletResource")); 

    /**
     * boolean showAllways =        preferences.getValue("showAllways", "false").equals("true");
boolean showOnlyWhenFinishDate =    preferences.getValue("showOnlyWhenFinishDate", "true").equals("true");
     */



    portletPreferences.setValue("showCalificationMode",ParamUtil.getString(actionRequest, "showCalificationMode"));

    portletPreferences.store();
    SessionMessages.add( 
            actionRequest, portletConfig.getPortletName() + ".doConfigure"); 
    //SessionMessages.add(actionRequest,"success");
}
项目:liferaylms-portlet    文件:BaseCourseAdminPortlet.java   
public void deleteCourse(ActionRequest actionRequest,
        ActionResponse actionResponse) throws Exception {

    ServiceContext serviceContext = ServiceContextFactory.getInstance(
            Course.class.getName(), actionRequest);

    long courseId = ParamUtil.getLong(actionRequest, "courseId", 0);
    if (courseId > 0) {

        //auditing
        List<Course> editions = CourseLocalServiceUtil.getChildCourses(courseId);
        for(Course edition : editions){
            CourseLocalServiceUtil.deleteCourse(edition.getCourseId());
            AuditingLogFactory.audit(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), Course.class.getName(), edition.getCourseId(), serviceContext.getUserId(), AuditConstants.CLOSE, null);
        }

        CourseLocalServiceUtil.deleteCourse(courseId);
        AuditingLogFactory.audit(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), Course.class.getName(), courseId, serviceContext.getUserId(), AuditConstants.CLOSE, null);


    }
}
项目:SinglePageAppPortlets    文件:MessageBoxPortlet.java   
@Override
public void processAction(ActionRequest req, ActionResponse resp)
      throws PortletException, IOException {

   // the only action for this portlet is to reset the stored messages

   String actionName = req.getParameter("action");
   logger.fine("MBP: Resetting messages. numMsgs = 0,  actionName = " + actionName);

   ArrayList<String> msgs = new ArrayList<String>();
   StringBuffer sb = new StringBuffer();
   sb.append("<p style='margin:2px 5px 2px 5px; color:#00D;"
         + " background-color:#AAF;'>");
   sb.append("Reset - No messages.");
   sb.append("</p>");
   msgs.add(sb.toString());

   resp.setRenderParameter(PARAM_NUM_MSGS, "0");
   req.getPortletSession().setAttribute(ATTRIB_MSGS, msgs);
}
项目:OEPv2    文件:AppRolePortlet.java   
public void addEditAppRole2JobPos(ActionRequest request, ActionResponse response) throws SystemException, PortalException, IOException {
    if (SessionErrors.isEmpty(request)) {
        ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
        long appRoleId = ParamUtil.getLong(request, AppRole2JobPosKeys.AddEditAttributes.APPROLE_ID, PortletKeys.LONG_DEFAULT);
        long jobPosId = ParamUtil.getLong(request, AppRole2JobPosKeys.AddEditAttributes.JOBPOS_ID, PortletKeys.LONG_DEFAULT);

        Long editId = ParamUtil.getLong(request, AppRole2JobPosKeys.AddEditAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
        if (editId == PortletKeys.LONG_DEFAULT) {
            AppRole2JobPosLocalServiceUtil.addAppRole2JobPos(appRoleId, jobPosId, serviceContext);
            SessionMessages.add(request, AssignRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_ASSIGNROLE2JOBPOS_SUCCESS_ADDNEW);    
        } else {
        }
    }
    SessionMessages.add(request, PortalUtil.getPortletId(request) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);         
    if (!SessionErrors.isEmpty(request)) {
        PortalUtil.copyRequestParameters(request, response);
    } else {
        response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
    }
}
项目:OEPv2    文件:AppRolePortlet.java   
public void deleteEP(ActionRequest request, ActionResponse response) throws PortalException, SystemException, IOException {
    long deleteId = ParamUtil.getLong(request, AppRole2JobPosKeys.BaseAppRole2JobPosAttributes.DELETE_ID, PortletKeys.LONG_DEFAULT);
    try {
        AppRole2Employee a2e = AppRole2EmployeeLocalServiceUtil.getAppRole2Employee(deleteId);
        if (a2e != null) {
            try {
                AppRole role = AppRoleLocalServiceUtil.getAppRole(a2e.getAppRoleId());
                UserSync userSync = UserSyncLocalServiceUtil.findByApplicationEmployee(role.getApplicationId(), a2e.getEmployeeId());
                userSync.setCheckpoint(new Date());
                userSync.setAccessibleStatus(0);
                UserSyncLocalServiceUtil.updateUserSync(userSync);
            }
            catch (Exception e) {
                e.printStackTrace();
            }               
        }
        AppRole2EmployeeLocalServiceUtil.removeAppRole2Employee(deleteId);
        SessionMessages.add(request, AssignRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_ASSIGNROLE2EMPLOYEE_SUCCESS_DELETE);  
    }
    catch (Exception ex) {
        SessionMessages.add(request, AssignRoleKeys.ErrorMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_ASSIGNROLE2EMPLOYEE_ERROR_DELETE);              
    }
    response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
}
项目:OEPv2    文件:AppRolePortlet.java   
public void addEditAppRole(ActionRequest request, ActionResponse response) throws SystemException, PortalException, IOException {
    validateParamsIntoSessionError(request);

    if (SessionErrors.isEmpty(request)) {
        ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
        long applicationId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.APPLICATION_ID, PortletKeys.LONG_DEFAULT);
        String roleCode = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_CODE, PortletKeys.TEXT_BOX);
        String roleName = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_NAME, PortletKeys.TEXT_BOX);

        Long editId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
        if (editId == PortletKeys.LONG_DEFAULT) {
            AppRoleLocalServiceUtil.addAppRole(applicationId, roleCode, roleName, serviceContext);
            SessionMessages.add(request, AppRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_SUCCESS_ADDNEW); 
        } else {
            AppRoleLocalServiceUtil.updateAppRole(editId, applicationId, roleCode, roleName, serviceContext);
            SessionMessages.add(request, AppRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_SUCCESS_UPDATE); 
        }
    }
    SessionMessages.add(request, PortalUtil.getPortletId(request) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);         
    if (!SessionErrors.isEmpty(request)) {
        PortalUtil.copyRequestParameters(request, response);
    } else {
        response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
    }
}
项目:OEPv2    文件:JobPosPortlet.java   
public void edit(ActionRequest request, ActionResponse response)
        throws PortalException, SystemException, IOException {
    long editId = ParamUtil.getLong(request,
            JobPosKeys.BaseJobPosAttributes.EDIT_ID,
            PortletKeys.LONG_DEFAULT);

    JobPos application = JobPosLocalServiceUtil
            .getJobPos(editId);
    setParameterIntoResponse(response, application);

    if (!SessionErrors.isEmpty(request)) {
        response.sendRedirect(ParamUtil.getString(request,
                PortletKeys.REDIRECT_PAGE));
    } else {
        PortalUtil.copyRequestParameters(request, response);
    }
}
项目:liferaylms-portlet    文件:EvaluationActivity.java   
public void publish(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception{

    LearningActivity learningActivity = LearningActivityLocalServiceUtil.getLearningActivity(ParamUtil.getLong(actionRequest, "actId"));

    Document document = SAXReaderUtil.read(learningActivity.getExtracontent());
    Element rootElement = document.getRootElement();

    Element publishDate = rootElement.element("publishDate");
    if(publishDate==null){
        rootElement.addElement("publishDate").setText(_dateFormat.format(new Date()));
    }
    learningActivity.setExtracontent(document.formattedString());
    LearningActivityLocalServiceUtil.updateLearningActivity(learningActivity);


    PortletURL viewPortletURL = ((LiferayPortletResponse)actionResponse).createRenderURL();
    viewPortletURL.setParameter("jspPage","/html/evaluationtaskactivity/view.jsp");

    String returnToFullPageURL = actionRequest.getParameter("returnToFullPageURL");
    if(Validator.isNotNull(returnToFullPageURL)) {
        viewPortletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
    }

    actionResponse.sendRedirect(viewPortletURL.toString());
}
项目:particity    文件:ManagementController.java   
@ActionMapping(params = "action=saveCfg")
private void saveCfg(final ActionRequest request,
        final ActionResponse response, final Model model) {

    if (Constants.RESTRICT_TO_DEMO) {
        m_objLog.debug("saveCfg::denied()");
        SessionErrors.add(request, "common.demo.denied");
        return;
    }

    m_objLog.debug("saveCfg::start()");
    response.setRenderParameter("tabId", "cfg");
    // response.setRenderParameter("cfgId",
    // form.getCategory().toString().toLowerCase());

    CustomPortalServiceHandler.saveConfig(request);
    m_objLog.debug("saveCfg::end()");
}
项目:OEPv2    文件:WorkingUnitPortlet.java   
public void editJobPos(ActionRequest request, ActionResponse response)
        throws PortalException, SystemException, IOException {
    long editId = ParamUtil.getLong(request,
            JobPosKeys.BaseJobPosAttributes.EDIT_ID,
            PortletKeys.LONG_DEFAULT);

    JobPos application = JobPosLocalServiceUtil
            .getJobPos(editId);
    setParameterIntoResponseJobPos(response, application);

    if (!SessionErrors.isEmpty(request)) {
        response.sendRedirect(ParamUtil.getString(request,
                PortletKeys.REDIRECT_PAGE));
    } else {
        PortalUtil.copyRequestParameters(request, response);
    }
}
项目:liferaylms-portlet    文件:SurveyActivity.java   
public void deletequestion(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {

    TestQuestion question = TestQuestionLocalServiceUtil.getTestQuestion(ParamUtil.getLong(actionRequest, "questionId"));
    TestQuestionLocalServiceUtil.deleteTestQuestion(ParamUtil.getLong(actionRequest, "questionId"));

    SessionMessages.add(actionRequest, "question-deleted-successfully");
    String backUrl = ParamUtil.get(actionRequest, "backUrl", "");
    if (Validator.isNotNull(backUrl)) {
        actionResponse.sendRedirect(backUrl);
    } else {
        actionResponse.setRenderParameter("actionEditingDetails", StringPool.TRUE);
        actionResponse.setRenderParameter("resId", Long.toString(question.getActId()));
        actionResponse.setRenderParameter("jspPage", "/html/surveyactivity/admin/edit.jsp");
    }
}