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
  • 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 a RestApiTemplate record class.
      Parameters:
      name - the value for the name record component
      displayName - the value for the displayName record component
      description - the value for the description record component
      baseUrl - the value for the baseUrl record component
      timeoutMs - the value for the timeoutMs record component
      verifySsl - the value for the verifySsl record component
      auth - the value for the auth record component
      headers - the value for the headers record component
      methods - the value for the methods record component
      isTemplate - the value for the isTemplate record component
      templateVersion - the value for the templateVersion record component
      requiredFields - the value for the requiredFields record 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 isTemplate is 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 isTemplate is true, includes template metadata (isTemplate, templateVersion, requiredFields). Note: Templates with placeholders don't need encryption since they don't contain real credentials.

    • toJsonString

      public String toJsonString(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Converts this template to a JSON string for storage.
    • toJsonStringEncrypted

      public String toJsonStringEncrypted(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Converts this template to a JSON string with encrypted sensitive fields.
    • builder

      public static RestApiTemplate.Builder builder()
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • displayName

      public String displayName()
      Returns the value of the displayName record component.
      Returns:
      the value of the displayName record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • baseUrl

      public String baseUrl()
      Returns the value of the baseUrl record component.
      Returns:
      the value of the baseUrl record component
    • timeoutMs

      public int timeoutMs()
      Returns the value of the timeoutMs record component.
      Returns:
      the value of the timeoutMs record component
    • verifySsl

      public boolean verifySsl()
      Returns the value of the verifySsl record component.
      Returns:
      the value of the verifySsl record component
    • auth

      public AuthConfig auth()
      Returns the value of the auth record component.
      Returns:
      the value of the auth record component
    • headers

      public Map<String,String> headers()
      Returns the value of the headers record component.
      Returns:
      the value of the headers record component
    • methods

      public List<RestApiTemplate.Method> methods()
      Returns the value of the methods record component.
      Returns:
      the value of the methods record component
    • isTemplate

      public boolean isTemplate()
      Returns the value of the isTemplate record component.
      Returns:
      the value of the isTemplate record component
    • templateVersion

      public String templateVersion()
      Returns the value of the templateVersion record component.
      Returns:
      the value of the templateVersion record component
    • requiredFields

      public List<String> requiredFields()
      Returns the value of the requiredFields record component.
      Returns:
      the value of the requiredFields record component