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