Description

This method adds a Generator to a given Attribute.


Generator Naming Convention

A generatorName must be the conical form of the Generator's name.

Examples:

  • com.genRocket.generator.RangeGen
  • com.genRocket.generator.ListGen
  • com.genRocket.generator.NameGen


Attribute Naming Convention

An attributeName must be prepended with the name of the Domain to which it belongs.

Examples:

  • Invoice.id
  • User.firstName
  • Address.city


Exceptions

The following GenRocket exceptions may be thrown by this method:  

  • If the runtime instance is currently running another Scenario.
  • If the requested domainName is not found.
  • If a duplicate attributeName is found.
  • If a required generator parameter is not defined.


Runtime Method Signature

Use this method signature when directly accessing the GenRocket binary runtime.


public Integer generatorAdd(String attributeName, String generatorName, Boolean setLoop, Map<String, Object> requiredGeneratorParameters)


REST/Socket Payload Request

Use this API JSON request payload when making an API call to the GenRocket REST or Socket Engine.


{
  "interfaceType": "Manual",
  "methodName": "generatorAdd",
  "parameters": {
    "attributeName": "",
    "generatorName": "",
    "setLoop": "false",
    "requiredGeneratorParameters": {
       "parameterName1": "",
       "parameterName2": "",
       "parameterNameN": ""
    }
  }
}


REST/Socket Payload Successful Payload Response

The API JSON response payload for this method returns the position of the Generator within the list of Generators assigned to the given Attribute.


{
  "responseType": "OK",
  "data": {
     "generatorPosition": ""
  }
}


Note: If you want to reference the linked Generator in an Attribute Generator Parameter, you will have to use the following format


#{self.<domainName>.<attributeName>.gen1}


e.g.


#{self.User.name.gen1}