CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-com-liferay--com-liferay-dynamic-data-mapping-api

Liferay Dynamic Data Mapping API provides comprehensive APIs for creating, managing, and processing dynamic forms and data structures within Liferay Portal.

Pending
Overview
Eval results
Files

templates.mddocs/

Template Engine & Rendering

Template processing system supporting FreeMarker, Velocity, and custom template languages for form and content rendering.

Capabilities

Template Management

interface DDMTemplateManager {
    Map<String, Object> getAutocompleteVariables(
        HttpServletRequest httpServletRequest, 
        HttpServletResponse httpServletResponse, 
        Language language) throws Exception;
        
    String[] getRestrictedVariables(Language language);
    
    boolean isAutocompleteEnabled(Language language);
}

enum Language {
    FREEMARKER("ftl"),
    VELOCITY("vm"),
    JAVASCRIPT("js");
    
    String getExtension();
}

Template Rendering

interface DDMDisplay {
    String getEditTemplateBackURL(HttpServletRequest httpServletRequest, 
        DDMTemplate template) throws PortalException;
        
    String getViewTemplateBackURL(HttpServletRequest httpServletRequest, 
        DDMTemplate template) throws PortalException;
        
    boolean isShowConfirmSelectStructure();
    boolean isShowConfirmSelectTemplate();
}

Usage Examples

Creating and Using Templates

@Component
public class TemplateExample {
    
    @Reference
    private DDMTemplateLocalService templateLocalService;
    
    public DDMTemplate createDisplayTemplate(long groupId, long structureId, long userId) 
        throws PortalException {
        
        String script = 
            "<#list entries as entry>" +
            "  <div class=\"entry\">" +
            "    <h3>${entry.title}</h3>" +
            "    <p>${entry.description}</p>" +
            "  </div>" +
            "</#list>";
            
        Map<Locale, String> nameMap = Collections.singletonMap(Locale.US, "Entry Display Template");
        Map<Locale, String> descriptionMap = Collections.singletonMap(Locale.US, "Template for displaying entries");
        
        ServiceContext serviceContext = new ServiceContext();
        serviceContext.setScopeGroupId(groupId);
        
        return templateLocalService.addTemplate(
            userId, groupId,
            PortalUtil.getClassNameId(DDMStructure.class), structureId,
            PortalUtil.getClassNameId(DDMTemplate.class),
            null, // auto-generate template key
            nameMap, descriptionMap,
            DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY,
            DDMTemplateConstants.TEMPLATE_MODE_CREATE,
            Language.FREEMARKER.getValue(),
            script, true, // cacheable
            false, null, null, // no small image
            serviceContext
        );
    }
}

Install with Tessl CLI

npx tessl i tessl/maven-com-liferay--com-liferay-dynamic-data-mapping-api

docs

data-providers.md

expressions.md

form-management.md

index.md

integration-extensions.md

models-services.md

security-validation.md

storage-io.md

templates.md

tile.json