Kuali Rice Bootcamp: Hands-On Exercises Colorado State University, January , 2008 Aaron Godert - Cornell University Rice Development Manager
Environment Set Up
Eclipse Overview Maven2 How we build - POMs Our standard project structure M2 repository Subervsion/CVS Checking out code Syncing Standard practices before committing code
Eclipse Overview Continued Useful features and tools in Eclipse Refactoring Code completion Ctrl+Shift+R Ctrl+Shift+T Organize imports Adding Javadocs Code generation - getters/setters, implements/overrides
The Recipes Application A simple system for maintaining recipes and categories that they fit into Run the web application STOP! Team Review
The Data Model Two Entities (Business Objects) Recipe Recipe Category Two Tables (DB Tables) RECIPES_T RECIPES_CATEGORIES_T
Exercise 1: Review the DB Tables Open recipes_db_bootstrap.sql in Eclipse
Exercise 2: Review the Business Objects Open the Java files in package edu.sampleu.recipe.bo.*
How These Link Together We use an ORM (Object Relational Mapper) called Apache OJB XML files combined with a set of Apache Java libraries that automatically persist data in our business objects to our DB Soon to be replaced by JPA - a Java standard No more XML, use annotations in Java code instead
Exercise 3: An OJB Example Open repository.xml in Eclipse and look at the mapping for RecipeCategory
Exercise 4: What JPA Will public class RecipeCategory extends PersistableBusinessObjectBase private Long id; private String name; //note this annotation is not required if column name matches attribute private String description; … }
Exercise 5: Recipe OJB Mapping Open repository.xml Open recipes_db_bootstrap.sql Open Recipe.java
Unit Testing We use JUnit for unit and integration testing We are starting to use HtmlUnit for web UI testing Automated tests that are programmed Run by our CI environment: Bamboo
Exercise 6: Testing Your OJB Mapping We can use JUnit to test our OJB mapping and the persistence of data between our Bos and DB tables Open RecipeDaoTest class Right click RecipeDaoTest class --> Run --> Run as JUnit Test STOP! Team Coding Exercise When ready, re-run the unit test
Leveraging the KNS Well use the KNS to provide search and detail information on categories and recipes Search = Lookup Detail Info = Inquiry Well use the KNS to provide maintenance CRUD operations with workflow backing them CRUD = Maintenance Documents
Exercise 7: Review RecipeCategory DD We use something called the Data Dictionary (DD) to construct our lookups, inquiries, and maintenance documents Open RecipeCategory.xml - this is the business object DD file Lookups Inquiries Open RecipeCategoryMaintenanceDocument.xml - this is the maintenance document XML CRUD, Workflow, Authz Run the web app to correlate DD to functionality
Exercise 8: Create Recipe DD Files Copy and rename RecipeCategory.xml to Recipe.xml Copy and rename RecipeCategoryMaintenanceDocument.xml to RecipeMaintenanceDocument.xml Open RecipesWorkflowBootstrap.xml Open recipes_db_bootstrap.sql STOP! Team Exercise When ready, run the web application
Exercise 9: Tweaking a Lookup Open RecipeCategory.xml Remove id from the lookup fields Restart the application
Exercise 10: Tweaking a Maint. Doc. Open RecipeMaintenanceDocument.xml Lets only have one section, so move the content from the details section and put it into the info section Remove the details section Restart the application
Exercise 11: Changing Initiation Authz Open RecipeCategoryMaintenance.xml Change the authorization workgroup from WorkflowAdmin to kualiUniversalGroup Restart the application; note you can only create a Recipe Category if you are now an admin
Exercise 12: Add Custom Rule Checks Open the RecipeRules class Open RecipeMaintenanceDocument.xml We want to check to see if any of the ingredients is beef, then we need to make sure that the beef category is chosen STOP! Team Exercise When ready, run the web application
Leveraging KEW We use KEW for workflow functionality and configuration Apply workflow rules to documents Alter workflow processing chains Call external services to make workflow decisions for us Leverage workflow for limited business process orchestration
Exercise 13: Adding a Group Approval Make use of the NamedRuleSelector - template- less rules Open RecipesWorkflowBootstrap.xml Open RecipesUsersWorkgroupsBootstrap.xml We want any Recipe Category changes to be approved by the RecipeMasters workgroup STOP! Team Exercise Restart application when changes have been made
Exercise 14: Routing on Document Data Make use of embedded Groovy scripting in routing rules Look at document data and route to a new group Chicken Recipe Masters if any of the ingredients are chicken Open RecipeUtils class Open RecipesWorkflowBootstrap.xml Open RecipesUsersWorkgroupsBootstrap.xml STOP! Team Exercise Restart application when changes have been made
Leveraging KEN We use KEN for notifications Extension of KEW Notification List = Action List Can subscribe to notification channels
Exercise 15: Creating a New Channel Open recipes_db_bootstrap.sql Review the SQL starting with -- KEN sample data -- This was already created for us when the DB was loaded, were just reviewing Start the application, go to the Kuali Enterprise Notification link STOP! Team Exercise
Exercise 16: Sending a Notification Manually via form - click the Send Simple Notification link STOP! Team Exercise
Exercise 17: Subscribing to a Channel Click on the Channel Subscriptions link STOP! Team Exercise
Exercise 18: Programmatic Notifications Send programmatically as an XML request, via the NotificationService, within the KEW Post-processor Open RecipesPostProcessor class Open RecipeMaintenanceDocument.xml STOP! Team Exercise Restart the application after changes have been made
Leveraging KSB Inter-application communications Allows services to be invoked via several different protocols Helps to create an SOA based system
Exercise 19: Creating a Service A new Magazine System manages magazines and needs to provide a service to show all managed magazines If any of those magazines are used in a recipe, a workgroup approval will need to be made by the Magazine Managers group Open MagazineService class Open MagazineServiceImpl class Open SpringBeans.xml STOP! Team Exercise
Exercise 20: Exposing a Service on KSB Open SpringBeans.xml - go to Rice Configurer section Open MagazineServiceTest class STOP! Team Exercise
Exercise 21: Invoking a Service in KEW Well invoke the service we just created as SOAP over the bus, to base routing off of it Open RecipesWorkflowBootstrap.xml Open RecipeUtils class Open RecipeUsersWorkgroupsBootstrap.xml STOP! Team Exercise