Wednesday, September 22, 2010

Got my T-Shirt & Cetificates :-)


What a wonderful day!

Thanks Google!!! Thanks OpenMRS!!!

Friday, August 20, 2010

Tuesday, August 10, 2010

August 9th

Got patch for HTML-57 and ticket 2087 committed to trunk!!!
Will summary this wonderful experience soon!

Friday, July 23, 2010

July 23th

submitted patch for #2087
start working on #HTML-57

Monday, July 19, 2010

July 17th

Finish the first patch for #2087, the second task of my GSOC project

Sunday, July 11, 2010

July 7th.

Provide a patch on adding support to get concept by mapping/by uuid to htmlFormEntry Module

Friday, July 2, 2010

July 02

bug fixes/function renaming/ after the first code review

Wednesday, June 16, 2010

update June 16th:

finished the ticket #1318's implementation.

Tuesday, June 1, 2010

Plan to crush #1318 part 1) form display/preview

Step 1:
add newrepeat tag handler
name the html control well


Friday, May 28, 2010

Plan to crush #1318

Goal: Get a new repeat tag working, the new repeat tag should incorporate jquery with the formentry module

Sub Goal:
1) Get new repeat tag display functioning
the general move is use jquery to clone and insert the new row of html control , to work this out,
we need to consider how to copy and insert all html controls with in a repeat tag


2)Get new repeat tag submit functioning
the module use a hashmap to store the {widget : htmlcontrol} name pair. The problem is when a new html controller has been generated by jquery/javascript, the module has no way to know about their existence.

The possible flow:

Form Creation
1) user edit a form, a tag

2)user submit/save/edit the form

Form Preview()
the html form is generated by createForm in formentrysession
we can handle the tag in line 247: applyTags function
The applyTagsHelper will do the job.
so
1) add a entry in the applicationContext.xml to relate with a handler
2)Create a new handler

the handler is used for generate required jquery/html for the newrepeat tag

input:

< newrepeat >
< template >
< obs conceptid = "123" >
< /template >
< /newrepeat >

Output(Mode = view):

< script .... the javascript/jquery to clone and insert the template >
< span ... the template html generated based on concept with id="123" >
....
< /span >

< span ... 1 generated html on concept with id="123" >
....
< /span >

Form Enter
To handle new repeat tag enter(save), 2 things needs to be done:
1) mapping a repeated widget with a htmlid

input Original:

< newrepeat >
< template >
< obs conceptid = "123" >
< /template >
< /newrepeat >

input intermidate:


Output(Mode = edit):

< script .... the javascript/jquery to clone and insert the template >
< span any exsiting obs that are associated with this encounter >
...
< /span >
< span ... the template html generated based on concept with id="123" >
....
< /span >

< span ... 1 generated html on concept with id="123" >
....
< /span >

Output(Mode = input):

< script .... the javascript/jquery to clone and insert the template >
< span ... the template html generated based on concept with id="123" >
....
< /span >

< span ... 1 generated html on concept with id="123" >
....
< /span >

Saturday, May 22, 2010

HTML Widget Model, the work flow

1) HTML Widget flow

a) jsp parser encounter a custom tag in a jsp page, i.e. <>

b) trace back based on the tld <>, found the definition in
"/WEB-INF/view/module/htmlwidgets/resources/htmlwidgets.tld"

c) the tag class in the tld file will lead to
org.openmrs.module.htmlwidgets.web.taglib.WidgetTag

c1) WidgetTag class has properties named : name, object, property
this will populated by the attributes of the same name based on demonstration.jsp:
the known attributes are:
id="defaultField${p.key}" // represents the id of the input field
name="${p.key}" // represents the name of the input field
object="${demo}" // represents the object whose property are editing
property="${p.key}" // represents the name of the property/field to edit
// on the object

d) in WidgetTag, the actual widget type will be figured out by reflection, then associate the tag with a Taghandle class.

g) TagHandle itself is a abstract class,openmrs has a ulti method to match a subclass according to the actual type of the tag.
This method works like this:
it will call openmrs api to return a list of loaded spring beans.
if a bean has a annotation and matches the type. it should be returned

f) why handler classes are treated as beans?
In ApplicationContext-Service. we see a line
< package="org.openmrs"> < type="annotation" expression="org.openmrs.annotation.Handler">

... < /context:include-filter>

This line will let spring to include any class which has a @handler annotation and load them as beans into spring Context(finally figure it out, phew~~) when refreshing the context.


Monday, May 17, 2010

Good Resources for Spring MVC3

1) official doc 3.x
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html

2) InfoQ doc 2.5
http://www.infoq.com/articles/spring-2.5-ii-spring-mvc

3) About 3.x REST style conversion
http://blog.m1key.me/2010/01/rest-with-spring-30-spring-mvc-and-dojo.html

