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.portlet.dynamicdatamapping;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.util.ProxyFactory;
019    import com.liferay.portal.service.ServiceContext;
020    
021    import java.io.File;
022    
023    import java.util.Locale;
024    import java.util.Map;
025    
026    /**
027     * @author Marcellus Tavares
028     */
029    public class DDMTemplateManagerUtil {
030    
031            public static DDMTemplate addTemplate(
032                            long userId, long groupId, long classNameId, long classPK,
033                            long resourceClassNameId, String templateKey,
034                            Map<Locale, String> nameMap, Map<Locale, String> descriptionMap,
035                            String type, String mode, String language, String script,
036                            boolean cacheable, boolean smallImage, String smallImageURL,
037                            File smallImageFile, ServiceContext serviceContext)
038                    throws PortalException {
039    
040                    return _ddmTemplateManager.addTemplate(
041                            userId, groupId, classNameId, classPK, resourceClassNameId,
042                            templateKey, nameMap, descriptionMap, type, mode, language, script,
043                            cacheable, smallImage, smallImageURL, smallImageFile,
044                            serviceContext);
045            }
046    
047            public static DDMTemplate fetchTemplate(
048                    long groupId, long classNameId, String templateKey) {
049    
050                    return _ddmTemplateManager.fetchTemplate(
051                            groupId, classNameId, templateKey);
052            }
053    
054            public static DDMTemplate getTemplate(long templateId)
055                    throws PortalException {
056    
057                    return _ddmTemplateManager.getTemplate(templateId);
058            }
059    
060            private static final DDMTemplateManager _ddmTemplateManager =
061                    ProxyFactory.newServiceTrackedInstance(DDMTemplateManager.class);
062    
063    }