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