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