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


Java UploadPortletRequest类代码示例

本文整理汇总了Java中com.liferay.portal.kernel.upload.UploadPortletRequest的典型用法代码示例。如果您正苦于以下问题:Java UploadPortletRequest类的具体用法?Java UploadPortletRequest怎么用?Java UploadPortletRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: prettify

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
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;
}
 
开发者ID:tmoreira2020,项目名称:portal-properties-prettier-app,代码行数:22,代码来源:PortalPropertiesPrettierPortlet.java

示例2: getParametersMapWithoutNulls

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
private Map<String, String[]> getParametersMapWithoutNulls(UploadPortletRequest portletRequest) {
	Map<String, String[]> parametersMapWithoutNulls = portletRequest.getParameterMap();
	List<String> keysToRemove = new ArrayList<String>();
	
	java.util.Iterator<String> it = parametersMapWithoutNulls.keySet().iterator();
	while(it.hasNext()) {
		String key = it.next();
		if (parametersMapWithoutNulls.get(key) == null) {
			keysToRemove.add(key);
		}
	}
	for (int i = 0; i < keysToRemove.size(); i++) {
		parametersMapWithoutNulls.remove(keysToRemove.get(i));
	}
	return parametersMapWithoutNulls;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:17,代码来源:BaseCourseAdminPortlet.java

示例3: EmployeeFileTerm

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public EmployeeFileTerm(ActionRequest actionRequest) {

		UploadPortletRequest request = PortalUtil.getUploadPortletRequest(actionRequest);
		
		ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
		
		fileName= request.getFileName("uploadedFile");
		
		file =  request.getFile("uploadedFile");

		mimeType = request.getContentType("uploadedFile");
		
		employeeFileId = ParamUtil.getLong(request, EMPLOYEE_FILE_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);
		
		fileEntryId = ParamUtil.getLong(request, FILE_ENTRY_ID);
		
		documentName = ParamUtil.getString(request, DOCUMENT_NAME);
		
		if(Validator.isNull(documentName)){
			documentName = fileName;
		}
		
	}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:40,代码来源:EmployeeFileTerm.java

示例4: multiMediaFromRequest

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
/**
 * Creates a MultiMedia object out of fields from the request.
 *
 * @param request
 * @return multiMedia
 */
public static MultiMedia multiMediaFromRequest(UploadPortletRequest request) {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
    MultiMedia model = new MultiMediaImpl();
    
    model.setMultiMediaId(ParamUtil.getLong(request, "multiMediaId"));
    model.setCompanyId(themeDisplay.getCompanyId());
    model.setUserId(themeDisplay.getUserId());
    
    model.setName(ParamUtil.getString(request, "name").trim());
    model.setType(ParamUtil.getInteger(request, "type"));
    model.setApplicationId(ParamUtil.getLong(request, "applicationId"));
    return model;
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:20,代码来源:ActionUtil.java

示例5: getAssetTagNames

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public static String[] getAssetTagNames(UploadPortletRequest uploadRequest)
{
	// En teor�a tenemos que obtener los tags y categories as�, pero 
	// hay que tener en cuenta que es un multipart y los params est�n realmente
	// en el uploadRequest y no en el actionRequest:			
	// http://www.liferay.com/community/wiki/-/wiki/Main/ServiceContext+Pattern
			
	return StringUtil.split(ParamUtil.getString(uploadRequest, "assetTagNames"));		
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:10,代码来源:LiferayViewUtil.java

示例6: addAlbum

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public void addAlbum(ActionRequest request, ActionResponse response)
	throws Exception {

	UploadPortletRequest uploadPortletRequest =
		PortalUtil.getUploadPortletRequest(request);

	long artistId = ParamUtil.getLong(uploadPortletRequest, "artistId");
	String name = ParamUtil.getString(uploadPortletRequest, "name");
	int year = ParamUtil.getInteger(uploadPortletRequest, "year");

	InputStream inputStream = uploadPortletRequest.getFileAsStream("file");

	ServiceContext serviceContext = ServiceContextFactory.getInstance(
		Album.class.getName(), uploadPortletRequest);

	try {
		AlbumServiceUtil.addAlbum(
			artistId, name, year, inputStream, serviceContext);

		SessionMessages.add(request, "albumAdded");

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

		response.sendRedirect(redirect);
	}
	catch (Exception e) {
		SessionErrors.add(request, e.getClass().getName());

		if (e instanceof AlbumNameException ||
			e instanceof PrincipalException) {

			response.setRenderParameter(
				"jspPage", "/html/albums/edit_album.jsp");
		}
		else {
			response.setRenderParameter("jspPage", "/html/error.jsp");
		}
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:41,代码来源:JukeboxPortlet.java

示例7: addArtist

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public void addArtist(ActionRequest request, ActionResponse response)
throws Exception {

	UploadPortletRequest uploadPortletRequest =
		PortalUtil.getUploadPortletRequest(request);

	String name = ParamUtil.getString(uploadPortletRequest, "name");

	String bio = ParamUtil.getString(uploadPortletRequest, "bio");

	InputStream inputStream = uploadPortletRequest.getFileAsStream(
		"file");

	ServiceContext serviceContext = ServiceContextFactory.getInstance(
		Artist.class.getName(), uploadPortletRequest);

	try {
		ArtistServiceUtil.addArtist(
			name, bio, inputStream, serviceContext);

		SessionMessages.add(request, "artistAdded");

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

		response.sendRedirect(redirect); }
	catch (Exception e) {
		SessionErrors.add(request, e.getClass().getName());

		if (e instanceof ArtistNameException ||
			e instanceof PrincipalException) {

			response.setRenderParameter(
				"jspPage", "/html/artists/edit_artist.jsp");
		}
		else {
			response.setRenderParameter("jspPage", "/html/error.jsp");
		}
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:41,代码来源:JukeboxPortlet.java

示例8: getUploadRequestFile

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
private File getUploadRequestFile(UploadPortletRequest uploadRequest,
		String paramName) throws LARFileException {
	File file = null;
	if (Validator.isNotNull(uploadRequest.getFileName(paramName))) {
		file = uploadRequest.getFile(paramName);
		if (!file.exists()) {
			throw new LARFileException("Import file '" + paramName
					+ "' does not exist");
		}
	}
	return file;
}
 
开发者ID:rivetlogic,项目名称:hr-portal,代码行数:13,代码来源:EditUserAction.java

示例9: addArtist

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public void addArtist(ActionRequest request, ActionResponse response)
	throws Exception {

	UploadPortletRequest uploadPortletRequest =
		PortalUtil.getUploadPortletRequest(request);

	String name = ParamUtil.getString(uploadPortletRequest, "name");

	String bio = ParamUtil.getString(uploadPortletRequest, "bio");

	InputStream inputStream = uploadPortletRequest.getFileAsStream(
		"file");

	ServiceContext serviceContext = ServiceContextFactory.getInstance(
		Artist.class.getName(), uploadPortletRequest);

	try {
		ArtistServiceUtil.addArtist(
			name, bio, inputStream, serviceContext);

		SessionMessages.add(request, "artistAdded");

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

		response.sendRedirect(redirect); }
	catch (Exception e) {
		SessionErrors.add(request, e.getClass().getName());

		if (e instanceof ArtistNameException ||
			e instanceof PrincipalException) {

			response.setRenderParameter(
				"jspPage", "/html/artists/edit_artist.jsp");
		}
		else {
			response.setRenderParameter("jspPage", "/html/error.jsp");
		}
	}
}
 
开发者ID:juliocamarero,项目名称:jukebox,代码行数:41,代码来源:JukeboxPortlet.java

示例10: addTempFileEntry

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的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-timetracker,代码行数:49,代码来源:ImportTaskRecordsMVCActionCommand.java

示例11: create

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public void create(
		ActionRequest actionRequest, ActionResponse actionResponse)
	throws Exception { 

	UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(
		actionRequest);

	RequestContext requestContext = new RequestContext(uploadRequest);

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

	String handlerName = ParamUtil.getString(uploadRequest, "handlerName");

	BaseHandler handler = HandlerUtil.getHandler(handlerName);

	boolean handlerIsPortalType = HandlerUtil.isPortalType(handlerName);

	long[] groupIds = requestContext.getGroupIds();

	if ((groupIds.length <= 0) || handlerIsPortalType) {
		groupIds = new long[] {themeDisplay.getScopeGroupId()};
	}

	long[] userIds = requestContext.getUserIds();

	if ((userIds.length <= 0) || handlerIsPortalType) {
		userIds = new long[] {themeDisplay.getUserId()};
	}

	for (long groupId : groupIds) {
		for (long userId : userIds) {
			requestContext = new RequestContext(uploadRequest);

			requestContext.setGroupId(groupId);
			requestContext.setUserId(userId);

			HandlerThread handlerThread = new HandlerThread(
				handler, requestContext);

			handlerThread.start();
		}
	}
}
 
开发者ID:sorin-pop,项目名称:data-manipulator,代码行数:45,代码来源:DataManipulatorAdmin.java

示例12: testPrettifyPortletRequest

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
@Test
public void testPrettifyPortletRequest() throws Exception {
	String liferayVersion = "6.2.3-ga4";
	boolean printDefaultValue = false;
	MockActionRequest request = new MockActionRequest();
	String expected = "expected";
	ByteArrayInputStream in = new ByteArrayInputStream(expected.getBytes());
	UploadPortletRequest uploadPortletRequest = createNiceMock(UploadPortletRequest.class);

	expect(uploadPortletRequest.getParameter("liferayVersion")).andReturn(
			liferayVersion);
	expect(uploadPortletRequest.getParameter("printDefaultValue"))
			.andReturn(String.valueOf(printDefaultValue));
	expect(uploadPortletRequest.getFileAsStream("portalPropertiesFile"))
			.andReturn(in);
	replay(uploadPortletRequest);

	Portal portal = createMock(Portal.class);

	expect(portal.getUploadPortletRequest(request)).andReturn(
			uploadPortletRequest);
	replay(portal);
	new PortalUtil().setPortal(portal);

	PortalPropertiesPrettierPortlet portlet = createMockBuilder(
			PortalPropertiesPrettierPortlet.class).addMockedMethod(
			"incrementCounter").createMock();

	PortalPropertiesPrettier prettier = createMock(PortalPropertiesPrettier.class);
	expect(
			prettier.prettify(anyObject(Properties.class),
					eq(liferayVersion), eq(printDefaultValue))).andReturn(
			expected);
	replay(prettier);

	portlet.prettier = prettier;

	portlet.incrementCounter(request);
	replay(portlet);

	String actual = portlet.prettify(request);

	Assert.assertEquals(expected, actual);
	verify(portlet);
	verify(portal);
	verify(uploadPortletRequest);
	verify(prettier);
}
 
开发者ID:tmoreira2020,项目名称:portal-properties-prettier-app,代码行数:49,代码来源:PortalPropertiesPrettierPortletTest.java

示例13: getAssetCategoryIds

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public static long[] getAssetCategoryIds(UploadPortletRequest uploadRequest)
{
	return StringUtil.split(ParamUtil.getString(uploadRequest, "assetCategoryIds"), 0L);	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:5,代码来源:LiferayViewUtil.java

示例14: importCourse

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public void importCourse(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

		UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
		long groupId = ParamUtil.getLong(uploadRequest, "groupId");
		
		try {

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

			File file = uploadRequest.getFile("importFileName");
			if (!file.exists()) {
				//	log.debug("Import file does not exist");
				throw new LARFileException("Import file does not exist");
			}
			String portletId = (String) actionRequest.getAttribute(WebKeys.PORTLET_ID);
			LayoutServiceUtil.importPortletInfo(themeDisplay.getLayout().getPlid(), groupId,portletId, uploadRequest.getParameterMap(), file);
			addSuccessMessage(actionRequest, actionResponse);
			
			/* Si esta seleccionado el modo de borrar tenemos que progpagar borrado de icono de la clase*/
			
			if(uploadRequest.getParameter(PortletDataHandlerKeys.DELETE_PORTLET_DATA).equals("true")){
				Course c = CourseLocalServiceUtil.getCourseByGroupCreatedId(groupId);
				c.setIcon(0);
				CourseLocalServiceUtil.updateCourse(c);
			}
			
			SessionMessages.add(actionRequest, "import-course-ok");

		} catch (Exception e) {
			e.printStackTrace();
			if ((e instanceof LARFileException) || (e instanceof LARTypeException)) {

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

			} if(e.getMessage() != null && e.getMessage().indexOf(NoLearningActivityTypeActiveException.class.getName()) >= 0){
				e.printStackTrace();
				actionResponse.setRenderParameter("view", "import");
				actionResponse.setRenderParameter("groupId", String.valueOf(groupId));
				SessionErrors.add(actionRequest, "error-learning-activity-type");	
			}
			else {
				log.error(e, e);
				SessionErrors.add(actionRequest, LayoutImportException.class.getName());
			}
		}
	}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:47,代码来源:CourseAdmin.java

示例15: addfiles

import com.liferay.portal.kernel.upload.UploadPortletRequest; //导入依赖的package包/类
public void addfiles(ActionRequest actionRequest, ActionResponse actionResponse)
		throws Exception {

	ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
	UploadPortletRequest request = PortalUtil.getUploadPortletRequest(actionRequest);

	String jspPage = ParamUtil.getString(actionRequest, "jspPage");
	long actId = ParamUtil.getLong(actionRequest, "resId", 0);
	String description = request.getParameter("description");
	String youtubecode=ParamUtil.getString(request,"youtubecode","");
	boolean videoControlEnabled=ParamUtil.getBoolean(request,"videoControl");
	LearningActivity larn = LearningActivityServiceUtil.getLearningActivity(actId);
	String extraContent=larn.getExtracontent();
	Document document = SAXReaderUtil.createDocument();
	Element rootElement = document.addElement("multimediaentry");
	if(extraContent!=null &&!"".equals(extraContent)&&!Validator.isNumber(extraContent))
	{
		document=SAXReaderUtil.read(extraContent);
		rootElement =document.getRootElement();
	}

	if(!"".equals(youtubecode))
	{
		Element video=rootElement.element("video");
		if(video!=null)
		{
			video.detach();
			rootElement.remove(video);
		}
		video = SAXReaderUtil.createElement("video");
		video.setText(youtubecode);		
		rootElement.add(video);
	}
	
	Element videoControl=rootElement.element("video-control");
	if(videoControl!=null)
	{
		videoControl.detach();
		rootElement.remove(videoControl);
	}
	
	videoControl = SAXReaderUtil.createElement("video-control");
	videoControl.setText(String.valueOf(videoControlEnabled));		
	rootElement.add(videoControl);
	
	larn.setExtracontent(document.formattedString());
	larn.setDescription( description,themeDisplay.getLocale());
	//LearningActivityServiceUtil.modLearningActivity(larn, serviceContext);

	LearningActivityServiceUtil.modLearningActivity(larn);
	//auditing
	AuditingLogFactory.audit(larn.getCompanyId(), larn.getGroupId(), LearningActivity.class.getName(), larn.getPrimaryKey(), themeDisplay.getUserId(), AuditConstants.UPDATE, null);
	
	SessionMessages.add(actionRequest, "activity-saved-successfully");
	actionResponse.setRenderParameter("jspPage", jspPage);
	actionResponse.setRenderParameter("actionEditingDetails", "true");	
	actionResponse.setRenderParameter("resId", Long.toString(actId));
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:59,代码来源:ResourceExternalActivity.java


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