Class RefDataSvc


  • public class RefDataSvc
    extends Object

    Provides a Reference Data Service.

    Examples

    Please find the reference data service examples below.

    Create CSV Reference Data with File Upload

    This Groovy example shows how to create or update CSV reference data set using FileItem file upload value.

     import com.avoka.tm.svc.RefDataSvc
     import org.apache.commons.fileupload.FileItem
    
     // Uploaded CSV format product list
     FileItem productsFileItem = ...
    
     new RefDataSvc()
         .setName("Product List")
         .setLocale("en_US")
         .setDataType("CSV")
         .setFileValue(productsFileItem)
         .createOrUpdate() 

    Create JSON Reference Data

    This Groovy example shows how to create or update JSON reference data set.

     import com.avoka.tm.svc.RefDataSvc
    
     String addressesJson = ...
    
     new RefDataSvc()
         .setName("Addresses")
         .setLocale("en_US")
         .setDataType("JSON")
         .setValue(addressesJson)
         .createOrUpdate() 

    Delete Reference Data Set

    This Groovy example shows how to delete a reference data set.

     import com.avoka.tm.svc.RefDataSvc
    
     new RefDataSvc()
         .setName("Addresses")
         .setLocale("en_US")
         .delete() 
    Since:
    17.10.0
    • Constructor Detail

      • RefDataSvc

        public RefDataSvc()
    • Method Detail

      • setClientCode

        public RefDataSvc setClientCode​(String clientCode)
        Set the reference data set organization client code. Generally this is not required as the service executes in a client organization security context.
        Parameters:
        clientCode - reference data organization client code
        Returns:
        the service object
      • setName

        public RefDataSvc setName​(String name)
        Set the name of the reference data set.
        Parameters:
        name - the name of the reference data
        Returns:
        the service object
      • setLocale

        public RefDataSvc setLocale​(String locale)
        Set the locale of the reference data set.
        Parameters:
        locale - the locale of the reference data
        Returns:
        the service object
      • setCacheTimeout

        public RefDataSvc setCacheTimeout​(int timeout)
        Set the cache timeout is seconds for the reference data set.
        Parameters:
        timeout - the cache timeout is seconds for the reference data set
        Returns:
        the service object
      • setDataType

        public RefDataSvc setDataType​(String type)
        Set the data type of the reference data set [ CSV | JSON | XML ].
        Parameters:
        type - the data type of the reference data
        Returns:
        the service object
      • setValue

        public RefDataSvc setValue​(String value)
        Set the value of the reference data set.
        Parameters:
        value - the locale of the reference data
        Returns:
        the service object
      • setFileValue

        public RefDataSvc setFileValue​(org.apache.commons.fileupload.FileItem fileValue)
        Set the file item value for the reference data set. If a FileItem value is specified this will be used in preference to a value parameter.
        Parameters:
        fileValue - the file item value for the reference data
        Returns:
        the service object
      • createOrUpdate

        public void createOrUpdate()
        Create or update the given reference data set.
      • delete

        public boolean delete()
        Delete the specified organization reference data set.
        Returns:
        if the reference data set was found and deleted or false if not found