当前位置: 首页>>代码示例>>Java>>正文


Java ActionRequest.getAttribute方法代码示例

本文整理汇总了Java中javax.portlet.ActionRequest.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java ActionRequest.getAttribute方法的具体用法?Java ActionRequest.getAttribute怎么用?Java ActionRequest.getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.portlet.ActionRequest的用法示例。


在下文中一共展示了ActionRequest.getAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSaveAndContinueRedirect

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected String getSaveAndContinueRedirect(
        ActionRequest actionRequest, Measurement measurement, Layout layout, String redirect)
    throws Exception {

    PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
        JavaConstants.JAVAX_PORTLET_CONFIG);
    
    LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcRenderCommandName", "editMeasurement");

    portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
    portletURL.setParameter("redirect", redirect, false);
    portletURL.setParameter(
        "groupId", String.valueOf(measurement.getGroupId()), false);
    portletURL.setParameter(
        "measurementId", String.valueOf(measurement.getMeasurementId()), false);
    portletURL.setWindowState(actionRequest.getWindowState());

    return portletURL.toString();
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:22,代码来源:EditMeasurementMVCActionCommand.java

示例2: MBContext

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
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);		
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:24,代码来源:MBContext.java

示例3: getSaveAndContinueRedirect

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected String getSaveAndContinueRedirect(
        ActionRequest actionRequest, TaskRecord taskRecord, Layout layout, String redirect)
    throws Exception {

    PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
        JavaConstants.JAVAX_PORTLET_CONFIG);
    
    LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcRenderCommandName", "editTaskRecord");

    portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
    portletURL.setParameter("redirect", redirect, false);
    portletURL.setParameter(
        "groupId", String.valueOf(taskRecord.getGroupId()), false);
    portletURL.setParameter(
        "taskRecordId", String.valueOf(taskRecord.getTaskRecordId()), false);
    portletURL.setWindowState(actionRequest.getWindowState());

    return portletURL.toString();
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:22,代码来源:EditTaskRecordMVCActionCommand.java

示例4: getSaveAndContinueRedirect

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected String getSaveAndContinueRedirect(
        ActionRequest actionRequest, Contact contact, Layout layout, String redirect)
    throws Exception {
    
    _log.info("getSaveAndContinueRedirect()");

    PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
        JavaConstants.JAVAX_PORTLET_CONFIG);
    
    LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcRenderCommandName", "editContact");

    portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
    portletURL.setParameter("redirect", redirect, false);
    portletURL.setParameter(
        "groupId", String.valueOf(contact.getGroupId()), false);
    portletURL.setParameter(
        "contactId", String.valueOf(contact.getContactId()), false);
    portletURL.setWindowState(actionRequest.getWindowState());

    return portletURL.toString();
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:24,代码来源:EditContactMVCActionCommand.java

示例5: JournalContext

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
/**
 * Constructor
 * 
 * @param actionRequest
 * @throws PortalException
 */
