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 public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> getStructures( 357 long[] groupIds, long classNameId) 358 throws com.liferay.portal.kernel.exception.SystemException { 359 return getService().getStructures(groupIds, classNameId); 360 } 361 362 public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> getStructures( 363 long[] groupIds, long classNameId, int start, int end) 364 throws com.liferay.portal.kernel.exception.SystemException { 365 return getService().getStructures(groupIds, classNameId, start, end); 366 } 367 368 /** 369 * Returns an ordered range of all the structures matching the groups and 370 * class name IDs, and matching the keywords in the structure names and 371 * descriptions. 372 * 373 * <p> 374 * Useful when paginating results. Returns a maximum of <code>end - 375 * start</code> instances. <code>start</code> and <code>end</code> are not 376 * primary keys, they are indexes in the result set. Thus, <code>0</code> 377 * refers to the first result in the set. Setting both <code>start</code> 378 * and <code>end</code> to {@link 379 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 380 * result set. 381 * </p> 382 * 383 * @param companyId the primary key of the structure's company 384 * @param groupIds the primary keys of the groups 385 * @param classNameIds the primary keys of the class names of the models 386 the structures are related to 387 * @param keywords the keywords (space separated), which may occur in the 388 structure's name or description (optionally <code>null</code>) 389 * @param start the lower bound of the range of structures to return 390 * @param end the upper bound of the range of structures to return (not 391 inclusive) 392 * @param orderByComparator the comparator to order the structures 393 (optionally <code>null</code>) 394 * @return the range of matching structures ordered by the comparator 395 * @throws SystemException if a system exception occurred 396 */ 397 public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> search( 398 long companyId, long[] groupIds, long[] classNameIds, 399 java.lang.String keywords, int start, int end, 400 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 401 throws com.liferay.portal.kernel.exception.SystemException { 402 return getService() 403 .search(companyId, groupIds, classNameIds, keywords, start, 404 end, orderByComparator); 405 } 406 407 /** 408 * Returns an ordered range of all the structures matching the groups, class 409 * name IDs, name keyword, description keyword, storage type, and type. 410 * 411 * <p> 412 * Useful when paginating results. Returns a maximum of <code>end - 413 * start</code> instances. <code>start</code> and <code>end</code> are not 414 * primary keys, they are indexes in the result set. Thus, <code>0</code> 415 * refers to the first result in the set. Setting both <code>start</code> 416 * and <code>end</code> to {@link 417 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 418 * result set. 419 * </p> 420 * 421 * @param companyId the primary key of the structure's company 422 * @param groupIds the primary keys of the groups 423 * @param classNameIds the primary keys of the class names of the models 424 the structures are related to 425 * @param name the name keywords 426 * @param description the description keywords 427 * @param storageType the structure's storage type. It can be "xml" or 428 "expando". For more information, see {@link 429 com.liferay.portlet.dynamicdatamapping.storage.StorageType}. 430 * @param type the structure's type. For more information, see {@link 431 com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}. 432 * @param andOperator whether every field must match its keywords, or just 433 one field 434 * @param start the lower bound of the range of structures to return 435 * @param end the upper bound of the range of structures to return (not 436 inclusive) 437 * @param orderByComparator the comparator to order the structures 438 (optionally <code>null</code>) 439 * @return the range of matching structures ordered by the comparator 440 * @throws SystemException if a system exception occurred 441 */ 442 public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructure> search( 443 long companyId, long[] groupIds, long[] classNameIds, 444 java.lang.String name, java.lang.String description, 445 java.lang.String storageType, int type, boolean andOperator, int start, 446 int end, 447 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 448 throws com.liferay.portal.kernel.exception.SystemException { 449 return getService() 450 .search(companyId, groupIds, classNameIds, name, 451 description, storageType, type, andOperator, start, end, 452 orderByComparator); 453 } 454 455 /** 456 * Returns the number of structures matching the groups and class name IDs, 457 * and matching the keywords in the structure names and descriptions. 458 * 459 * @param companyId the primary key of the structure's company 460 * @param groupIds the primary keys of the groups 461 * @param classNameIds the primary keys of the class names of the models 462 the structures are related to 463 * @param keywords the keywords (space separated), which may occur in the 464 structure's name or description (optionally <code>null</code>) 465 * @return the number of matching structures 466 * @throws SystemException if a system exception occurred 467 */ 468 public static int searchCount(long companyId, long[] groupIds, 469 long[] classNameIds, java.lang.String keywords) 470 throws com.liferay.portal.kernel.exception.SystemException { 471 return getService() 472 .searchCount(companyId, groupIds, classNameIds, keywords); 473 } 474 475 /** 476 * Returns the number of structures matching the groups, class name IDs, 477 * name keyword, description keyword, storage type, and type 478 * 479 * @param companyId the primary key of the structure's company 480 * @param groupIds the primary keys of the groups 481 * @param classNameIds the primary keys of the class names of the models 482 the structure's are related to 483 * @param name the name keywords 484 * @param description the description keywords 485 * @param storageType the structure's storage type. It can be "xml" or 486 "expando". For more information, see {@link 487 com.liferay.portlet.dynamicdatamapping.storage.StorageType}. 488 * @param type the structure's type. For more information, see {@link 489 com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}. 490 * @param andOperator whether every field must match its keywords, or just 491 one field 492 * @return the number of matching structures 493 * @throws SystemException if a system exception occurred 494 */ 495 public static int searchCount(long companyId, long[] groupIds, 496 long[] classNameIds, java.lang.String name, 497 java.lang.String description, java.lang.String storageType, int type, 498 boolean andOperator) 499 throws com.liferay.portal.kernel.exception.SystemException { 500 return getService() 501 .searchCount(companyId, groupIds, classNameIds, name, 502 description, storageType, type, andOperator); 503 } 504 505 /** 506 * Updates the structure matching the class name ID, structure key, and 507 * group, replacing its old parent structure, name map, description map, and 508 * XSD with new ones. 509 * 510 * @param groupId the primary key of the group 511 * @param parentStructureId the primary key of the new parent structure 512 * @param classNameId the primary key of the class name for the structure's 513 related model 514 * @param structureKey the unique string identifying the structure 515 * @param nameMap the structure's new locales and localized names 516 * @param descriptionMap the structure's new locales and localized 517 description 518 * @param xsd the structure's new XML schema definition 519 * @param serviceContext the service context to be applied. Can set the 520 modification date. 521 * @return the updated structure 522 * @throws PortalException if the user did not have permission to update the 523 structure or if a portal exception occurred 524 * @throws SystemException if a system exception occurred 525 */ 526 public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure updateStructure( 527 long groupId, long parentStructureId, long classNameId, 528 java.lang.String structureKey, 529 java.util.Map<java.util.Locale, java.lang.String> nameMap, 530 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 531 java.lang.String xsd, 532 com.liferay.portal.service.ServiceContext serviceContext) 533 throws com.liferay.portal.kernel.exception.PortalException, 534 com.liferay.portal.kernel.exception.SystemException { 535 return getService() 536 .updateStructure(groupId, parentStructureId, classNameId, 537 structureKey, nameMap, descriptionMap, xsd, serviceContext); 538 } 539 540 /** 541 * Updates the structure matching the structure ID, replacing the old parent 542 * structure ID, name map, description map, and XSD with the new values. 543 * 544 * @param structureId the primary key of the structure 545 * @param parentStructureId the new parent structure primary key 546 * @param nameMap the structure's new locales and localized names 547 * @param descriptionMap the structure's new locales and localized 548 description 549 * @param xsd the new XML schema definition of the structure 550 * @param serviceContext the service context to be applied. Can set the 551 modification date. 552 * @return the updated structure 553 * @throws PortalException if the user did not have permission to update the 554 structure or if a portal exception occurred 555 * @throws SystemException if a system exception occurred 556 */ 557 public static com.liferay.portlet.dynamicdatamapping.model.DDMStructure updateStructure( 558 long structureId, long parentStructureId, 559 java.util.Map<java.util.Locale, java.lang.String> nameMap, 560 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 561 java.lang.String xsd, 562 com.liferay.portal.service.ServiceContext serviceContext) 563 throws com.liferay.portal.kernel.exception.PortalException, 564 com.liferay.portal.kernel.exception.SystemException { 565 return getService() 566 .updateStructure(structureId, parentStructureId, nameMap, 567 descriptionMap, xsd, serviceContext); 568 } 569 570 public static DDMStructureService getService() { 571 if (_service == null) { 572 _service = (DDMStructureService)PortalBeanLocatorUtil.locate(DDMStructureService.class.getName()); 573 574 ReferenceRegistry.registerReference(DDMStructureServiceUtil.class, 575 "_service"); 576 } 577 578 return _service; 579 } 580 581 /** 582 * @deprecated As of 6.2.0 583 */ 584 public void setService(DDMStructureService service) { 585 } 586 587 private static DDMStructureService _service; 588 }