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


Java LayoutSetPrototype类代码示例

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


LayoutSetPrototype类属于com.liferay.portal.model包,在下文中一共展示了LayoutSetPrototype类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: importLayouts

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
private void importLayouts(long userId,Group grupo,LayoutSetPrototype lsProto) throws PortalException, SystemException
{
		LayoutSet ls = lsProto.getLayoutSet();	
		
		Map<String, String[]> parameterMap =getLayoutSetPrototypeParameters();

		
	File fileIni= layoutLocalService.exportLayoutsAsFile(ls.getGroupId(), true,
			null,parameterMap, null, null);

	try
	{
	layoutLocalService.importLayouts(userId, grupo.getPublicLayoutSet().getGroupId(), 
		grupo.getPublicLayoutSet().isPrivateLayout(),
		parameterMap, fileIni);
	}
	catch(Exception e)
	{
	}
	FileUtil.delete(fileIni);
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:23,代码来源:CourseLocalServiceImpl.java

示例3: buildSQLComunidadesComMaisPaginasCriadas

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
public static String buildSQLComunidadesComMaisPaginasCriadas(Configuracao config) {
	
	StringBuilder sb = new StringBuilder();
	sb.append(" SELECT ");
	sb.append(" L.groupId, G.name AS tituloComunidade ,count(*) AS quantidade  ");
	sb.append(" FROM Layout L ");
	sb.append(" INNER JOIN Group_ G ON L.groupId = G.groupId ");
	sb.append(" WHERE L.companyId = ? ");
	sb.append(" AND L.groupId NOT IN (select groupId from Group_ where classNameId in " );
	sb.append(" (select classNameId from ClassName_ where value = '"+ LayoutPrototype.class.getName() +"' OR value = '"+ User.class.getName() +"' OR value = '"+ UserGroup.class.getName() +"' OR value = '"+ LayoutSetPrototype.class.getName() +"' ))");
	sb.append(" AND G.name <> '"+ GroupConstants.CONTROL_PANEL +"'");
	sb.append(" AND L.createDate BETWEEN ? AND ? ");
	
	sb.append(montarSQLRestricaoDeComunidadeSeNecessario("AND", "L", config.getComunidadeSelecionada()));
	
	sb.append(" GROUP BY L.groupId , G.name ");
	sb.append("  ORDER BY quantidade DESC , tituloComunidade ASC; ");
	
	return sb.toString();
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:21,代码来源:SQLBuilder.java

示例4: buildSQLComunidadesComMaisConteudosWebCriados

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
public static String buildSQLComunidadesComMaisConteudosWebCriados(Configuracao config) {
	
	StringBuilder sb = new StringBuilder();
	sb.append(" SELECT ");
	sb.append(" J.groupId, G.name AS tituloComunidade ,count (DISTINCT J.articleId) as quantidade ");
	sb.append(" FROM JournalArticle J  ");
	sb.append(" INNER JOIN Group_ G ON J.groupId = G.groupId ");
	sb.append(" WHERE J.companyId = ? ");
	sb.append(" AND J.groupId IN (SELECT groupId FROM Group_ WHERE classNameId NOT IN  " );
	sb.append(" (SELECT classNameId FROM ClassName_  where value = '"+ User.class.getName() +"' OR value = '"+ UserGroup.class.getName() +"' OR value = '"+ LayoutSetPrototype.class.getName() +"'))");
	sb.append(" AND J.createDate BETWEEN ? AND ? ");
	
	sb.append(montarSQLRestricaoDeComunidadeSeNecessario("AND", "J", config.getComunidadeSelecionada()));
	
	sb.append(" GROUP BY J.groupId , G.name ");
	sb.append("  ORDER BY quantidade DESC , J.groupId DESC; ");
	
	return sb.toString();
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:20,代码来源:SQLBuilder.java

示例5: getLayoutSetPrototype

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
protected LayoutSetPrototype getLayoutSetPrototype(
		long companyId, String name)
	throws Exception {

	Locale locale = LocaleUtil.getDefault();

	List<LayoutSetPrototype> layoutSetPrototypes =
		LayoutSetPrototypeLocalServiceUtil.search(
			companyId, null, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

	for (LayoutSetPrototype layoutSetPrototype : layoutSetPrototypes) {
		if (name.equals(layoutSetPrototype.getName(locale))) {
			return layoutSetPrototype;
		}
	}

	return null;
}
 
开发者ID:rivetlogic,项目名称:liferay-evernote,代码行数:19,代码来源:BaseImporter.java

示例6: setupSettings

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
protected void setupSettings(String fileName) throws Exception {
	if (targetClassName.equals(Group.class.getName())) {
		return;
	}

	JSONObject jsonObject = getJSONObject(fileName);

	if (jsonObject == null) {
		return;
	}

	LayoutSetPrototype layoutSetPrototype =
		LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(
			getTargetClassPK());

	String layoutSetPrototypeSettings = jsonObject.getString(
		"layoutSetPrototypeSettings", StringPool.BLANK);

	layoutSetPrototype.setSettings(layoutSetPrototypeSettings);

	LayoutSetPrototypeLocalServiceUtil.updateLayoutSetPrototype(
		layoutSetPrototype);
}
 
开发者ID:rivetlogic,项目名称:liferay-evernote,代码行数:24,代码来源:FileSystemImporter.java

示例7: processAction

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
public void processAction(StrutsPortletAction originalStrutsPortletAction,
		PortletConfig portletConfig, ActionRequest actionRequest,
		ActionResponse actionResponse) throws Exception {
	
	long layoutSetPrototypeId = ParamUtil.getLong(
			actionRequest, PARAM_ID, INVALID_ID);
	ServiceContext serviceContext = 
			ServiceContextFactory.getInstance(LayoutSetPrototype.class.getName(), actionRequest);
	
	if(layoutSetPrototypeId > 0){			
		LayoutSetPrototype layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil
				.getLayoutSetPrototype(layoutSetPrototypeId);
		layoutSetPrototype.setExpandoBridgeAttributes(serviceContext);
		LayoutSetPrototypeLocalServiceUtil.updateLayoutSetPrototype(layoutSetPrototype);
	}
	 
	originalStrutsPortletAction.processAction(originalStrutsPortletAction, portletConfig, 
			actionRequest, actionResponse);
}
 
开发者ID:rivetlogic,项目名称:liferay-microsite-manager,代码行数:20,代码来源:LayoutCustomFieldsAction.java

示例8: getCourseTemplates

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
protected String getCourseTemplates(PortletPreferences preferences, long companyId){

		// Templates
		String templates = null;
		boolean filterByTemplates = GetterUtil.getBoolean(preferences.getValue("filterByTemplates", StringPool.FALSE),false);
		log.debug("Filtrando por plantillas "+filterByTemplates);
		if(filterByTemplates){
			try {  
				templates = "";
				String[] layusprsel=null;
				if(preferences.getValue("courseTemplates", null)!=null&&preferences.getValue("courseTemplates", null).length()>0){
					layusprsel=preferences.getValue("courseTemplates", "").split(",");
				}
			    
				if(layusprsel==null || layusprsel.length<=0){
					layusprsel = LmsPrefsLocalServiceUtil.getLmsPrefsIni(companyId).getLmsTemplates().split(",");
				}
				if(layusprsel!=null &&layusprsel.length>0){
					LayoutSetPrototype layoutSetPrototype = null;
					for (int i=0; i<layusprsel.length; i++) {
						layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.fetchLayoutSetPrototype(Long.parseLong(layusprsel[i]));
						templates += "'" + layoutSetPrototype.getUuid() + "'";
						if (i<(layusprsel.length-1)){
							templates += ", ";
						}	
				    }
			   }
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		}
		return templates;
	}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:35,代码来源:BaseCourseAdminPortlet.java

示例9: fetchLayoutSetPrototypeByDescription

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
@SuppressWarnings("unused")
private static LayoutSetPrototype fetchLayoutSetPrototypeByDescription(String description,long companyId) throws SystemException,PortalException
{
	LayoutSetPrototype lspRes = null;
	for(LayoutSetPrototype lsp:LayoutSetPrototypeLocalServiceUtil.search(companyId, true,0,Integer.MAX_VALUE, null))	
	{
		if(description.equals(lsp.getDescription()))
		{
			lspRes = lsp;
			break;
		}
	}
	return lspRes;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:15,代码来源:CourseLocalServiceImpl.java

示例10: getMicroSite

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
public static MicroSiteBean getMicroSite(long companyId,long groupId, long userId) throws PortalException, SystemException {
    Group group;
    LayoutSet layoutSet;
    LayoutSetPrototype layoutSetPrototype;
    MicroSiteBean microSitesBean = null;
    try {
        group = GroupLocalServiceUtil.getGroup(groupId);
        microSitesBean = new MicroSiteBeanImpl();
        microSitesBean.setMicroSiteId(group.getGroupId());
        microSitesBean.setGroupId(group.getGroupId());
        microSitesBean.setName(group.getName());
        microSitesBean.setDescription(group.getDescription());
        microSitesBean.setActive(group.isActive());
        microSitesBean.setFriendlyURL(group.getFriendlyURL());
        microSitesBean.setType(group.getType());
        microSitesBean.setManualMembership(group.getManualMembership());
        
        layoutSet = group.getPrivateLayoutSet();
        if(!layoutSet.getLayoutSetPrototypeUuid().isEmpty()) {
            layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypeByUuidAndCompanyId(
                    layoutSet.getLayoutSetPrototypeUuid(), companyId);
            microSitesBean.setPrivateLayoutSetPrototypeId(layoutSetPrototype.getLayoutSetPrototypeId());
            microSitesBean.setPrivateLayoutSetPrototypeLinkEnabled(layoutSet.getLayoutSetPrototypeLinkEnabled());
        }
        layoutSet = group.getPublicLayoutSet();
        if(!layoutSet.getLayoutSetPrototypeUuid().isEmpty()) {
            layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypeByUuidAndCompanyId(
                    layoutSet.getLayoutSetPrototypeUuid(), companyId);
            microSitesBean.setPublicLayoutSetPrototypeId(layoutSetPrototype.getLayoutSetPrototypeId());
            microSitesBean.setPublicLayoutSetPrototypeLinkEnabled(layoutSet.getLayoutSetPrototypeLinkEnabled());
        }
    } catch (NoSuchGroupException e) {
        MicroSite microSite = MicroSiteLocalServiceUtil.findByCompanyGroupUser(companyId, groupId, userId);
        if(microSite != null) {
            MicroSiteLocalServiceUtil.deleteMicroSite(microSite);
        }
    }
    return microSitesBean;
}
 
开发者ID:rivetlogic,项目名称:liferay-microsite-manager,代码行数:40,代码来源:MicroSiteUtil.java

示例11: getSiteTemplateList

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
public static List<SiteTemplateBean> getSiteTemplateList(PortletRequest request) 
        throws SystemException, PortalException {
    SiteTemplateBean siteTemplateBean;
    List<SiteTemplateBean> siteTemplateBeans = new ArrayList<SiteTemplateBean>();
    
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
    //Get the layout set prototypes
    List<LayoutSetPrototype> layoutSetPrototypes = 
            LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypes(themeDisplay.getCompanyId());
    for (LayoutSetPrototype layoutSetPrototype : layoutSetPrototypes) {
    	
    	Boolean hasAttribute = layoutSetPrototype.getExpandoBridge().hasAttribute(ExpandoStartupAction.COLUMN_NAME);
    	
    	if(hasAttribute){
    		boolean allowedToUse = (Boolean) layoutSetPrototype.getExpandoBridge()
        			.getAttribute(ExpandoStartupAction.COLUMN_NAME);
        	if(allowedToUse){
        		siteTemplateBean = new SiteTemplateBeanImpl();
                siteTemplateBean.setId(layoutSetPrototype.getLayoutSetPrototypeId());
                siteTemplateBean.setName(layoutSetPrototype.getNameCurrentValue());
                siteTemplateBeans.add(siteTemplateBean);
        	}
    	}
    	
        
    }
    return siteTemplateBeans;
}
 
开发者ID:rivetlogic,项目名称:liferay-microsite-manager,代码行数:29,代码来源:MicroSiteUtil.java

示例12: doRun

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
private void doRun(String[] ids) throws Exception{
	ExpandoTable table = null;

	long companyId = Long.parseLong(ids[0]);

	try {
	 	table = ExpandoTableLocalServiceUtil.addDefaultTable(
		 	companyId, LayoutSetPrototype.class.getName());
	}
	catch(DuplicateTableNameException dtne) {
	 	table = ExpandoTableLocalServiceUtil.getDefaultTable(
		 	companyId, LayoutSetPrototype.class.getName());
	}
	long tableId = table.getTableId();

	try {
		Role guestUserRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER);
		
		ExpandoColumn column = ExpandoColumnLocalServiceUtil.addColumn(
			tableId, COLUMN_NAME, ExpandoColumnConstants.BOOLEAN);
		
		ExpandoColumnLocalServiceUtil.updateExpandoColumn(column);
		ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, 
                  ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, 
                  String.valueOf(column.getColumnId()), guestUserRole.getRoleId(), new String[] { ActionKeys.VIEW});
	}
	catch(DuplicateColumnNameException dcne) {
		LOG.debug("Expando" +  COLUMN_NAME + " already exist!");

	}
}
 
开发者ID:rivetlogic,项目名称:liferay-microsite-manager,代码行数:32,代码来源:ExpandoStartupAction.java

示例13: 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

示例14: validateLayoutPrototypes

import com.liferay.portal.model.LayoutSetPrototype; //导入依赖的package包/类
protected void validateLayoutPrototypes(
		Element layoutsElement, List<Element> layoutElements)
	throws Exception {

	List<Tuple> missingLayoutPrototypes = new ArrayList<Tuple>();

	String layoutSetPrototypeUuid = layoutsElement.attributeValue(
		"layout-set-prototype-uuid");

	if (Validator.isNotNull(layoutSetPrototypeUuid)) {
		try {
			LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypeByUuid(
				layoutSetPrototypeUuid);
		}
		catch (NoSuchLayoutSetPrototypeException nlspe) {
			String layoutSetPrototypeName = layoutsElement.attributeValue(
				"layout-set-prototype-name");

			missingLayoutPrototypes.add(
				new Tuple(
					LayoutSetPrototype.class.getName(),
					layoutSetPrototypeUuid, layoutSetPrototypeName));
		}
	}

	for (Element layoutElement : layoutElements) {
		String layoutPrototypeUuid = GetterUtil.getString(
			layoutElement.attributeValue("layout-prototype-uuid"));

		if (Validator.isNotNull(layoutPrototypeUuid)) {
			try {
				LayoutPrototypeLocalServiceUtil.getLayoutPrototypeByUuid(
					layoutPrototypeUuid);
			}
			catch (NoSuchLayoutPrototypeException nslpe) {
				String layoutPrototypeName = GetterUtil.getString(
					layoutElement.attributeValue("layout-prototype-name"));

				missingLayoutPrototypes.add(
					new Tuple(
						LayoutPrototype.class.getName(),
						layoutPrototypeUuid, layoutPrototypeName));
			}
		}
	}

	if (!missingLayoutPrototypes.isEmpty()) {
		throw new LayoutPrototypeException(missingLayoutPrototypes);
	}
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:51,代码来源:LayoutImporter.java


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