Summary May 17th

1) a machine for future demonstration

http://columbia.cs.uga.edu:8381/

2) a simple application that using spring MVC3

http://columbia.cs.uga.edu:8381/MyFirstSpringMVC3/

Next, start learning jquery

Tuesday, May 4, 2010

Weekly Summary May 04

Last week tasks:
1)Communicate with mentor.
2)Reading module source code
3)study the overview
http://openmrs.org/wiki/HTML_Form_Entry_Module_Technical_Overview

Tuesday, April 27, 2010

Thursday, April 8, 2010

jQuery

to be added

Sunday, April 4, 2010

Spring Annotation

good examples:

1)http://stackoverflow.com/questions/803495/annotations-in-spring-mvc

2)http://svn.openmrs.org/openmrs-modules/devexamples/

Friday, April 2, 2010

Openmrs workflow (1)where to find

1) based on the the suffix of the target, find the fliter from Web.xml
example:
target:module.list
step 1)
in web.xml:

openmrs
*.list

step 2)
now come to the openmrs-servlet.xml:
moduleListController

step 3)
in the same file, we find:
class="org.openmrs.module.web.controller.ModuleListController">
moduleList
/admin/modules/moduleList
module.list

then we know the target servlet.

Thursday, April 1, 2010

Learning OpenMrs Project, Source code(4)

1)org.openmrs.web.filter
Gzip filter/startup filter/session filter

2)org.openmrs.web.filter.initialization
the setup wizard and webpage templates

3)org.openmrs.web.filter.startuperror/update
update liquibase

4)org.openmrs.web.servlet
servlet for login/out graph summary

5)org.openmrs.web.taglib.*
tags, for customized view

6)org.openmrs.web.user
for user property

Wednesday, March 31, 2010

Spring MVC(3) AOP advicer

http://www.javalobby.org/java/forums/t44746.html

Spring MVC(2) Property Editor

From http://www.shaunabram.com/data-binding-in-spring-mvc/
Spring MVC allows the use of command objects (aka form backing objects, model attributes, domain model objects – basically the objects used to transport data between your view and your controller) using just about any type. However, the Servlet API deals with form parameters as Strings. Spring uses a technique called data binding to covert between the String representation and the real underlying type. This enables user input to be bound to the objects you use to process user input. In other words, the values entered by a user in a form can be used to set the property values on a chosen object.

Spring MVC(1) basic controller work flow

1)DispatcherServlet: the main servlet
org.openmrs.web

2)Controllers
SimpleFormController

Workflow from: http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/web/portlet/mvc/AbstractFormController.html#workflow

1)The controller receives a request for a new form (typically a Render Request only). The render phase will proceed to display the form as follows.

2)Call to formBackingObject() which by default, returns an instance of the commandClass that has been configured (see the properties the superclass exposes), but can also be overridden to e.g. retrieve an object from the database (that needs to be modified using the form).

3) Call to initBinder() which allows you to register custom editors for certain fields (often properties of non- primitive or non-String types) of the command class. This will render appropriate Strings for those property values, e.g. locale-specific date strings.

4)The PortletRequestDataBinder gets applied to populate the new form object with initial request parameters and the onBindOnNewForm(RenderRequest, Object, BindException) callback method is invoked. (only if bindOnNewForm is set to true) Make sure that the initial parameters do not include the parameter that indicates a form submission has occurred.

5)Call to showForm to return a View that should be rendered (typically the view that renders the form). This method has to be implemented in subclasses.

6)The showForm() implementation will call referenceData, which you can implement to provide any relevant reference data you might need when editing a form (e.g. a List of Locale objects you're going to let the user select one from).

7)Model gets exposed and view gets rendered, to let the user fill in the form.

8)The controller receives a form submission (typically an Action Request). To use a different way of detecting a form submission, override the isFormSubmission method. The action phase will proceed to process the form submission as follows.

9)If sessionForm is not set, formBackingObject is called to retrieve a form object. Otherwise, the controller tries to find the command object which is already bound in the session. If it cannot find the object, the action phase does a call to handleInvalidSubmit which - by default - tries to create a new form object and resubmit the form. It then sets a render parameter that will indicate to the render phase that this was an invalid submit.

10)Still in the action phase of a valid submit, the PortletRequestDataBinder gets applied to populate the form object with current request parameters.

11)Call to onBind(PortletRequest, Object, Errors) which allows you to do custom processing after binding but before validation (e.g. to manually bind request parameters to bean properties, to be seen by the Validator).

12)If validateOnBinding is set, a registered Validator will be invoked. The Validator will check the form object properties, and register corresponding errors via the given Errors object.

