kra developers bootcamp

30
KRA Developers Bootcamp Terry Durkin - IU (Development Manager/Lead Developer) Bryan Hutchinson - Cornell (Development Manager/Lead Developer)

Upload: ophrah

Post on 14-Jan-2016

38 views

Category:

Documents


0 download

DESCRIPTION

KRA Developers Bootcamp. Terry Durkin - IU (Development Manager/Lead Developer) Bryan Hutchinson - Cornell (Development Manager/Lead Developer). About KRA. Six partner schools Cornell, Indiana, Michigan State, MIT, Arizona, CSU Based on a MITs Coeus Full Featured Research Admin suite - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: KRA Developers Bootcamp

KRA Developers Bootcamp

Terry Durkin - IU

(Development Manager/Lead Developer)

Bryan Hutchinson - Cornell

(Development Manager/Lead Developer)

Page 2: KRA Developers Bootcamp

About KRA

• Six partner schools– Cornell, Indiana, Michigan State, MIT,

Arizona, CSU

• Based on a MITs Coeus– Full Featured Research Admin suite– 12+ years of development work– Still going!– Consortium model

Page 3: KRA Developers Bootcamp

More About KRA

• First Release - July 2008– Proposal Development– Budget– Grants.gov S2S

• Second Release - 2009– Awards– IRB/Human Participants– …

• Beyond– Functional Parity with Coeus

Page 4: KRA Developers Bootcamp

How Bootcamp Works

• High-level Overview of Concepts• Discussion based on slides• Exercises

– Sample Application mimicking KRA functionality

• Ask questions any time!• Be engaged - You will get out what you

put in!

Page 5: KRA Developers Bootcamp

Day 1 - Documents and BOs

• Kuali is “Document based”

• Two Types of Documents– Transactional Documents– Maintenance Documents

Page 6: KRA Developers Bootcamp

Transactional Documents

• Represent a business function– Apply for funds (by creating a proposal)– Manage Human Participants (by creating a protocol,

amendment, etc…)

• Complex rules and approval process• Lots of data• Potentially long living• Focus on Transactional Documents later in the

week

Page 7: KRA Developers Bootcamp

Maintenance Documents

• Manage (create/alter) Reference Data

• What is “reference data”– In DB terms, it’s a table used by the entire

system as a FK from other tables– People, Organizations, Units, Sponsors, etc…– What else would be reference data?

• Simple documents to perform CRUD operations

Page 8: KRA Developers Bootcamp

Business Objects

• Business Objects (BOs) are Java Beans– Properties– Getters/Setters

• Two categories– Reference Data (CRUD via Maint Docs)– Those used in Transactional Documents

(Document Composition)

• Map to a single table in the DB

Page 9: KRA Developers Bootcamp

Database

• Kuali uses OJB as an ORM tool– OJB - ObJectRelationalBridge– ORM - Object-Relational Mapping

• Configure

• Write Java Code (not SQL)

• Related data elements are stored together

• Model complex database relationships

Page 10: KRA Developers Bootcamp

Using OJB

• OJB Repository XML• Class Descriptor

– Define the Java Class and the Table Name

• Field Descriptor– Java Property Name– Column Name– JDBC Type– Conversion (boolean to char, custom datatypes, etc…)– Primary Key– Optimistic Locking

Page 11: KRA Developers Bootcamp

OJB - Getting more advanced

• Model Relationships– Collection Descriptor– Reference Descriptor

• More on these later in the week.

Page 12: KRA Developers Bootcamp

Data Dictionary (DD)

• Controls the behavior of Bos

• Defined in XML - <BO Class Name>.xml– Inquiries– Lookups– Attributes - Properties of the BO

• UI Controls - Lookups, Maint Docs, Trans Docs• Size & Shape Validation• Required-ness

Page 13: KRA Developers Bootcamp

OJB - repository.xml

• Reference Descriptor– Relationships to Reference data– 1:1 (Proposal:Sponsor)– Not saved/deleted when the related object is saved

• Collection Descriptor– Relationships where a parent can have many children– 1:M (Proposal:Investigators; Investigator:Unit)– “Reverse Foreign Key”– Save with the Parent

Page 14: KRA Developers Bootcamp

Maintenance Docs

• How we manage Reference Bos• XML based:

<BO Class Name>MaintenanceDocument.xml

– BO Class– Maintainable Class - API for customization– Business Rules - API to perform validation– Document Authorizer - Customize AuthZ for a doc– Document Type - Reference to KEW– Maintainable Section(s) and Item(s) - what and how

