Class ClientBuilder

java.lang.Object
com.avoka.tm.svc.ClientBuilder

public class ClientBuilder extends Object

Provides a Client value object builder class.

Examples

Please find the Client builder examples below.

Create a Client and assign a form space

This example shows how to create a Client object and assign a form space.

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 Client client= new ClientBuilder()
                  .setName("client1")
                  .setCode("client1")
                  .setStatus("Active")
                  .addSpaceName("Work Spaces")
                  .setDescription("client1 description")
                  .create()
 

Create a Client and assign multiple form spaces and an email service

This example shows how to create a Client object and assign multiple form spaces and an email service.

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 def spaceNames = new HashSet();
 spaceNames.add("Work Spaces")
 spaceNames.add("Web Plug-in")

 Client client= new ClientBuilder()
                  .setName("client1")
                  .setCode("client1")
                  .setStatus("Active")
                  .setSpaceNames(spaceNames)
                  .setEmailService("SMTP Email Service - v1.0.0")
                  .setDescription("client1 description")
                  .create()
 

Update a Client and add a form space.

The example below shows how to update a Client and add a form space.

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 Client client= new ClientBuilder()
                  .setCode("client1")
                  .addSpaceName("Web Plug-in")
                  .update()
 

Create or Update a Client and assign/add a form space.

The example below shows how to create or update a Client and assign/add a form space.

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 Client client= new ClientBuilder()
                  .setName("client1")
                  .setCode("client1")
                  .setStatus("Active")
                  .addSpaceName("Work Spaces")
                  .createOrUpdate()
 
Since:
23.10.0
  • Constructor Details

  • Method Details

    • setName

      public ClientBuilder setName(String clientName)
      Set the client name parameter.
      Parameters:
      clientName - client name
      Returns:
      the client service
    • setCode

      public ClientBuilder setCode(String clientCode)
      Set the client code parameter.
      Parameters:
      clientCode - client code
      Returns:
      the client service
    • setDescription

      public ClientBuilder setDescription(String description)
      Set the description parameter.
      Parameters:
      description - client description
      Returns:
      the client service
    • setEmailService

      public ClientBuilder setEmailService(String emailService)
      Set the emailService parameter.
      Parameters:
      emailService - client code
      Returns:
      the client service
    • setStatus

      public ClientBuilder setStatus(String status)
      Set the client status parameter.
      Parameters:
      status - client status
      Returns:
      the client service
    • setSpaceNames

      public ClientBuilder setSpaceNames(Set<String> spaceNames)
      Set the client space names
      Parameters:
      spaceNames - the client space names the client should be assigned to
      Returns:
      the client service
    • addSpaceName

      public ClientBuilder addSpaceName(String spaceName)
      Add the form space names the client should be assigned to.
      Parameters:
      spaceName - the form space name the client should be assigned to
      Returns:
      the client service
    • removeSpaceName

      public ClientBuilder removeSpaceName(String spaceName)
      Remove the form space names the client should be assigned to.
      Parameters:
      spaceName - the form space name the client should not be assigned to
      Returns:
      the client service
    • create

      public Client create() throws IllegalAccessException
      Create a new client based on the specified parameters and return the new client value object.
      Returns:
      the newly created client value object
      Throws:
      IllegalAccessException
    • update

      public Client update() throws IllegalAccessException
      Update the client specified by the clientCode parameter and return the updated client value object. This method will throw a IllegalArgumentException if the specified client specified by clientCode parameter was not found.
      Returns:
      the update client value object
      Throws:
      IllegalAccessException
    • createOrUpdate

      public Client createOrUpdate() throws IllegalAccessException
      Create or update the client specified by the given parameters, and return current client value object. If the client specified by the clientCode is not found then a new client will be created.
      Returns:
      create or update the client specified by the given parameters, and return current client value object
      Throws:
      IllegalAccessException