13)Call to onBindAndValidate which allows you to do custom processing after binding and validation (e.g. to manually bind request parameters, and to validate them outside a Validator).

14)Call to processFormSubmission to process the submission, with or without binding errors. This method has to be implemented in subclasses and will be called only once per form submission.

15)The portal will then call the render phase of processing the form submission. This phase will be called repeatedly by the portal every time the page is refreshed. All processing here should take this into account. Any one-time-only actions (such as modifying a database) must be done in the action phase.

16)If the action phase indicated this is an invalid submit, the render phase calls renderInvalidSubmit which – also by default – will render the results of the resubmitted form. Be sure to override both handleInvalidSubmit and renderInvalidSubmit if you want to change this overall behavior.

17)Finally, call renderFormSubmission to render the results of the submission, with or without binding errors. This method has to be implemented in subclasses and will be called repeatedly by the portal.

Workflow (in addition to the superclass):
1)Call to processFormSubmission which inspects the Errors object to see if any errors have occurred during binding and validation.
2)If errors occured, the controller will return the configured formView, showing the form again (possibly rendering according error messages).
3)If isFormChangeRequest is overridden and returns true for the given request, the controller will return the formView too. In that case, the controller will also suppress validation. Before returning the formView, the controller will invoke onFormChange(javax.portlet.ActionRequest, javax.portlet.ActionResponse, java.lang.Object, org.springframework.validation.BindException), giving sub-classes a chance to make modification to the command object. This is intended for requests that change the structure of the form, which should not cause validation and show the form in any case.
4)If no errors occurred, the controller will call onSubmitAction during the action phase and then onSubmitRender during the render phase, which in case of the default implementation delegate to onSubmitAction and onSubmitRender with just the command object. The default implementation of the latter method will return the configured successView. Consider just implementing doSubmitAction for simply performing a submit action during the action phase and then rendering the success view during the render phase.

Learning OpenMrs Project, Source code(3)

1) org.openmrs.h7.web.*: h7 controller, servlet

2)org.openmrs.layout.web
layout?

3)org.openmrs.module.web
servlet?
ModelAndView?
Module load unload,

4)org.openmrs.module.controller
controller

5)org.openmrs.module.web.extension
abstract class of extension op

6)org.openmrs.module.web.extension.provider
link?

7)org.openmrs.module.web.filter
to allow module defined filter to be loaded and excute

8)org.openmrs.web.taglib
tag parsing?

9)org.openmrs.notification.web.*
notification? initBind? processFormSubmission?

10)org.openmrs.sheduler.web
formBackingObject?
referenceData?


11)org.openmrs.summary.web
PatientSummarySpecification

12)org.openmrs.web.controller
SimpleFormController?
webform controller & validator

13)org.openmrs.web.dwr
dwr?
Direct Web Remoting is a framework that allows us to translate java objects and methods to javascript objects and methods. Together with DOJO, DWR forms the basis of the AJAX in OpenMRS. The dwr.xml descriptor file describes which classes and methods are translated and made available to javascript calls. Most base DWR-able classes are placed into the org.openmrs.web.dwr package.

Tuesday, March 30, 2010

Learning OpenMrs Project, Source code(2)

1)org.openmrs.messagesource
???

2)org.openmrs.module
module defintion, loader, factory

3)org.openmrs.notification.*
communication between users

4)org.openmrs.ob.*
observation?

5)org.openmrs.order/org.openmrs.patient
deal with order and patient

6)org.openmrs.propertyeditor
propertyeditor??

7)org.openmrs.report/reporting
deprecated, deal with report

8)org.openmrs.scheduler
Task/scheduler

9)org.openmrs.serilization
serilization

10)org.openmrs.util
security, db ,etc.

11)org.openmrs.validator
validation

Monday, March 29, 2010

Learning OpenMrs Project, Source code(1)

1)org.openmrs
contain model definitions
official notes:
These classes represent the core domain objects for the OpenMRS project

2)org.openmrs.annotation
annotation definitions
on:This package contains classes associated with the custom java 1.5+ annotations

3)org.openmrs.aop
Need to dig~~
what is advisor?
on:This package contains the classes associated with Aspect Oriented Programming

4)org.openmrs.api
containing interfaces, exceptions

5)org.openmrs.context
context contains user context(could be n) and service context(only1)
On:This package describes the context framework through which authentication is performed and services provided for the OpenMRS system

6)org.openmrs.api.db
dao interface definition and exception definition

7)org.openmrs.api.hibernate
the hibernate implementation of org.openmrs.api.db

8)org.openmrs.api.handler
the handler class automatically called using AOP???

9)org.openmrs.api.imp
the implementation of the api interfaces

10)org.openmrs.arden
logic??

11) h7
special format for medical info?

12)openmrs.logic
build criterials for query

to be continues