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


Java PortalUtil类代码示例

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


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

示例1: processLifecycleEvent

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
@Override
public void processLifecycleEvent(LifecycleEvent lifecycleEvent) throws ActionException {
	User user;
	try {
		user = PortalUtil.getUser(lifecycleEvent.getRequest());
		
		PrincipalThreadLocal.setName(user.getUserId());

		PermissionChecker permissionChecker;

		permissionChecker = PermissionCheckerFactoryUtil.create(user);

		PermissionThreadLocal.setPermissionChecker(permissionChecker);

		String friendlyUrl = user.getSiteGroups().get(0).getFriendlyURL();

		lifecycleEvent.getResponse().sendRedirect("/group" + friendlyUrl);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:24,代码来源:LoginPostAction.java

示例2: buildFields

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
/**
 * Build content field
 *
 * @param groupId Company group ID
 * @param locales locales
 * @param baseArticle content data
 * @return DDMStructure applied content XML strings
 * @throws Exception
 */
public String buildFields(long groupId, String[] locales, String baseArticle) throws Exception {
	DDMStructure ddmStructure = 
		_DDMStructureLocalService.getStructure(
			groupId,
			PortalUtil.getClassNameId(JournalArticle.class), 
			LDFPortletKeys._DDM_STRUCTURE_KEY
		);

	Map<String, Serializable> fieldsMap = Maps.newConcurrentMap();
	fieldsMap.put(DDM_CONTENT, baseArticle);

	Fields fields = _ddmLocalUtil.toFields(
			ddmStructure.getStructureId(), 
			fieldsMap, 
			locales,
			LocaleUtil.getDefault());

	return _journalConverter.getContent(ddmStructure, fields);
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:29,代码来源:JournalUtils.java

示例3: runSQL

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
	try {
		DataSource dataSource = regionPersistence.getDataSource();

		DB db = DBManagerUtil.getDB();

		sql = db.buildSQL(sql);
		sql = PortalUtil.transformSQL(sql);

		SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
				sql);

		sqlUpdate.update();
	}
	catch (Exception e) {
		throw new SystemException(e);
	}
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:24,代码来源:RegionLocalServiceBaseImpl.java

示例4: runSQL

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
	try {
		DataSource dataSource = countryPersistence.getDataSource();

		DB db = DBManagerUtil.getDB();

		sql = db.buildSQL(sql);
		sql = PortalUtil.transformSQL(sql);

		SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
				sql);

		sqlUpdate.update();
	}
	catch (Exception e) {
		throw new SystemException(e);
	}
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:24,代码来源:CountryLocalServiceBaseImpl.java

示例5: runSQL

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
/**
 * Performs a SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) {
	try {
		DataSource dataSource = fooPersistence.getDataSource();

		DB db = DBManagerUtil.getDB();

		sql = db.buildSQL(sql);
		sql = PortalUtil.transformSQL(sql);

		SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
				sql);

		sqlUpdate.update();
	}
	catch (Exception e) {
		throw new SystemException(e);
	}
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:24,代码来源:FooServiceBaseImpl.java

示例6: isRelatedEntry

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
@Override
protected boolean isRelatedEntry(Data data) {

	long groupId = data.getGroupId();
	long repositoryId = data.get("repositoryId", -1L);

	boolean hiddenFolder = isHiddenFolder(groupId, repositoryId);

	if (!hiddenFolder) {
		return false;
	}

	long classNameId = data.get("classNameId", 0L);

	if (classNameId == 0) {
		return false;
	}

	String permissionsClassName = PortalUtil.getClassName(classNameId);

	return ArrayUtil.contains(
		validPermissionClassNames, permissionsClassName);
}
 
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:24,代码来源:DLFileEntryPermissionsHelper.java

示例7: isRelatedEntry

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
@Override
protected boolean isRelatedEntry(Data data) {

	long categoryId = data.get("categoryId", 0L);

	if (categoryId != MBCategoryConstants.DISCUSSION_CATEGORY_ID) {
		return false;
	}

	long classNameId = data.get("classNameId", 0L);

	if (classNameId == 0) {
		return false;
	}

	String permissionsClassName = PortalUtil.getClassName(classNameId);

	return ArrayUtil.contains(
		validPermissionClassNames, permissionsClassName);
}
 
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:21,代码来源:MBMessagePermissionsHelper.java

示例8: EmployeeFileTerm

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的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

示例9: getCurrentLayoutFriendlyURL

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
/**
 * Get current layout friendly URL
 * 
 * @return String friendly URL for the current layout
 * @throws PortalException
 */
public static String getCurrentLayoutFriendlyURL(PortletRequest portletRequest)
	throws PortalException {

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

	Layout selectedLayout =
		LayoutLocalServiceUtil.getLayout(themeDisplay.getPlid());
	return PortalUtil.getLayoutFriendlyURL(selectedLayout, themeDisplay);
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:17,代码来源:GSearchUtil.java

示例10: getNotLayoutBoundJournalArticleUrl

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
/**
 * Get a view url for an article which is not bound to a layout or has a
 * default view page.
 * 
 * @return url string
 * @throws PortalException
 */
protected String getNotLayoutBoundJournalArticleUrl()
	throws PortalException {

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

	Layout layout = GSearchUtil.getLayoutByFriendlyURL(
		_portletRequest, _assetPublisherPageFriendlyURL);

	String assetPublisherInstanceId =
		GSearchUtil.findDefaultAssetPublisherInstanceId(layout);

	JournalArticle journalArticle = getJournalArticle();

	StringBundler sb = new StringBundler();
	sb.append(PortalUtil.getLayoutFriendlyURL(layout, themeDisplay));
	sb.append("/-/asset_publisher/");
	sb.append(assetPublisherInstanceId);
	sb.append("/content/");
	sb.append(journalArticle.getUrlTitle());
	sb.append("?_");
	sb.append(AssetPublisherPortletKeys.ASSET_PUBLISHER);
	sb.append("_INSTANCE_");
	sb.append(assetPublisherInstanceId);
	sb.append("_groupId=");
	sb.append(journalArticle.getGroupId());

	return sb.toString();
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:37,代码来源:JournalArticleItemBuilder.java

示例11: getLink

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String getLink() {

	StringBundler sb = new StringBundler();
	sb.append(PortalUtil.getPortalURL(_portletRequest));
	sb.append("/documents/");
	sb.append(_document.get(Field.SCOPE_GROUP_ID));
	sb.append("/");
	sb.append(_document.get(Field.FOLDER_ID));
	sb.append("/");
	sb.append(_document.get("path"));

	return sb.toString();
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:18,代码来源:DLFileEntryItemBuilder.java

示例12: doLogin

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
@Override
protected String[] doLogin(
		HttpServletRequest request, HttpServletResponse response)
	throws Exception {

	String[] credentials = null;

	long companyId = PortalUtil.getCompanyId(request);

	User autoLoginUser = null;

	try {
		autoLoginUser = _userLocalService.getUserByEmailAddress(
			companyId, "[email protected]");
	}
	catch (Exception e) {
	}

	if (autoLoginUser != null) {
		credentials = new String[3];

		credentials[0] = Long.toString(autoLoginUser.getUserId());
		credentials[1] = autoLoginUser.getPassword();
		credentials[2] = Boolean.toString(true);
	}

	return credentials;
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:29,代码来源:BladeAutoLogin.java

示例13: generateSQLCriterion

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
public static Criterion generateSQLCriterion(String sql) {
	if (Validator.isNull(sql)) {
		return null;
	}

	sql = PortalUtil.transformSQL(sql);

	return RestrictionsFactoryUtil.sqlRestriction(sql);
}
 
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:10,代码来源:ModelUtil.java

示例14: addDDLRecordSet

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
private static void addDDLRecordSet(final DdlRecordset recordSet, final long groupId)
        throws SystemException, PortalException {
    LOG.info("Adding DDLRecordSet " + recordSet.getName());
    Map<Locale, String> nameMap = new HashMap<>();
    Locale siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);
    nameMap.put(siteDefaultLocale, recordSet.getName());
    Map<Locale, String> descMap = new HashMap<>();
    descMap.put(siteDefaultLocale, recordSet.getDescription());
    DDLRecordSet ddlRecordSet = null;
    try {
        ddlRecordSet = DDLRecordSetLocalServiceUtil.fetchRecordSet(groupId, recordSet.getKey());
    } catch (SystemException e) {
        LOG.error("Error while trying to find DDLRecordSet with key: " + recordSet.getKey(), e);
    }

    if (ddlRecordSet != null) {
        LOG.info("DDLRecordSet already exists and will be overwritten.");
        ddlRecordSet.setNameMap(nameMap);
        ddlRecordSet.setDescriptionMap(descMap);
        ddlRecordSet.setDDMStructureId(ResolverUtil
                .getStructureId(recordSet.getDdlStructureKey(), groupId, DDLRecordSet.class, false));
        DDLRecordSetLocalServiceUtil.updateDDLRecordSet(ddlRecordSet);
        LOG.info("DDLRecordSet successfully updated: " + recordSet.getName());
        return;
    }

    DDLRecordSet newDDLRecordSet = DDLRecordSetLocalServiceUtil.addRecordSet(
            LiferaySetup.getRunAsUserId(), groupId,
            ResolverUtil.getStructureId(recordSet.getDdlStructureKey(), groupId,
                    DDLRecordSet.class, false),
            recordSet.getDdlStructureKey(), nameMap, descMap, MIN_DISPLAY_ROWS, 0,
            new ServiceContext());
    LOG.info("Added DDLRecordSet: " + newDDLRecordSet.getName());
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:35,代码来源:SetupArticles.java

示例15: getDefaultLocale

import com.liferay.portal.kernel.util.PortalUtil; //导入依赖的package包/类
public static Locale getDefaultLocale(final long groupId, final String locationHint) {
    Locale siteDefaultLocale = null;
    try {
        siteDefaultLocale = PortalUtil.getSiteDefaultLocale(groupId);
    } catch (PortalException | SystemException e) {
        LOG.error("Error Reading Locale while for " + locationHint);
    }
    return siteDefaultLocale;
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:10,代码来源:TitleMapUtil.java


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