MdsDummyDataGenerator

public interface MdsDummyDataGenerator

Methods

clearEntities

void clearEntities()

generateDummyEntities

void generateDummyEntities(int numberOfEntities, boolean regenerateBundle)

Generate a given amount of empty entities

Parameters:
  • numberOfEntities – How many entities should be generated
  • regenerateBundle – Should the data bundle be regenerated after entities are created
Throws:
  • IOException

generateDummyEntities

void generateDummyEntities(int numberOfEntities, int fieldsPerEntity, int lookupsPerEntity, boolean regenerateBundle)

Generate a given amount of entities

Parameters:
  • numberOfEntities – How many entities should be generated
  • fieldsPerEntity – How many fields should each entity have - type of field is assigned randomly
  • lookupsPerEntity – How many lookups should each entity have
  • regenerateBundle – Should the data bundle be regenerated after entities are created
Throws:
  • IOException

generateDummyInstances

void generateDummyInstances(Long entityId, int numberOfInstances)

Generates a given amount of instances. For most common field types, values will be automatically assigned.

Parameters:
  • entityId – Id of an entity, for which we want to generate instances
  • numberOfInstances – How many instances should be generated
Throws:

generateDummyInstances

void generateDummyInstances(Long entityId, int numberOfInstances, int numberOfHistoricalRevisions, int numberOfTrashInstances)

Generates a given amount of instances, historical revisions and deleted instances. For most common field types, values will be automatically assigned.

Parameters:
  • entityId – Id of an entity, for which we want to generate instances
  • numberOfInstances – How many instances should be generated
  • numberOfHistoricalRevisions – How many historical revisions should be generated
  • numberOfTrashInstances – How many instances in trash should be generated
Throws:

getEntityPrefix

String getEntityPrefix()

getFieldPrefix

String getFieldPrefix()

getLookupPrefix

String getLookupPrefix()

getService

MotechDataService getService(BundleContext bundleContext, String className)

makeDummyInstance

Object makeDummyInstance(Long entityId)

Makes a dummy instance for a given entity. It won’t insert the created instance into the database, so it can be used to prepare a large dataset of random instances (for example, to insert them manually and measure time)

Parameters:
  • entityId – Id of an entity, for which we want to generate instance
Throws:
Returns:

Generated instance, with randomly assigned fields

setEntityPrefix

void setEntityPrefix(String entityPrefix)

Sets a prefix for the generated entities. Defaults to “Entity”

Parameters:
  • entityPrefix – The prefix for generated entities

setFieldPrefix

void setFieldPrefix(String fieldPrefix)

Sets the prefix for the generated fields. Defaults to “field”

Parameters:
  • fieldPrefix – The prefix for generated fields

setLookupPrefix

void setLookupPrefix(String lookupPrefix)

Sets a prefix for the generated lookups. Defaults to “Lookup”

Parameters:
  • lookupPrefix – The prefix for generated lookups