Java 类com.liferay.portal.kernel.util.ParamUtil 实例源码

项目:liferay-dummy-factory    文件:PageMVCResourceCommand.java   
@Override
protected void doServeResource(ResourceRequest request, ResourceResponse response)
        throws Exception {
    String cmd = ParamUtil.getString(request, Constants.CMD);
    String serializedJson = "";

    if(cmd.equals(CMD_PAGELIST)) {
        serializedJson = getPageLists(request,response );
    } else {
        _log.error("Unknown command is passed <" + cmd + ">");
    }

    HttpServletResponse servletResponse = _portal.getHttpServletResponse(
            response);

    servletResponse.setContentType(ContentTypes.APPLICATION_JSON);

    ServletResponseUtil.write(servletResponse, serializedJson);     
}
项目:ch-inofix-timetracker    文件:TaskRecordDisplayTerms.java   
public TaskRecordDisplayTerms(PortletRequest portletRequest) {

        super(portletRequest);

        createDate = ParamUtil.getString(portletRequest, CREATE_DATE);
        description = ParamUtil.getString(portletRequest, DESCRIPTION);
        duration = ParamUtil.getLong(portletRequest, DURATION);
        fromDate = ParamUtil.getString(portletRequest, FROM_DATE);
        groupId = ParamUtil.getLong(portletRequest, GROUP_ID);
        ownerUserId = ParamUtil.getLong(portletRequest, OWNER_USER_ID);
        modifiedDate = ParamUtil.getString(portletRequest, MODIFIED_DATE);
        String statusString = ParamUtil.getString(portletRequest, STATUS);

        if (Validator.isNotNull(statusString)) {
            status = GetterUtil.getInteger(statusString);
        }
        ticketURL = ParamUtil.getString(portletRequest, TICKET_URL);
        taskRecordId = ParamUtil.getLong(portletRequest, TASKRECORDID);
        untilDate = ParamUtil.getString(portletRequest, UNTIL_DATE);
        userName = ParamUtil.getString(portletRequest, USER_NAME);
        workPackage = ParamUtil.getString(portletRequest, WORK_PACKAGE);
    }
项目: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    文件:ImportTaskRecordsMVCResourceCommand.java   
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws Exception {

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

    PortletRequestDispatcher portletRequestDispatcher = null;

    if (cmd.equals(Constants.IMPORT)) {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
    } else {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                "/import/new_import/import_task_records_resources.jsp");
    }

    portletRequestDispatcher.include(resourceRequest, resourceResponse);
}
项目:ch-inofix-timetracker    文件:ActionUtil.java   
public static TaskRecord getTaskRecord(HttpServletRequest request) throws Exception {

        long taskRecordId = ParamUtil.getLong(request, "taskRecordId");

        TaskRecord taskRecord = null;

        if (taskRecordId > 0) {
            taskRecord = TaskRecordServiceUtil.getTaskRecord(taskRecordId);

            // TODO: Add TrashBin support
            // if (taskRecord.isInTrash()) {
            // throw new NoSuchTaskRecordException("{taskRecordId=" +
            // taskRecordId + "}");
            // }
        }

        return taskRecord;
    }
项目: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   
/**
 * Routes between global configuration editing and tab editing
 *
 * @param request  The request
 * @param response The response
 * @throws PortletException If something goes wrong
 * @throws IOException      If something goes wrong
 */