public JournalContext(ActionRequest actionRequest) throws PortalException {
	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

	// Fetch data
	numberOfArticles = ParamUtil.getLong(actionRequest, "numberOfArticles", 1);
	baseTitle = ParamUtil.getString(actionRequest, "baseTitle", "");
	baseArticle = ParamUtil.getString(actionRequest, "baseArticle", "");
	folderId = ParamUtil.getLong(actionRequest, "folderId", 0);
	totalParagraphs = ParamUtil.getInteger(actionRequest, "totalParagraphs", 0);
	titleWords = ParamUtil.getInteger(actionRequest, "titleWords", 0);
	randomAmount = ParamUtil.getInteger(actionRequest, "randomAmount", 0);
	createContentsType = ParamUtil.getLong(actionRequest, "createContentsType", 0);
	linkLists = ParamUtil.getString(actionRequest, "linkLists", "");
	ddmStructureId = ParamUtil.getLong(actionRequest, "ddmStructureId", 0);
	ddmTemplateId = ParamUtil.getLong(actionRequest, "ddmTemplateId", 0);

	// Locales
	String[] defLang = { LocaleUtil.getDefault().toString() };
	locales = ParamUtil.getStringValues(actionRequest, "locales", defLang);

	// Sites
	String[] groupsStrIds = ParamUtil.getStringValues(actionRequest, "groupIds",
			new String[] { String.valueOf(themeDisplay.getScopeGroupId()) });
	groupIds = CommonUtil.convertStringToLongArray(groupsStrIds);

	// Fetch default locale
	defaultLocale = LocaleUtil.fromLanguageId(themeDisplay.getUser().getLanguageId());

	descriptionMap = new ConcurrentHashMap<Locale, String>();
	descriptionMap.put(defaultLocale, StringPool.BLANK);
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:38,代码来源:JournalContext.java

示例6: validateFile

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected void validateFile(ActionRequest actionRequest, ActionResponse actionResponse, String folderName)
        throws Exception {

    _log.info("validateFile()");

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

    long groupId = ParamUtil.getLong(actionRequest, "groupId");

    FileEntry fileEntry = ExportImportHelperUtil.getTempFileEntry(groupId, themeDisplay.getUserId(), folderName);

    InputStream inputStream = null;

    try {
        inputStream = _dlFileEntryLocalService.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion(),
                false);

        // TODO: validate uploaded file

        JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
        //
        // if ((weakMissingReferences != null) &&
        // !weakMissingReferences.isEmpty()) {
        //
        // jsonObject.put("warningMessages",
        // StagingUtil.getWarningMessagesJSONArray(themeDisplay.getLocale(),
        // weakMissingReferences));
        // }

        JSONPortletResponseUtil.writeJSON(actionRequest, actionResponse, jsonObject);
    } finally {
        StreamUtil.cleanUp(inputStream);
    }
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:35,代码来源:ImportMeasurementsMVCActionCommand.java

示例7: handleUploadException

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected void handleUploadException(ActionRequest actionRequest, ActionResponse actionResponse, String folderName,
        Exception e) throws Exception {

    _log.info("handleUploadException()");

    HttpServletResponse response = _portal.getHttpServletResponse(actionResponse);

    response.setContentType(ContentTypes.TEXT_HTML);
    response.setStatus(HttpServletResponse.SC_OK);

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

    deleteTempFileEntry(themeDisplay.getScopeGroupId(), folderName);

    JSONObject jsonObject = StagingUtil.getExceptionMessagesJSONObject(themeDisplay.getLocale(), e,
            (ExportImportConfiguration) null);

    JSONPortletResponseUtil.writeJSON(actionRequest, actionResponse, jsonObject);
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:20,代码来源:ImportMeasurementsMVCActionCommand.java

示例8: addTempFileEntry

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected void addTempFileEntry(ActionRequest actionRequest, String folderName) throws Exception {

        _log.info("addTempFileEntry()");

        UploadPortletRequest uploadPortletRequest = _portal.getUploadPortletRequest(actionRequest);

        checkExceededSizeLimit(uploadPortletRequest);

        long groupId = ParamUtil.getLong(actionRequest, "groupId");

        deleteTempFileEntry(groupId, folderName);

        InputStream inputStream = null;

        try {
            String sourceFileName = uploadPortletRequest.getFileName("file");

            inputStream = uploadPortletRequest.getFileAsStream("file");

            String contentType = uploadPortletRequest.getContentType("file");

            _layoutService.addTempFileEntry(groupId, folderName, sourceFileName, inputStream, contentType);
        } catch (Exception e) {
            UploadException uploadException = (UploadException) actionRequest.getAttribute(WebKeys.UPLOAD_EXCEPTION);

            if (uploadException != null) {
                Throwable cause = uploadException.getCause();

                if (cause instanceof FileUploadBase.IOFileUploadException) {
                    if (_log.isInfoEnabled()) {
                        _log.info("Temporary upload was cancelled");
                    }
                }

                if (uploadException.isExceededFileSizeLimit()) {
                    throw new FileSizeException(cause);
                }

                if (uploadException.isExceededUploadRequestSizeLimit()) {
                    throw new UploadRequestSizeException(cause);
                }
            } else {
                throw e;
            }
        } finally {
            StreamUtil.cleanUp(inputStream);
        }
    }
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:49,代码来源:ImportMeasurementsMVCActionCommand.java

示例9: importData

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected void importData(ActionRequest actionRequest, String folderName) throws Exception {

        _log.info("importData()");

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

        long groupId = ParamUtil.getLong(actionRequest, "groupId");

        FileEntry fileEntry = ExportImportHelperUtil.getTempFileEntry(groupId, themeDisplay.getUserId(), folderName);

        InputStream inputStream = null;

        try {
            inputStream = _dlFileEntryLocalService.getFileAsStream(fileEntry.getFileEntryId(), fileEntry.getVersion(),
                    false);

            importData(actionRequest, fileEntry.getTitle(), inputStream);

            deleteTempFileEntry(groupId, folderName);
        } finally {
            StreamUtil.cleanUp(inputStream);
        }
    }
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:24,代码来源:ImportTaskRecordsMVCActionCommand.java

示例10: importData

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected void importData(ActionRequest actionRequest, String fileName, InputStream inputStream) throws Exception {

        _log.info("importData()");

        String extension = FileUtil.getExtension(fileName);

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

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

        long groupId = ParamUtil.getLong(actionRequest, "groupId");

        Map<String, Serializable> importMeasurementSettingsMap = ExportImportConfigurationSettingsMapFactory
                .buildImportMeasurementsSettingsMap(themeDisplay.getUserId(), groupId, actionRequest.getParameterMap(),
                        themeDisplay.getLocale(), themeDisplay.getTimeZone());

        // TODO: reconsider addDraft...
        // TODO: reconsider TYPE_IMPORT_LAYOUT
        ExportImportConfiguration exportImportConfiguration = _exportImportConfigurationLocalService
                .addDraftExportImportConfiguration(themeDisplay.getUserId(),
                        ExportImportConfigurationConstants.TYPE_IMPORT_LAYOUT, importMeasurementSettingsMap);

        _measurementService.importMeasurementsInBackground(exportImportConfiguration, inputStream, extension);

    }
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:26,代码来源:ImportMeasurementsMVCActionCommand.java

示例11: deleteBackgroundTasks

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected void deleteBackgroundTasks(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    
    _log.info("deleteBackgroundTasks()");

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    long groupId = themeDisplay.getScopeGroupId();

    try {
        long[] backgroundTaskIds = ParamUtil.getLongValues(actionRequest, "deleteBackgroundTaskIds");

        for (long backgroundTaskId : backgroundTaskIds) {
            _measurementService.deleteBackgroundTask(groupId, backgroundTaskId);
        }
    } catch (Exception e) {
        if (e instanceof NoSuchBackgroundTaskException || e instanceof PrincipalException) {

            SessionErrors.add(actionRequest, e.getClass());

            actionResponse.setRenderParameter("mvcPath", "/error.jsp");

            hideDefaultSuccessMessage(actionRequest);

        } else {
            throw e;
        }
    }

    addSuccessMessage(actionRequest, actionResponse);

}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:31,代码来源:ImportMeasurementsMVCActionCommand.java

示例12: JoinSiteStatusTerm

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
public JoinSiteStatusTerm(ActionRequest request) {

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

		JoinSiteStatusId = ParamUtil.getLong(request, JOIN_SITE_STATUS_ID);
		
		groupId = themeDisplay.getScopeGroupId();
		
		companyId = themeDisplay.getCompanyId();
		
		userId = themeDisplay.getUserId();
		
		userName = themeDisplay.getUser().getFullName();
		
		createDate = ParamUtil.getDate(request, CREATE_DATE,
				DateTimeUtils.getDateTimeFormat(DateTimeUtils._VN_DATE_TIME_FORMAT));
		
		modifiedDate = ParamUtil.getDate(request, MODIFIED_DATE,
				DateTimeUtils.getDateTimeFormat(DateTimeUtils._VN_DATE_TIME_FORMAT));
		
		employeeId = ParamUtil.getLong(request, EMPLOYEE_ID);
		
		joinSiteGroupId = ParamUtil.getLong(request, JOIN_SITE_GROUP_ID);
		
		status = ParamUtil.getInteger(request, STATUS);
		
	}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:28,代码来源:JoinSiteStatusTerm.java

示例13: getExportImportConfiguration

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected ExportImportConfiguration getExportImportConfiguration(ActionRequest actionRequest) throws Exception {

        Map<String, Serializable> exportContactsSettingsMap = null;

        long exportImportConfigurationId = ParamUtil.getLong(actionRequest, "exportImportConfigurationId");

        if (exportImportConfigurationId > 0) {
            ExportImportConfiguration exportImportConfiguration = _exportImportConfigurationLocalService
                    .fetchExportImportConfiguration(exportImportConfigurationId);

            if (exportImportConfiguration != null) {
                exportContactsSettingsMap = exportImportConfiguration.getSettingsMap();
            }
        }

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

        if (exportContactsSettingsMap == null) {

            exportContactsSettingsMap = ExportImportContactsConfigurationSettingsMapFactory
                    .buildExportContactsSettingsMap(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
                            themeDisplay.getPlid(), themeDisplay.getScopeGroupId(), PortletKeys.CONTACT_MANAGER,
                            actionRequest.getParameterMap(), themeDisplay.getLocale(), TimeZone.getDefault(), null);
        }

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

        if (Validator.isNull(taskName)) {

            taskName = "contacts";

        }

        return _exportImportConfigurationLocalService.addDraftExportImportConfiguration(themeDisplay.getUserId(),
                taskName, ExportImportConfigurationConstants.TYPE_EXPORT_LAYOUT, exportContactsSettingsMap);
    }
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:37,代码来源:ExportContactsMVCActionCommand.java

示例14: deleteBackgroundTasks

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected void deleteBackgroundTasks(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

        ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
        long groupId = themeDisplay.getScopeGroupId();

        try {
            long[] backgroundTaskIds = ParamUtil.getLongValues(actionRequest, "deleteBackgroundTaskIds");

            for (long backgroundTaskId : backgroundTaskIds) {
                _contactService.deleteBackgroundTask(groupId, backgroundTaskId);
            }
        } catch (Exception e) {
            if (e instanceof NoSuchBackgroundTaskException || e instanceof PrincipalException) {

                SessionErrors.add(actionRequest, e.getClass());

                actionResponse.setRenderParameter("mvcPath", "/error.jsp");

                hideDefaultSuccessMessage(actionRequest);

            } else {
                throw e;
            }
        }

        addSuccessMessage(actionRequest, actionResponse);

    }
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:29,代码来源:ImportContactsMVCActionCommand.java

示例15: getExportImportConfiguration

import javax.portlet.ActionRequest; //导入方法依赖的package包/类
protected ExportImportConfiguration getExportImportConfiguration(ActionRequest actionRequest) throws Exception {

        Map<String, Serializable> exportContactsSettingsMap = null;

        long exportImportConfigurationId = ParamUtil.getLong(actionRequest, "exportImportConfigurationId");

        if (exportImportConfigurationId > 0) {
            ExportImportConfiguration exportImportConfiguration = _exportImportConfigurationLocalService
                    .fetchExportImportConfiguration(exportImportConfigurationId);

            if (exportImportConfiguration != null) {
                exportContactsSettingsMap = exportImportConfiguration.getSettingsMap();
            }
        }

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

        if (exportContactsSettingsMap == null) {

            // TODO: use buildImportContactsSettingsMap
            exportContactsSettingsMap = ExportImportContactsConfigurationSettingsMapFactory
                    .buildExportContactsSettingsMap(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
                            themeDisplay.getPlid(), themeDisplay.getScopeGroupId(), PortletKeys.CONTACT_MANAGER,
                            actionRequest.getParameterMap(), themeDisplay.getLocale(), TimeZone.getDefault(), null);
        }

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

        if (Validator.isNull(taskName)) {

            taskName = "contacts";

        }

        return _exportImportConfigurationLocalService.addDraftExportImportConfiguration(themeDisplay.getUserId(),
                taskName, ExportImportConfigurationConstants.TYPE_EXPORT_LAYOUT, exportContactsSettingsMap);
    }
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:38,代码来源:ImportContactsMVCActionCommand.java


注:本文中的javax.portlet.ActionRequest.getAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。