
com.liferay.headless.delivery.dto.v1_0.PageSectionDefinition Maven / Gradle / Ivy
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.headless.delivery.dto.v1_0;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.liferay.petra.function.UnsafeSupplier;
import com.liferay.petra.string.StringBundler;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.vulcan.graphql.annotation.GraphQLField;
import com.liferay.portal.vulcan.graphql.annotation.GraphQLName;
import com.liferay.portal.vulcan.util.ObjectMapperUtil;
import jakarta.annotation.Generated;
import jakarta.validation.Valid;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Supplier;
/**
* @author Javier Gamarra
* @generated
*/
@Generated("")
@GraphQLName(
description = "Represents a definition of a Page section.",
value = "PageSectionDefinition"
)
@JsonFilter("Liferay.Vulcan")
@XmlRootElement(name = "PageSectionDefinition")
public class PageSectionDefinition implements Serializable {
public static PageSectionDefinition toDTO(String json) {
return ObjectMapperUtil.readValue(PageSectionDefinition.class, json);
}
public static PageSectionDefinition unsafeToDTO(String json) {
return ObjectMapperUtil.unsafeReadValue(
PageSectionDefinition.class, json);
}
@io.swagger.v3.oas.annotations.media.Schema(deprecated = true)
public String getBackgroundColor() {
if (_backgroundColorSupplier != null) {
backgroundColor = _backgroundColorSupplier.get();
_backgroundColorSupplier = null;
}
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
_backgroundColorSupplier = null;
}
@JsonIgnore
public void setBackgroundColor(
UnsafeSupplier backgroundColorUnsafeSupplier) {
_backgroundColorSupplier = () -> {
try {
return backgroundColorUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@Deprecated
@GraphQLField
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String backgroundColor;
@JsonIgnore
private Supplier _backgroundColorSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The background fragment image of the page section."
)
@Valid
public FragmentImage getBackgroundFragmentImage() {
if (_backgroundFragmentImageSupplier != null) {
backgroundFragmentImage = _backgroundFragmentImageSupplier.get();
_backgroundFragmentImageSupplier = null;
}
return backgroundFragmentImage;
}
public void setBackgroundFragmentImage(
FragmentImage backgroundFragmentImage) {
this.backgroundFragmentImage = backgroundFragmentImage;
_backgroundFragmentImageSupplier = null;
}
@JsonIgnore
public void setBackgroundFragmentImage(
UnsafeSupplier
backgroundFragmentImageUnsafeSupplier) {
_backgroundFragmentImageSupplier = () -> {
try {
return backgroundFragmentImageUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "The background fragment image of the page section."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected FragmentImage backgroundFragmentImage;
@JsonIgnore
private Supplier _backgroundFragmentImageSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
deprecated = true,
description = "Deprecated as of Athanasius (7.3.x), replaced by backgroundFragmentImage"
)
@Valid
public BackgroundImage getBackgroundImage() {
if (_backgroundImageSupplier != null) {
backgroundImage = _backgroundImageSupplier.get();
_backgroundImageSupplier = null;
}
return backgroundImage;
}
public void setBackgroundImage(BackgroundImage backgroundImage) {
this.backgroundImage = backgroundImage;
_backgroundImageSupplier = null;
}
@JsonIgnore
public void setBackgroundImage(
UnsafeSupplier
backgroundImageUnsafeSupplier) {
_backgroundImageSupplier = () -> {
try {
return backgroundImageUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@Deprecated
@GraphQLField(
description = "Deprecated as of Athanasius (7.3.x), replaced by backgroundFragmentImage"
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected BackgroundImage backgroundImage;
@JsonIgnore
private Supplier _backgroundImageSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "Defines the content visibility of the container."
)
public String getContentVisibility() {
if (_contentVisibilitySupplier != null) {
contentVisibility = _contentVisibilitySupplier.get();
_contentVisibilitySupplier = null;
}
return contentVisibility;
}
public void setContentVisibility(String contentVisibility) {
this.contentVisibility = contentVisibility;
_contentVisibilitySupplier = null;
}
@JsonIgnore
public void setContentVisibility(
UnsafeSupplier contentVisibilityUnsafeSupplier) {
_contentVisibilitySupplier = () -> {
try {
return contentVisibilityUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "Defines the content visibility of the container."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String contentVisibility;
@JsonIgnore
private Supplier _contentVisibilitySupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "A list of CSS Classes that are applied to the element."
)
public String[] getCssClasses() {
if (_cssClassesSupplier != null) {
cssClasses = _cssClassesSupplier.get();
_cssClassesSupplier = null;
}
return cssClasses;
}
public void setCssClasses(String[] cssClasses) {
this.cssClasses = cssClasses;
_cssClassesSupplier = null;
}
@JsonIgnore
public void setCssClasses(
UnsafeSupplier cssClassesUnsafeSupplier) {
_cssClassesSupplier = () -> {
try {
return cssClassesUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "A list of CSS Classes that are applied to the element."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String[] cssClasses;
@JsonIgnore
private Supplier _cssClassesSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "Custom CSS that is applied on the fragment."
)
public String getCustomCSS() {
if (_customCSSSupplier != null) {
customCSS = _customCSSSupplier.get();
_customCSSSupplier = null;
}
return customCSS;
}
public void setCustomCSS(String customCSS) {
this.customCSS = customCSS;
_customCSSSupplier = null;
}
@JsonIgnore
public void setCustomCSS(
UnsafeSupplier customCSSUnsafeSupplier) {
_customCSSSupplier = () -> {
try {
return customCSSUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "Custom CSS that is applied on the fragment.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String customCSS;
@JsonIgnore
private Supplier _customCSSSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The custom CSS viewports of the page collection."
)
@Valid
public CustomCSSViewport[] getCustomCSSViewports() {
if (_customCSSViewportsSupplier != null) {
customCSSViewports = _customCSSViewportsSupplier.get();
_customCSSViewportsSupplier = null;
}
return customCSSViewports;
}
public void setCustomCSSViewports(CustomCSSViewport[] customCSSViewports) {
this.customCSSViewports = customCSSViewports;
_customCSSViewportsSupplier = null;
}
@JsonIgnore
public void setCustomCSSViewports(
UnsafeSupplier
customCSSViewportsUnsafeSupplier) {
_customCSSViewportsSupplier = () -> {
try {
return customCSSViewportsUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "The custom CSS viewports of the page collection."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected CustomCSSViewport[] customCSSViewports;
@JsonIgnore
private Supplier _customCSSViewportsSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The fragment link of the page section."
)
@Valid
public FragmentLink getFragmentLink() {
if (_fragmentLinkSupplier != null) {
fragmentLink = _fragmentLinkSupplier.get();
_fragmentLinkSupplier = null;
}
return fragmentLink;
}
public void setFragmentLink(FragmentLink fragmentLink) {
this.fragmentLink = fragmentLink;
_fragmentLinkSupplier = null;
}
@JsonIgnore
public void setFragmentLink(
UnsafeSupplier fragmentLinkUnsafeSupplier) {
_fragmentLinkSupplier = () -> {
try {
return fragmentLinkUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "The fragment link of the page section.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected FragmentLink fragmentLink;
@JsonIgnore
private Supplier _fragmentLinkSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The fragment style of the page section."
)
@Valid
public FragmentStyle getFragmentStyle() {
if (_fragmentStyleSupplier != null) {
fragmentStyle = _fragmentStyleSupplier.get();
_fragmentStyleSupplier = null;
}
return fragmentStyle;
}
public void setFragmentStyle(FragmentStyle fragmentStyle) {
this.fragmentStyle = fragmentStyle;
_fragmentStyleSupplier = null;
}
@JsonIgnore
public void setFragmentStyle(
UnsafeSupplier fragmentStyleUnsafeSupplier) {
_fragmentStyleSupplier = () -> {
try {
return fragmentStyleUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "The fragment style of the page section.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected FragmentStyle fragmentStyle;
@JsonIgnore
private Supplier _fragmentStyleSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "A list of fragment viewports of the page section."
)
@Valid
public FragmentViewport[] getFragmentViewports() {
if (_fragmentViewportsSupplier != null) {
fragmentViewports = _fragmentViewportsSupplier.get();
_fragmentViewportsSupplier = null;
}
return fragmentViewports;
}
public void setFragmentViewports(FragmentViewport[] fragmentViewports) {
this.fragmentViewports = fragmentViewports;
_fragmentViewportsSupplier = null;
}
@JsonIgnore
public void setFragmentViewports(
UnsafeSupplier
fragmentViewportsUnsafeSupplier) {
_fragmentViewportsSupplier = () -> {
try {
return fragmentViewportsUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "A list of fragment viewports of the page section."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected FragmentViewport[] fragmentViewports;
@JsonIgnore
private Supplier _fragmentViewportsSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The page section's html properties"
)
@Valid
public HtmlProperties getHtmlProperties() {
if (_htmlPropertiesSupplier != null) {
htmlProperties = _htmlPropertiesSupplier.get();
_htmlPropertiesSupplier = null;
}
return htmlProperties;
}
public void setHtmlProperties(HtmlProperties htmlProperties) {
this.htmlProperties = htmlProperties;
_htmlPropertiesSupplier = null;
}
@JsonIgnore
public void setHtmlProperties(
UnsafeSupplier
htmlPropertiesUnsafeSupplier) {
_htmlPropertiesSupplier = () -> {
try {
return htmlPropertiesUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "The page section's html properties")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected HtmlProperties htmlProperties;
@JsonIgnore
private Supplier _htmlPropertiesSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "A flag that indicates whether the page section is indexed or not."
)
public Boolean getIndexed() {
if (_indexedSupplier != null) {
indexed = _indexedSupplier.get();
_indexedSupplier = null;
}
return indexed;
}
public void setIndexed(Boolean indexed) {
this.indexed = indexed;
_indexedSupplier = null;
}
@JsonIgnore
public void setIndexed(
UnsafeSupplier indexedUnsafeSupplier) {
_indexedSupplier = () -> {
try {
return indexedUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "A flag that indicates whether the page section is indexed or not."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected Boolean indexed;
@JsonIgnore
private Supplier _indexedSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "the page section's layout."
)
@Valid
public Layout getLayout() {
if (_layoutSupplier != null) {
layout = _layoutSupplier.get();
_layoutSupplier = null;
}
return layout;
}
public void setLayout(Layout layout) {
this.layout = layout;
_layoutSupplier = null;
}
@JsonIgnore
public void setLayout(
UnsafeSupplier layoutUnsafeSupplier) {
_layoutSupplier = () -> {
try {
return layoutUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "the page section's layout.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected Layout layout;
@JsonIgnore
private Supplier _layoutSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The custom name of a Page section."
)
public String getName() {
if (_nameSupplier != null) {
name = _nameSupplier.get();
_nameSupplier = null;
}
return name;
}
public void setName(String name) {
this.name = name;
_nameSupplier = null;
}
@JsonIgnore
public void setName(UnsafeSupplier nameUnsafeSupplier) {
_nameSupplier = () -> {
try {
return nameUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "The custom name of a Page section.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String name;
@JsonIgnore
private Supplier _nameSupplier;
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!(object instanceof PageSectionDefinition)) {
return false;
}
PageSectionDefinition pageSectionDefinition =
(PageSectionDefinition)object;
return Objects.equals(toString(), pageSectionDefinition.toString());
}
@Override
public int hashCode() {
String string = toString();
return string.hashCode();
}
public String toString() {
StringBundler sb = new StringBundler();
sb.append("{");
String backgroundColor = getBackgroundColor();
if (backgroundColor != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"backgroundColor\": ");
sb.append("\"");
sb.append(_escape(backgroundColor));
sb.append("\"");
}
FragmentImage backgroundFragmentImage = getBackgroundFragmentImage();
if (backgroundFragmentImage != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"backgroundFragmentImage\": ");
sb.append(String.valueOf(backgroundFragmentImage));
}
BackgroundImage backgroundImage = getBackgroundImage();
if (backgroundImage != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"backgroundImage\": ");
sb.append(String.valueOf(backgroundImage));
}
String contentVisibility = getContentVisibility();
if (contentVisibility != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"contentVisibility\": ");
sb.append("\"");
sb.append(_escape(contentVisibility));
sb.append("\"");
}
String[] cssClasses = getCssClasses();
if (cssClasses != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"cssClasses\": ");
sb.append("[");
for (int i = 0; i < cssClasses.length; i++) {
sb.append("\"");
sb.append(_escape(cssClasses[i]));
sb.append("\"");
if ((i + 1) < cssClasses.length) {
sb.append(", ");
}
}
sb.append("]");
}
String customCSS = getCustomCSS();
if (customCSS != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"customCSS\": ");
sb.append("\"");
sb.append(_escape(customCSS));
sb.append("\"");
}
CustomCSSViewport[] customCSSViewports = getCustomCSSViewports();
if (customCSSViewports != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"customCSSViewports\": ");
sb.append("[");
for (int i = 0; i < customCSSViewports.length; i++) {
sb.append(String.valueOf(customCSSViewports[i]));
if ((i + 1) < customCSSViewports.length) {
sb.append(", ");
}
}
sb.append("]");
}
FragmentLink fragmentLink = getFragmentLink();
if (fragmentLink != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"fragmentLink\": ");
sb.append(String.valueOf(fragmentLink));
}
FragmentStyle fragmentStyle = getFragmentStyle();
if (fragmentStyle != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"fragmentStyle\": ");
sb.append(String.valueOf(fragmentStyle));
}
FragmentViewport[] fragmentViewports = getFragmentViewports();
if (fragmentViewports != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"fragmentViewports\": ");
sb.append("[");
for (int i = 0; i < fragmentViewports.length; i++) {
sb.append(String.valueOf(fragmentViewports[i]));
if ((i + 1) < fragmentViewports.length) {
sb.append(", ");
}
}
sb.append("]");
}
HtmlProperties htmlProperties = getHtmlProperties();
if (htmlProperties != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"htmlProperties\": ");
sb.append(String.valueOf(htmlProperties));
}
Boolean indexed = getIndexed();
if (indexed != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"indexed\": ");
sb.append(indexed);
}
Layout layout = getLayout();
if (layout != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"layout\": ");
sb.append(String.valueOf(layout));
}
String name = getName();
if (name != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"name\": ");
sb.append("\"");
sb.append(_escape(name));
sb.append("\"");
}
sb.append("}");
return sb.toString();
}
@io.swagger.v3.oas.annotations.media.Schema(
accessMode = io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY,
defaultValue = "com.liferay.headless.delivery.dto.v1_0.PageSectionDefinition",
name = "x-class-name"
)
public String xClassName;
private static String _escape(Object object) {
return StringUtil.replace(
String.valueOf(object), _JSON_ESCAPE_STRINGS[0],
_JSON_ESCAPE_STRINGS[1]);
}
private static boolean _isArray(Object value) {
if (value == null) {
return false;
}
Class> clazz = value.getClass();
return clazz.isArray();
}
private static String _toJSON(Map map) {
StringBuilder sb = new StringBuilder("{");
@SuppressWarnings("unchecked")
Set set = map.entrySet();
@SuppressWarnings("unchecked")
Iterator> iterator = set.iterator();
while (iterator.hasNext()) {
Map.Entry entry = iterator.next();
sb.append("\"");
sb.append(_escape(entry.getKey()));
sb.append("\": ");
Object value = entry.getValue();
if (_isArray(value)) {
sb.append("[");
Object[] valueArray = (Object[])value;
for (int i = 0; i < valueArray.length; i++) {
if (valueArray[i] instanceof Map) {
sb.append(_toJSON((Map)valueArray[i]));
}
else if (valueArray[i] instanceof String) {
sb.append("\"");
sb.append(valueArray[i]);
sb.append("\"");
}
else {
sb.append(valueArray[i]);
}
if ((i + 1) < valueArray.length) {
sb.append(", ");
}
}
sb.append("]");
}
else if (value instanceof Map) {
sb.append(_toJSON((Map)value));
}
else if (value instanceof String) {
sb.append("\"");
sb.append(_escape(value));
sb.append("\"");
}
else {
sb.append(value);
}
if (iterator.hasNext()) {
sb.append(", ");
}
}
sb.append("}");
return sb.toString();
}
private static final String[][] _JSON_ESCAPE_STRINGS = {
{"\\", "\"", "\b", "\f", "\n", "\r", "\t"},
{"\\\\", "\\\"", "\\b", "\\f", "\\n", "\\r", "\\t"}
};
private Map _extendedProperties;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy