Class RefDataSvc


  • public class RefDataSvc
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      RefDataSvc()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void createOrUpdate()
      Create or update the given reference data set.
      boolean delete()
      Delete the specified organization reference data set.
      RefDataSvc setCacheTimeout​(int timeout)
      Set the cache timeout is seconds for the reference data set.
      RefDataSvc setClientCode​(java.lang.String clientCode)
      Set the reference data set organization client code.
      RefDataSvc setDataType​(java.lang.String type)
      Set the data type of the reference data set [ CSV | JSON | XML ].
      RefDataSvc setFileValue​(org.apache.commons.fileupload.FileItem fileValue)
      Set the file item value for the reference data set.
      RefDataSvc setLocale​(java.lang.String locale)
      Set the locale of the reference data set.
      RefDataSvc setName​(java.lang.String name)
      Set the name of the reference data set.
      RefDataSvc setValue​(java.lang.String value)
      Set the value of the reference data set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RefDataSvc

        public RefDataSvc()
    • Method Detail

      • setClientCode

        public RefDataSvc setClientCode​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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