CurryInfo: spicey-4.2.0 / Spicey.ControllerGeneration.destroyController

definition: Info
 
destroyController :: ControllerGenerator
destroyController erdname (Entity entityName _) _ _ =
  let entlc  = lowerFirst entityName  -- entity name in lowercase
      entvar = (0, entlc)             -- entity parameter for controller
      listEntityURL = '?' : entityName ++ "/list"
  in
  controllerFunction
  ("Deletes a given " ++ entityName ++ " entity\n" ++
   "and proceeds with the list controller.")
  entityName "destroy" 1
  (baseType (model erdname, entityName) ~> controllerType)
  [simpleRule [CPVar entvar]
    (applyF (pre "$")
       [applyF checkAuthorizationFunc
         [applyF (enauthModName,entlc++"OperationAllowed")
                 [applyF (authorizationModule,"DeleteEntity") [CVar entvar]]],
        CLambda [CPVar (0,"_")] $
         applyF (spiceyModule,"transactionController")
            [applyF (model erdname,"runT")
                    [applyF (transFunctionName entityName "delete")
                            [CVar entvar]],
             applyF (pre "const")
               [doExpr
                  [CSExpr $ applyF (spiceyModule,"setPageMessage")
                                   [string2ac $ entityName ++ " deleted"],
                   CSExpr $ applyF (spiceyModule,"redirectController")
                                   [applyF (spiceyModule,"listRoute")
                                           [CVar entvar]]]]]])]
demand: Info
 argument 2
deterministic: Info
 deterministic operation
documentation: Info
 
Generates controller to delete an entity.
failfree: Info
 (_, _, _, _)
indeterministic: Info
 referentially transparent operation
infix: Info
 no fixity defined
iotype: Info
 {(_,{Entity},_,_) |-> _}
name: Info
 destroyController
precedence: Info
 no precedence defined
result-values: Info
 _
signature: Info
 String -> Database.ERD.Entity -> [Database.ERD.Relationship]
-> [Database.ERD.Entity] -> AbstractCurry.Types.CFuncDecl
solution-complete: Info
 operation might suspend on free variables
terminating: Info
 possibly non-terminating
totally-defined: Info
 possibly non-reducible on same data term