Class AgentModelPricingService

java.lang.Object
com.flowable.agent.engine.pricing.AgentModelPricingService

public class AgentModelPricingService extends Object
Stores agent model prices in the platform configuration store and applies default-tenant fallback.
  • Field Details

  • Constructor Details

    • AgentModelPricingService

      public AgentModelPricingService(ConfigurationService configurationService, tools.jackson.databind.ObjectMapper objectMapper)
  • Method Details

    • getPricesForTenant

      public List<AgentModelPrice> getPricesForTenant(String tenantId, boolean merge)
      Returns the agent model prices for the given tenant.

      When merge is true, the default-tenant prices are merged with the tenant's own (the tenant's entries override/add, matched by model prefix). This is the effective list to price tokens against, used by the dashboard cost result mappers (AgentCostByModel/Total/ByDateQueryResultMapper) and the REST agent-model-prices read endpoint, so a tenant inherits the default prices unless it overrides them.

      When merge is false, only the entries actually stored for this tenant are returned, without the default-tenant fallback. This is what the pricing editor (Control/Hub pricing pages, via the REST agent-model-prices?raw=true parameter) needs: inherited default-tenant prices live under the default tenant and cannot be edited/deleted through a tenant view, so they must not appear in the editable list.

    • fetchStored

      protected List<AgentModelPrice> fetchStored(String tenantId)
      The price entries actually stored for the given tenant (no default-tenant fallback).
    • get

      public AgentModelPrice get(String tenantId, String modelPrefix)
    • save

      public AgentModelPrice save(String tenantId, AgentModelPrice price)
    • delete

      public void delete(String tenantId, String modelPrefix)
    • findProperty

      protected ConfigurationProperty findProperty(String tenantId, String modelPrefix)
    • normalize

      protected String normalize(String tenantId)
    • toJson

      protected String toJson(AgentModelPrice price)
      Serializes the price fields (the model prefix is the configuration property name, not part of the value).
    • fromJson

      protected AgentModelPrice fromJson(String modelPrefix, String json)
    • mergeEffective

      protected static List<AgentModelPrice> mergeEffective(List<AgentModelPrice> defaults, List<AgentModelPrice> tenant)
      Merges default-tenant prices with the tenant's own, keyed by model prefix (tenant overrides/adds).