blob: 1b5753ad22e3d21b18661ca31845a19485362c0b [file] [log] [blame]
mock entitymodel for ${{BASIC_PROJECT_NAME}}.entities.* {
import ${{BASIC_PROJECT_NAME}}.datainterchange.*
datainterchanges {
datainterchange import Warehouses from file "file://${{PROJECT_LOC}}/../${{BASIC_PROJECT_NAME}}.model.datainterchange/models/smooksresources/warehouses.xml"
}
resources {
resource GenderResources {
attributes (flag, description)
items {
MALE ( "M" "male" )
FEMALE ( "F" "female" )
}
}
resource CountryResources {
attributes (native_name)
items {
DE ( "Deutschland" )
FR ( "France" )
UK ( "Great Britain" )
}
}
resource CompanyRelationResources {
attributes (name, description)
items {
SUPPLIER ( "supplier", "delivering interesting goods" )
CUSTOMER ( "customer", "buying our interesting goods" )
}
}
resource CurrencyResources {
attributes (code description)
items {
USD ( "USD" "Dollar" )
EUR ( "EUR" "Euro" )
}
}
resource MonthResources {
items {
JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER
}
}
}
objects {
/** containing consistent information for a postal address */
object AddressObject {
/** ISO-3166-Alpha-2-Code */
var iso3166 by enum CountryResources
var street switch on iso3166 {
when DE ( "Berlinerplatz ##", "Münchnerstr. ##", "[never]EverStrasse 9" )
when FR ( "Arc de Truimphe ##" )
when UK ( "Paddington Street ##" "Willington Road ##" )
}
var state_province switch on iso3166 {
when DE ( "Baden-Württemberg" "Rheinland-Pfalz" "Niedersachsen" )
when FR ( "Acquitaine" "Centre" "Burgund" "Paris" )
when UK ( "East" "East Midlands" "London" "North East" )
}
var postalcode ( "#####" )
var city switch on iso3166 {
when DE ( "Berlin" "Buxtehude" "Darmstadt" "Karlsruhe" "München" )
when FR ( "Paris" )
when UK ( "Belfast" "Cardiff" "Lonon" )
}
var country with iso3166.native_name
var phonenumber switch on iso3166 {
when DE ( "+49 (###) ####-###" )
when FR ( "+33 (###) ####-###" )
when UK ( "+44 (###) ####-###" )
}
var alphabet switch on iso3166 {
when DE ( "abcdefghijklmnopqrstuvwxyzäöüß" )
when FR ( "abcdefghijklmnopqrstuvwxyzáàâéè" )
when UK ( "abcdefghijklmnopqrstuvwxyz" )
}
}
/** containing consistent information about a company */
object CompanyObject {
embed company_address defined as AddressObject
var companyDomain ( "com" "org" )
var companyName ( "Alist" "Beans" "Klein" )
var companySuffix ( "AG" "GmbH" "KoKG" )
var companyEmail ( "info" "kontakt" )
var name ( "[companyName] [companySuffix]" )
var email ( "[companyEmail]@[companyName].[companyDomain]" )
var position_title ( "Store Manager" "HQ Finance" "Store Permanent Checker" )
}
/** containing consistent information about a department */
object DepartmentObject {
embed department_address defined as AddressObject
var name ( "Einkauf" "Lohnbuchhaltung" "Verkauf" "Zentrale" )
var default_yearly_income randomize unsigned double in range 10000.0 up to and including 30000.0 with 2 decimals round to 500.0
}
/** containing consistent information about a currencies */
object CurrencyObject {
var currencies by enum CurrencyResources
var code with currencies.code
var description with currencies.description
}
object ValueBeanObject {
var amount randomize unsigned double in range 2000.0 up to and including 130000.0 with 2 decimals round to 500.0
embed currency defined as CurrencyObject
}
/** containing consistent information about a person */
object PersonObject {
var sex by enum GenderResources
var marital by enum MaritalStatus
var gender with sex.flag
var marital_status with marital
var firstName switch on sex {
when MALE ( "Andreas" "Armin" "Ernst" "Hans" "Hubert" "Jens" "Johan" "Michael" "Norbert" "Oliver" "Thorsten" "Ulrich" )
when FEMALE ( "Andrea" "Evelin" "Jutta" "Maria" )
}
var lastName ( "Abbott" "Collins" "Hammond" "Maynard" "Schultz" "Swanson" "Watson" "Zimmerman" )
var fullName ( "[firstName] [lastName]" )
var mailProvider ( "gmail.de" "yahoo.de" "mail.de" )
var privateEmail ( "[firstName].[lastName]@[mailProvider]" )
embed home_address defined as AddressObject
embed employer defined as CompanyObject
var education_level ( "Bachelors Degree" "Partial College" "Graduate Degree" "High School Degree" )
var birth_date randomize date in range -50 up to and including -20 years
var yearly_income randomize unsigned double in range 10000.0 up to and including 30000.0 with 2 decimals round to 500.0
var num_cars_owned randomize signed integer from (3 8 11)
var age randomize signed integer in range 17 up to and including 90
var trendIndex randomize signed double in range -10 up to and including 10 with 2 decimals
var goalReachedPercent randomize signed double in range 0 up to and including 100 with 2 decimals
var nativeGerman randomize boolean
var portrait switch on sex {
when MALE (
"dacf6830-d36b-422d-9cc5-d981f27c49c1" // Boss
"803c55a5-9bbb-402c-9d15-a2fde19f369d" // Employee9
"b2e3cab2-22ed-45e9-ad6a-af0e54054177" // Employee16
"ce1f20d4-b962-46df-acb7-5558561800b2" // Employee18
)
when FEMALE (
"b01c3e47-8226-43ce-88e2-6e93b3991f06" // Employee2
"976a9cd2-1859-47e3-9f2c-83e0f9e2f0ae" // Employee3
"0dc1064b-c09d-400c-9159-1909798cd9f8" // Employee6
"0051e81f-c2c9-432a-b0d9-0cf065dfee49" // Employee7
"8a5f20be-77bc-4e57-a5ea-5bdf37a948c4" // Employee8
"9d5b6d6f-515a-4ee2-8000-593e026aa248" // Employee10
"f00e8c41-8fe5-4a4f-9c29-a36ace86eafa" // Employee11
"970c6257-9441-4f3f-aeea-4d5c31f83acf" // Employee14
"4d2e2844-7be3-4870-b09c-e95e466565e9" // Employee15
"1a074db7-5e6c-4022-a054-17a959678229" // Employee17
"e24a0980-9724-494f-afba-a1c0b7cb64b8" // Employee20
"8ba871b4-bc07-4608-a0fb-7aa47620525b" // Employee21
"c6d42a81-a798-420b-90de-9fd0f80f5515" // Employee23
"96f5fdd0-6e94-4ac9-b8d1-8771196bee38" // Employee26
)
}
var expenses_for_cars calculate as double based on (String gender, int num_cars_owned) {
var result = 0.0;
if ("M".equals(gender)) {
result = num_cars_owned * 123.45
}
else {
result = 999.99
}
return result
}
}
}
mock entities {
mocking mockDailies for entity Dailies iterate theDate with date from 2016-01-01 until yesterday every 1 days {
var dayOfMonth calculate based on (theDate) {
return theDate.getDate
}
var monthOfYear calculate based on (theDate) {
return theDate.month+1
}
var theYear calculate based on (theDate) {
return theDate.year+1900
}
var quarter calculate based on (theDate) {
return "Q"+(1+((theDate.month / 3) as int))
}
var theDay calculate based on (theDate) {
return new java.text.SimpleDateFormat("E").format(theDate)
}
var theMonth calculate based on (theDate) {
return new java.text.SimpleDateFormat("M").format(theDate)
}
var weekOfYear calculate based on (theDate) {
return Integer.parseInt(new java.text.SimpleDateFormat("w").format(theDate))
}
}
mocking mockedCompanyRelation for entity CompanyRelationType by resource CompanyRelationResources {
var name as name
var description as description
}
mocking mockedCompanyGroup for entity CompanyGroup rows 2 to 5 {
temporary groupData by object CompanyObject
var name as groupData.companyName
var description randomize sentences 5
}
mocking mockedCompany for entity Company rows 5 to 10 {
temporary companyData by object CompanyObject
ref company_group to mockedCompanyGroup
var name as companyData.companyName
var description randomize sentences 5
ref relation_type to mockedCompanyRelation
}
mocking mockedDepartment for entity Department rows 10 to 20 {
temporary departmentData by object DepartmentObject
ref company to mockedCompany
var name as departmentData.name
var description randomize sentences 5
var default_yearly_income as departmentData.default_yearly_income
}
mocking currency for entity Currency by resource CurrencyResources {
var code as code
var description as description
}
mocking mockedPerson for entity Person rows 20 to 50 {
temporary personData by object PersonObject
var first_name as personData.firstName
var last_name as personData.lastName
var marital_status as personData.marital_status
var gender as personData.gender
var birthdate as personData.birth_date
var education as personData.education_level
/** only 70% of all persons are employees, the other 30% are individuals */
ref department to mockedDepartment optional for 70 percent
var position as personData.employer.position_title
var portrait as personData.portrait
var num_cars_owned as personData.num_cars_owned
var expenses_for_cars as personData.expenses_for_cars
var yearly_income as personData.yearly_income
var age as personData.age
var trendIndex as personData.trendIndex
var goalReachedPercent as personData.goalReachedPercent
var nativeGerman as personData.nativeGerman
ref warehouse to existing entities optional for 80 percent
var percentual_diff_to_default calculate based on (yearly_income, department.default_yearly_income) {
return yearly_income / department__default_yearly_income
}
}
mocking mockedPersonInfo for entity PersonInfo rows 10 to 100 {
ref person to mockedPerson
var message randomize sentences 10
}
mocking mockedAddress for entity Address rows 20 to 100 {
temporary addressData by object AddressObject
ref company to mockedCompany optional for 10 percent
ref department to mockedDepartment optional for 20 percent
ref person to mockedPerson optional for 70 percent
var address1 as addressData.street
var city as addressData.city
var state_province as addressData.state_province
var country as addressData.country
var postal_code as addressData.postalcode
}
}
}