Package com.avoka.tm.svc
Class PropertyBuilder
java.lang.Object
com.avoka.tm.svc.PropertyBuilder
Provides a property value builder service.
Examples
Example scripts are provided below.
Create/Update Form Property
The example below will create or update a "Product Codes" form version property against specified forms current form version. The property value may be use in Form Prefill or Dynamic Data services.
 import com.avoka.tm.svc.*
 String value = "product codes data..."
 new PropertyBuilder()
     .setName("Product Codes")
     .setValue(value)
     .setFormCode("PDS-12")
     .build() 
 Create/Update Organization Property
The example below will create or update a "Loan Types" Organization property.
 import com.avoka.tm.svc.*
 String value = "loan types data..."
 new PropertyBuilder()
     .setName("Loan Types")
     .setValue(value)
     .setClientCode("maguire")
     .build() 
 Create/Update Form Space Property
The example below will create or update a "Locale Messages" Form Space property.
 import com.avoka.tm.svc.*
 String value = "locale messages data..."
 new PropertyBuilder()
     .setName("Locale Messages")
     .setValue(value)
     .setSpaceName("Work Space")
     .build() 
 Reference Data Loading Example
The example below is show a Fluent Groovy service provide a REST service endpoint for uploading an Orgs "Product Catalog" reference data set via a mult-part post request. This Fluent Groovy service is exposed via the REST Groovy Service Invoker API.
 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*
 import jakarta.servlet.http.*
 import org.apache.commons.fileupload.FileItem
 class FluentGroovyService {
     // Injected at runtime
     public Logger logger
     Object invoke(SvcDef svcDef, HttpServletRequest request, User user, Map params) {
         // Get the products file upload file item
         FileItem fileItem = (FileItem) params.products
         logger.info "loading file: " + fileItem.name
         // Convert the fileItem binary data to CSV text
         String productsCSV = new String(fileItem.get(), "UTF-8")
         // Create or update the Organizations "Product Catalog" property
         new PropertyBuilder()
             .setName("Product Catalog")
             .setValue(productsCSV)
             .setClientCode(svcDef.clientCode)
             .build()
         String msg = "Imported '" + fileItem.name + "' file into 'Product Catalog' organization property"
         logger.info msg
         return msg
     }
 } - Since:
- 5.0.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidbuild()Create or update the property based on the specified parameter.setClientCode(String clientCode) Set the property organization client code parameter.setFormCode(String formCode) Set the property form code parameter.Set the property name parameter.setSpaceName(String spaceName) Set the property space name parameter.Set the property value parameter.
- 
Constructor Details- 
PropertyBuilderpublic PropertyBuilder()
 
- 
- 
Method Details- 
setNameSet the property name parameter.- Parameters:
- name- the property name
- Returns:
- the property builder
 
- 
setValueSet the property value parameter.- Parameters:
- value- the property value
- Returns:
- the property builder
 
- 
setFormCode@FluentSecurityPermission(permissions="form-edit") public PropertyBuilder setFormCode(String formCode) Set the property form code parameter.- Parameters:
- formCode- the property form code
- Returns:
- the property builder
 
- 
setClientCode@FluentSecurityPermission(permissions="organization-property-edit") public PropertyBuilder setClientCode(String clientCode) Set the property organization client code parameter.- Parameters:
- clientCode- the property organization client code
- Returns:
- the property builder
 
- 
setSpaceName@FluentSecurityPermission(permissions="organization-edit") public PropertyBuilder setSpaceName(String spaceName) Set the property space name parameter.- Parameters:
- spaceName- the property space name
- Returns:
- the property builder
 
- 
buildpublic void build()Create or update the property based on the specified parameter.
 
-