001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.configuration; 029 030import org.opencms.ade.configuration.CmsConfigurationReader.DiscardPropertiesMode; 031import org.opencms.ade.configuration.formatters.CmsFormatterChangeSet; 032import org.opencms.ade.detailpage.CmsDetailPageInfo; 033import org.opencms.ade.galleries.CmsAddContentRestriction; 034import org.opencms.file.CmsObject; 035import org.opencms.file.CmsResource; 036import org.opencms.main.CmsLog; 037import org.opencms.util.CmsUUID; 038 039import java.util.ArrayList; 040import java.util.Collection; 041import java.util.Collections; 042import java.util.Comparator; 043import java.util.HashMap; 044import java.util.List; 045import java.util.Map; 046import java.util.Set; 047 048import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 049import org.apache.commons.lang3.builder.ToStringStyle; 050import org.apache.commons.logging.Log; 051 052import com.google.common.collect.ComparisonChain; 053import com.google.common.collect.Lists; 054 055/** 056 * Represents a parsed sitemap or module configuration.<p> 057 * 058 * This is the internal representation stored in the cache. The configuration class 059 * which is actually returned by CmsADEManager, and which contains most of the logic 060 * related to sitemap configurations, is CmsADEConfigData. 061 */ 062public class CmsADEConfigDataInternal { 063 064 /** 065 * Represents the value of an attribute, with additional information about where the value originated from. 066 */ 067 public static class AttributeValue { 068 069 /** The path of the configuration from which this attribute value originates. */ 070 private String m_origin; 071 072 /** The value of the attribute. */ 073 private String m_value; 074 075 /** 076 * Creates a new instance. 077 * 078 * @param value the attribute value 079 * @param origin the origin path 080 */ 081 public AttributeValue(String value, String origin) { 082 083 super(); 084 m_value = value; 085 m_origin = origin; 086 } 087 088 /** 089 * Gets the origin path. 090 * 091 * @return the origin path 092 */ 093 public String getOrigin() { 094 095 return m_origin; 096 } 097 098 /** 099 * Gets the attribute string value. 100 * 101 * @return the attribute value 102 */ 103 public String getValue() { 104 105 return m_value; 106 } 107 108 /** 109 * @see java.lang.Object#toString() 110 */ 111 @Override 112 public String toString() { 113 114 return "[" + m_value + " (from: " + m_origin + ")]"; 115 } 116 } 117 118 /** 119 * Represents a reference to a sitemap configuration with some associated metadata about that reference. 120 */ 121 public static class ConfigReference { 122 123 /** The id of the referenced configuration. */ 124 private CmsUUID m_config; 125 126 /** The metadata associated with the reference. */ 127 private ConfigReferenceMeta m_meta = new ConfigReferenceMeta(); 128 129 /** 130 * Creates a new instance. 131 * 132 * @param config the id of the target sitemap configuration 133 */ 134 public ConfigReference(CmsUUID config) { 135 136 m_config = config; 137 } 138 139 /** 140 * Creates a new instance. 141 * 142 * @param config the id of the target sitemap configuration 143 * @param meta the metadata associated with the reference 144 */ 145 public ConfigReference(CmsUUID config, ConfigReferenceMeta meta) { 146 147 m_config = config; 148 m_meta = meta; 149 150 } 151 152 /** 153 * Gets the id of the referenced sitemap configuration. 154 * 155 * @return the id of the referenced sitemap configuration 156 */ 157 public CmsUUID getId() { 158 159 return m_config; 160 161 } 162 163 /** 164 * Gets the metadata for the configuration reference 165 * 166 * @return the metadata for the configuration reference 167 */ 168 public ConfigReferenceMeta getMeta() { 169 170 return m_meta; 171 } 172 173 } 174 175 /** 176 * Contains a sitemap configuration bean together with some metadata about how it was referenced from other sitemap configurations. 177 */ 178 public static class ConfigReferenceInstance { 179 180 /** The configuration object. */ 181 private CmsADEConfigDataInternal m_config; 182 183 /** The metadata associated with the configuration reference. */ 184 private ConfigReferenceMeta m_meta = new ConfigReferenceMeta(); 185 186 /** 187 * Creates a new instance. 188 * 189 * @param config the configuration 190 */ 191 public ConfigReferenceInstance(CmsADEConfigDataInternal config) { 192 193 m_config = config; 194 } 195 196 /** 197 * Creates a new instance. 198 * 199 * @param config the configuration 200 * @param meta the metadata associated with the reference to the configuration 201 */ 202 public ConfigReferenceInstance(CmsADEConfigDataInternal config, ConfigReferenceMeta meta) { 203 204 m_config = config; 205 m_meta = meta; 206 207 } 208 209 /** 210 * Gets the configuration instance. 211 * 212 * @return the configuration 213 */ 214 public CmsADEConfigDataInternal getConfig() { 215 216 return m_config; 217 } 218 219 /** 220 * Gets the metadata associated with the configuration reference. 221 * 222 * @return the reference metadata 223 */ 224 public ConfigReferenceMeta getMeta() { 225 226 return m_meta; 227 } 228 229 } 230 231 /** 232 * Represents additional metadata from the query string of a master configuration link. 233 */ 234 public static class ConfigReferenceMeta { 235 236 /** The 'template' parameter. */ 237 public static final String PARAM_TEMPLATE = "template"; 238 239 /** The template identifier. */ 240 private String m_template; 241 242 /** 243 * Creates a new, empty instance. 244 */ 245 public ConfigReferenceMeta() { 246 // do nothing 247 248 } 249 250 /** 251 * Creates a new instance from the parameters from a master configuration link. 252 * 253 * @param params the parameters for the metadata 254 */ 255 public ConfigReferenceMeta(Map<String, String[]> params) { 256 257 String[] templateVals = params.get(PARAM_TEMPLATE); 258 if ((templateVals != null) && (templateVals.length > 0)) { 259 m_template = templateVals[0]; 260 } 261 } 262 263 /** 264 * If this object is the metadata for a link to a master configuration M, and 'next' is the metadata 265 * for a link from M to some other master configuration N, combines the metadata into a single object and returns it. 266 * 267 * @param next the metadata to combine this object with 268 * @return the combined metadata 269 */ 270 public ConfigReferenceMeta combine(ConfigReferenceMeta next) { 271 272 ConfigReferenceMeta result = new ConfigReferenceMeta(); 273 result.m_template = m_template != null ? m_template : next.m_template; 274 return result; 275 } 276 277 /** 278 * Gets the template identifier. 279 * 280 * <p>The template identifier should be one of the template context keys provided by a template provider. 281 * 282 * @return the template identifier 283 */ 284 public String getTemplate() { 285 286 return m_template; 287 } 288 289 /** 290 * Returns true if 'remove all' settings should be ignored in the referenced master configuration. 291 * 292 * @return if true, 'remove all' settings are ignored in the referenced master configuration 293 */ 294 public boolean isSkipRemovals() { 295 296 return getTemplate() != null; 297 } 298 299 /** 300 * @see java.lang.Object#toString() 301 */ 302 @Override 303 public String toString() { 304 305 return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); 306 } 307 308 } 309 310 /** Logger instance for this class. */ 311 private static final Log LOG = CmsLog.getLog(CmsADEConfigDataInternal.class); 312 313 /** The "create contents locally" flag. */ 314 protected boolean m_createContentsLocally; 315 316 /** Should inherited model pages be discarded? */ 317 protected boolean m_discardInheritedModelPages; 318 319 /** Should inherited types be discarded? */ 320 protected boolean m_discardInheritedTypes; 321 322 /** The 'discard properties' mode. */ 323 protected DiscardPropertiesMode m_discardPropertiesMode; 324 325 /** The configured formatter changes. */ 326 protected CmsFormatterChangeSet m_formatterChangeSet = new CmsFormatterChangeSet(); 327 328 /** True if subsite should be included in site selector. */ 329 protected boolean m_includeInSiteSelector; 330 331 /** True if this is a module configuration, not a normal sitemap configuration. */ 332 protected boolean m_isModuleConfig; 333 334 /** The master configuration structure ids. */ 335 protected List<ConfigReference> m_masterConfigs; 336 337 /** Mode for using formatter keys / the new container page format. */ 338 protected Boolean m_useFormatterKeys; 339 340 /** The restrictions for the 'add content' dialog. */ 341 private CmsAddContentRestriction m_addContentRestriction = CmsAddContentRestriction.EMPTY; 342 343 /** The set of ids of site plugins to add. */ 344 private Set<CmsUUID> m_addedPlugins; 345 346 /** Structure id of the sitemap attribute editor configuration file. */ 347 private CmsUUID m_attributeEditorConfigId; 348 349 /** The map of attributes. */ 350 private Map<String, AttributeValue> m_attributes = Collections.emptyMap(); 351 352 /** The base path of this configuration. */ 353 private String m_basePath; 354 355 /** The CMS context. */ 356 private CmsObject m_cms; 357 358 /** the dynamic functions available. */ 359 private Set<CmsUUID> m_dynamicFunctions; 360 361 /** True if detail contents outside the sitemap should not be used with detail pages in the sitemap. */ 362 private boolean m_excludeExternalDetailContents; 363 364 /** The list of configured function references. */ 365 private List<CmsFunctionReference> m_functionReferences = Lists.newArrayList(); 366 367 /** The functions to remove. */ 368 private Set<CmsUUID> m_functionsToRemove; 369 370 /** The mode determining how to deal with disabled functions. */ 371 private CmsGalleryDisabledTypesMode m_galleryDisabledFunctionsMode; 372 373 /** The display mode for deactivated types in the gallery dialog. */ 374 private CmsGalleryDisabledTypesMode m_galleryDisabledTypesMode; 375 376 /** The internal detail page configuration. */ 377 private List<CmsDetailPageInfo> m_ownDetailPages = Lists.newArrayList(); 378 379 /** The internal model page entries. */ 380 private volatile List<CmsModelPageConfig> m_ownModelPageConfig = null; 381 382 /** Model page data with no resources. */ 383 private List<CmsModelPageConfigWithoutResource> m_ownModelPageConfigRaw = new ArrayList<>(); 384 385 /** The internal property configuration. */ 386 private List<CmsPropertyConfig> m_ownPropertyConfigurations = Lists.newArrayList(); 387 388 /** The internal resource type entries. */ 389 private List<CmsResourceTypeConfig> m_ownResourceTypes = Lists.newArrayList(); 390 391 /** True if detail pages from this sitemap should be preferred when linking to contents inside this sitemap. */ 392 private boolean m_preferDetailPagesForLocalContents; 393 394 /** Flag indicating whether all functions should be removed. */ 395 private boolean m_removeAllFunctions; 396 397 /** If true, all site plugins inherited from parent sitemaps should be removed. */ 398 private boolean m_removeAllPlugins; 399 400 /** The set of ids of site plugins to remove. */ 401 private Set<CmsUUID> m_removedPlugins; 402 403 /** True if inherited shared setting overrides should be removed. */ 404 private boolean m_removeSharedSettingOverrides; 405 406 /** The resource from which the configuration data was read. */ 407 private CmsResource m_resource; 408 409 /** Shared setting override ID, may be null. */ 410 private CmsUUID m_sharedSettingOverride; 411 412 /** The type ordering mode. */ 413 private CmsTypeOrderingMode m_typeOrderingMode; 414 415 /** 416 * Creates a new configuration data instance.<p> 417 * 418 * @param cms the CMS context 419 * @param resource the resource from which this configuration data was read 420 * @param isModuleConfig true if this is a module configuration 421 * @param basePath the base path 422 * @param masterConfigs structure ids of master configuration files 423 * @param resourceTypeConfig the resource type configuration 424 * @param galleryDisabledTypesMode the display mode deactivated types in the gallery dialog 425 * @param galleryDisabledFunctionsMode the mode controlling how to deal with disabled functions 426 * @param discardInheritedTypes the "discard inherited types" flag 427 * @param propertyConfig the property configuration 428 * @param discardPropertiesMode the "discard inherited properties" mode 429 * @param detailPageInfos the detail page configuration 430 * @param modelPages the model page configuration 431 * @param functionReferences the function reference configuration 432 * @param discardInheritedModelPages the "discard inherited model pages" flag 433 * @param createContentsLocally the "create contents locally" flag 434 * @param preferDetailPagesForLocalContents the "preferDetailPagesForLocalContents" flag 435 * @param excludeExternalDetailContents the "excludeExternalDetailContents" flag 436 * @param includeInSiteSelector the "includeInSiteSelector" flag 437 * @param formatterChangeSet the formatter changes 438 * @param removeAllFunctions flag indicating whether all functions should be removed 439 * @param functionIds the dynamic functions available 440 * @param functionsToRemove the function ids to remove 441 * @param removeAllPlugins true all site plugins should be removed 442 * @param removedPlugins the ids of site plugins to remove 443 * @param addedPlugins the ids of site plugins to add 444 * @param useFormatterKeys mode for using formatter keys / the new container page format 445 * @param orderingMode the mode used to order the resource types 446 * @param restriction the restrictions for the 'Add content' dialog 447 * @param sharedSettingOverride shared setting override id, may be null 448 * @param removeSharedSettingOverrides true if inherited shared setting overrides should be removed 449 * @param attributeEditorConfigId the structure id of the attribute editor configuration file 450 * @param attributes the map of attributes 451 */ 452 public CmsADEConfigDataInternal( 453 CmsObject cms, 454 CmsResource resource, 455 boolean isModuleConfig, 456 String basePath, 457 List<ConfigReference> masterConfigs, 458 List<CmsResourceTypeConfig> resourceTypeConfig, 459 CmsGalleryDisabledTypesMode galleryDisabledTypesMode, 460 CmsGalleryDisabledTypesMode galleryDisabledFunctionsMode, 461 boolean discardInheritedTypes, 462 List<CmsPropertyConfig> propertyConfig, 463 DiscardPropertiesMode discardPropertiesMode, 464 List<CmsDetailPageInfo> detailPageInfos, 465 List<CmsModelPageConfigWithoutResource> modelPages, 466 List<CmsFunctionReference> functionReferences, 467 boolean discardInheritedModelPages, 468 boolean createContentsLocally, 469 boolean preferDetailPagesForLocalContents, 470 boolean excludeExternalDetailContents, 471 boolean includeInSiteSelector, 472 CmsFormatterChangeSet formatterChangeSet, 473 boolean removeAllFunctions, 474 Set<CmsUUID> functionIds, 475 Set<CmsUUID> functionsToRemove, 476 boolean removeAllPlugins, 477 Set<CmsUUID> addedPlugins, 478 Set<CmsUUID> removedPlugins, 479 Boolean useFormatterKeys, 480 CmsTypeOrderingMode orderingMode, 481 CmsAddContentRestriction restriction, 482 CmsUUID sharedSettingOverride, 483 boolean removeSharedSettingOverrides, 484 CmsUUID attributeEditorConfigId, 485 Map<String, String> attributes) { 486 487 m_cms = cms; 488 m_resource = resource; 489 m_basePath = basePath; 490 m_ownResourceTypes = resourceTypeConfig; 491 m_galleryDisabledTypesMode = galleryDisabledTypesMode; 492 m_galleryDisabledFunctionsMode = galleryDisabledFunctionsMode; 493 m_ownPropertyConfigurations = propertyConfig; 494 m_ownModelPageConfigRaw = modelPages; 495 m_ownDetailPages = detailPageInfos; 496 m_functionReferences = functionReferences; 497 m_isModuleConfig = isModuleConfig; 498 m_masterConfigs = masterConfigs; 499 if (m_masterConfigs == null) { 500 m_masterConfigs = Collections.emptyList(); 501 } 502 503 m_discardInheritedTypes = discardInheritedTypes; 504 m_discardPropertiesMode = discardPropertiesMode; 505 m_discardInheritedModelPages = discardInheritedModelPages; 506 m_createContentsLocally = createContentsLocally; 507 m_preferDetailPagesForLocalContents = preferDetailPagesForLocalContents; 508 m_formatterChangeSet = formatterChangeSet; 509 m_formatterChangeSet.setDebugPath(m_basePath); 510 m_dynamicFunctions = functionIds; 511 m_functionsToRemove = functionsToRemove; 512 m_removeAllFunctions = removeAllFunctions; 513 m_excludeExternalDetailContents = excludeExternalDetailContents; 514 m_includeInSiteSelector = includeInSiteSelector; 515 m_useFormatterKeys = useFormatterKeys; 516 m_removeAllPlugins = removeAllPlugins; 517 m_addedPlugins = Collections.unmodifiableSet(addedPlugins); 518 m_removedPlugins = Collections.unmodifiableSet(removedPlugins); 519 m_sharedSettingOverride = sharedSettingOverride; 520 m_removeSharedSettingOverrides = removeSharedSettingOverrides; 521 Map<String, AttributeValue> attributeObjects = new HashMap<>(); 522 String attributeOrigin = basePath; 523 if (resource != null) { 524 attributeOrigin = resource.getRootPath(); 525 } 526 for (Map.Entry<String, String> entry : attributes.entrySet()) { 527 attributeObjects.put(entry.getKey(), new AttributeValue(entry.getValue(), attributeOrigin)); 528 } 529 m_attributes = Collections.unmodifiableMap(new HashMap<>(attributeObjects)); 530 531 m_typeOrderingMode = orderingMode; 532 m_addContentRestriction = restriction; 533 m_attributeEditorConfigId = attributeEditorConfigId; 534 } 535 536 /** 537 * Creates an empty configuration data object with a given base path.<p> 538 * 539 * @param basePath the base path 540 */ 541 public CmsADEConfigDataInternal(String basePath) { 542 543 m_basePath = basePath; 544 } 545 546 /** 547 * Creates a new configuration data instance.<p> 548 549 * @param resource the resource from which this configuration data was read 550 * @param isModuleConfig true if this is a module configuration 551 * @param basePath the base path 552 * @param masterConfigs structure ids of master configuration files 553 * @param resourceTypeConfig the resource type configuration 554 * @param discardInheritedTypes the "discard inherited types" flag 555 * @param propertyConfig the property configuration 556 * @param discardPropertiesMode the "discard inherited properties" mode 557 * @param detailPageInfos the detail page configuration 558 * @param modelPages the model page configuration 559 * @param functionReferences the function reference configuration 560 * @param discardInheritedModelPages the "discard inherited model pages" flag 561 * @param createContentsLocally the "create contents locally" flag 562 * @param preferDetailPagesForLocalContents the "preferDetailPagesForLocalContents" flag 563 * @param excludeExternalDetailContents the "excludeExternalDetailContents" flag 564 * @param includeInSiteSelector the "includeInSiteSelector" flag 565 * @param formatterChangeSet the formatter changes 566 * @param removeAllFunctions flag indicating whether all functions should be removed 567 * @param functionIds the dynamic functions available 568 */ 569 protected CmsADEConfigDataInternal( 570 CmsResource resource, 571 boolean isModuleConfig, 572 String basePath, 573 List<ConfigReference> masterConfigs, 574 List<CmsResourceTypeConfig> resourceTypeConfig, 575 boolean discardInheritedTypes, 576 List<CmsPropertyConfig> propertyConfig, 577 DiscardPropertiesMode discardPropertiesMode, 578 List<CmsDetailPageInfo> detailPageInfos, 579 List<CmsModelPageConfig> modelPages, 580 List<CmsFunctionReference> functionReferences, 581 boolean discardInheritedModelPages, 582 boolean createContentsLocally, 583 boolean preferDetailPagesForLocalContents, 584 boolean excludeExternalDetailContents, 585 boolean includeInSiteSelector, 586 CmsFormatterChangeSet formatterChangeSet, 587 boolean removeAllFunctions, 588 Set<CmsUUID> functionIds) { 589 590 m_resource = resource; 591 m_basePath = basePath; 592 m_ownResourceTypes = resourceTypeConfig; 593 m_ownPropertyConfigurations = propertyConfig; 594 m_ownModelPageConfig = modelPages; 595 m_ownDetailPages = detailPageInfos; 596 m_functionReferences = functionReferences; 597 m_isModuleConfig = isModuleConfig; 598 m_masterConfigs = masterConfigs; 599 if (m_masterConfigs == null) { 600 m_masterConfigs = Collections.emptyList(); 601 } 602 603 m_discardInheritedTypes = discardInheritedTypes; 604 m_discardPropertiesMode = discardPropertiesMode; 605 m_discardInheritedModelPages = discardInheritedModelPages; 606 m_createContentsLocally = createContentsLocally; 607 m_preferDetailPagesForLocalContents = preferDetailPagesForLocalContents; 608 m_formatterChangeSet = formatterChangeSet; 609 m_dynamicFunctions = functionIds; 610 m_removeAllFunctions = removeAllFunctions; 611 m_excludeExternalDetailContents = excludeExternalDetailContents; 612 m_includeInSiteSelector = includeInSiteSelector; 613 } 614 615 /** 616 * Creates an empty configuration for a given base path.<p> 617 * 618 * @param basePath the base path 619 * 620 * @return the empty configuration object 621 */ 622 public static CmsADEConfigDataInternal emptyConfiguration(String basePath) { 623 624 return new CmsADEConfigDataInternal(basePath); 625 } 626 627 /** 628 * Gets the restrictions for the 'Add content' dialog. 629 * 630 * @return the restrictions for the 'Add content' dialog 631 */ 632 public CmsAddContentRestriction getAddContentRestriction() { 633 634 return m_addContentRestriction; 635 } 636 637 /** 638 * Gets the set of ids of added site plugins. 639 * 640 * @return the set of ids of added site plugins 641 */ 642 public Set<CmsUUID> getAddedPlugins() { 643 644 return m_addedPlugins; 645 } 646 647 /** 648 * Gets the structure id of the sitemap attribute editor configuration 649 * @return the structure id of the sitemap attribute editor configuration 650 */ 651 public CmsUUID getAttributeEditorConfigId() { 652 653 return m_attributeEditorConfigId; 654 } 655 656 /** 657 * Gets the map of attributes for this sitemap configuration. 658 * 659 * @return the map of attributes 660 */ 661 public Map<String, AttributeValue> getAttributes() { 662 663 return m_attributes; 664 } 665 666 /** 667 * Gets the base path.<p> 668 * 669 * @return the base path 670 */ 671 public String getBasePath() { 672 673 return m_basePath; 674 } 675 676 /** 677 * Gets the display mode for deactivated types in the sitemap dialog. 678 * 679 * @return the display mode for deactivated types 680 */ 681 public CmsGalleryDisabledTypesMode getDisabledTypeMode() { 682 683 return m_galleryDisabledTypesMode; 684 } 685 686 /** 687 * Gets the 'discard properties' mode. 688 * 689 * @return the discard properties mode 690 */ 691 public DiscardPropertiesMode getDiscardPropertiesMode() { 692 693 return m_discardPropertiesMode; 694 } 695 696 /** 697 * Returns the set of configured dynamic functions, regardless of whether the 'remove all formatters' option is enabled. 698 * 699 * @return the dynamic functions 700 */ 701 public Collection<CmsUUID> getDynamicFunctions() { 702 703 if (m_dynamicFunctions == null) { 704 return Collections.emptySet(); 705 } 706 return Collections.unmodifiableSet(m_dynamicFunctions); 707 } 708 709 /** 710 * Gets the formatter change set.<p> 711 * 712 * @return the formatter change set.<p> 713 */ 714 public CmsFormatterChangeSet getFormatterChangeSet() { 715 716 return m_formatterChangeSet; 717 718 } 719 720 /** 721 * Gets the dynamic function references.<p> 722 * 723 * @return the dynamic function references 724 */ 725 public List<CmsFunctionReference> getFunctionReferences() { 726 727 return m_functionReferences; 728 } 729 730 /** 731 * Gets the ids of dynamic functions to remove. 732 * 733 * @return the ids of dynamic functions to remove 734 */ 735 public Collection<CmsUUID> getFunctionsToRemove() { 736 737 return m_functionsToRemove; 738 } 739 740 /** 741 * Gets the mode for how disabled functions should be handled. 742 * 743 * @return the mode for disabled functions 744 */ 745 public CmsGalleryDisabledTypesMode getGalleryDisabledFunctionsMode() { 746 747 return m_galleryDisabledFunctionsMode; 748 } 749 750 /** 751 * Gets the structure ids of the master configuration files. 752 * 753 * @return the structure ids of the master configurations 754 */ 755 public List<ConfigReference> getMasterConfigs() { 756 757 return Collections.unmodifiableList(m_masterConfigs); 758 } 759 760 /** 761 * Returns the ownDetailPages.<p> 762 * 763 * @return the ownDetailPages 764 */ 765 public List<CmsDetailPageInfo> getOwnDetailPages() { 766 767 return m_ownDetailPages; 768 } 769 770 /** 771 * Returns the ownModelPageConfig.<p> 772 * 773 * @return the ownModelPageConfig 774 */ 775 public List<CmsModelPageConfig> getOwnModelPageConfig() { 776 777 if (m_ownModelPageConfig == null) { 778 List<CmsModelPageConfig> result = new ArrayList<>(); 779 for (CmsModelPageConfigWithoutResource modelPage : m_ownModelPageConfigRaw) { 780 try { 781 CmsResource resource = m_cms.readResource(modelPage.getStructureId()); 782 result.add(new CmsModelPageConfig(resource, modelPage.isDefault(), modelPage.isDisabled())); 783 } catch (Exception e) { 784 LOG.warn("can't read model page for base path " + m_basePath + ": " + e.getLocalizedMessage(), e); 785 } 786 } 787 m_ownModelPageConfig = result; 788 return result; 789 } else { 790 return m_ownModelPageConfig; 791 } 792 } 793 794 /** 795 * Returns the ownPropertyConfigurations.<p> 796 * 797 * @return the ownPropertyConfigurations 798 */ 799 public List<CmsPropertyConfig> getOwnPropertyConfigurations() { 800 801 return m_ownPropertyConfigurations; 802 } 803 804 /** 805 * Gets the resource types defined in this configuration.<p> 806 * 807 * @return the resource type configurations 808 */ 809 public List<CmsResourceTypeConfig> getOwnResourceTypes() { 810 811 return m_ownResourceTypes; 812 } 813 814 /** 815 * Gets the set of ids of removed site plugins. 816 * 817 * @return the set of ids of removed site plugins 818 */ 819 public Set<CmsUUID> getRemovedPlugins() { 820 821 return m_removedPlugins; 822 } 823 824 /** 825 * Returns the resource.<p> 826 * 827 * @return the resource 828 */ 829 public CmsResource getResource() { 830 831 return m_resource; 832 } 833 834 /** 835 * Gets the shared setting override ID (may be null). 836 * 837 * @return the shared setting override ID 838 */ 839 public CmsUUID getSharedSettingOverride() { 840 841 return m_sharedSettingOverride; 842 } 843 844 /** 845 * Gets the type ordering mode. 846 * 847 * @return the type ordering mode 848 */ 849 public CmsTypeOrderingMode getTypeOrderingMode() { 850 851 return m_typeOrderingMode; 852 } 853 854 /** 855 * Gets the 'use formatter keys' mode.<p> 856 * 857 * If true, container pages will be written in the new format, including using formatter keys when possible. 858 * 859 * @return the 'use formatter keys' mode 860 */ 861 public Boolean getUseFormatterKeys() { 862 863 return m_useFormatterKeys; 864 } 865 866 /** 867 * Returns true if contents should be created in the sub-sitemap.<p> 868 * 869 * @return true if contents should be created in the sub-sitemap 870 */ 871 public boolean isCreateContentsLocally() { 872 873 return m_createContentsLocally; 874 } 875 876 /** 877 * Returns true if inherited model pages should be discarded.<p> 878 * 879 * @return true if inherited model pages should be discarded. 880 */ 881 public boolean isDiscardInheritedModelPages() { 882 883 return m_discardInheritedModelPages; 884 } 885 886 /** 887 * Returns true if inherited properties should be discarded.<p> 888 * 889 * @return true if inherited property configurations should be discardded.<p> 890 */ 891 public boolean isDiscardInheritedProperties() { 892 893 return m_discardPropertiesMode != DiscardPropertiesMode.keep; 894 } 895 896 /** 897 * Returns true if inherited types should be discarded.<p> 898 * 899 * @return true if inherited types should be discarded 900 */ 901 public boolean isDiscardInheritedTypes() { 902 903 return m_discardInheritedTypes; 904 } 905 906 /** 907 * Returns true if detail pages inside this subsite (and descendant subsites) should not be used for contents outside the subsite (and descendant subsites).<p> 908 * 909 * @return true if external detail contents should be excluded 910 */ 911 public boolean isExcludeExternalDetailContents() { 912 913 return m_excludeExternalDetailContents; 914 } 915 916 /** 917 * Returns true if the subsite should be included in the site selector. 918 * 919 * @return true if the subsite should be included in the site selector 920 */ 921 public boolean isIncludeInSiteSelector() { 922 923 return m_includeInSiteSelector; 924 } 925 926 /** 927 * Returns the isModuleConfig.<p> 928 * 929 * @return the isModuleConfig 930 */ 931 public boolean isModuleConfig() { 932 933 return m_isModuleConfig; 934 } 935 936 /** 937 * Returns true if detail pages from this sitemap should be preferred for creating links to detail contents located inside this sitemap.<p> 938 * 939 * @return true if detail pages from this sitemap should be preferred 940 */ 941 public boolean isPreferDetailPagesForLocalContents() { 942 943 return m_preferDetailPagesForLocalContents; 944 } 945 946 /** 947 * True if all functions should be removed by this sitemap configuration. 948 * 949 * @return true if all functions should be removed 950 */ 951 public boolean isRemoveAllFunctions() { 952 953 return m_removeAllFunctions; 954 } 955 956 /** 957 * Returns true if all site plugins inherited from parent sitemaps should be removed. 958 * 959 * @return true if all site plugins should be removed 960 */ 961 public boolean isRemoveAllPlugins() { 962 963 return m_removeAllPlugins; 964 } 965 966 /** 967 * Returns true if shared setting overrides inherited from other sitemap configurations should be discarded. 968 * 969 * @return true if inherited shared setting overrides should be discarded 970 */ 971 public boolean isRemoveSharedSettingOverrides() { 972 973 return m_removeSharedSettingOverrides; 974 } 975 976 /** 977 * @see java.lang.Object#toString() 978 */ 979 @Override 980 public String toString() { 981 982 if (getBasePath() != null) { 983 return "[" + getBasePath() + "]"; 984 } else { 985 return super.toString(); 986 } 987 988 } 989 990 /** 991 * Merges the parent's data into this object.<p> 992 * 993 * @param parent the parent configuration data 994 */ 995 protected void mergeParent(CmsADEConfigDataInternal parent) { 996 997 List<CmsResourceTypeConfig> parentTypes = null; 998 if (parent != null) { 999 parentTypes = parent.m_ownResourceTypes; 1000 } else { 1001 parentTypes = Collections.emptyList(); 1002 } 1003 1004 List<CmsPropertyConfig> parentProperties = null; 1005 if (parent != null) { 1006 parentProperties = parent.m_ownPropertyConfigurations; 1007 } else { 1008 parentProperties = Collections.emptyList(); 1009 } 1010 1011 List<CmsModelPageConfig> parentModelPages = null; 1012 if (parent != null) { 1013 parentModelPages = parent.m_ownModelPageConfig; 1014 } else { 1015 parentModelPages = Collections.emptyList(); 1016 } 1017 1018 List<CmsFunctionReference> parentFunctionRefs = null; 1019 if (parent != null) { 1020 parentFunctionRefs = parent.m_functionReferences; 1021 } else { 1022 parentFunctionRefs = Collections.emptyList(); 1023 } 1024 1025 m_ownResourceTypes = CmsADEConfigData.combineConfigurationElements(parentTypes, m_ownResourceTypes, false); 1026 m_ownPropertyConfigurations = CmsADEConfigData.combineConfigurationElements( 1027 parentProperties, 1028 m_ownPropertyConfigurations, 1029 false); 1030 m_ownModelPageConfig = CmsADEConfigData.combineConfigurationElements( 1031 parentModelPages, 1032 m_ownModelPageConfig, 1033 false); 1034 m_functionReferences = CmsADEConfigData.combineConfigurationElements( 1035 parentFunctionRefs, 1036 m_functionReferences, 1037 false); 1038 1039 // dynamic functions are not used in module configurations, so we do not need to merge them here 1040 } 1041 1042 /** 1043 * Handle the ordering from the module configurations.<p> 1044 */ 1045 protected void processModuleOrdering() { 1046 1047 Collections.sort(m_ownResourceTypes, new Comparator<CmsResourceTypeConfig>() { 1048 1049 public int compare(CmsResourceTypeConfig a, CmsResourceTypeConfig b) { 1050 1051 return ComparisonChain.start().compare(a.getOrder(), b.getOrder()).compare( 1052 a.getTypeName(), 1053 b.getTypeName()).result(); 1054 } 1055 }); 1056 1057 Collections.sort(m_ownPropertyConfigurations, new Comparator<CmsPropertyConfig>() { 1058 1059 public int compare(CmsPropertyConfig a, CmsPropertyConfig b) { 1060 1061 return ComparisonChain.start().compare(a.getOrder(), b.getOrder()).compare( 1062 a.getName(), 1063 b.getName()).result(); 1064 } 1065 }); 1066 1067 Collections.sort(m_functionReferences, new Comparator<CmsFunctionReference>() { 1068 1069 public int compare(CmsFunctionReference a, CmsFunctionReference b) { 1070 1071 return ComparisonChain.start().compare(a.getOrder(), b.getOrder()).compare( 1072 a.getName(), 1073 b.getName()).result(); 1074 } 1075 }); 1076 } 1077 1078}