|
definition: |
generateRoutesForERD :: ERD -> CurryProg
generateRoutesForERD (ERD _ entities _) =
let spiceySysCtrl = "Controller.SpiceySystem" in
simpleCurryProg
mappingModuleName
([spiceyModule, "System.Routes", spiceySysCtrl, dataModuleName] ++
(map (\e -> controllerModuleName (entityName e)) entities)) -- imports
[] -- typedecls
[
stCmtFunc
("Maps the controllers associated to URLs in module RoutesData\n"++
"into the actual controller operations.")
(mappingModuleName, "getController")
1
Public
(baseType (mappingModuleName, "ControllerReference") ~> controllerType)
[simpleRule [CPVar (1, "fktref")]
(CCase CRigid (CVar (1, "fktref"))
( [cBranch (CPComb (dataModuleName, "ProcessListController") [])
(constF (spiceySysCtrl, "processListController")),
cBranch (CPComb (dataModuleName, "LoginController") [])
(constF (spiceySysCtrl, "loginController"))] ++
map branchesForEntity entities ++
[cBranch (CPVar (2,"_"))
(applyF (spiceyModule, "displayError")
[string2ac "getController: no mapping found"])]
)
)]
] -- functions
[] -- opdecls
|
|
demand: |
argument 1 |
|
deterministic: |
deterministic operation |
|
failfree: |
_ |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{({ERD}) |-> {CurryProg}}
|
|
name: |
generateRoutesForERD |
|
precedence: |
no precedence defined |
|
result-values: |
{CurryProg}
|
|
signature: |
Database.ERD.ERD -> AbstractCurry.Types.CurryProg |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
yes |
|
totally-defined: |
reducible on all ground data terms |