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


Java DDMTemplate类代码示例

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


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

示例1: getFileEntryTypes

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
@Override
public Map<DLFileEntryType, List<DDMTemplate>> getFileEntryTypes(PermissionChecker permissionChecker, long groupId) throws PortalException {
    List<DLFileEntryType> fileEntryTypes = this.dlFileEntryTypeService.getFileEntryTypes(this.portal.getCurrentAndAncestorSiteGroupIds(groupId));
    HashMap<DLFileEntryType, List<DDMTemplate>> fileEntryTypeTemplateMapping = new HashMap<>(fileEntryTypes.size());

    Map<Group, List<DDMTemplate>> templatesByGroup = this.getDLFileEntryTypeTemplates(permissionChecker, groupId);
    List<DDMTemplate> templates = new ArrayList<>();
    for(List<DDMTemplate> groupTemplates : templatesByGroup.values()) {
        templates.addAll(groupTemplates);
    }

    // Put the default file entry type in there (because getFileEntryTypes won't do it)
    fileEntryTypeTemplateMapping.put(this.dlFileEntryTypeService.getDLFileEntryType(DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_BASIC_DOCUMENT), templates);

    for(DLFileEntryType fileEntryType : fileEntryTypes) {
        fileEntryTypeTemplateMapping.put(fileEntryType, templates);
    }

    return fileEntryTypeTemplateMapping;
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:21,代码来源:FlashlightSearchServiceImpl.java

示例2: renderADT

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
/**
 * Renders an ADT.
 *
 * @param request the request
 * @param response the response
 * @param templateCtx the template context
 * @param templateUUID the UUID of the ADT (DDMTemplate object/table) to render
 * @throws TemplateNotFoundException if no template having such UUID could be found
 * @throws CouldNotRenderTemplateException if the template could not be rendered
 */
public void renderADT(RenderRequest request, RenderResponse response, Map<String, Object> templateCtx, String templateUUID) throws CouldNotRenderTemplateException, TemplateNotFoundException {
    HttpServletRequest httpServletRequest = this.portal.getHttpServletRequest(request);
    HttpServletResponse httpServletResponse = this.portal.getHttpServletResponse(response);
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
    long companyId = themeDisplay.getCompanyId();

    try {
        List<DDMTemplate> ddmTemplates = this.getDDMTemplateLocalService().getDDMTemplatesByUuidAndCompanyId(templateUUID, companyId);
        if (ddmTemplates.isEmpty()) {
            throw new TemplateNotFoundException("No ADT found with companyId ["+companyId+"] and UUID ["+templateUUID+"]");
        }
        String renderedTemplate = this.getPortletDisplayTemplate().renderDDMTemplate(httpServletRequest, httpServletResponse, ddmTemplates.get(0), Collections.emptyList(), templateCtx);
        response.getWriter().write(renderedTemplate);
    } catch (Exception e) {
        throw new CouldNotRenderTemplateException("Could not render from ADT [" + templateUUID + "]", e);
    }
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:28,代码来源:TemplatedPortlet.java

示例3: getTemplateUUID

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
public static String getTemplateUUID(final String templateKey, final long groupId)
        throws SystemException, PortalException {

    DynamicQuery dq = DDMTemplateLocalServiceUtil.dynamicQuery()
            .add(PropertyFactoryUtil.forName("templateKey").eq(templateKey));
    List<DDMTemplate> templateList = new ArrayList<DDMTemplate>();
    String uuid = "NOT FOUND!!!!";
    try {
        DDMTemplate template = null;
        templateList = DDMTemplateLocalServiceUtil.dynamicQuery(dq);
        if (templateList != null && templateList.size() > 0 && templateList.get(0) != null) {
            uuid = templateList.get(0).getUuid();
        }
    } catch (SystemException e) {
        LOG.error("Tempate with key " + templateKey + " not found !!", e);
    }

    return uuid;
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:20,代码来源:ResolverUtil.java

示例4: getApplicationDisplayTemplates

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
/**
 * Returns the DL File Entry types templates
 *
 * @param permissionChecker The current context's permission checker
 * @param groupId The current site ID
 * @param classNameId The template's classNameId
 * @return A list of templates indexed by file entry types
 *
 * @throws PortalException If an error occurs while searching templates
 */
private Map<Group, List<DDMTemplate>> getApplicationDisplayTemplates(PermissionChecker permissionChecker, long groupId, long classNameId) throws PortalException {
    HashMap<Group, List<DDMTemplate>> adts = new HashMap<>();

    long[] currentGroupIds = this.portal.getCurrentAndAncestorSiteGroupIds(groupId);
    long userId = permissionChecker.getUserId();
    for(long currentGroupId : currentGroupIds) {
        List<DDMTemplate> groupTemplates = this.ddmTemplateService.getTemplates(currentGroupId, classNameId)
            .stream()
            .filter(template -> {
                // See DDMTemplatePermission.java in Liferay's source code for the inspirational stuff
                String modelResourceName = DDMTemplate.class.getName();
                long companyId = template.getCompanyId();
                long templateId = template.getTemplateId();
                String actionKey = ActionKeys.VIEW;

                return (
                    permissionChecker.hasOwnerPermission(companyId, modelResourceName, templateId, userId, actionKey) ||
                    permissionChecker.hasPermission(companyId, modelResourceName, templateId, actionKey)
                );
            })
            .collect(Collectors.toList());

        // If we have templates to show, put it in the map
        if(!groupTemplates.isEmpty()) {
            Group group = this.groupService.getGroup(currentGroupId);
            adts.put(group, groupTemplates);
        }
    }

    return adts;
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:42,代码来源:FlashlightSearchServiceImpl.java

示例5: indexDlFileEntryTypeTemplatesByUuid

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
/**
 * Indexes the ddm templates by file entry type UUID
 * @param fileEntryTemplates The ddm templates
 * @return The re-indexed ddm templates, by UUID
 */
private static final Map<String, List<DDMTemplate>> indexDlFileEntryTypeTemplatesByUuid(Map<DLFileEntryType, List<DDMTemplate>> fileEntryTemplates) {
    HashMap<String, List<DDMTemplate>> index = new HashMap<>(fileEntryTemplates.size());
    for(Entry<DLFileEntryType, List<DDMTemplate>> entry : fileEntryTemplates.entrySet()) {
        index.put(entry.getKey().getUuid(), entry.getValue());
    }
    return index;
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:13,代码来源:FlashlightSearchPortlet.java

示例6: getTemplateId

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
public static long getTemplateId(final String templateKey, final long groupId,
                                 final Class clazz) throws SystemException, PortalException {

    long classNameId = ClassNameLocalServiceUtil.getClassNameId(clazz);

    DDMTemplate template = DDMTemplateLocalServiceUtil.getTemplate(groupId, classNameId,
            templateKey);
    return template.getTemplateId();
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:10,代码来源:ResolverUtil.java

示例7: getJournalArticleViewTemplates

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
@Override
public Map<Group, List<DDMTemplate>> getJournalArticleViewTemplates(PermissionChecker permissionChecker, long groupId) throws PortalException {
    return this.getApplicationDisplayTemplates(permissionChecker, groupId, this.classNameService.getClassNameId(JournalArticleViewTemplateHandler.class));
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:5,代码来源:FlashlightSearchServiceImpl.java

示例8: getPortletApplicationDisplayTemplates

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
@Override
public Map<Group, List<DDMTemplate>> getPortletApplicationDisplayTemplates(PermissionChecker permissionChecker, long groupId) throws PortalException {
    return this.getApplicationDisplayTemplates(permissionChecker, groupId, this.classNameService.getClassNameId(FlashlightSearchService.ADT_CLASS));
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:5,代码来源:FlashlightSearchServiceImpl.java

示例9: getDLFileEntryTypeTemplates

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
/**
 * Returns the DL File Entry types templates
 *
 * @param permissionChecker The current context's permission checker
 * @param groupId The current site ID
 * @return A list of templates indexed by file entry types
 *
 * @throws PortalException If an error occurs while searching templates
 */
private Map<Group, List<DDMTemplate>> getDLFileEntryTypeTemplates(PermissionChecker permissionChecker, long groupId) throws PortalException {
    return this.getApplicationDisplayTemplates(permissionChecker, groupId, this.classNameService.getClassNameId(DLFileEntryTypeTemplateHandler.class));
}
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:13,代码来源:FlashlightSearchServiceImpl.java

示例10: getJournalArticleViewTemplates

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
/**
 * Returns the list of Application Display templates that are used to render journal article search results inside
 * the portlet
 *
 * @param permissionChecker The current context's permission checker
 * @param groupId The current site ID
 * @return Application Display Templates that are used to render journal articles search results
 *
 * @throws PortalException If an error occurs while fetching the data
 */
public Map<Group, List<DDMTemplate>> getJournalArticleViewTemplates(PermissionChecker permissionChecker, long groupId) throws PortalException;
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:12,代码来源:FlashlightSearchService.java

示例11: getFileEntryTypes

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
/**
 * Returns the list of file entry type templates that are visible to the given site and its parents
 *
 * @param permissionChecker The current context's permission checker
 * @param groupId The site from which to start the search for file entry templates
 * @return A list of file entry templates, accessible from the given context. They are indexed by DLFileEntryType.
 *
 * @throws PortalException If an error occurs while fetching the data
 */
public Map<DLFileEntryType, List<DDMTemplate>> getFileEntryTypes(PermissionChecker permissionChecker, long groupId) throws PortalException;
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:11,代码来源:FlashlightSearchService.java

示例12: getPortletApplicationDisplayTemplates

import com.liferay.dynamic.data.mapping.model.DDMTemplate; //导入依赖的package包/类
/**
 * Returns the list of application display templates that can be used with the Flashlight search portlet
 *
 * @param permissionChecker The current context's permission checker
 * @param groupId The current site ID
 * @return The application display templates, indexed by site
 *
 * @throws PortalException If an error occurs while fetching the templates
 */
public Map<Group, List<DDMTemplate>> getPortletApplicationDisplayTemplates(PermissionChecker permissionChecker, long groupId) throws PortalException;
 
开发者ID:savoirfairelinux,项目名称:flashlight-search,代码行数:11,代码来源:FlashlightSearchService.java


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