Record Class RestApiTemplate
java.lang.Object
java.lang.Record
com.bonitasoft.processbuilder.extension.template.RestApiTemplate
public record RestApiTemplate(String name, String displayName, String description, String baseUrl, int timeoutMs, boolean verifySsl, AuthConfig auth, Map<String,String> headers, List<RestApiTemplate.Method> methods, boolean isTemplate, String templateVersion, List<String> requiredFields)
extends Record
Represents a REST API template configuration.
Use this class to create type-safe REST API configurations that can be stored in PBConfiguration. This class supports both:
- REST API Configurations: Actual API configurations with real credentials
- REST API Templates: Template definitions with placeholders ({{baseUrl}}, {{token}}, etc.)
When isTemplate is true, the template includes additional metadata like
templateVersion and requiredFields that help the UI render
configuration forms for users to fill in placeholders.
- Since:
- 2025-02-06
- Author:
- Process Builder Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordRepresents a method/endpoint in the REST API. -
Constructor Summary
ConstructorsConstructorDescriptionRestApiTemplate(String name, String displayName, String description, String baseUrl, int timeoutMs, boolean verifySsl, AuthConfig auth, Map<String, String> headers, List<RestApiTemplate.Method> methods, boolean isTemplate, String templateVersion, List<String> requiredFields) Creates an instance of aRestApiTemplaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionauth()Returns the value of theauthrecord component.baseUrl()Returns the value of thebaseUrlrecord component.static RestApiTemplate.Builderbuilder()Returns the value of thedescriptionrecord component.Returns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.booleanReturns the value of theisTemplaterecord component.methods()Returns the value of themethodsrecord component.name()Returns the value of thenamerecord component.Returns the value of therequiredFieldsrecord component.Returns the value of thetemplateVersionrecord component.intReturns the value of thetimeoutMsrecord component.com.fasterxml.jackson.databind.JsonNodetoJson(com.fasterxml.jackson.databind.ObjectMapper mapper) Converts this template to JSON format for storage in PBConfiguration.configValue.com.fasterxml.jackson.databind.JsonNodetoJsonEncrypted(com.fasterxml.jackson.databind.ObjectMapper mapper) Converts this template to JSON format with encrypted sensitive fields.toJsonString(com.fasterxml.jackson.databind.ObjectMapper mapper) Converts this template to a JSON string for storage.toJsonStringEncrypted(com.fasterxml.jackson.databind.ObjectMapper mapper) Converts this template to a JSON string with encrypted sensitive fields.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theverifySslrecord component.
-
Constructor Details
-
RestApiTemplate
public RestApiTemplate(String name, String displayName, String description, String baseUrl, int timeoutMs, boolean verifySsl, AuthConfig auth, Map<String, String> headers, List<RestApiTemplate.Method> methods, boolean isTemplate, String templateVersion, List<String> requiredFields) Creates an instance of aRestApiTemplaterecord class.- Parameters:
name- the value for thenamerecord componentdisplayName- the value for thedisplayNamerecord componentdescription- the value for thedescriptionrecord componentbaseUrl- the value for thebaseUrlrecord componenttimeoutMs- the value for thetimeoutMsrecord componentverifySsl- the value for theverifySslrecord componentauth- the value for theauthrecord componentheaders- the value for theheadersrecord componentmethods- the value for themethodsrecord componentisTemplate- the value for theisTemplaterecord componenttemplateVersion- the value for thetemplateVersionrecord componentrequiredFields- the value for therequiredFieldsrecord component
-
-
Method Details
-
toJson
public com.fasterxml.jackson.databind.JsonNode toJson(com.fasterxml.jackson.databind.ObjectMapper mapper) Converts this template to JSON format for storage in PBConfiguration.configValue.When
isTemplateis true, includes template metadata (isTemplate, templateVersion, requiredFields). -
toJsonEncrypted
public com.fasterxml.jackson.databind.JsonNode toJsonEncrypted(com.fasterxml.jackson.databind.ObjectMapper mapper) Converts this template to JSON format with encrypted sensitive fields.When
isTemplateis true, includes template metadata (isTemplate, templateVersion, requiredFields). Note: Templates with placeholders don't need encryption since they don't contain real credentials. -
toJsonString
Converts this template to a JSON string for storage. -
toJsonStringEncrypted
Converts this template to a JSON string with encrypted sensitive fields. -
builder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
baseUrl
Returns the value of thebaseUrlrecord component.- Returns:
- the value of the
baseUrlrecord component
-
timeoutMs
public int timeoutMs()Returns the value of thetimeoutMsrecord component.- Returns:
- the value of the
timeoutMsrecord component
-
verifySsl
public boolean verifySsl()Returns the value of theverifySslrecord component.- Returns:
- the value of the
verifySslrecord component
-
auth
Returns the value of theauthrecord component.- Returns:
- the value of the
authrecord component
-
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-
methods
Returns the value of themethodsrecord component.- Returns:
- the value of the
methodsrecord component
-
isTemplate
public boolean isTemplate()Returns the value of theisTemplaterecord component.- Returns:
- the value of the
isTemplaterecord component
-
templateVersion
Returns the value of thetemplateVersionrecord component.- Returns:
- the value of the
templateVersionrecord component
-
requiredFields
Returns the value of therequiredFieldsrecord component.- Returns:
- the value of the
requiredFieldsrecord component
-