@Override
protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    // Very, very simple routing. That's all we need, folks.
    String editModeParam = ParamUtil.get(request, PortletRequestParameter.EDIT_MODE.getName(), StringPool.BLANK);
    EditMode editMode = EditMode.getEditMode(editModeParam);

    switch(editMode) {
        case TAB:
            this.doEditTab(request, response);
        break;
        case FACET:
            this.doEditFacet(request, response);
        break;
        default:
            this.doEditGlobal(request, response);
        break;
    }

}
项目: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    文件:ContactDisplayTerms.java   
public ContactDisplayTerms(PortletRequest portletRequest) {
    super(portletRequest);

    company = ParamUtil.getString(portletRequest, COMPANY);
    contactId = ParamUtil.getString(portletRequest, CONTACT_ID);
    createDate = ParamUtil.getString(portletRequest, CREATE_DATE);
    email = ParamUtil.getString(portletRequest, EMAIL);
    fax = ParamUtil.getString(portletRequest, FAX);
    fullName = ParamUtil.getString(portletRequest, FULL_NAME);
    // TODO: add default IMPP
    name = ParamUtil.getString(portletRequest, NAME);
    modifiedDate = ParamUtil.getString(portletRequest, MODIFIED_DATE);
    String statusString = ParamUtil.getString(portletRequest, STATUS);

    if (Validator.isNotNull(statusString)) {
        status = GetterUtil.getInteger(statusString);
    }

    phone = ParamUtil.getString(portletRequest, PHONE);
    userName = ParamUtil.getString(portletRequest, USER_NAME);
}
项目:ch-inofix-contact-manager    文件:ImportContactsMVCResourceCommand.java   
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws Exception {

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

    PortletRequestDispatcher portletRequestDispatcher = null;

    if (cmd.equals(Constants.IMPORT)) {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
    } else {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                "/import/new_import/import_contacts_resources.jsp");
    }

    portletRequestDispatcher.include(resourceRequest, resourceResponse);
}
项目: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);
    }
}
项目:ch-inofix-contact-manager    文件:ActionUtil.java   
public static Contact getContact(HttpServletRequest request) throws Exception {

        long contactId = ParamUtil.getLong(request, "contactId");

        Contact contact = null;

        if (contactId > 0) {
            contact = ContactServiceUtil.getContact(contactId);

            // TODO: Add TrashBin support
            // if (contact.isInTrash()) {
            // throw new NoSuchContactException("{contactId=" +
            // contactId + "}");
            // }
        }

        return contact;
    }
项目:liferay-gsearch    文件:QueryParamsBuilderImpl.java   
/**
 * Set groups parameter.
 */
protected void setGroupsParam() {

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

    String scopeFilter =
        ParamUtil.getString(_portletRequest, GSearchWebKeys.FILTER_SCOPE);

    long[] groupIds;

    if ("this-site".equals(scopeFilter)) {
        groupIds = new long[] {
            themeDisplay.getScopeGroupId()
        };
    }
    else {
        groupIds = new long[] {};
    }
    _queryParams.setGroupIds(groupIds);
}
项目:liferay-gsearch    文件:QueryParamsBuilderImpl.java   
/**
 * Set search type (normal / image search). Search type is determined from
 * typefilter value
 */
protected void setResultsLayoutParam() {

    String resultsLayoutParam =
        ParamUtil.getString(_portletRequest, GSearchWebKeys.RESULTS_LAYOUT);

    String extensionParam = ParamUtil.getString(
        _portletRequest, GSearchWebKeys.FACET_EXTENSION);

    String type = ParamUtil.getString(
        _portletRequest, GSearchWebKeys.FILTER_TYPE);

    boolean imageLayoutAvailable = "file".equals(type) || "Image".equals(extensionParam);

    if (GSearchResultsLayouts.THUMBNAIL_LIST.equals(resultsLayoutParam)) {
        _queryParams.setResultsLayout(GSearchResultsLayouts.THUMBNAIL_LIST);
    }
    else if (GSearchResultsLayouts.IMAGE.equals(resultsLayoutParam) &&
        imageLayoutAvailable) {
        _queryParams.setResultsLayout(GSearchResultsLayouts.IMAGE);
    }
    else {
        _queryParams.setResultsLayout(GSearchResultsLayouts.LIST);
    }
}
项目:liferay-gsearch    文件:QueryParamsBuilderImpl.java   
/**
 * Set types (asset types to search for).
 * 
 * @throws ClassNotFoundException
 * @throws PatternSyntaxException
 * @throws JSONException 
 */
protected void setTypeParam()
    throws PatternSyntaxException, ClassNotFoundException, JSONException {

    String typeFilter =
        ParamUtil.getString(_portletRequest, GSearchWebKeys.FILTER_TYPE);

    List<String> classNames = new ArrayList<String>();

    String className = parseAssetClass(typeFilter);

    if (className != null) {
        classNames.add(className);
    }
    else {
        classNames.addAll(parseDefaultAssetClasses());
    }

    _queryParams.setClassNames(classNames);
}
项目:liferay-gsearch    文件:GSearchUtil.java   
/**
 * Get redirect url.
 * 
 * @return redirect url
 * @throws PortalException
 */
public static String getRedirectURL(PortletRequest portletRequest)
    throws PortalException {

    StringBundler sb = new StringBundler();

    sb.append(GSearchUtil.getCurrentLayoutFriendlyURL(portletRequest));
    sb.append("?");
    sb.append(GSearchWebKeys.KEYWORDS).append("=").append(
        ParamUtil.getString(portletRequest, GSearchWebKeys.KEYWORDS));
    sb.append("&").append(GSearchWebKeys.FILTER_SCOPE).append("=").append(
        ParamUtil.getString(portletRequest, GSearchWebKeys.FILTER_SCOPE));
    sb.append("&").append(GSearchWebKeys.FILTER_TIME).append("=").append(
        ParamUtil.getString(portletRequest, GSearchWebKeys.FILTER_TIME));
    sb.append("&").append(GSearchWebKeys.FILTER_TYPE).append("=").append(
        ParamUtil.getString(portletRequest, GSearchWebKeys.FILTER_TYPE));
    sb.append("&").append(GSearchWebKeys.SORT_FIELD).append("=").append(
        ParamUtil.getString(portletRequest, GSearchWebKeys.SORT_FIELD));
    sb.append("&").append(GSearchWebKeys.SORT_DIRECTION).append("=").append(
        ParamUtil.getString(portletRequest, GSearchWebKeys.SORT_DIRECTION));
    sb.append("&").append(GSearchWebKeys.START).append("=").append(
        ParamUtil.getString(portletRequest, GSearchWebKeys.START));

    return HtmlUtil.escapeURL(sb.toString());
}
项目:liferay-dummy-factory    文件:JournalDummyFactory.java   
@Override
public DummyGenerator<JournalContext> create(ActionRequest request) {
    long createContentsType = 0;
    DummyGenerator<JournalContext> generator = _JournalSimpleDummyGenerator;

    createContentsType = ParamUtil.getLong(request, "createContentsType", LDFPortletKeys.MB_CATEGORY_CREATE);

    if (createContentsType == LDFPortletKeys.WCM_DUMMY_CONTENTS_CREATE) {
        generator = _JournalRandomDummyGenerator;

    } else if (createContentsType == LDFPortletKeys.WCM_STRUCTURE_TEMPLATE_SELECT_CREATE) {
        generator = _JournalStructureTemplateDummyGenerator;

    }

    return generator;
}
项目:liferay-dummy-factory    文件:RoleMVCResourceCommand.java   
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {
    String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);
    String serializedJson = "";

    if (cmd.equals(CMD_ROLELIST)) {
        serializedJson = getRoleLists(resourceRequest, resourceResponse);
    } else {
        _log.error("Unknown command is passed <" + cmd + ">");
    }

    HttpServletResponse response = _portal.getHttpServletResponse(resourceResponse);

    response.setContentType(ContentTypes.APPLICATION_JSON);

    ServletResponseUtil.write(response, serializedJson);
}
项目: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    文件:MBContext.java   
public MBContext(ActionRequest actionRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
            WebKeys.THEME_DISPLAY);

    //Fetch data
    numberOfMB = ParamUtil.getLong(actionRequest, "numberOfMB",0);
    categoryId = ParamUtil.getLong(actionRequest, "categoryId",MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID);
    subject = ParamUtil.getString(actionRequest, "subject","dummy subject");
    body = ParamUtil.getString(actionRequest, "body","dummy body");
    anonymous = ParamUtil.getBoolean(actionRequest, "anonymous",false);
    allowPingbacks = ParamUtil.getBoolean(actionRequest, "allowPingbacks",false);
    priority = ParamUtil.getDouble(actionRequest, "priority",0.0);
    parentCategoryId = ParamUtil.getLong(actionRequest, "parentCategoryId",MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID);
    categoryName = ParamUtil.getString(actionRequest, "categoryName","dummy Category Name");
    description = ParamUtil.getString(actionRequest, "description","dummy description");
    threadId = ParamUtil.getLong(actionRequest, "threadId",0);
    siteGroupId = ParamUtil.getLong(actionRequest, "siteGroupId",themeDisplay.getScopeGroupId());

    // Sites
    String[] groupsStrIds = ParamUtil.getStringValues(actionRequest, "groupIds",
            new String[] { String.valueOf(themeDisplay.getScopeGroupId()) });
    groupIds = CommonUtil.convertStringToLongArray(groupsStrIds);       
}
项目:liferay-dummy-factory    文件:MBMVCResourceCommand.java   
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws Exception {
    String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);
    String serializedJson = "";

    if(cmd.equals(CMD_THREAD_LIST)) {
        serializedJson = getThreadList(resourceRequest,resourceResponse );

    } else if (cmd.equals(CMD_CATEGORY_LIST)) {
        serializedJson = getCategoryList(resourceRequest,resourceResponse );

    } else {
        _log.error("Unknown command is passed <" + cmd + ">");
    }

    HttpServletResponse response = _portal.getHttpServletResponse(
            resourceResponse);

    response.setContentType(ContentTypes.APPLICATION_JSON);

    ServletResponseUtil.write(response, serializedJson);        
}
项目:ch-inofix-data-manager    文件:MeasurementDisplayTerms.java   
public MeasurementDisplayTerms(PortletRequest portletRequest) {

        super(portletRequest);

        createDate = ParamUtil.getString(portletRequest, CREATE_DATE);
        data = ParamUtil.getString(portletRequest, DATA);
        from = ParamUtil.getLong(portletRequest, FROM);
        groupId = ParamUtil.getLong(portletRequest, GROUP_ID);
        id = ParamUtil.getString(portletRequest, ID);
        measurementId = ParamUtil.getLong(portletRequest, MEASUREMENT_ID);
        modifiedDate = ParamUtil.getString(portletRequest, MODIFIED_DATE);
        name = ParamUtil.getString(portletRequest, NAME);
        String statusString = ParamUtil.getString(portletRequest, STATUS);

        if (Validator.isNotNull(statusString)) {
            status = GetterUtil.getInteger(statusString);
        }
        until = ParamUtil.getLong(portletRequest, UNTIL);
        userName = ParamUtil.getString(portletRequest, USER_NAME);
    }
