List of usage examples for com.liferay.portal.kernel.util PortalUtil getAncestorSiteGroupIds
public static long[] getAncestorSiteGroupIds(long groupId)
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMStructureLocalServiceImpl.java
License:Open Source License
/** * Returns the structure matching the class name ID, structure key, and * group, optionally searching ancestor sites (that have sharing enabled) * and global scoped sites./*from www .j av a2 s. com*/ * * <p> * This method first searches in the group. If the structure is still not * found and <code>includeAncestorStructures</code> is set to * <code>true</code>, this method searches the group's ancestor sites (that * have sharing enabled) and lastly searches global scoped sites. * </p> * * @param groupId the primary key of the group * @param classNameId the primary key of the class name for the structure's * related model * @param structureKey the unique string identifying the structure * @param includeAncestorStructures whether to include ancestor sites (that * have sharing enabled) and include global scoped sites in the * search * @return the matching structure, or <code>null</code> if a matching * structure could not be found */ @Override public DDMStructure fetchStructure(long groupId, long classNameId, String structureKey, boolean includeAncestorStructures) { structureKey = getStructureKey(structureKey); DDMStructure structure = ddmStructurePersistence.fetchByG_C_S(groupId, classNameId, structureKey); if (structure != null) { return structure; } if (!includeAncestorStructures) { return null; } for (long ancestorSiteGroupId : PortalUtil.getAncestorSiteGroupIds(groupId)) { structure = ddmStructurePersistence.fetchByG_C_S(ancestorSiteGroupId, classNameId, structureKey); if (structure != null) { return structure; } } return null; }
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMStructureLocalServiceImpl.java
License:Open Source License
/** * Returns the structure matching the class name ID, structure key, and * group, optionally searching ancestor sites (that have sharing enabled) * and global scoped sites.// w w w.ja v a2 s . co m * * <p> * This method first searches in the group. If the structure is still not * found and <code>includeAncestorStructures</code> is set to * <code>true</code>, this method searches the group's ancestor sites (that * have sharing enabled) and lastly searches global scoped sites. * </p> * * @param groupId the primary key of the structure's group * @param classNameId the primary key of the class name for the structure's * related model * @param structureKey the unique string identifying the structure * @param includeAncestorStructures whether to include ancestor sites (that * have sharing enabled) and include global scoped sites in the * search in the search * @return the matching structure */ @Override public DDMStructure getStructure(long groupId, long classNameId, String structureKey, boolean includeAncestorStructures) throws PortalException { structureKey = getStructureKey(structureKey); DDMStructure structure = ddmStructurePersistence.fetchByG_C_S(groupId, classNameId, structureKey); if (structure != null) { return structure; } if (!includeAncestorStructures) { throw new NoSuchStructureException("No DDMStructure exists with the structure key " + structureKey); } for (long curGroupId : PortalUtil.getAncestorSiteGroupIds(groupId)) { structure = ddmStructurePersistence.fetchByG_C_S(curGroupId, classNameId, structureKey); if (structure != null) { return structure; } } throw new NoSuchStructureException( "No DDMStructure exists with the structure key " + structureKey + " in the ancestor groups"); }
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMTemplateLocalServiceImpl.java
License:Open Source License
/** * Returns the template matching the group and template key, optionally * searching ancestor sites (that have sharing enabled) and global scoped * sites./* w w w. j av a2 s . c o m*/ * * <p> * This method first searches in the given group. If the template is still * not found and <code>includeAncestorTemplates</code> is set to * <code>true</code>, this method searches the group's ancestor sites (that * have sharing enabled) and lastly searches global scoped sites. * </p> * * @param groupId the primary key of the group * @param classNameId the primary key of the class name for the template's * related model * @param templateKey the unique string identifying the template * @param includeAncestorTemplates whether to include ancestor sites (that * have sharing enabled) and include global scoped sites in the * search in the search * @return the matching template, or <code>null</code> if a matching * template could not be found */ @Override public DDMTemplate fetchTemplate(long groupId, long classNameId, String templateKey, boolean includeAncestorTemplates) { templateKey = StringUtil.toUpperCase(StringUtil.trim(templateKey)); DDMTemplate template = ddmTemplatePersistence.fetchByG_C_T(groupId, classNameId, templateKey); if (template != null) { return template; } if (!includeAncestorTemplates) { return null; } for (long ancestorSiteGroupId : PortalUtil.getAncestorSiteGroupIds(groupId)) { template = ddmTemplatePersistence.fetchByG_C_T(ancestorSiteGroupId, classNameId, templateKey); if (template != null) { return template; } } return null; }
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMTemplateLocalServiceImpl.java
License:Open Source License
/** * Returns the template matching the group and template key, optionally * searching ancestor sites (that have sharing enabled) and global scoped * sites./*from w ww . j a v a 2 s . c om*/ * * <p> * This method first searches in the group. If the template is still not * found and <code>includeAncestorTemplates</code> is set to * <code>true</code>, this method searches the group's ancestor sites (that * have sharing enabled) and lastly searches global scoped sites. * </p> * * @param groupId the primary key of the group * @param classNameId the primary key of the class name for the template's * related model * @param templateKey the unique string identifying the template * @param includeAncestorTemplates whether to include ancestor sites (that * have sharing enabled) and include global scoped sites in the * search in the search * @return the matching template * @throws PortalException if a portal exception occurred */ @Override public DDMTemplate getTemplate(long groupId, long classNameId, String templateKey, boolean includeAncestorTemplates) throws PortalException { templateKey = StringUtil.toUpperCase(StringUtil.trim(templateKey)); DDMTemplate template = ddmTemplatePersistence.fetchByG_C_T(groupId, classNameId, templateKey); if (template != null) { return template; } if (!includeAncestorTemplates) { throw new NoSuchTemplateException("No DDMTemplate exists with the template key " + templateKey); } for (long ancestorSiteGroupId : PortalUtil.getAncestorSiteGroupIds(groupId)) { template = ddmTemplatePersistence.fetchByG_C_T(ancestorSiteGroupId, classNameId, templateKey); if (template != null) { return template; } } throw new NoSuchTemplateException( "No DDMTemplate exists with the template key " + templateKey + " in the ancestor groups"); }
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMTemplateLocalServiceImpl.java
License:Open Source License
@Override public List<DDMTemplate> getTemplates(long groupId, long classNameId, long classPK, boolean includeAncestorTemplates) throws PortalException { List<DDMTemplate> ddmTemplates = new ArrayList<>(); ddmTemplates.addAll(ddmTemplatePersistence.findByG_C_C(groupId, classNameId, classPK)); if (!includeAncestorTemplates) { return ddmTemplates; }//from ww w .j a va 2 s .c o m ddmTemplates.addAll(ddmTemplatePersistence.findByG_C_C(PortalUtil.getAncestorSiteGroupIds(groupId), classNameId, classPK)); return ddmTemplates; }
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMTemplateServiceImpl.java
License:Open Source License
@Override public List<DDMTemplate> getTemplates(long companyId, long groupId, long classNameId, long classPK, long resourceClassNameId, boolean includeAncestorTemplates, int status) throws PortalException { List<DDMTemplate> ddmTemplates = new ArrayList<>(); ddmTemplates.addAll(getTemplates(companyId, new long[] { groupId }, classNameId, classPK, resourceClassNameId, null, null, status)); if (!includeAncestorTemplates) { return ddmTemplates; }/*from www .j a v a 2s .co m*/ ddmTemplates.addAll(getTemplates(companyId, PortalUtil.getAncestorSiteGroupIds(groupId), classNameId, classPK, resourceClassNameId, null, null, status)); return ddmTemplates; }