Example
This example illustrates the use of Event Type (FSCFOLIO@1.1001:HistoryEventType) and Log an event to objects history (FSCFOLIO@1.1001:LogHistoryEvent).
In this example a new history entry is created when a trip is added to a logbook.
instances.ducx-om |
---|
objmodel FSCLOGBOOK@111.100 { /** * Event type for recorded trips */ instance HistoryEventType ET_NewTrip { symbol = SymbolRecordTrip; hetdescription = {} hetsingletext = {} hetmultipletext = {} hetpersist = false; hetrequiredetails = false; broadercompterms = { EC_DriversLogbook } } /** * Category for event types of driver's logbook */ instance HistoryEventType EC_DriversLogbook { symbol = SymbolLogbook; narrowercompterms = { ET_NewTrip } broadercompterms = { EC_Root } } // Add category "EC_DriversLogbook" to the root of event categories "EC_Root" extend instance EC_Root { narrowercompterms = { EC_DriversLogbook } } // Define default values for event type "ET_NewTrip" extend instance DefaultConfig { cfgnotificationsettings<notsettingstype, component, notsettingsnotification, notsettingsmail, notsettingsrss> = { { ET_NewTrip, FSCLOGBOOK@111.100, true, true, true } } } } |
usecases.ducx-uc |
---|
usecases FSCLOGBOOK@111.100 { /** * Record a new trip in a trip log */ RecordTrip(Trip trip) { variant TripLog { impl = expression { cooobj.ObjectLock(true, true); /* * Add trip to trip list */ cooobj.trltrips += trip; /* * Log the recording of a trip in the history */ cooobj.LogHistoryEvent(#ET_NewTrip, null, null, null, null, null, null, null, null, [cooobj.Escape(trip.trpdepartureplace,true), cooobj.Escape(trip.trpdestinationplace,true)]); } } } } |