********************************************************************************
	Instructions for how to use this BRMS/Guvnor sample repository.   
********************************************************************************

This shows a very basic sample repository with validation and pricing rules for mortgages. 
It has a very simple client app that shows how the agent is configured and used. It also uses non pojo declared facts.


Step 1: Get a jboss AS instance
Step 2: Deploy drools-guvnor.war (ideally unzip it into a folder called drools-guvnor.war - for reasons you will see later). 
Step 3: Startup app server and browse to http://localhost:8080/drools-guvnor (log in as any user name you like). 
Step 4: Go to Administration/Import Export section, and select the mortgage-sample-repository.xml - import and REFRESH BROWSER
Step 5: You should see the repository with rules/categories and a package called "mortgages".  
Step 6: Go to the package menu and click "rebuild all packages" - this is needed if its a new version of drools. Do the same for snapshots. 
Step 7: You can then run the tests that are scenarios as needed !

* Setting up the client app *
Step 8: Import the mortgage-client app (its an eclipse project) into eclipse IDE (or other IDE)
Step 9: Browse to the war "directory" (exploded war) and grab drools-api, drools-core and mvel jars (just the 3) from WEB-INF/lib and place them in the LIB directory of that project. 
(this step is necessary to make sure that the version of the runtime that the client has is the same as the one in the BRMS). 
Step 10: open mortgageapproval.properties in the project: make sure it points to your BRMS server address (this is the agent config file)
Step 11: you can execute the "client" ! Note how it uses declared facts. 


* Setting up a business user view *
Step 12: In Guvnor, go to Administration/User permissions and mappings. Create a new user called "admin" which has admin permissions
Step 13: In the same UI, create a new user called "BA" and give them ONLY analyst or analyst.readonly permissions to some categories (eg pricing category only)
Step 14: Stop the app server, open the components.xml in the WEB-INF directory of drools-guvnor.war, and set permission to true:

<security:role-based-permission-resolver enable-role-based-authorization="true"/>

Step 15: restart app server

You will now have 2 users, admin which sees everything, and a "BA" user, which can only see what you choose to show to them.  
