def orderHook(t, attrs): products = ["bottles", "boxes", "equipment"] attrs["product"] = products[random.randint(0, len(products)-1)] customers = ["A", "B", "C"] clientTypes = ["consolidate", "new"] salesmanagers = ["Marc", "Johann", "Mary"] financialOfficiers = ["Alexander" , "Robert", "Mario"] warehousemen = ["Alex"] orderResults = ["positive", "negative"] attrs["customer"] = customers[random.randint(0, len(customers)-1)] users = ["U1", "U2", "U3"] attrs["user"] = users[random.randint(0, len(users)-1)] attrs["amount"] = random.randint(0, 1000) attrs["clientType"] = clientTypes[random.randint(0, len(clientTypes)-1)] attrs["salesmanager"] = salesmanagers[random.randint(0, len(salesmanagers) -1)] attrs["financialOfficier"] = financialOfficiers[random.randint(0, len(financialOfficiers)-1)] attrs["warehouseman"] = warehousemen[random.randint(0, len(warehousemen)-1)] attrs["orderResult"] = orderResults[random.randint(0, len(orderResults)-1)] t0, t1 = defaultActivityHook(t, attrs) return t0,t1
def ConfermaHook(t, attrs ): giorni = ["lun", "mart", "merc", "giov", "ven", "sab", "dom" ] giorno = giorni[random.randint(0, len(giorni)-1)] attrs["giorno"] = giorno t0, t1 = defaultActivityHook(t, attrs) return t0,t1
def prenotaHook(t, attrs ): dests = ["Francia", "Germania", "Grecia", "Marocco"] dest = dests[random.randint(0, len(dests)-1)] attrs["dest"] = dest t0, t1 = defaultActivityHook(t, attrs) return t0,t1
def notifyHook(t, attrs): # Urgente = ["Yes", "No"] # Urgente = [True, False] # Urgente = [0, 1] Urgente = [0.0, 1.0] urg = Urgente[random.randint(0, len(Urgente)-1)] attrs["urg"] = urg t0, t1 = defaultActivityHook(t, attrs) return t0,t1
def startHook(t, attrs): cittadinanza = ["Eu", "ExtraEu"] citt = cittadinanza[random.randint(0, len(cittadinanza)-1)] attrs["citt"] = citt tipi = ["Bar", "Farmacia", "AntennaUMTS"] tipo = tipi[random.randint(0, len(tipi)-1)] attrs["tipo"] = tipo t0, t1, a = defaultActivityHook(t, attrs) return t0,t1, ["citt", "tipo"]
def orderHook(t, attrs): products = ["bottles", "boxes", "equipment"] attrs["product"] = products[random.randint(0, len(products)-1)] customers = ["A", "B", "C"] attrs["customer"] = customers[random.randint(0, len(customers)-1)] users = ["U1", "U2", "U3"] attrs["user"] = users[random.randint(0, len(users)-1)] attrs["amount"] = random.randint(0, 1000) t0, t1 = defaultActivityHook(t, attrs) return t0,t1
def externalHook(t, attrs): t0, t1 = defaultActivityHook(t, attrs) min_t = 0.5 if attrs["user"] == "U1" else \ 1.0 max_t = 1.0 if attrs["user"] == "U2" else \ 3.0 ratio = 1 if attrs["amount"] < 500 else \ 2 min_t *= ratio max_t *= ratio delta1 = random.randint(min_t * 60*60, max_t * 60*60) return t0, t1 + delta1
def warehouseHook(t, attrs): t0, t1 = defaultActivityHook(t, attrs) min_t = 0.5 if attrs["product"] == "boxes" else \ 1.0 max_t = 1.0 if attrs["product"] == "boxes" else \ 3.0 ratio = 1 if attrs["amount"] < 700 else \ 2 min_t *= ratio max_t *= ratio delta1 = random.randint(min_t * 60*60, max_t * 60*60) return t0, t1 + delta1
def financialHook(t, attrs): t0, t1 = defaultActivityHook(t, attrs) min_t = 0.5 if attrs["customer"] == "A" or attrs["customer"] == "B" else \ 1.0 max_t = 1.0 if attrs["customer"] == "A" or attrs["customer"] == "B" else \ 3.0 ratio = 1 if attrs["amount"] < 300 else \ 2 if attrs["amount"] < 700 else \ 3 min_t *= ratio max_t *= ratio delta1 = random.randint(min_t * 60*60, max_t * 60*60) return t0, t1 + delta1
def notifyHook(t, attrs): #Urgente = ["Yes", "No"] # Urgente = [True, False] # Urgente = [0, 1] # Urgente = [0.0, 1.0] #urg = Urgente[random.randint(0, len(Urgente)-1)] #attrs["urg"] = urg cittadinanza = ["Eu", "ExtraEu"] citt = cittadinanza[random.randint(0, len(cittadinanza)-1)] attrs["citt"] = citt dests = ["Italy", "UK", "USA", "Spain"] dest = dests[random.randint(0, len(dests)-1)] attrs["dest"] = dest attrs["age"] = random.randint(1, 80) t0, t1 = defaultActivityHook(t, attrs) return t0,t1