attributes are presented – Attributes, Locking Key, Default Existence Checks…

Page 15: KRA Developers Bootcamp

Values Finders

• User to present a list of options in the UI– Drop-down– Radio Group

• Queries the database and returns a list of valid values

• PersistableBusinessObjectsCaluesFinder– 80% - BO Class, Key/Label Attributes Names

• Custom Values Finders – 20% - Extend KeyValuesBase, Implement

KeyValuesFinder

• XML (DD) and Code (Class file)

Page 16: KRA Developers Bootcamp

Transactional Documents

• Composed of a Document class and multiple BOs– Document Composition BOs have a reference

to the Document class/table (FK Relationship)

• Transactional Document classes are special BOs– Super BOs with additional behavior

Page 17: KRA Developers Bootcamp

Transactional Document

• Similar to Maint Doc DD files– Add Attributes (since these are BOs)– No lookups (we use KEW for Doc Search)– No Inquiries

• Similar to other OJB mappings– Lots of relationships defined– Other mappings should not refer back to the

Document class

Page 18: KRA Developers Bootcamp

Web stuff in Kuali/KRA

• Struts– Pseudo MVC– Forms, Actions, Mappings

• Struts in Kuali– Heavily customized– Addresses common Struts anti-patterns– Simplifies development

• Single Action Mapping

Page 19: KRA Developers Bootcamp

Struts Action Classes

Object Hierarchy for KRA:

-KraTransactionalDocument

----KualiTransactionalDocumentBase

------KualiDocumentActionBase

--------KualiAction

----------DispatchAction

Page 20: KRA Developers Bootcamp

Struts Form Classes

• Document is placed in the Form• POJO Form Base handles type conversion • Object Hierarchy for KRA:

-ProposalDevelopmentForm----KualiTransactionalDocumentFormBase------KualiDocumentFormBase--------KualiForm----------PojoFormBase------------ActionForm (Struts base form)

Page 21: KRA Developers Bootcamp

Building the UI

• JSPs/Custom Tags

• JSTL and JSP Expression Language– Preferable to Struts tags when possible

• Kuali Rice Tags– page.tag and documentPage.tag– tab.tag– documentControls.tag

Page 22: KRA Developers Bootcamp

KRA Custom Tags

• Build complex JSPs

• Maintainability

• Methodology is approximate, but in general:– 1 JSP per page– 1 .tag per panel on the page

Page 23: KRA Developers Bootcamp

HTMLControlAttribute.tag

• <kul:htmlControlAttribute />

• Replaces struts <html:xxx />

• Uses Data Dictionary entries to determine:– Type of control (text, drop-down, etc)– Length– Max Length

• DD Attributes

Page 24: KRA Developers Bootcamp

Lists of Data

• Old stuff– OJB, BOs, DD, etc

• New stuff– Document changes

• Special getter• Deletion Aware Lists

– Action Form - Methods for add/delete– JSP/tag - Accessing properties of a list

Page 25: KRA Developers Bootcamp

Services and DAOs• Services are where Business Logic occurs

– Perform a calculation; Save a Document

• Services are defined as Interfaces and Implemented as classes

• Spring manages the resolution of Interface to actual code - Spring Beans XML

• Accessing Services– Dependency Injection– Service Locator (KraServiceLocator)

• Data Access Objects - DAOs– Similar to Services, but have knowledge of the data model

Page 26: KRA Developers Bootcamp

Rules and Events

• Events - A way to evaluate a rule when an action occurs– Automatically invoked via frameworks (Save,

Route, etc…)– Custom events (add or delete a BO from a

list)

Page 27: KRA Developers Bootcamp

Rules

• Beyond size & shape validation from the DD

• DocumentRuleBase - Customize save/route/etc… rules

• Custom Rules - Implemented in Rules classes; Validate pretty much anything about the document; Return true/false

Page 28: KRA Developers Bootcamp

Error Messages

• Give context to errors– Display error messages on the appropriate

panel– Highlight fields that have errors

• Generated from DD

• Generated from Rules classes

Page 29: KRA Developers Bootcamp

Audit Errors

• Similar to Error Messages

• Allows users to continue working on their document and defer validation until ready

• Errors and Warnings

• Provides a link to where the error is occurring

Page 30: KRA Developers Bootcamp

Document Authorizer

• Determine the level of access that a user has to the document– Read Only– Full Access– Somewhere in between

• Document Actions– What actions can a user take on a document– Implemented in JSPs via <kul:documentControls />

• Who can initiate a document