My favorites | Sign in
Project Home Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Initialises the necessary contents {@model Session}s, including the {@event onInit} {@model Event}.
*/
package org.openiaml.model.drools.rules.sessions

#list any import classes here.
import org.openiaml.model.drools.*;

import org.openiaml.model.inference.*;
import org.openiaml.model.model.*;
import org.openiaml.model.model.impl.*;
import org.openiaml.model.model.wires.*;
import org.openiaml.model.model.visual.*;
import org.openiaml.model.model.operations.*;
import org.openiaml.model.model.scopes.*;
import org.openiaml.model.model.components.*;

#declare any global variables here
global OverridableCreateElementsHelper handler;
global DroolsInsertionQueue queue;
global DroolsHelperFunctions functions;

/**
* @inference Scope,Event
* {@model Scope}s have an {@model Event} named {@model Scope#onInit}.
*/
rule "Create 'init' event for Sessions"
when
session : Scope( )
not (event : Event( eContainer == session, session.onInit == event ))

eval ( handler.veto( session ))

then
Event event = handler.generatedEventOnInit(session, session);
queue.add(event, drools);

end

/**
* If a Session contains an Operation, but not a Frame, then the target Operation
* can never be called. Consequently, we add a new Frame to all empty Sessions
* to permit these Operations to be called.
*
* <p>TODO This should NOT be put as part of the inference rules, but rather the
* code generation logic - however, this is a quicker hack ;)
*
* @inference Session
* A {@model Session} will contain at least a single {@model Frame}.
*/
rule "Create an empty Frame for an empty Session, for Operation callbacks"
when
session : Session( )
not ( Frame ( eContainer == session) )

eval ( handler.veto( session ))

then
Frame frame = handler.generatedFrame(session, session);
handler.setName(frame, "Empty frame for session");
queue.add(frame, drools);

end

Change log

r3149 by soundasleep on Oct 13, 2011   Diff
improving model completion rule
documentation for Event, BuiltinOperation,
BuiltinProperty
Email.onFailure and Email.onSent were not
being generated automatically
Go to: 
Project members, sign in to write a code review

Older revisions

r3147 by soundasleep on Oct 6, 2011   Diff
cleaning up Drools rule package
documentation
r2950 by soundasleep on May 22, 2011   Diff
 issue 240 : updating more rule packages
with inference modeldoc
r2833 by soundasleep on May 6, 2011   Diff
 issue 244 : updating inference rules
All revisions of this file

File info

Size: 1969 bytes, 63 lines
Powered by Google Project Hosting