001    /**
002     * Copyright (c) 2000-2013 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.ReferenceRegistry;
019    
020    /**
021     * 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.
022     *
023     * <p>
024     * 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.
025     * </p>
026     *
027     * @author Brian Wing Shun Chan
028     * @see DDMTemplateService
029     * @see com.liferay.portlet.dynamicdatamapping.service.base.DDMTemplateServiceBaseImpl
030     * @see com.liferay.portlet.dynamicdatamapping.service.impl.DDMTemplateServiceImpl
031     * @generated
032     */
033    public class DDMTemplateServiceUtil {
034            /*
035             * NOTE FOR DEVELOPERS:
036             *
037             * 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.
038             */
039    
040            /**
041            * Returns the Spring bean ID for this bean.
042            *
043            * @return the Spring bean ID for this bean
044            */
045            public static java.lang.String getBeanIdentifier() {
046                    return getService().getBeanIdentifier();
047            }
048    
049            /**
050            * Sets the Spring bean ID for this bean.
051            *
052            * @param beanIdentifier the Spring bean ID for this bean
053            */
054            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
055                    getService().setBeanIdentifier(beanIdentifier);
056            }
057    
058            /**
059            * Adds a template.
060            *
061            * @param groupId the primary key of the group
062            * @param classNameId the primary key of the class name for template's
063            related model
064            * @param classPK the primary key of the template's related entity
065            * @param nameMap the template's locales and localized names
066            * @param descriptionMap the template's locales and localized descriptions
067            * @param type the template's type. For more information, see {@link
068            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
069            * @param mode the template's mode. For more information, see {@link
070            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
071            * @param language the template's script language. For more information,
072            see {@link
073            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
074            * @param script the template's script
075            * @param serviceContext the service context to be applied. Must have the
076            <code>ddmResource</code> attribute to check permissions. Can set
077            the UUID, creation date, modification date, guest permissions,
078            and group permissions for the template.
079            * @return the template
080            * @throws PortalException if the user did not have permission to add the
081            template or if a portal exception occurred
082            * @throws SystemException if a system exception occurred
083            */
084            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate addTemplate(
085                    long groupId, long classNameId, long classPK,
086                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
087                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
088                    java.lang.String type, java.lang.String mode,
089                    java.lang.String language, java.lang.String script,
090                    com.liferay.portal.service.ServiceContext serviceContext)
091                    throws com.liferay.portal.kernel.exception.PortalException,
092                            com.liferay.portal.kernel.exception.SystemException {
093                    return getService()
094                                       .addTemplate(groupId, classNameId, classPK, nameMap,
095                            descriptionMap, type, mode, language, script, serviceContext);
096            }
097    
098            /**
099            * Adds a template with additional parameters.
100            *
101            * @param groupId the primary key of the group
102            * @param classNameId the primary key of the class name for template's
103            related model
104            * @param classPK the primary key of the template's related entity
105            * @param templateKey the unique string identifying the template
106            (optionally <code>null</code>)
107            * @param nameMap the template's locales and localized names
108            * @param descriptionMap the template's locales and localized descriptions
109            * @param type the template's type. For more information, see {@link
110            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
111            * @param mode the template's mode. For more information, see {@link
112            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
113            * @param language the template's script language. For more information,
114            see {@link
115            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
116            * @param script the template's script
117            * @param cacheable whether the template is cacheable
118            * @param smallImage whether the template has a small image
119            * @param smallImageURL the template's small image URL (optionally
120            <code>null</code>)
121            * @param smallImageFile the template's small image file (optionally
122            <code>null</code>)
123            * @param serviceContext the service context to be applied. Must have the
124            <code>ddmResource</code> attribute to check permissions. Can set
125            the UUID, creation date, modification date, guest permissions,
126            and group permissions for the template.
127            * @return the template
128            * @throws PortalException if the user did not have permission to add the
129            template or if a portal exception occurred
130            * @throws SystemException if a system exception occurred
131            */
132            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate addTemplate(
133                    long groupId, long classNameId, long classPK,
134                    java.lang.String templateKey,
135                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
136                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
137                    java.lang.String type, java.lang.String mode,
138                    java.lang.String language, java.lang.String script, boolean cacheable,
139                    boolean smallImage, java.lang.String smallImageURL,
140                    java.io.File smallImageFile,
141                    com.liferay.portal.service.ServiceContext serviceContext)
142                    throws com.liferay.portal.kernel.exception.PortalException,
143                            com.liferay.portal.kernel.exception.SystemException {
144                    return getService()
145                                       .addTemplate(groupId, classNameId, classPK, templateKey,
146                            nameMap, descriptionMap, type, mode, language, script, cacheable,
147                            smallImage, smallImageURL, smallImageFile, serviceContext);
148            }
149    
150            /**
151            * Copies the template, creating a new template with all the values
152            * extracted from the original one. This method supports defining a new name
153            * and description.
154            *
155            * @param templateId the primary key of the template to be copied
156            * @param nameMap the new template's locales and localized names
157            * @param descriptionMap the new template's locales and localized
158            descriptions
159            * @param serviceContext the service context to be applied. Must have the
160            <code>ddmResource</code> attribute to check permissions. Can set
161            the UUID, creation date, modification date, guest permissions,
162            and group permissions for the template.
163            * @return the new template
164            * @throws PortalException if the user did not have permission to add the
165            template or if a portal exception occurred
166            * @throws SystemException if a system exception occurred
167            */
168            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate copyTemplate(
169                    long templateId,
170                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
171                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
172                    com.liferay.portal.service.ServiceContext serviceContext)
173                    throws com.liferay.portal.kernel.exception.PortalException,
174                            com.liferay.portal.kernel.exception.SystemException {
175                    return getService()
176                                       .copyTemplate(templateId, nameMap, descriptionMap,
177                            serviceContext);
178            }
179    
180            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate copyTemplate(
181                    long templateId,
182                    com.liferay.portal.service.ServiceContext serviceContext)
183                    throws com.liferay.portal.kernel.exception.PortalException,
184                            com.liferay.portal.kernel.exception.SystemException {
185                    return getService().copyTemplate(templateId, serviceContext);
186            }
187    
188            /**
189            * Copies all the templates matching the class name ID, class PK, and type.
190            * This method creates new templates, extracting all the values from the old
191            * ones and updating their class PKs.
192            *
193            * @param classNameId the primary key of the class name for template's
194            related model
195            * @param classPK the primary key of the original template's related entity
196            * @param newClassPK the primary key of the new template's related entity
197            * @param type the template's type. For more information, see {@link
198            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
199            * @param serviceContext the service context to be applied. Must have the
200            <code>ddmResource</code> attribute to check permissions. Can set
201            the UUID, creation date, modification date, guest permissions,
202            and group permissions for the template.
203            * @return the new template
204            * @throws PortalException if the user did not have permission to add the
205            template or if a portal exception occurred
206            * @throws SystemException if a system exception occurred
207            */
208            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> copyTemplates(
209                    long classNameId, long classPK, long newClassPK, java.lang.String type,
210                    com.liferay.portal.service.ServiceContext serviceContext)
211                    throws com.liferay.portal.kernel.exception.PortalException,
212                            com.liferay.portal.kernel.exception.SystemException {
213                    return getService()
214                                       .copyTemplates(classNameId, classPK, newClassPK, type,
215                            serviceContext);
216            }
217    
218            /**
219            * Deletes the template and its resources.
220            *
221            * @param templateId the primary key of the template to be deleted
222            * @throws PortalException if the user did not have permission to delete the
223            template or if a portal exception occurred
224            * @throws SystemException if a system exception occurred
225            */
226            public static void deleteTemplate(long templateId)
227                    throws com.liferay.portal.kernel.exception.PortalException,
228                            com.liferay.portal.kernel.exception.SystemException {
229                    getService().deleteTemplate(templateId);
230            }
231    
232            /**
233            * Returns the template matching the group and template key.
234            *
235            * @param groupId the primary key of the group
236            * @param classNameId the primary key of the class name for template's
237            related model
238            * @param templateKey the unique string identifying the template
239            * @return the matching template, or <code>null</code> if a matching
240            template could not be found
241            * @throws PortalException if the user did not have permission to view the
242            template
243            * @throws SystemException if a system exception occurred
244            */
245            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate fetchTemplate(
246                    long groupId, long classNameId, java.lang.String templateKey)
247                    throws com.liferay.portal.kernel.exception.PortalException,
248                            com.liferay.portal.kernel.exception.SystemException {
249                    return getService().fetchTemplate(groupId, classNameId, templateKey);
250            }
251    
252            /**
253            * Returns the template with the ID.
254            *
255            * @param templateId the primary key of the template
256            * @return the template with the ID
257            * @throws PortalException if the user did not have permission to view the
258            template or if a matching template could not be found
259            * @throws SystemException if a system exception occurred
260            */
261            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate getTemplate(
262                    long templateId)
263                    throws com.liferay.portal.kernel.exception.PortalException,
264                            com.liferay.portal.kernel.exception.SystemException {
265                    return getService().getTemplate(templateId);
266            }
267    
268            /**
269            * Returns the template matching the group and template key.
270            *
271            * @param groupId the primary key of the group
272            * @param classNameId the primary key of the class name for template's
273            related model
274            * @param templateKey the unique string identifying the template
275            * @return the matching template
276            * @throws PortalException if a matching template could not be found
277            * @throws SystemException if a system exception occurred
278            */
279            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate getTemplate(
280                    long groupId, long classNameId, java.lang.String templateKey)
281                    throws com.liferay.portal.kernel.exception.PortalException,
282                            com.liferay.portal.kernel.exception.SystemException {
283                    return getService().getTemplate(groupId, classNameId, templateKey);
284            }
285    
286            /**
287            * Returns the template matching the group and template key, optionally in
288            * the global scope.
289            *
290            * <p>
291            * This method first searches in the group. If the template is still not
292            * found and <code>includeGlobalTemplates</code> is set to
293            * <code>true</code>, this method searches the global group.
294            * </p>
295            *
296            * @param groupId the primary key of the group
297            * @param classNameId the primary key of the class name for template's
298            related model
299            * @param templateKey the unique string identifying the template
300            * @param includeGlobalTemplates whether to include the global scope in the
301            search
302            * @return the matching template
303            * @throws PortalException if a matching template could not be found
304            * @throws SystemException if a system exception occurred
305            */
306            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate getTemplate(
307                    long groupId, long classNameId, java.lang.String templateKey,
308                    boolean includeGlobalTemplates)
309                    throws com.liferay.portal.kernel.exception.PortalException,
310                            com.liferay.portal.kernel.exception.SystemException {
311                    return getService()
312                                       .getTemplate(groupId, classNameId, templateKey,
313                            includeGlobalTemplates);
314            }
315    
316            /**
317            * Returns all the templates matching the group and class name ID.
318            *
319            * @param groupId the primary key of the group
320            * @param classNameId the primary key of the class name for template's
321            related model
322            * @return the matching templates
323            * @throws SystemException if a system exception occurred
324            */
325            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplates(
326                    long groupId, long classNameId)
327                    throws com.liferay.portal.kernel.exception.SystemException {
328                    return getService().getTemplates(groupId, classNameId);
329            }
330    
331            /**
332            * Returns all the templates matching the group, class name ID, and class
333            * PK.
334            *
335            * @param groupId the primary key of the group
336            * @param classNameId the primary key of the class name for template's
337            related model
338            * @param classPK the primary key of the template's related entity
339            * @return the matching templates
340            * @throws SystemException if a system exception occurred
341            */
342            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplates(
343                    long groupId, long classNameId, long classPK)
344                    throws com.liferay.portal.kernel.exception.SystemException {
345                    return getService().getTemplates(groupId, classNameId, classPK);
346            }
347    
348            /**
349            * Returns all the templates matching the class name ID, class PK, type, and
350            * mode.
351            *
352            * @param groupId the primary key of the group
353            * @param classNameId the primary key of the class name for template's
354            related model
355            * @param classPK the primary key of the template's related entity
356            * @param type the template's type. For more information, see {@link
357            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
358            * @return the matching templates
359            * @throws SystemException if a system exception occurred
360            */
361            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplates(
362                    long groupId, long classNameId, long classPK, java.lang.String type)
363                    throws com.liferay.portal.kernel.exception.SystemException {
364                    return getService().getTemplates(groupId, classNameId, classPK, type);
365            }
366    
367            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplates(
368                    long groupId, long classNameId, long classPK, java.lang.String type,
369                    java.lang.String mode)
370                    throws com.liferay.portal.kernel.exception.SystemException {
371                    return getService()
372                                       .getTemplates(groupId, classNameId, classPK, type, mode);
373            }
374    
375            /**
376            * Returns all the templates matching the group and class PK.
377            *
378            * @param groupId the primary key of the group
379            * @param classPK the primary key of the template's related entity
380            * @return the matching templates
381            * @throws SystemException if a system exception occurred
382            */
383            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplatesByClassPK(
384                    long groupId, long classPK)
385                    throws com.liferay.portal.kernel.exception.SystemException {
386                    return getService().getTemplatesByClassPK(groupId, classPK);
387            }
388    
389            /**
390            * Returns an ordered range of all the templates matching the group and
391            * structure class name ID.
392            *
393            * <p>
394            * Useful when paginating results. Returns a maximum of <code>end -
395            * start</code> instances. <code>start</code> and <code>end</code> are not
396            * primary keys, they are indexes in the result set. Thus, <code>0</code>
397            * refers to the first result in the set. Setting both <code>start</code>
398            * and <code>end</code> to {@link
399            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
400            * result set.
401            * </p>
402            *
403            * @param groupId the primary key of the group
404            * @param structureClassNameId the primary key of the class name for the
405            template's related structure
406            * @param start the lower bound of the range of templates to return
407            * @param end the upper bound of the range of templates to return (not
408            inclusive)
409            * @param orderByComparator the comparator to order the templates
410            (optionally <code>null</code>)
411            * @return the range of matching templates ordered by the comparator
412            * @throws SystemException if a system exception occurred
413            */
414            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplatesByStructureClassNameId(
415                    long groupId, long structureClassNameId, int start, int end,
416                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
417                    throws com.liferay.portal.kernel.exception.SystemException {
418                    return getService()
419                                       .getTemplatesByStructureClassNameId(groupId,
420                            structureClassNameId, start, end, orderByComparator);
421            }
422    
423            /**
424            * Returns an ordered range of all the templates matching the group, class
425            * name ID, class PK, type, and mode, and matching the keywords in the
426            * template names and descriptions.
427            *
428            * <p>
429            * Useful when paginating results. Returns a maximum of <code>end -
430            * start</code> instances. <code>start</code> and <code>end</code> are not
431            * primary keys, they are indexes in the result set. Thus, <code>0</code>
432            * refers to the first result in the set. Setting both <code>start</code>
433            * and <code>end</code> to {@link
434            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
435            * result set.
436            * </p>
437            *
438            * @param companyId the primary key of the template's company
439            * @param groupId the primary key of the group
440            * @param classNameId the primary key of the class name for template's
441            related model
442            * @param classPK the primary key of the template's related entity
443            * @param keywords the keywords (space separated), which may occur in the
444            template's name or description (optionally <code>null</code>)
445            * @param type the template's type (optionally <code>null</code>). For more
446            information, see {@link
447            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
448            * @param mode the template's mode (optionally <code>null</code>) For more
449            information, see {@link
450            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
451            * @param start the lower bound of the range of templates to return
452            * @param end the upper bound of the range of templates to return (not
453            inclusive)
454            * @param orderByComparator the comparator to order the templates
455            (optionally <code>null</code>)
456            * @return the matching templates ordered by the comparator
457            * @throws SystemException if a system exception occurred
458            */
459            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> search(
460                    long companyId, long groupId, long classNameId, long classPK,
461                    java.lang.String keywords, java.lang.String type,
462                    java.lang.String mode, int start, int end,
463                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
464                    throws com.liferay.portal.kernel.exception.SystemException {
465                    return getService()
466                                       .search(companyId, groupId, classNameId, classPK, keywords,
467                            type, mode, start, end, orderByComparator);
468            }
469    
470            /**
471            * Returns an ordered range of all the templates matching the group, class
472            * name ID, class PK, name keyword, description keyword, type, mode, and
473            * language.
474            *
475            * <p>
476            * Useful when paginating results. Returns a maximum of <code>end -
477            * start</code> instances. <code>start</code> and <code>end</code> are not
478            * primary keys, they are indexes in the result set. Thus, <code>0</code>
479            * refers to the first result in the set. Setting both <code>start</code>
480            * and <code>end</code> to {@link
481            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
482            * result set.
483            * </p>
484            *
485            * @param companyId the primary key of the template's company
486            * @param groupId the primary key of the group
487            * @param classNameId the primary key of the class name for template's
488            related model
489            * @param classPK the primary key of the template's related entity
490            * @param name the name keywords (optionally <code>null</code>)
491            * @param description the description keywords (optionally
492            <code>null</code>)
493            * @param type the template's type (optionally <code>null</code>). For more
494            information, see {@link
495            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
496            * @param mode the template's mode (optionally <code>null</code>). For more
497            information, see {@link
498            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
499            * @param language the template's script language (optionally
500            <code>null</code>). For more information, see {@link
501            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
502            * @param andOperator whether every field must match its keywords, or just
503            one field.
504            * @param start the lower bound of the range of templates to return
505            * @param end the upper bound of the range of templates to return (not
506            inclusive)
507            * @param orderByComparator the comparator to order the templates
508            (optionally <code>null</code>)
509            * @return the matching templates ordered by the comparator
510            * @throws SystemException if a system exception occurred
511            */
512            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> search(
513                    long companyId, long groupId, long classNameId, long classPK,
514                    java.lang.String name, java.lang.String description,
515                    java.lang.String type, java.lang.String mode,
516                    java.lang.String language, boolean andOperator, int start, int end,
517                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
518                    throws com.liferay.portal.kernel.exception.SystemException {
519                    return getService()
520                                       .search(companyId, groupId, classNameId, classPK, name,
521                            description, type, mode, language, andOperator, start, end,
522                            orderByComparator);
523            }
524    
525            /**
526            * Returns an ordered range of all the templates matching the group IDs,
527            * class name IDs, class PK, type, and mode, and matching the keywords in
528            * the template names and descriptions.
529            *
530            * <p>
531            * Useful when paginating results. Returns a maximum of <code>end -
532            * start</code> instances. <code>start</code> and <code>end</code> are not
533            * primary keys, they are indexes in the result set. Thus, <code>0</code>
534            * refers to the first result in the set. Setting both <code>start</code>
535            * and <code>end</code> to {@link
536            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
537            * result set.
538            * </p>
539            *
540            * @param companyId the primary key of the template's company
541            * @param groupIds the primary keys of the groups
542            * @param classNameIds the primary keys of the entity's instances the
543            templates are related to
544            * @param classPK the primary key of the template's related entity
545            * @param keywords the keywords (space separated), which may occur in the
546            template's name or description (optionally <code>null</code>)
547            * @param type the template's type (optionally <code>null</code>). For more
548            information, see {@link
549            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
550            * @param mode the template's mode (optionally <code>null</code>). For more
551            information, see {@link
552            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
553            * @param start the lower bound of the range of templates to return
554            * @param end the upper bound of the range of templates to return (not
555            inclusive)
556            * @param orderByComparator the comparator to order the templates
557            (optionally <code>null</code>)
558            * @return the matching templates ordered by the comparator
559            * @throws SystemException if a system exception occurred
560            */
561            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> search(
562                    long companyId, long[] groupIds, long[] classNameIds, long classPK,
563                    java.lang.String keywords, java.lang.String type,
564                    java.lang.String mode, int start, int end,
565                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
566                    throws com.liferay.portal.kernel.exception.SystemException {
567                    return getService()
568                                       .search(companyId, groupIds, classNameIds, classPK,
569                            keywords, type, mode, start, end, orderByComparator);
570            }
571    
572            /**
573            * Returns an ordered range of all the templates matching the group IDs,
574            * class name IDs, class PK, name keyword, description keyword, type, mode,
575            * and language.
576            *
577            * <p>
578            * Useful when paginating results. Returns a maximum of <code>end -
579            * start</code> instances. <code>start</code> and <code>end</code> are not
580            * primary keys, they are indexes in the result set. Thus, <code>0</code>
581            * refers to the first result in the set. Setting both <code>start</code>
582            * and <code>end</code> to {@link
583            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
584            * result set.
585            * </p>
586            *
587            * @param companyId the primary key of the template's company
588            * @param groupIds the primary keys of the groups
589            * @param classNameIds the primary keys of the entity's instances the
590            templates are related to
591            * @param classPK the primary key of the template's related entity
592            * @param name the name keywords (optionally <code>null</code>)
593            * @param description the description keywords (optionally
594            <code>null</code>)
595            * @param type the template's type (optionally <code>null</code>). For more
596            information, see {@link
597            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
598            * @param mode the template's mode (optionally <code>null</code>). For more
599            information, see {@link
600            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
601            * @param language the template's script language (optionally
602            <code>null</code>). For more information, see {@link
603            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
604            * @param andOperator whether every field must match its keywords, or just
605            one field.
606            * @param start the lower bound of the range of templates to return
607            * @param end the upper bound of the range of templates to return (not
608            inclusive)
609            * @param orderByComparator the comparator to order the templates
610            (optionally <code>null</code>)
611            * @return the matching templates ordered by the comparator
612            * @throws SystemException if a system exception occurred
613            */
614            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> search(
615                    long companyId, long[] groupIds, long[] classNameIds, long classPK,
616                    java.lang.String name, java.lang.String description,
617                    java.lang.String type, java.lang.String mode,
618                    java.lang.String language, boolean andOperator, int start, int end,
619                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
620                    throws com.liferay.portal.kernel.exception.SystemException {
621                    return getService()
622                                       .search(companyId, groupIds, classNameIds, classPK, name,
623                            description, type, mode, language, andOperator, start, end,
624                            orderByComparator);
625            }
626    
627            /**
628            * Returns the number of templates matching the group, class name ID, class
629            * PK, type, and mode, and matching the keywords in the template names and
630            * descriptions.
631            *
632            * @param companyId the primary key of the template's company
633            * @param groupId the primary key of the group
634            * @param classNameId the primary key of the class name for template's
635            related model
636            * @param classPK the primary key of the template's related entity
637            * @param keywords the keywords (space separated), which may occur in the
638            template's name or description (optionally <code>null</code>)
639            * @param type the template's type (optionally <code>null</code>). For more
640            information, see {@link
641            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
642            * @param mode the template's mode (optionally <code>null</code>). For more
643            information, see {@link
644            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
645            * @return the number of matching templates
646            * @throws SystemException if a system exception occurred
647            */
648            public static int searchCount(long companyId, long groupId,
649                    long classNameId, long classPK, java.lang.String keywords,
650                    java.lang.String type, java.lang.String mode)
651                    throws com.liferay.portal.kernel.exception.SystemException {
652                    return getService()
653                                       .searchCount(companyId, groupId, classNameId, classPK,
654                            keywords, type, mode);
655            }
656    
657            /**
658            * Returns the number of templates matching the group, class name ID, class
659            * PK, name keyword, description keyword, type, mode, and language.
660            *
661            * @param companyId the primary key of the template's company
662            * @param groupId the primary key of the group
663            * @param classNameId the primary key of the class name for template's
664            related model
665            * @param classPK the primary key of the template's related entity
666            * @param name the name keywords (optionally <code>null</code>)
667            * @param description the description keywords (optionally
668            <code>null</code>)
669            * @param type the template's type (optionally <code>null</code>). For more
670            information, see {@link
671            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
672            * @param mode the template's mode (optionally <code>null</code>). For more
673            information, see {@link
674            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
675            * @param language the template's script language (optionally
676            <code>null</code>). For more information, see {@link
677            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
678            * @param andOperator whether every field must match its keywords, or just
679            one field.
680            * @return the number of matching templates
681            * @throws SystemException if a system exception occurred
682            */
683            public static int searchCount(long companyId, long groupId,
684                    long classNameId, long classPK, java.lang.String name,
685                    java.lang.String description, java.lang.String type,
686                    java.lang.String mode, java.lang.String language, boolean andOperator)
687                    throws com.liferay.portal.kernel.exception.SystemException {
688                    return getService()
689                                       .searchCount(companyId, groupId, classNameId, classPK, name,
690                            description, type, mode, language, andOperator);
691            }
692    
693            /**
694            * Returns the number of templates matching the group IDs, class name IDs,
695            * class PK, type, and mode, and matching the keywords in the template names
696            * and descriptions.
697            *
698            * @param companyId the primary key of the template's company
699            * @param groupIds the primary keys of the groups
700            * @param classNameIds the primary keys of the entity's instances the
701            templates are related to
702            * @param classPK the primary key of the template's related entity
703            * @param keywords the keywords (space separated), which may occur in the
704            template's name or description (optionally <code>null</code>)
705            * @param type the template's type (optionally <code>null</code>). For more
706            information, see {@link
707            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
708            * @param mode the template's mode (optionally <code>null</code>). For more
709            information, see {@link
710            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
711            * @return the number of matching templates
712            * @throws SystemException if a system exception occurred
713            */
714            public static int searchCount(long companyId, long[] groupIds,
715                    long[] classNameIds, long classPK, java.lang.String keywords,
716                    java.lang.String type, java.lang.String mode)
717                    throws com.liferay.portal.kernel.exception.SystemException {
718                    return getService()
719                                       .searchCount(companyId, groupIds, classNameIds, classPK,
720                            keywords, type, mode);
721            }
722    
723            /**
724            * Returns the number of templates matching the group IDs, class name IDs,
725            * class PK, name keyword, description keyword, type, mode, and language.
726            *
727            * @param companyId the primary key of the template's company
728            * @param groupIds the primary keys of the groups
729            * @param classNameIds the primary keys of the entity's instances the
730            templates are related to
731            * @param classPK the primary key of the template's related entity
732            * @param name the name keywords (optionally <code>null</code>)
733            * @param description the description keywords (optionally
734            <code>null</code>)
735            * @param type the template's type (optionally <code>null</code>). For more
736            information, see {@link
737            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
738            * @param mode the template's mode (optionally <code>null</code>). For more
739            information, see {@link
740            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
741            * @param language the template's script language (optionally
742            <code>null</code>). For more information, see {@link
743            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
744            * @param andOperator whether every field must match its keywords, or just
745            one field.
746            * @return the number of matching templates
747            * @throws SystemException if a system exception occurred
748            */
749            public static int searchCount(long companyId, long[] groupIds,
750                    long[] classNameIds, long classPK, java.lang.String name,
751                    java.lang.String description, java.lang.String type,
752                    java.lang.String mode, java.lang.String language, boolean andOperator)
753                    throws com.liferay.portal.kernel.exception.SystemException {
754                    return getService()
755                                       .searchCount(companyId, groupIds, classNameIds, classPK,
756                            name, description, type, mode, language, andOperator);
757            }
758    
759            /**
760            * Updates the template matching the ID.
761            *
762            * @param templateId the primary key of the template
763            * @param nameMap the template's new locales and localized names
764            * @param descriptionMap the template's new locales and localized
765            description
766            * @param type the template's type. For more information, see {@link
767            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
768            * @param mode the template's mode. For more information, see {@link
769            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
770            * @param language the template's script language. For more information,
771            see {@link
772            com.liferay.portlet.dynamicdatamapping.model.DDMTemplateConstants}.
773            * @param script the template's script
774            * @param cacheable whether the template is cacheable
775            * @param smallImage whether the template has a small image
776            * @param smallImageURL the template's small image URL (optionally
777            <code>null</code>)
778            * @param smallImageFile the template's small image file (optionally
779            <code>null</code>)
780            * @param serviceContext the service context to be applied. Can set the
781            modification date.
782            * @return the updated template
783            * @throws PortalException if the user did not have permission to update the
784            template or if a portal exception occurred
785            * @throws SystemException if a system exception occurred
786            */
787            public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate updateTemplate(
788                    long templateId,
789                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
790                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
791                    java.lang.String type, java.lang.String mode,
792                    java.lang.String language, java.lang.String script, boolean cacheable,
793                    boolean smallImage, java.lang.String smallImageURL,
794                    java.io.File smallImageFile,
795                    com.liferay.portal.service.ServiceContext serviceContext)
796                    throws com.liferay.portal.kernel.exception.PortalException,
797                            com.liferay.portal.kernel.exception.SystemException {
798                    return getService()
799                                       .updateTemplate(templateId, nameMap, descriptionMap, type,
800                            mode, language, script, cacheable, smallImage, smallImageURL,
801                            smallImageFile, serviceContext);
802            }
803    
804            public static DDMTemplateService getService() {
805                    if (_service == null) {
806                            _service = (DDMTemplateService)PortalBeanLocatorUtil.locate(DDMTemplateService.class.getName());
807    
808                            ReferenceRegistry.registerReference(DDMTemplateServiceUtil.class,
809                                    "_service");
810                    }
811    
812                    return _service;
813            }
814    
815            /**
816             * @deprecated As of 6.2.0
817             */
818            public void setService(DDMTemplateService service) {
819            }
820    
821            private static DDMTemplateService _service;
822    }