001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://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 GmbH & Co. KG, please see the 018 * company website: https://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: https://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.xml.content; 029 030import org.opencms.file.CmsFile; 031import org.opencms.file.CmsObject; 032import org.opencms.file.CmsProperty; 033import org.opencms.file.CmsResource; 034import org.opencms.i18n.CmsMessages; 035import org.opencms.i18n.CmsMultiMessages.I_KeyFallbackHandler; 036import org.opencms.main.CmsException; 037import org.opencms.relations.CmsRelationType; 038import org.opencms.search.fields.CmsSearchField; 039import org.opencms.util.CmsDefaultSet; 040import org.opencms.widgets.I_CmsComplexWidget; 041import org.opencms.widgets.I_CmsWidget; 042import org.opencms.workplace.editors.directedit.I_CmsEditHandler; 043import org.opencms.xml.CmsXmlContentDefinition; 044import org.opencms.xml.CmsXmlException; 045import org.opencms.xml.containerpage.CmsFormatterConfiguration; 046import org.opencms.xml.content.CmsDefaultXmlContentHandler.InvalidRelationAction; 047import org.opencms.xml.types.I_CmsXmlContentValue; 048import org.opencms.xml.types.I_CmsXmlContentValue.CmsSearchContentConfig; 049import org.opencms.xml.types.I_CmsXmlContentValue.SearchContentType; 050import org.opencms.xml.types.I_CmsXmlSchemaType; 051 052import java.util.Arrays; 053import java.util.Collections; 054import java.util.List; 055import java.util.Locale; 056import java.util.Map; 057import java.util.Objects; 058import java.util.Set; 059 060import org.dom4j.Element; 061 062import jakarta.servlet.ServletRequest; 063 064/** 065 * Handles special XML content livetime events, and also provides XML content editor rendering hints.<p> 066 * 067 * @since 6.0.0 068 */ 069public interface I_CmsXmlContentHandler { 070 071 /** 072 * The available display types for element widgets. 073 */ 074 public static enum DisplayType { 075 /** The two column type. */ 076 column, 077 078 /** The default display type. */ 079 none, 080 081 /** The single line type. */ 082 singleline, 083 084 /** The default wide display type. */ 085 wide 086 } 087 088 /** 089 * Settings for a JSON renderer. 090 */ 091 public static class JsonRendererSettings { 092 093 /** The renderer class name. */ 094 private String m_className; 095 096 /** The parameters for the renderer. */ 097 private Map<String, String> m_params; 098 099 /** 100 * Creates a new instance. 101 * 102 * @param className the class name 103 * @param params the parameters 104 */ 105 public JsonRendererSettings(String className, Map<String, String> params) { 106 107 m_className = className; 108 m_params = params; 109 } 110 111 /** 112 * Gets the class name. 113 * 114 * @return the class name 115 */ 116 public String getClassName() { 117 118 return m_className; 119 } 120 121 /** 122 * Gets the parameters. 123 * 124 * @return the parameters 125 */ 126 public Map<String, String> getParameters() { 127 128 if (m_params == null) { 129 return Collections.emptyMap(); 130 } 131 return Collections.unmodifiableMap(m_params); 132 } 133 } 134 135 /** 136 * The available mapping types. Currently only available for searchsettings (using the "addto" attribute in the node <solrfield>). 137 */ 138 public static enum MappingType { 139 /** Map for the content's resource. */ 140 ELEMENT, 141 142 /** Map for all container pages the content is placed on. */ 143 PAGE 144 } 145 146 /** Represents how values should be handled with regard to synchronization across locales in the editor. */ 147 public static enum SynchronizationMode { 148 /** No synchronization. */ 149 none, 150 /** Normal synchronization. */ 151 standard, 152 /** Strong synchronization - a value will be synchronized even if the parent nodes are missing in the target locale. */ 153 strong; 154 } 155 156 /** Mapping name for the 'date expired' mapping. */ 157 String ATTRIBUTE_DATEEXPIRED = "dateexpired"; 158 159 /** Mapping name for the 'date released' mapping. */ 160 String ATTRIBUTE_DATERELEASED = "datereleased"; 161 162 /** List of all allowed attribute mapping names, for fast lookup. */ 163 List<String> ATTRIBUTES = Collections.unmodifiableList( 164 Arrays.asList(new String[] {ATTRIBUTE_DATERELEASED, ATTRIBUTE_DATEEXPIRED})); 165 166 /** Prefix for attribute mappings. */ 167 String MAPTO_ATTRIBUTE = "attribute:"; 168 169 /** Prefix for permission mappings. */ 170 String MAPTO_PERMISSION = "permission:"; 171 172 /** Prefix for property mappings. */ 173 String MAPTO_PROPERTY = "property:"; 174 175 /** Prefix for property mappings. */ 176 String MAPTO_PROPERTY_INDIVIDUAL = MAPTO_PROPERTY + CmsProperty.TYPE_INDIVIDUAL + ":"; 177 178 /** Prefix for property list mappings. */ 179 String MAPTO_PROPERTY_LIST = "propertyList:"; 180 181 /** Prefix for property list mappings. */ 182 String MAPTO_PROPERTY_LIST_INDIVIDUAL = MAPTO_PROPERTY_LIST + CmsProperty.TYPE_INDIVIDUAL + ":"; 183 184 /** Prefix for property list mappings. */ 185 String MAPTO_PROPERTY_LIST_SHARED = MAPTO_PROPERTY_LIST + CmsProperty.TYPE_SHARED + ":"; 186 187 /** Prefix for property mappings. */ 188 String MAPTO_PROPERTY_SHARED = MAPTO_PROPERTY + CmsProperty.TYPE_SHARED + ":"; 189 190 /** Prefix for URL name mappings. */ 191 String MAPTO_URLNAME = "urlName"; 192 193 /** 194 * Returns a (possibly empty set) of tags for the given field path (relative to the current content definition). 195 * 196 * <p>This is meant to provide metadata about a field for tools that process the content (e.g. translation). 197 * 198 * @param remainingPath path of a content field 199 * @return the set of agent tags 200 */ 201 public Set<String> getAgentTags(String remainingPath); 202 203 /** 204 * Gets the configured placeholder for the given path. 205 * 206 * @param path the element path 207 * @return the placeholder (may contain macros) 208 */ 209 public String getPlaceholder(String path); 210 211 /** 212 * Writes an availability date back to the content, if a mapping is defined for it. 213 * 214 * @param cms the CMS context 215 * @param content the content to write to 216 * @param attr the attribute to write 217 * @param locales the locales of the resource 218 * @param value the value to write 219 * 220 * @throws CmsException if something goes wrong 221 */ 222 boolean applyReverseAvailabilityMapping( 223 CmsObject cms, 224 CmsXmlContent content, 225 CmsMappingResolutionContext.AttributeType attr, 226 List<Locale> locales, 227 long value) 228 throws CmsException; 229 230 /** 231 * Checks if an availability attribute should be written back to the content if the availability is changed through the availability dialog. 232 * 233 * @param attr the attribute to check 234 * @return true if the attribute should be written to the content 235 */ 236 boolean canUseReverseAvailabilityMapping(CmsMappingResolutionContext.AttributeType attr); 237 238 /** 239 * Removes potentially existing formerly mapped values, according 240 * to the rules of the specific XML content handler.<p> 241 * 242 * The default implementation does nothing and is only added for backward compatibility. 243 * 244 * @param cms the current OpenCms user context 245 * @param content the XML content to resolve the mappings for 246 * 247 * @throws CmsException if something goes wrong 248 */ 249 @SuppressWarnings("unused") 250 default void clearMappings(CmsObject cms, CmsXmlContent content) throws CmsException { 251 252 // Do nothing by default. 253 return; 254 } 255 256 /** 257 * Gets the list of allowed template context names.<p> 258 * 259 * @return the list of allowed template context names 260 */ 261 CmsDefaultSet<String> getAllowedTemplates(); 262 263 /** 264 * Gets the list of change handler configurations. 265 * 266 * @return the list of change handler configurations 267 */ 268 List<CmsChangeHandlerConfig> getChangeHandlerConfigs(); 269 270 /** 271 * Gets the unconfigured complex widget defined for the given path.<p> 272 * 273 * @param cms the CMS context 274 * @param path the value path 275 * @return the complex widget 276 */ 277 I_CmsComplexWidget getComplexWidget(CmsObject cms, String path); 278 279 /** 280 * Returns the configuration String value for the widget used to edit the given XML content schema type.<p> 281 * 282 * If no configuration value is available, this method must return <code>null</code>. 283 * 284 * @param type the value to get the widget configuration for 285 * 286 * @return the configuration String value for the widget used to edit the given XML content schema type 287 */ 288 String getConfiguration(I_CmsXmlSchemaType type); 289 290 /** 291 * Gets the widget configuration for the given sub-path.<p> 292 * 293 * @param remainingPath a sub-path 294 * @return the widget configuration for the given sub-path 295 */ 296 String getConfiguration(String remainingPath); 297 298 /** 299 * Gets the configured display type for a given path.<p> 300 * 301 * @param path the path 302 * @param defaultVal the value to return if no configured display type is found 303 * 304 * @return the configured display type (or the default value) 305 */ 306 DisplayType getConfiguredDisplayType(String path, DisplayType defaultVal); 307 308 /** 309 * Returns the resource-independent CSS resources to include into the html-page head.<p> 310 * 311 * @return the CSS resources to include into the html-page head 312 */ 313 Set<String> getCSSHeadIncludes(); 314 315 /** 316 * Returns all the CSS resources to include into the html-page head.<p> 317 * 318 * @param cms the current CMS context 319 * @param resource the resource from which to get the head includes 320 * 321 * @throws CmsException if something goes wrong 322 * 323 * @return the CSS resources to include into the html-page head 324 */ 325 Set<String> getCSSHeadIncludes(CmsObject cms, CmsResource resource) throws CmsException; 326 327 /** 328 * Returns the default String value for the given XML content schema type object in the given XML content.<p> 329 * 330 * If a schema type does not have a default value, this method must return <code>null</code>. 331 * 332 * @param cms the current users OpenCms context 333 * @param resource the content resource 334 * @param type the type to get the default for 335 * @param path the element path 336 * @param locale the currently selected locale for the value 337 * 338 * @return the default String value for the given XML content value object 339 * 340 * @see org.opencms.xml.types.I_CmsXmlSchemaType#getDefault(Locale) 341 */ 342 String getDefault(CmsObject cms, CmsResource resource, I_CmsXmlSchemaType type, String path, Locale locale); 343 344 /** 345 * Returns the default String value for the given XML content schema type object in the given XML content.<p> 346 * 347 * If a schema type does not have a default value, this method must return <code>null</code>. 348 * 349 * @param cms the current users OpenCms context 350 * @param value the value to get the default for 351 * @param locale the currently selected locale for the value 352 * 353 * @return the default String value for the given XML content value object 354 * 355 * @see org.opencms.xml.types.I_CmsXmlSchemaType#getDefault(Locale) 356 */ 357 String getDefault(CmsObject cms, I_CmsXmlContentValue value, Locale locale); 358 359 /** 360 * Gets the default complex widget to be used for this type.<p> 361 * 362 * @return the default complex widget for this type 363 */ 364 I_CmsComplexWidget getDefaultComplexWidget(); 365 366 /** 367 * Gets the default complex widget class name configured for this type.<p> 368 * 369 * @return the default complex widget class name 370 */ 371 String getDefaultComplexWidgetClass(); 372 373 /** 374 * Gets the default complex widget configuration string configured for this type.<p> 375 * 376 * @return the default complex widget configuration string 377 */ 378 String getDefaultComplexWidgetConfiguration(); 379 380 /** 381 * Returns if the widget for this type should be displayed in compact view.<p> 382 * 383 * @param type the value to check the view mode for 384 * 385 * @return the widgets display type 386 */ 387 DisplayType getDisplayType(I_CmsXmlSchemaType type); 388 389 /** 390 * Returns the edit handler if configured.<p> 391 * 392 * @return the edit handler 393 */ 394 I_CmsEditHandler getEditHandler(); 395 396 /** 397 * Returns the editor change handlers.<p> 398 * 399 * @param selfOnly if true, only return editor change handlers configured directly for this content handler 400 * @return the editor change handlers 401 */ 402 List<I_CmsXmlContentEditorChangeHandler> getEditorChangeHandlers(boolean selfOnly); 403 404 /** 405 * Returns the container page element formatter configuration for a given resource.<p> 406 * 407 * @param cms the current users OpenCms context, used for selecting the right project 408 * @param res the resource for which the formatter configuration should be retrieved 409 * 410 * @return the container page element formatter configuration for this handler 411 */ 412 CmsFormatterConfiguration getFormatterConfiguration(CmsObject cms, CmsResource res); 413 414 /** 415 * Gets the geo-coordinate mapping configuration. 416 * 417 * @return the geo-coordinate mapping configuration 418 */ 419 CmsGeoMappingConfiguration getGeoMappingConfiguration(); 420 421 /** 422 * Gets the action to perform if the given name refers to a link field which refers to a VFS file that no longer exists. 423 * 424 * @param name the field name 425 * @return the action 426 */ 427 default InvalidRelationAction getInvalidRelationAction(String name) { 428 429 return null; 430 } 431 432 /** 433 * Returns the resource-independent javascript resources to include into the html-page head.<p> 434 * 435 * @return the javascript resources to include into the html-page head 436 */ 437 Set<String> getJSHeadIncludes(); 438 439 /** 440 * Returns all the javascript resources to include into the html-page head.<p> 441 * 442 * @param cms the current CMS context 443 * @param resource the resource for which the head includes should be retrieved 444 * 445 * @return the javascript resources to include into the html-page head 446 * 447 * @throws CmsException if something goes wrong 448 */ 449 Set<String> getJSHeadIncludes(CmsObject cms, CmsResource resource) throws CmsException; 450 451 /** 452 * Gets the JSON renderer settings. 453 * 454 * @return the JSON renderer settings 455 */ 456 JsonRendererSettings getJsonRendererSettings(); 457 458 /** 459 * Gets the mappings defined in the schema. 460 * 461 * @return the mappings 462 */ 463 Map<String, List<String>> getMappings(); 464 465 /** 466 * Returns the all mappings defined for the given element xpath.<p> 467 * 468 * @param elementName the element xpath to look up the mapping for 469 * 470 * @return the mapping defined for the given element xpath 471 */ 472 List<String> getMappings(String elementName); 473 474 /** 475 * Gets the message key fallback handler.<p> 476 * 477 * This is used to automatically provide fallbacks for missing message keys in the editor.<p> 478 * 479 * @return the message key fallback handler 480 */ 481 I_KeyFallbackHandler getMessageKeyHandler(); 482 483 /** 484 * Returns the {@link CmsMessages} that are used to resolve localized keys 485 * for the given locale in this content handler.<p> 486 * 487 * If no localized messages are configured for this content handler, 488 * this method returns <code>null</code>.<p> 489 * 490 * @param locale the locale to get the messages for 491 * 492 * @return the {@link CmsMessages} that are used to resolve localized keys 493 * for the given locale in this content handler 494 */ 495 CmsMessages getMessages(Locale locale); 496 497 /** 498 * Returns the folder name that contains eventual XML content model files to use for this resource type.<p> 499 * 500 * @return the folder name containing eventual XML content master files 501 */ 502 String getModelFolder(); 503 504 /** 505 * Returns the nested formatters for the given resource.<p> 506 * 507 * @param cms the cms context 508 * @param res the resource 509 * @param locale the content locale 510 * @param req the request if available 511 * 512 * @return the nested formatter ids 513 */ 514 List<String> getNestedFormatters(CmsObject cms, CmsResource res, Locale locale, ServletRequest req); 515 516 /** 517 * Gets the parameter with the given name..<p> 518 * 519 * @param param the parameter name 520 * @return the parameter value 521 */ 522 String getParameter(String param); 523 524 /** 525 * Returns the preview URI for the given XML content value object to be displayed in the editor.<p> 526 * 527 * If <code>null</code> is returned, no preview is possible for contents using this handler.<p> 528 * 529 * @param cms the current OpenCms user context 530 * @param content the XML content to display the preview URI for 531 * @param resourcename the name in the VFS of the resource that is currently edited 532 * 533 * @return the preview URI for the given XML content value object to be displayed in the editor 534 */ 535 String getPreview(CmsObject cms, CmsXmlContent content, String resourcename); 536 537 /** 538 * Returns the relation type for the given value.<p> 539 * 540 * @param value the value to get the relation type for 541 * 542 * @return the relation type for the given value 543 * 544 * @deprecated use {@link #getRelationType(String)} with {@link I_CmsXmlContentValue#getPath()} instead 545 */ 546 @Deprecated 547 CmsRelationType getRelationType(I_CmsXmlContentValue value); 548 549 /** 550 * Returns the relation type for the given path.<p> 551 * 552 * @param path the path to get the relation type for 553 * 554 * @return the relation type for the given path 555 */ 556 CmsRelationType getRelationType(String path); 557 558 /** 559 * Returns the relation type for the given path.<p> 560 * 561 * @param xpath the path to get the relation type for 562 * @param defaultType the default type if none is set 563 * 564 * @return the relation type for the given path 565 */ 566 CmsRelationType getRelationType(String xpath, CmsRelationType defaultType); 567 568 /** 569 * Returns the search content configuration, ie., the way how to integrate the value into full text search.<p> 570 * 571 * For the full text search, the value of all elements in one locale of the XML content are combined 572 * to one big text, which is referred to as the "content" in the context of the full text search. 573 * With this option, it is possible to hide certain elements from this "content" that does not make sense 574 * to include in the full text search.<p> 575 * 576 * Moreover, if the value contains a link to another resource, the content of that other resource can be added. 577 * 578 * And additionally it is possible to adjust the value by a custom adjustment implementation before it is added. 579 * 580 * @param value the XML content value to check 581 * 582 * @return the search content type, indicating how the element should be added to the content for the full text search 583 */ 584 CmsSearchContentConfig getSearchContentConfig(I_CmsXmlContentValue value); 585 586 /** 587 * Returns all configured Search fields for this XML content.<p> 588 * 589 * @return the Search fields for this XMl content 590 */ 591 Set<CmsSearchField> getSearchFields(); 592 593 /** 594 * Returns all configured Search fields for this XML content that should be attached to container pages the content is placed on.<p> 595 * 596 * @return the Search fields for this XMl content 597 */ 598 Set<CmsSearchField> getSearchFieldsForPage(); 599 600 /** 601 * Returns the search content settings defined in the annotation node of this XML content.<p> 602 * 603 * A search setting defined within the xsd:annotaion node of an XML schema definition can look like:<p> 604 * <code><searchsetting element="Image/Align" searchContent="false"/></code><p> 605 * 606 * The returned map contains the 'element' attribute value as keys and the 'searchContent' 607 * attribute value as values.<p> 608 * 609 * @return the search field settings for this XML content schema 610 */ 611 Map<String, CmsSearchContentConfig> getSearchSettings(); 612 613 /** 614 * Returns the element settings defined for the container page formatters.<p> 615 * 616 * @param cms the current CMS context 617 * @param resource the resource for which to get the setting definitions 618 * 619 * @return the element settings defined for the container page formatters 620 */ 621 Map<String, CmsXmlContentProperty> getSettings(CmsObject cms, CmsResource resource); 622 623 /** 624 * Returns the configuration for elements that require a synchronization across all locales.<p> 625 * 626 * @param recursive if true, recursively combines all synchronization information from nested schemas, otherwise only returns the synchronizations for this schema 627 * @return the synchronization information 628 */ 629 CmsSynchronizationSpec getSynchronizations(boolean recursive); 630 631 /** 632 * Returns the tabs to be displayed in the editor.<p> 633 * 634 * @return the tabs to be displayed in the editor 635 */ 636 List<CmsXmlContentTab> getTabs(); 637 638 /** 639 * Returns the "Title" mapping set for the given XML content document in the given Locale.<p> 640 * 641 * @param cms the current OpenCms user context 642 * @param document the XML content to get the title mapping for (this must be of a type that uses this handler) 643 * @param locale the locale to get the title mapping for 644 * 645 * @return the "Title" mapping set for the given XML content document in the given Locale 646 */ 647 String getTitleMapping(CmsObject cms, CmsXmlContent document, Locale locale); 648 649 /** 650 * Gets the version transformation VFS path. 651 * 652 * <p>If schema versions are used, the the XSLT transformation read from this VFS path is used to transform contents 653 * of older versions into the current version. 654 * 655 * @return the VFS path to read an XSLT file for version transformation from 656 */ 657 String getVersionTransformation(); 658 659 /** 660 * Gets the widget for the given path and CMS context. 661 * 662 * @param cms the current CMS context 663 * @param path the XML value path 664 * @return the widget for the path 665 */ 666 I_CmsWidget getWidget(CmsObject cms, String path); 667 668 /** 669 * Returns the editor widget that should be used for the given XML content value.<p> 670 * 671 * The handler implementations should use the "appinfo" node of the XML content definition 672 * schema to define the mappings of elements to widgets.<p> 673 * 674 * @param value the XML content value to get the widget for 675 * 676 * @return the editor widget that should be used for the given XML content value 677 * 678 * @throws CmsXmlException if something goes wrong 679 */ 680 @Deprecated 681 I_CmsWidget getWidget(I_CmsXmlSchemaType value) throws CmsXmlException; 682 683 /** 684 * Returns true if the contents for this content handler have schema-based formatters which can be disabled or enabled.<p> 685 * 686 * @return true if the contents for this content handler have schema-based formatters which can be disabled or enabled 687 */ 688 boolean hasModifiableFormatters(); 689 690 /** 691 * Returns whether there are nested formatters configured for this content type.<p> 692 * 693 * @return <code>true</code> if there are nested formatters configured for this content type 694 */ 695 boolean hasNestedFormatters(); 696 697 /** 698 * Returns if there are locale synchronized elements configured.<p> 699 * 700 * @return <code>true</code> if there are locale synchronized elements configured 701 */ 702 boolean hasSynchronizedElements(); 703 704 /** 705 * Returns if there are visibility handlers configured for this content type.<p> 706 * 707 * @return <code>true</code> if there are visibility handlers configured for this content type 708 */ 709 boolean hasVisibilityHandlers(); 710 711 /** 712 * Initializes this content handler for the given XML content definition by 713 * analyzing the "appinfo" node.<p> 714 * 715 * @param appInfoElement the "appinfo" element root node to analyze 716 * @param contentDefinition the XML content definition that XML content handler belongs to 717 * 718 * @throws CmsXmlException if something goes wrong 719 */ 720 void initialize(Element appInfoElement, CmsXmlContentDefinition contentDefinition) throws CmsXmlException; 721 722 /** 723 * Performs a check of the given XML document.<p> 724 * 725 * The main difference to the {@link #resolveValidation(CmsObject, I_CmsXmlContentValue, CmsXmlContentErrorHandler)} 726 * method is that this method may silently remove some values, for instance, for broken links.<p> 727 * 728 * @param cms the current OpenCms user context 729 * @param document the document to resolve the check rules for 730 */ 731 void invalidateBrokenLinks(CmsObject cms, CmsXmlContent document); 732 733 /** 734 * Checks whether the Acacia editor is disabled for this type.<p> 735 * 736 * @return true if the Acacia editor is disabled 737 */ 738 boolean isAcaciaEditorDisabled(); 739 740 /** 741 * Returns <code>true</code> if the XML content should be indexed when it is dropped in a container page, 742 * and returns <code>false</code> if this XML content should be indexed as 'stand-alone' document.<p> 743 * 744 * This flag is intended by excluding XML contents from the search index that are not used as detail pages, 745 * but to index those extraction result when they are part of a container page.<p> 746 * 747 * In order to set this falg add an attribute <code>containerpageOnly="true"</code> to the 748 * <code>'<searchsettings>-node'</code> of the XSD of the resource type you want to be indexed only 749 * when it is part of a container page.<p> 750 * 751 * @return the container page only flag 752 */ 753 boolean isContainerPageOnly(); 754 755 /** 756 * Returns <code>true</code> in case the given value should be searchable with 757 * the integrated full text search.<p> 758 * 759 * For the full text search, the value of all elements in one locale of the XML content are combined 760 * to one big text, which is referred to as the "content" in the context of the full text search. 761 * With this option, it is possible to hide certain elements from this "content" that does not make sense 762 * to include in the full text search.<p> 763 * 764 * @param value the XML content value to check 765 * 766 * @return <code>true</code> in case the given value should be searchable 767 * 768 * @deprecated use {@link #getSearchContentConfig(I_CmsXmlContentValue)} instead. Will be removed if plain lucene search is removed. 769 */ 770 @Deprecated 771 default boolean isSearchable(I_CmsXmlContentValue value) { 772 773 CmsSearchContentConfig config = getSearchContentConfig(value); 774 return Objects.equals(null == config ? null : config.getSearchContentType(), SearchContentType.TRUE); 775 } 776 777 /** 778 * Returns if the given content field should be visible to the current user.<p> 779 * 780 * @param cms the cms context 781 * @param schemaType the content value type 782 * @param valuePath the value path 783 * @param resource the edited resource 784 * @param contentLocale the content locale 785 * 786 * @return <code>true</code> if the given content field should be visible to the current user 787 */ 788 boolean isVisible( 789 CmsObject cms, 790 I_CmsXmlSchemaType schemaType, 791 String valuePath, 792 CmsResource resource, 793 Locale contentLocale); 794 795 /** 796 * Prepares the given XML content to be used after it was read from the OpenCms VFS.<p> 797 * 798 * This method is always called after any content is unmarshalled. 799 * It can be used to perform customized actions on the given XML content.<p> 800 * 801 * @param cms the current OpenCms user context 802 * @param content the XML content to be used as read from the VFS 803 * 804 * @return the prepared content to be used 805 */ 806 CmsXmlContent prepareForUse(CmsObject cms, CmsXmlContent content); 807 808 /** 809 * Prepares the given XML content to be written to the OpenCms VFS.<p> 810 * 811 * This method is always called before any content gets written. 812 * It can be used to perform XML validation, pretty - printing 813 * or customized actions on the given XML content.<p> 814 * 815 * @param cms the current OpenCms user context 816 * @param content the XML content to be written 817 * @param file the resource the XML content in it's current state was unmarshalled from 818 * 819 * @return the file to write to the OpenCms VFS, this will be an updated version of the parameter file 820 * 821 * @throws CmsException in case something goes wrong 822 */ 823 CmsFile prepareForWrite(CmsObject cms, CmsXmlContent content, CmsFile file) throws CmsException; 824 825 /** 826 * Resolves the value mappings of the given XML content value, according 827 * to the rules of this XML content handler.<p> 828 * 829 * @param cms the current OpenCms user context 830 * @param content the XML content to resolve the mappings for 831 * @param value the value to resolve the mappings for 832 * 833 * @throws CmsException if something goes wrong 834 */ 835 void resolveMapping(CmsObject cms, CmsXmlContent content, I_CmsXmlContentValue value) throws CmsException; 836 837 /** 838 * Performs a validation of the given XML content value, and saves all errors or warnings found in 839 * the provided XML content error handler.<p> 840 * 841 * The errorHandler parameter is optional, if <code>null</code> is given a new error handler 842 * instance must be created.<p> 843 * 844 * @param cms the current OpenCms user context 845 * @param value the value to resolve the validation rules for 846 * @param errorHandler (optional) an error handler instance that contains previous error or warnings 847 * 848 * @return an error handler that contains all errors and warnings currently found 849 */ 850 CmsXmlContentErrorHandler resolveValidation( 851 CmsObject cms, 852 I_CmsXmlContentValue value, 853 CmsXmlContentErrorHandler errorHandler); 854 855}