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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.util.ReferenceRegistry;
021    
022    /**
023     * Provides the remote service utility for DDMStructure. This utility wraps
024     * {@link com.liferay.portlet.dynamicdatamapping.service.impl.DDMStructureServiceImpl} and is the
025     * primary access point for service operations in application layer code running
026     * on a remote server. Methods of this service are expected to have security
027     * checks based on the propagated JAAS credentials because this service can be
028     * accessed remotely.
029     *
030     * @author Brian Wing Shun Chan
031     * @see DDMStructureService
032     * @see com.liferay.portlet.dynamicdatamapping.service.base.DDMStructureServiceBaseImpl
033     * @see com.liferay.portlet.dynamicdatamapping.service.impl.DDMStructureServiceImpl
034     * @generated
035     */
036    @ProviderType
037    public class DDMStructureServiceUtil {
038            /*
039             * NOTE FOR DEVELOPERS:
040             *
041             * Never modify this class directly. Add custom service methods to {@link com.liferay.portlet.dynamicdatamapping.service.impl.DDMStructureServiceImpl} and rerun ServiceBuilder to regenerate this class.
042             */
043    
044            /**
045            * Returns the Spring bean ID for this bean.
046            *
047            * @return the Spring bean ID for this bean
048            */
049            public static java.lang.String getBeanIdentifier() {
050                    return getService().getBeanIdentifier();
051            }
052    
053            /**
054            * Sets the Spring bean ID for this bean.
055            *
056            * @param beanIdentifier the Spring bean ID for this bean
057            */
058            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
059                    getService().setBeanIdentifier(beanIdentifier);
060            }
061    
062            /**
063            * Adds a structure referencing a default parent structure, using the portal
064            * property <code>dynamic.data.lists.storage.type</code> storage type and
065            * default structure type.
066            *
067            * @param userId the primary key of the structure's creator/owner
068            * @param groupId the primary key of the group
069            * @param classNameId the primary key of the class name for the structure's
070            related model
071            * @param nameMap the structure's locales and localized names
072            * @param descriptionMap the structure's locales and localized descriptions
073            * @param xsd the structure's XML schema definition
074            * @param serviceContext the service context to be applied. Can set the
075            UUID, creation date, modification date, guest permissions, and
076            group permissions for the structure.
077            * @return the structure
078            * @throws PortalException if a user with the primary key could not be
079            found, if the user did not have permission to add the structure,
080            if the XSD was not well-formed, or if a portal exception occurred
081            * @throws SystemException if a system exception occurred
082            */
083            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure addStructure(
084                    long userId, long groupId, long classNameId,
085                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
086                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
087                    java.lang.String xsd,
088                    com.liferay.portal.service.ServiceContext serviceContext)
089                    throws com.liferay.portal.kernel.exception.PortalException,
090                            com.liferay.portal.kernel.exception.SystemException {
091                    return getService()
092                                       .addStructure(userId, groupId, classNameId, nameMap,
093                            descriptionMap, xsd, serviceContext);
094            }
095    
096            /**
097            * Adds a structure referencing its parent structure.
098            *
099            * @param groupId the primary key of the group
100            * @param parentStructureId the primary key of the parent structure
101            (optionally {@link
102            com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants#DEFAULT_PARENT_STRUCTURE_ID})
103            * @param classNameId the primary key of the class name for the structure's
104            related model
105            * @param structureKey the unique string identifying the structure
106            (optionally <code>null</code>)
107            * @param nameMap the structure's locales and localized names
108            * @param descriptionMap the structure's locales and localized descriptions
109            * @param xsd the structure's XML schema definition
110            * @param storageType the structure's storage type. It can be "xml" or
111            "expando". For more information, see {@link
112            com.liferay.portlet.dynamicdatamapping.storage.StorageType}.
113            * @param type the structure's type. For more information, see {@link
114            com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}.
115            * @param serviceContext the service context to be applied. Can set the
116            UUID, creation date, modification date, guest permissions, and
117            group permissions for the structure.
118            * @return the structure
119            * @throws PortalException if the user did not have permission to add the
120            structure, if the XSD is not well formed, or if a portal
121            exception occurred
122            * @throws SystemException if a system exception occurred
123            */
124            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure addStructure(
125                    long groupId, long parentStructureId, long classNameId,
126                    java.lang.String structureKey,
127                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
128                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
129                    java.lang.String xsd, java.lang.String storageType, int type,
130                    com.liferay.portal.service.ServiceContext serviceContext)
131                    throws com.liferay.portal.kernel.exception.PortalException,
132                            com.liferay.portal.kernel.exception.SystemException {
133                    return getService()
134                                       .addStructure(groupId, parentStructureId, classNameId,
135                            structureKey, nameMap, descriptionMap, xsd, storageType, type,
136                            serviceContext);
137            }
138    
139            /**
140            * Adds a structure referencing the parent structure by its structure key.
141            * In case the parent structure is not found, it uses the default parent
142            * structure ID.
143            *
144            * @param userId the primary key of the structure's creator/owner
145            * @param groupId the primary key of the group
146            * @param parentStructureKey the unique string identifying the structure
147            * @param classNameId the primary key of the class name for the structure's
148            related model
149            * @param structureKey unique string identifying the structure (optionally
150            <code>null</code>)
151            * @param nameMap the structure's locales and localized names
152            * @param descriptionMap the structure's locales and localized descriptions
153            * @param xsd the XML schema definition of the structure
154            * @param storageType the storage type of the structure. It can be XML or
155            expando. For more information, see {@link
156            com.liferay.portlet.dynamicdatamapping.storage.StorageType}.
157            * @param type the structure's type. For more information, see {@link
158            com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}.
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 structure.
163            * @return the structure
164            * @throws PortalException if a user with the primary key could not be
165            found, if the user did not have permission to add the structure,
166            if the XSD was not well-formed, or if a portal exception occurred
167            * @throws SystemException if a system exception occurred
168            */
169            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure addStructure(
170                    long userId, long groupId, java.lang.String parentStructureKey,
171                    long classNameId, java.lang.String structureKey,
172                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
173                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
174                    java.lang.String xsd, java.lang.String storageType, int type,
175                    com.liferay.portal.service.ServiceContext serviceContext)
176                    throws com.liferay.portal.kernel.exception.PortalException,
177                            com.liferay.portal.kernel.exception.SystemException {
178                    return getService()
179                                       .addStructure(userId, groupId, parentStructureKey,
180                            classNameId, structureKey, nameMap, descriptionMap, xsd,
181                            storageType, type, serviceContext);
182            }
183    
184            /**
185            * Copies a structure, creating a new structure with all the values
186            * extracted from the original one. The new structure supports a new name
187            * and description.
188            *
189            * @param structureId the primary key of the structure to be copied
190            * @param nameMap the new structure's locales and localized names
191            * @param descriptionMap the new structure's locales and localized
192            descriptions
193            * @param serviceContext the service context to be applied. Can set the
194            UUID, creation date, modification date, guest permissions, and
195            group permissions for the structure.
196            * @return the new structure
197            * @throws PortalException if the user did not have permission to add the
198            structure or if a portal exception occurred
199            * @throws SystemException if a system exception occurred
200            */
201            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure copyStructure(
202                    long structureId,
203                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
204                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
205                    com.liferay.portal.service.ServiceContext serviceContext)
206                    throws com.liferay.portal.kernel.exception.PortalException,
207                            com.liferay.portal.kernel.exception.SystemException {
208                    return getService()
209                                       .copyStructure(structureId, nameMap, descriptionMap,
210                            serviceContext);
211            }
212    
213            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure copyStructure(
214                    long structureId,
215                    com.liferay.portal.service.ServiceContext serviceContext)
216                    throws com.liferay.portal.kernel.exception.PortalException,
217                            com.liferay.portal.kernel.exception.SystemException {
218                    return getService().copyStructure(structureId, serviceContext);
219            }
220    
221            /**
222            * Deletes the structure and its resources.
223            *
224            * <p>
225            * Before deleting the structure, the system verifies whether the structure
226            * is required by another entity. If it is needed, an exception is thrown.
227            * </p>
228            *
229            * @param structureId the primary key of the structure to be deleted
230            * @throws PortalException if the user did not have permission to delete the
231            structure or if a portal exception occurred
232            * @throws SystemException if a system exception occurred
233            */
234            public static void deleteStructure(long structureId)
235                    throws com.liferay.portal.kernel.exception.PortalException,
236                            com.liferay.portal.kernel.exception.SystemException {
237                    getService().deleteStructure(structureId);
238            }
239    
240            /**
241            * Returns the structure matching the class name ID, structure key, and
242            * group.
243            *
244            * @param groupId the primary key of the group
245            * @param classNameId the primary key of the class name for the structure's
246            related model
247            * @param structureKey the unique string identifying the structure
248            * @return the matching structure, or <code>null</code> if a matching
249            structure could not be found
250            * @throws PortalException if the user did not have permission to view the
251            structure or if a portal exception occurred
252            * @throws SystemException if a system exception occurred
253            */
254            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure fetchStructure(
255                    long groupId, long classNameId, java.lang.String structureKey)
256                    throws com.liferay.portal.kernel.exception.PortalException,
257                            com.liferay.portal.kernel.exception.SystemException {
258                    return getService().fetchStructure(groupId, classNameId, structureKey);
259            }
260    
261            /**
262            * Returns the structure with the ID.
263            *
264            * @param structureId the primary key of the structure
265            * @return the structure with the ID
266            * @throws PortalException if the user did not have permission to view the
267            structure or if a structure with the ID could not be found
268            * @throws SystemException if a system exception occurred
269            */
270            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure getStructure(
271                    long structureId)
272                    throws com.liferay.portal.kernel.exception.PortalException,
273                            com.liferay.portal.kernel.exception.SystemException {
274                    return getService().getStructure(structureId);
275            }
276    
277            /**
278            * Returns the structure matching the class name ID, structure key, and
279            * group.
280            *
281            * @param groupId the primary key of the structure's group
282            * @param classNameId the primary key of the class name for the structure's
283            related model
284            * @param structureKey the unique string identifying the structure
285            * @return the matching structure
286            * @throws PortalException if the user did not have permission to view the
287            structure or if a matching structure could not be found
288            * @throws SystemException if a system exception occurred
289            */
290            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure getStructure(
291                    long groupId, long classNameId, java.lang.String structureKey)
292                    throws com.liferay.portal.kernel.exception.PortalException,
293                            com.liferay.portal.kernel.exception.SystemException {
294                    return getService().getStructure(groupId, classNameId, structureKey);
295            }
296    
297            /**
298            * Returns the structure matching the class name ID, structure key, and
299            * group, optionally in the global scope.
300            *
301            * <p>
302            * This method first searches in the group. If the structure is still not
303            * found and <code>includeGlobalStructures</code> is set to
304            * <code>true</code>, this method searches the global group.
305            * </p>
306            *
307            * @param groupId the primary key of the structure's group
308            * @param classNameId the primary key of the class name for the structure's
309            related model
310            * @param structureKey the unique string identifying the structure
311            * @param includeGlobalStructures whether to include the global scope in
312            the search
313            * @return the matching structure
314            * @throws PortalException if the user did not have permission to view the
315            structure or if a matching structure could not be found
316            * @throws SystemException if a system exception occurred
317            */
318            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure getStructure(
319                    long groupId, long classNameId, java.lang.String structureKey,
320                    boolean includeGlobalStructures)
321                    throws com.liferay.portal.kernel.exception.PortalException,
322                            com.liferay.portal.kernel.exception.SystemException {
323                    return getService()
324                                       .getStructure(groupId, classNameId, structureKey,
325                            includeGlobalStructures);
326            }
327    
328            /**
329            * Returns all the structures in the group that the user has permission to
330            * view.
331            *
332            * @param groupId the primary key of the group
333            * @return the structures in the group that the user has permission to view
334            * @throws SystemException if a system exception occurred
335            */
336            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> getStructures(
337                    long groupId)
338                    throws com.liferay.portal.kernel.exception.SystemException {
339                    return getService().getStructures(groupId);
340            }
341    
342            /**
343            * Returns all the structures in the groups that the user has permission to
344            * view.
345            *
346            * @param groupIds the primary key of the groups
347            * @return the structures in the groups that the user has permission to view
348            * @throws SystemException if a system exception occurred
349            */
350            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> getStructures(
351                    long[] groupIds)
352                    throws com.liferay.portal.kernel.exception.SystemException {
353                    return getService().getStructures(groupIds);
354            }
355    
356            /**
357            * Returns an ordered range of all the structures matching the groups and
358            * class name IDs, and matching the keywords in the structure names and
359            * descriptions.
360            *
361            * <p>
362            * Useful when paginating results. Returns a maximum of <code>end -
363            * start</code> instances. <code>start</code> and <code>end</code> are not
364            * primary keys, they are indexes in the result set. Thus, <code>0</code>
365            * refers to the first result in the set. Setting both <code>start</code>
366            * and <code>end</code> to {@link
367            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
368            * result set.
369            * </p>
370            *
371            * @param companyId the primary key of the structure's company
372            * @param groupIds the primary keys of the groups
373            * @param classNameIds the primary keys of the class names of the models
374            the structures are related to
375            * @param keywords the keywords (space separated), which may occur in the
376            structure's name or description (optionally <code>null</code>)
377            * @param start the lower bound of the range of structures to return
378            * @param end the upper bound of the range of structures to return (not
379            inclusive)
380            * @param orderByComparator the comparator to order the structures
381            (optionally <code>null</code>)
382            * @return the range of matching structures ordered by the comparator
383            * @throws SystemException if a system exception occurred
384            */
385            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> search(
386                    long companyId, long[] groupIds, long[] classNameIds,
387                    java.lang.String keywords, int start, int end,
388                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
389                    throws com.liferay.portal.kernel.exception.SystemException {
390                    return getService()
391                                       .search(companyId, groupIds, classNameIds, keywords, start,
392                            end, orderByComparator);
393            }
394    
395            /**
396            * Returns an ordered range of all the structures matching the groups, class
397            * name IDs, name keyword, description keyword, storage type, and type.
398            *
399            * <p>
400            * Useful when paginating results. Returns a maximum of <code>end -
401            * start</code> instances. <code>start</code> and <code>end</code> are not
402            * primary keys, they are indexes in the result set. Thus, <code>0</code>
403            * refers to the first result in the set. Setting both <code>start</code>
404            * and <code>end</code> to {@link
405            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
406            * result set.
407            * </p>
408            *
409            * @param companyId the primary key of the structure's company
410            * @param groupIds the primary keys of the groups
411            * @param classNameIds the primary keys of the class names of the models
412            the structures are related to
413            * @param name the name keywords
414            * @param description the description keywords
415            * @param storageType the structure's storage type. It can be "xml" or
416            "expando". For more information, see {@link
417            com.liferay.portlet.dynamicdatamapping.storage.StorageType}.
418            * @param type the structure's type. For more information, see {@link
419            com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}.
420            * @param andOperator whether every field must match its keywords, or just
421            one field
422            * @param start the lower bound of the range of structures to return
423            * @param end the upper bound of the range of structures to return (not
424            inclusive)
425            * @param orderByComparator the comparator to order the structures
426            (optionally <code>null</code>)
427            * @return the range of matching structures ordered by the comparator
428            * @throws SystemException if a system exception occurred
429            */
430            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> search(
431                    long companyId, long[] groupIds, long[] classNameIds,
432                    java.lang.String name, java.lang.String description,
433                    java.lang.String storageType, int type, boolean andOperator, int start,
434                    int end,
435                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
436                    throws com.liferay.portal.kernel.exception.SystemException {
437                    return getService()
438                                       .search(companyId, groupIds, classNameIds, name,
439                            description, storageType, type, andOperator, start, end,
440                            orderByComparator);
441            }
442    
443            /**
444            * Returns the number of structures matching the groups and class name IDs,
445            * and matching the keywords in the structure names and descriptions.
446            *
447            * @param companyId the primary key of the structure's company
448            * @param groupIds the primary keys of the groups
449            * @param classNameIds the primary keys of the class names of the models
450            the structures are related to
451            * @param keywords the keywords (space separated), which may occur in the
452            structure's name or description (optionally <code>null</code>)
453            * @return the number of matching structures
454            * @throws SystemException if a system exception occurred
455            */
456            public static int searchCount(long companyId, long[] groupIds,
457                    long[] classNameIds, java.lang.String keywords)
458                    throws com.liferay.portal.kernel.exception.SystemException {
459                    return getService()
460                                       .searchCount(companyId, groupIds, classNameIds, keywords);
461            }
462    
463            /**
464            * Returns the number of structures matching the groups, class name IDs,
465            * name keyword, description keyword, storage type, and type
466            *
467            * @param companyId the primary key of the structure's company
468            * @param groupIds the primary keys of the groups
469            * @param classNameIds the primary keys of the class names of the models
470            the structure's are related to
471            * @param name the name keywords
472            * @param description the description keywords
473            * @param storageType the structure's storage type. It can be "xml" or
474            "expando". For more information, see {@link
475            com.liferay.portlet.dynamicdatamapping.storage.StorageType}.
476            * @param type the structure's type. For more information, see {@link
477            com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}.
478            * @param andOperator whether every field must match its keywords, or just
479            one field
480            * @return the number of matching structures
481            * @throws SystemException if a system exception occurred
482            */
483            public static int searchCount(long companyId, long[] groupIds,
484                    long[] classNameIds, java.lang.String name,
485                    java.lang.String description, java.lang.String storageType, int type,
486                    boolean andOperator)
487                    throws com.liferay.portal.kernel.exception.SystemException {
488                    return getService()
489                                       .searchCount(companyId, groupIds, classNameIds, name,
490                            description, storageType, type, andOperator);
491            }
492    
493            /**
494            * Updates the structure matching the class name ID, structure key, and
495            * group, replacing its old parent structure, name map, description map, and
496            * XSD with new ones.
497            *
498            * @param groupId the primary key of the group
499            * @param parentStructureId the primary key of the new parent structure
500            * @param classNameId the primary key of the class name for the structure's
501            related model
502            * @param structureKey the unique string identifying the structure
503            * @param nameMap the structure's new locales and localized names
504            * @param descriptionMap the structure's new locales and localized
505            description
506            * @param xsd the structure's new XML schema definition
507            * @param serviceContext the service context to be applied. Can set the
508            modification date.
509            * @return the updated structure
510            * @throws PortalException if the user did not have permission to update the
511            structure or if a portal exception occurred
512            * @throws SystemException if a system exception occurred
513            */
514            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure updateStructure(
515                    long groupId, long parentStructureId, long classNameId,
516                    java.lang.String structureKey,
517                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
518                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
519                    java.lang.String xsd,
520                    com.liferay.portal.service.ServiceContext serviceContext)
521                    throws com.liferay.portal.kernel.exception.PortalException,
522                            com.liferay.portal.kernel.exception.SystemException {
523                    return getService()
524                                       .updateStructure(groupId, parentStructureId, classNameId,
525                            structureKey, nameMap, descriptionMap, xsd, serviceContext);
526            }
527    
528            /**
529            * Updates the structure matching the structure ID, replacing the old parent
530            * structure ID, name map, description map, and XSD with the new values.
531            *
532            * @param structureId the primary key of the structure
533            * @param parentStructureId the new parent structure primary key
534            * @param nameMap the structure's new locales and localized names
535            * @param descriptionMap the structure's new locales and localized
536            description
537            * @param xsd the new XML schema definition of the structure
538            * @param serviceContext the service context to be applied. Can set the
539            modification date.
540            * @return the updated structure
541            * @throws PortalException if the user did not have permission to update the
542            structure or if a portal exception occurred
543            * @throws SystemException if a system exception occurred
544            */
545            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure updateStructure(
546                    long structureId, long parentStructureId,
547                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
548                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
549                    java.lang.String xsd,
550                    com.liferay.portal.service.ServiceContext serviceContext)
551                    throws com.liferay.portal.kernel.exception.PortalException,
552                            com.liferay.portal.kernel.exception.SystemException {
553                    return getService()
554                                       .updateStructure(structureId, parentStructureId, nameMap,
555                            descriptionMap, xsd, serviceContext);
556            }
557    
558            public static DDMStructureService getService() {
559                    if (_service == null) {
560                            _service = (DDMStructureService)PortalBeanLocatorUtil.locate(DDMStructureService.class.getName());
561    
562                            ReferenceRegistry.registerReference(DDMStructureServiceUtil.class,
563                                    "_service");
564                    }
565    
566                    return _service;
567            }
568    
569            /**
570             * @deprecated As of 6.2.0
571             */
572            public void setService(DDMStructureService service) {
573            }
574    
575            private static DDMStructureService _service;
576    }