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


Java LayoutSetPrototype.getLayoutSetPrototypeId方法代码示例

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


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

示例1: createDefaultSiteTemplate

import com.liferay.portal.model.LayoutSetPrototype; //导入方法依赖的package包/类
public void createDefaultSiteTemplate(long companyId) throws PortalException, SystemException 
{
	boolean exists = false;
	long layoutSetPrototypeId = 0;
	for(LayoutSetPrototype lay:LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypes(0, LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypesCount())){
		if(lay.getCompanyId() == companyId && "course".equals(lay.getName(LocaleUtil.getDefault()))) {
			exists=true;
			layoutSetPrototypeId = lay.getLayoutSetPrototypeId();
		}
	}
	
	if(!exists){
		long defaultUserId = UserLocalServiceUtil.getDefaultUserId(companyId);
		Map<Locale, String> nameMap = new HashMap<Locale, String>();
		nameMap.put(LocaleUtil.getDefault(), "course");
		layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype(defaultUserId, companyId, nameMap, "course", true,true,new ServiceContext());
		InputStream larStream=this.getClass().getClassLoader().getResourceAsStream("/course.lar");
		LayoutLocalServiceUtil.importLayouts(defaultUserId,layoutSetPrototype.getGroup().getGroupId() , 
				layoutSetPrototype.getLayoutSet().isPrivateLayout(), getLayoutSetPrototypeParameters(), larStream);
	} else {
		layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(layoutSetPrototypeId);
	}
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:25,代码来源:StartupAction.java

示例2: afterPropertiesSet

import com.liferay.portal.model.LayoutSetPrototype; //导入方法依赖的package包/类
public void afterPropertiesSet() throws Exception {
	User user = UserLocalServiceUtil.getDefaultUser(companyId);

	userId = user.getUserId();

	Group group = null;

	if (targetClassName.equals(LayoutSetPrototype.class.getName())) {
		LayoutSetPrototype layoutSetPrototype = getLayoutSetPrototype(
			companyId, targetValue);

		if (layoutSetPrototype != null) {
			existing = true;
		}
		else {
			layoutSetPrototype =
				LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype(
					userId, companyId, getTargetValueMap(),
					StringPool.BLANK, true, true, new ServiceContext());
		}

		group = layoutSetPrototype.getGroup();

		targetClassPK = layoutSetPrototype.getLayoutSetPrototypeId();
	}
	else if (targetClassName.equals(Group.class.getName())) {
		if (targetValue.equals(GroupConstants.GUEST)) {
			group = GroupLocalServiceUtil.getGroup(
				companyId, GroupConstants.GUEST);

			List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
				group.getGroupId(), false,
				LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, false, 0, 1);

			if (!layouts.isEmpty()) {
				Layout layout = layouts.get(0);

				LayoutTypePortlet layoutTypePortlet =
					(LayoutTypePortlet)layout.getLayoutType();

				List<String> portletIds = layoutTypePortlet.getPortletIds();

				if (portletIds.size() != 2) {
					existing = true;
				}

				for (String portletId : portletIds) {
					if (!portletId.equals("47") &&
						!portletId.equals("58")) {

						existing = true;
					}
				}
			}
		}
		else {
			group = GroupLocalServiceUtil.fetchGroup(
				companyId, targetValue);

			if (group != null) {
				existing = true;
			}
			else {
				group = GroupLocalServiceUtil.addGroup(
					userId, GroupConstants.DEFAULT_PARENT_GROUP_ID,
					StringPool.BLANK,
					GroupConstants.DEFAULT_PARENT_GROUP_ID,
					GroupConstants.DEFAULT_LIVE_GROUP_ID, targetValue,
					StringPool.BLANK, GroupConstants.TYPE_SITE_OPEN, true,
					GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null,
					true, true, new ServiceContext());
			}
		}

		targetClassPK = group.getGroupId();
	}

	if (group != null) {
		groupId = group.getGroupId();
	}
}
 
开发者ID:rivetlogic,项目名称:liferay-document-and-media-treeview,代码行数:82,代码来源:BaseImporter.java


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