001    /**
002     * Copyright (c) 2000-2011 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.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the d d m template remote service. This utility wraps {@link com.liferay.portlet.dynamicdatamapping.service.impl.DDMTemplateServiceImpl} and is the primary access point for service operations in application layer code running on a remote server.
023     *
024     * <p>
025     * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see DDMTemplateService
030     * @see com.liferay.portlet.dynamicdatamapping.service.base.DDMTemplateServiceBaseImpl
031     * @see com.liferay.portlet.dynamicdatamapping.service.impl.DDMTemplateServiceImpl
032     * @generated
033     */
034    public class DDMTemplateServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portlet.dynamicdatamapping.service.impl.DDMTemplateServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate addTemplate(
041                    long groupId, long structureId,
042                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
043                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
044                    java.lang.String type, java.lang.String mode,
045                    java.lang.String language, java.lang.String script,
046                    com.liferay.portal.service.ServiceContext serviceContext)
047                    throws com.liferay.portal.kernel.exception.PortalException,
048                            com.liferay.portal.kernel.exception.SystemException {
049                    return getService()
050                                       .addTemplate(groupId, structureId, nameMap, descriptionMap,
051                            type, mode, language, script, serviceContext);
052            }
053    
054            public static void deleteTemplate(long templateId)
055                    throws com.liferay.portal.kernel.exception.PortalException,
056                            com.liferay.portal.kernel.exception.SystemException {
057                    getService().deleteTemplate(templateId);
058            }
059    
060            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate getTemplate(
061                    long templateId)
062                    throws com.liferay.portal.kernel.exception.PortalException,
063                            com.liferay.portal.kernel.exception.SystemException {
064                    return getService().getTemplate(templateId);
065            }
066    
067            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplates(
068                    long structureId, java.lang.String type, java.lang.String mode)
069                    throws com.liferay.portal.kernel.exception.SystemException {
070                    return getService().getTemplates(structureId, type, mode);
071            }
072    
073            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate updateTemplate(
074                    long templateId,
075                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
076                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
077                    java.lang.String type, java.lang.String mode,
078                    java.lang.String language, java.lang.String script,
079                    com.liferay.portal.service.ServiceContext serviceContext)
080                    throws com.liferay.portal.kernel.exception.PortalException,
081                            com.liferay.portal.kernel.exception.SystemException {
082                    return getService()
083                                       .updateTemplate(templateId, nameMap, descriptionMap, type,
084                            mode, language, script, serviceContext);
085            }
086    
087            public static DDMTemplateService getService() {
088                    if (_service == null) {
089                            _service = (DDMTemplateService)PortalBeanLocatorUtil.locate(DDMTemplateService.class.getName());
090    
091                            ReferenceRegistry.registerReference(DDMTemplateServiceUtil.class,
092                                    "_service");
093                            MethodCache.remove(DDMTemplateService.class);
094                    }
095    
096                    return _service;
097            }
098    
099            public void setService(DDMTemplateService service) {
100                    MethodCache.remove(DDMTemplateService.class);
101    
102                    _service = service;
103    
104                    ReferenceRegistry.registerReference(DDMTemplateServiceUtil.class,
105                            "_service");
106                    MethodCache.remove(DDMTemplateService.class);
107            }
108    
109            private static DDMTemplateService _service;
110    }