项目:ch-inofix-data-manager    文件:ImportMeasurementsMVCResourceCommand.java   
@Override
    protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
            throws Exception {

//        _log.info("doServeResource()");

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

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

        PortletRequestDispatcher portletRequestDispatcher = null;

        if (cmd.equals(Constants.IMPORT)) {
            portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
        } else {
            portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                    "/import/new_import/import_measurements_resources.jsp");
        }

        portletRequestDispatcher.include(resourceRequest, resourceResponse);
    }
项目:liferay-blade-samples    文件:CustomMVCResourceCommand.java   
@Override
public boolean serveResource(
        ResourceRequest resourceRequest, ResourceResponse resourceResponse)
    throws PortletException {

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

    if (cmd.equals("BOOKMARK_ORDERABLE")) {
        serveOlderUserBookmarks(resourceRequest, resourceResponse);
    }
    else {
        _editFolderMVCResourceCommand.serveResource(
            resourceRequest, resourceResponse);
    }

    return true;
}
项目:liferay-blade-samples    文件:CustomMVCResourceCommand.java   
@Override
public boolean serveResource(
        ResourceRequest resourceRequest, ResourceResponse resourceResponse)
    throws PortletException {

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

    if (cmd.equals("BOOKMARK_ORDERABLE")) {
        serveOlderUserBookmarks(resourceRequest, resourceResponse);
    }
    else {
        _editFolderMVCResourceCommand.serveResource(
            resourceRequest, resourceResponse);
    }

    return true;
}
项目:liferay-blade-samples    文件:CustomMVCResourceCommand.java   
@Override
public boolean serveResource(
        ResourceRequest resourceRequest, ResourceResponse resourceResponse)
    throws PortletException {

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

    if (cmd.equals("BOOKMARK_ORDERABLE")) {
        serveOlderUserBookmarks(resourceRequest, resourceResponse);
    }
    else {
        _editFolderMVCResourceCommand.serveResource(
            resourceRequest, resourceResponse);
    }

    return true;
}
项目: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);
            }
        }
    }

}
项目:data-manipulator    文件:RequestContext.java   
public Calendar getCalendar(String key) {
    Calendar cal = Calendar.getInstance();

    cal.set(
        Calendar.YEAR, ParamUtil.getInteger(_uploadRequest, key + "Year"));

    cal.set(
        Calendar.MONTH,
        ParamUtil.getInteger(_uploadRequest, key + "Month"));

    cal.set(
        Calendar.DATE, ParamUtil.getInteger(_uploadRequest, key + "Day"));

    cal.set(
        Calendar.HOUR, ParamUtil.getInteger(_uploadRequest, key + "Hour"));

    cal.set(
        Calendar.MINUTE,
        ParamUtil.getInteger(_uploadRequest, key + "Minute"));

    cal.set(
        Calendar.AM_PM, ParamUtil.getInteger(_uploadRequest, key + "AmPm"));

    return cal;
}
项目: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());
}
项目:OEPv2    文件:EbPartnerShipPortlet.java   
public void addEbPartnerShip(ActionRequest actionRequest,
        ActionResponse actionResponse) throws PortletException {
    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
    try {
        String name = ParamUtil.getString(actionRequest, "name");
        String cpaId = ParamUtil.getString(actionRequest, "cpaId");
        String service = ParamUtil.getString(actionRequest, "service");

        EbPartnerShip ebPartnerShip = EbPartnerShipLocalServiceUtil.addEbPartnerShip(name, cpaId, service, serviceContext);

        /*
        actionResponse.setRenderParameter("ebPartnerShipId", String.valueOf(ebPartnerShip.getEbPartnerShipId()));
        actionResponse.setRenderParameter("mvcPath",
                "/html/dossiermgt/portlet/ebpartnership/edit_ebpartnership.jsp");
        */
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:OEPv2    文件:DocTemplatePortlet.java   
public void addDocTemplate(ActionRequest actionRequest,
        ActionResponse actionResponse) throws PortletException {
    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
    try {
        String templateNo = ParamUtil.getString(actionRequest, "templateNo");
        String title = ParamUtil.getString(actionRequest, "title");
        String enTitle = ParamUtil.getString(actionRequest, "enTitle");
        String _uuid = ParamUtil.getString(actionRequest, "fileEntryUuid");
        DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getFileEntryByUuidAndGroupId(_uuid, serviceContext.getScopeGroupId());
        DocTemplate docTemplate = DocTemplateLocalServiceUtil.addDocTemplate(templateNo, title, enTitle, fileEntry.getFileEntryId(), serviceContext);

        if (docTemplate != null) {
            SessionMessages.add(actionRequest.getPortletSession(), DocTemplateKeys.SuccessMessageKeys.ORG_OEP_CORE_UTILITIES_DOSSIERMGT_PORTLET_DOCTEMPLATE_SUCCESS_ADDNEW);
            _log.info("doc template have been added successfylly");
        } else {
            _log.error("There is an Erron in adding doc template");
        }
        actionResponse.setRenderParameter("mvcPath",
                "/html/dossiermgt/portlet/doctemplate/edit_doctemplate.jsp");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:portal-properties-prettier-app    文件:PortalPropertiesPrettierPortlet.java   
protected String prettify(PortletRequest request) throws IOException,
        PortletException {
    UploadPortletRequest uploadPortletRequest = PortalUtil
            .getUploadPortletRequest(request);

    String liferayVersion = ParamUtil.getString(uploadPortletRequest,
            "liferayVersion", "7.0.4-ga5");
    boolean printDefaultValue = ParamUtil.getBoolean(uploadPortletRequest,
            "printDefaultValue");

    Properties customProperties = PropertiesUtil.load(
            uploadPortletRequest.getFileAsStream("portalPropertiesFile"),
            "UTF-8");

    String prettyProperties = prettier.prettify(customProperties,
            liferayVersion, printDefaultValue);

    incrementCounter(request);

    return prettyProperties;
}
项目:OEPv2    文件:ProcessDesignerPortlet.java   
@Override
public void serveResource(ResourceRequest resourceRequest,
        ResourceResponse resourceResponse) throws IOException,
        PortletException {
    System.out.println("#############AJAX CALL####################");
    String diagram = ParamUtil.getString(resourceRequest, "diagram");

    JSONObject diagramJSON = new JSONObject(diagram);
    //System.out.println(diagram);
    System.out.println(diagramJSON.get("nodes"));
    JSONArray arrDiagram = diagramJSON.getJSONArray("nodes");
    for (int i = 0; i < arrDiagram.length(); i++) {

    }
    resourceResponse.setContentType("text/html");
    PrintWriter writer = resourceResponse.getWriter();
    writer.print(diagram);
    writer.write("Hello");
    writer.flush();
    writer.close();
    super.serveResource(resourceRequest, resourceResponse);
}
项目: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();
    }
}
项目:liferaylms-portlet    文件:ModuleNavigationAction.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("showPreviousModuleButton", actionRequest.getParameter("showPreviousModuleButton"));

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

}
项目:OEPv2    文件:DossierProcPortlet.java   
@ProcessEvent(qname = "{http://org.oep.com/events}ipc-dossierdangky")
public void dossierDangkyEvent(ActionRequest request,
        ActionResponse response) {

    /**
     * Get sample text from UI
     */

    String dossierProcId = ParamUtil
            .getString(request, "dossierProcId", "");
    QName qName = new QName("http://org.oep.com/events",
            "ipc-dossierdangky");
    response.setRenderParameter("tabs1",
            ParamUtil.getString(request, "tabs1"));
    response.setEvent(qName, dossierProcId);
}
项目:OEPv2    文件:DossierProcPortlet.java   
public void dossierDangkyAction(ActionRequest request,
        ActionResponse response) throws PortletException, IOException {
    ThemeDisplay themeDisplay = (ThemeDisplay) request
            .getAttribute(WebKeys.THEME_DISPLAY);
    String pageName = "/dichvucongtructuyen";
    String portletName = "oepeserviceregisteronline_WAR_oepeserviceportlet";
    String dossierProcId = ParamUtil
            .getString(request, "dossierProcId", "");
    long plid = 0L;
    try {
        plid = LayoutLocalServiceUtil.getFriendlyURLLayout(
                themeDisplay.getScopeGroupId(), false, pageName).getPlid();
    } catch (Exception e) {
        e.printStackTrace();
    }

    PortletURL redirectURL = PortletURLFactoryUtil.create(
            PortalUtil.getHttpServletRequest(request), portletName, plid,
            PortletRequest.RENDER_PHASE);
    redirectURL.setParameter("dossierProcId", dossierProcId); 
    redirectURL.setParameter("data", "This Value Comes From Welcome Page");
    response.sendRedirect(redirectURL.toString());

}
项目:OEPv2    文件:MenuListDomain.java   
public void myAdministrationNoEvent(ActionRequest request,
        ActionResponse response) {

    /**
     * Get sample text from UI
     */
    String administrationNo = ParamUtil.getString(request,
            "administrationNo", "");
    QName qName = new QName("http://org.oep.com/events",
            "ipc-administrationno");
    String tg = ParamUtil.getString(request, "tabs1");
    if (tg == null || tg.equals("")) {
        tg = "one";
    }
    response.setRenderParameter("tabs1", tg);
    response.setEvent(qName, administrationNo);
}