001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.dynamic.data.mapping.kernel;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.service.ServiceContext;
021    import com.liferay.portal.kernel.util.ProxyFactory;
022    
023    import java.io.File;
024    
025    import java.util.Locale;
026    import java.util.Map;
027    
028    /**
029     * @author Marcellus Tavares
030     */
031    @ProviderType
032    public class DDMTemplateManagerUtil {
033    
034            public static DDMTemplate addTemplate(
035                            long userId, long groupId, long classNameId, long classPK,
036                            long resourceClassNameId, String templateKey,
037                            Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
038                            String type, String mode, String language, String script,
039                            boolean cacheable, boolean smallImage, String smallImageURL,
040                            File smallImageFile, ServiceContext serviceContext)
041                    throws PortalException {
042    
043                    return _ddmTemplateManager.addTemplate(
044                            userId, groupId, classNameId, classPK, resourceClassNameId,
045                            templateKey, nameMap, descriptionMap, type, mode, language, script,
046                            cacheable, smallImage, smallImageURL, smallImageFile,
047                            serviceContext);
048            }
049    
050            public static DDMTemplate fetchTemplate(
051                    long groupId, long classNameId, String templateKey) {
052    
053                    return _ddmTemplateManager.fetchTemplate(
054                            groupId, classNameId, templateKey);
055            }
056    
057            public static DDMTemplate getTemplate(long templateId)
058                    throws PortalException {
059    
060                    return _ddmTemplateManager.getTemplate(templateId);
061            }
062    
063            private static final DDMTemplateManager _ddmTemplateManager =
064                    ProxyFactory.newServiceTrackedInstance(DDMTemplateManager.class);
065    
066    }