You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(141) |
Sep
(184) |
Oct
(159) |
Nov
(77) |
Dec
(114) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(212) |
Feb
(302) |
Mar
(323) |
Apr
(360) |
May
(302) |
Jun
(392) |
Jul
(299) |
Aug
(858) |
Sep
(499) |
Oct
(489) |
Nov
(324) |
Dec
(438) |
2008 |
Jan
(449) |
Feb
(388) |
Mar
(811) |
Apr
(583) |
May
(949) |
Jun
(1431) |
Jul
(943) |
Aug
(527) |
Sep
(576) |
Oct
(440) |
Nov
(1046) |
Dec
(658) |
2009 |
Jan
(259) |
Feb
(192) |
Mar
(495) |
Apr
(2322) |
May
(2023) |
Jun
(1387) |
Jul
(722) |
Aug
(771) |
Sep
(167) |
Oct
(142) |
Nov
(384) |
Dec
(884) |
2010 |
Jan
(344) |
Feb
(82) |
Mar
(248) |
Apr
(341) |
May
(389) |
Jun
(289) |
Jul
(19) |
Aug
(478) |
Sep
(274) |
Oct
(431) |
Nov
(322) |
Dec
(207) |
2011 |
Jan
(125) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: John C. <jc...@us...> - 2007-02-07 01:50:57
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26198/src/org/tolven/web Modified Files: RegisterAction.java Log Message: Remove forced reset of session wide paramters, which now come from the actual record. Index: RegisterAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/RegisterAction.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** RegisterAction.java 23 Jan 2007 09:12:42 -0000 1.36 --- RegisterAction.java 7 Feb 2007 01:50:51 -0000 1.37 *************** *** 193,198 **** public String updateAccount() { getAccount().setTitle(getAccountTitle()); ! getTop().setAccountTitle(getAccountTitle()); ! getTop().setAccountTimeZone(getAccount().getTimeZone()); // Reset the timezone getTop().setTimeZone(null); --- 193,198 ---- public String updateAccount() { getAccount().setTitle(getAccountTitle()); ! // getTop().setAccountTitle(getAccountTitle()); ! // getTop().setAccountTimeZone(getAccount().getTimeZone()); // Reset the timezone getTop().setTimeZone(null); |
From: John C. <jc...@us...> - 2007-02-07 01:41:12
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22366/src/org/tolven/web Modified Files: MenuAction.java Log Message: New update logic Index: MenuAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/MenuAction.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** MenuAction.java 4 Feb 2007 16:43:00 -0000 1.31 --- MenuAction.java 7 Feb 2007 01:41:07 -0000 1.32 *************** *** 19,22 **** --- 19,23 ---- import java.text.SimpleDateFormat; import java.util.GregorianCalendar; + import java.util.HashMap; import java.util.List; import java.util.Map; *************** *** 26,29 **** --- 27,31 ---- import javax.naming.NamingException; import javax.servlet.http.HttpSession; + import javax.xml.bind.JAXBException; import org.jfree.chart.ChartFactory; *************** *** 54,57 **** --- 56,60 ---- import org.tolven.doc.entity.DocCCR; import org.tolven.doc.entity.DocXML; + import org.tolven.trim.util.TRIMException; /** * Faces Action Bean concerned with menu configuration and display. Note that menus include both metadata (MenuStructure) and *************** *** 457,460 **** --- 460,466 ---- menuLocal.persistMenuData(newPatient); System.out.println( "[createPatient] patient=" + newPatient.getId() + " Doc id: " + doc.getId() ); + + // Note the elementId of this new item + menuDataItem = newPatient; return "success"; *************** *** 473,489 **** // } // ! // /** ! // * Submit the current menu item, which must be a wizard ! // * @return ! // */ ! // public String submit( ) { ! // // } ! /** * Temporary: Create an assessment * @return */ ! public String createAssessment() { // Climb the current menu path to find the patient MenuStructure node String patientPath = getTargetMenuPath().getSubPath("patient"); --- 479,503 ---- // } // ! // public String createAssessment( ) { ! // MenuStructure ms = menuLocal.findMenuStructure(getAccountId(), "echr:patient:assessment"); ! // DocXML doc = instantiate( ms, context); ! // MenuData md = new MenuData(); ! // md.setMenuStructure(ms); ! // md.setAccount(doc.getAccount()); ! //// md.setParent01(patient); ! //// md.setDate01(getNow()); ! //// md.setString01("GCS"); ! // md.setString02( "new"); ! // menuBean.persistMenuData(md); ! // return md; // } ! /** * Temporary: Create an assessment * @return + * @throws TRIMException + * @throws JAXBException */ ! public String createAssessment() throws JAXBException, TRIMException { // Climb the current menu path to find the patient MenuStructure node String patientPath = getTargetMenuPath().getSubPath("patient"); *************** *** 508,511 **** --- 522,530 ---- ass.setString01("GCS"); ass.setString02( "new"); + Map<String, String> context = new HashMap<String, String>(); + context.put(patient.getMenuStructure().getPath(), patient.getPath()); + System.out.println( "Context: " + patient.getMenuStructure().getPath() + " / " + patient.getPath()); + DocXML doc = creatorBean.instantiate(getAccountId(), "echr:gcs", context); + ass.setDocumentId(doc.getId()); menuLocal.persistMenuData(ass); *************** *** 522,525 **** --- 541,545 ---- newActivity.setString01(patient.getString01() + ", " + patient.getString02()); newActivity.setString02( "Glasgow Coma Scale in process"); + newActivity.setDocumentId(doc.getId()); newActivity.setReference(ass); menuLocal.persistMenuData(newActivity); *************** *** 538,541 **** --- 558,562 ---- assAll.setString01("GCS"); assAll.setString02( "new"); + assAll.setDocumentId(doc.getId()); assAll.setReference(ass); menuLocal.persistMenuData(assAll); *************** *** 543,546 **** --- 564,578 ---- } + /** + * Submit the current menu item, which must be a wizard + * @return + * @throws Exception + */ + public String submit( ) throws Exception { + MenuData md = getMenuDataItem( ); + creatorBean.submit(md); + return "success"; + } + public String getGivenName() { return givenName; |
From: John C. <jc...@us...> - 2007-02-07 01:40:35
|
Update of /cvsroot/tolven/tolvenWEB/web/wizard In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21995/web/wizard Modified Files: wizTemplate.xhtml gcs.xhtml Log Message: New update logic Index: gcs.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/wizard/gcs.xhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gcs.xhtml 16 Jan 2007 06:48:49 -0000 1.3 --- gcs.xhtml 7 Feb 2007 01:40:33 -0000 1.4 *************** *** 22,41 **** // alert("computeGCS" ); $(field.name + 'Val').value = field.value; ! if ($F('#{menu.element}-gcsEVal')=='' || $F('#{menu.element}-gcsVVal')=='' || $F('#{menu.element}-gcsMVal')=='') { ! $('#{menu.element}-gcsInterpret').value = '<incomplete>'; ! $('#{menu.element}-gcsScore').value = ''; return; } ! var score = (1 * $F('#{menu.element}-gcsMVal')) + ! (1 * $F('#{menu.element}-gcsVVal')) + ! (1 * $F('#{menu.element}-gcsEVal')); ! $('#{menu.element}-gcsScore').value = "GCS " + score + " = E" + $F('#{menu.element}-gcsEVal') + " V" + $F('#{menu.element}-gcsVVal') + " M" + $F('#{menu.element}-gcsMVal') + " at " + $F('#{menu.element}-gcsTVal'); ! if (score < 8) $('#{menu.element}-gcsInterpret').value = "Severe"; ! else if (score < 13) $('#{menu.element}-gcsInterpret').value = "Moderate"; ! else if (score < 15) $('#{menu.element}-gcsInterpret').value = "Minor"; ! else $('#{menu.element}-gcsInterpret').value = "Fully awake"; } // ]]> </script> <div class="step" title="Getting Started" > <div class="pagesm"> --- 22,42 ---- // alert("computeGCS" ); $(field.name + 'Val').value = field.value; ! if ($F('#{menu.elementLabel}gcsEVal')=='' || $F('#{menu.elementLabel}gcsVVal')=='' || $F('#{menu.elementLabel}gcsMVal')=='') { ! $('#{menu.elementLabel}gcsInterpret').value = '<incomplete>'; ! $('#{menu.elementLabel}gcsScore').value = ''; return; } ! var score = (1 * $F('#{menu.elementLabel}gcsMVal')) + ! (1 * $F('#{menu.elementLabel}gcsVVal')) + ! (1 * $F('#{menu.elementLabel}gcsEVal')); ! $('#{menu.elementLabel}gcsScore').value = "GCS " + score + " = E" + $F('#{menu.elementLabel}gcsEVal') + " V" + $F('#{menu.elementLabel}gcsVVal') + " M" + $F('#{menu.elementLabel}gcsMVal') + " at " + $F('#{menu.elementLabel}gcsTVal'); ! if (score < 8) $('#{menu.elementLabel}gcsInterpret').value = "Severe"; ! else if (score < 13) $('#{menu.elementLabel}gcsInterpret').value = "Moderate"; ! else if (score < 15) $('#{menu.elementLabel}gcsInterpret').value = "Minor"; ! else $('#{menu.elementLabel}gcsInterpret').value = "Fully awake"; } // ]]> </script> + <div class="step" title="Getting Started" > <div class="pagesm"> *************** *** 49,102 **** <div class="step" title="Glasgow Coma Scale" > <div class="pagesm"> ! <fieldset id="#{menu.element}-time"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.element}-','time');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Assessment Time (T)</legend> ! <input id="#{menu.element}-gcsT" name="#{menu.element}-gcsT" readonly="true" type="text" value="" size="30"/><br /> ! <a href="javascript:addHours('#{menu.element}-gcsT',-1);#{menu.elementLabel}computeGCS($('#{menu.element}-gcsT'));">-1h</a> ! <a href="javascript:addMinutes('#{menu.element}-gcsT',-10);#{menu.elementLabel}computeGCS($('#{menu.element}-gcsT'));">-10m</a> ! <a href="javascript:addMinutes('#{menu.element}-gcsT',-1);#{menu.elementLabel}computeGCS($('#{menu.element}-gcsT'));">-1m</a> ! <a href="javascript:setNow('#{menu.element}-gcsT');#{menu.elementLabel}computeGCS($('#{menu.element}-gcsT'));">now</a> ! <a href="javascript:addMinutes('#{menu.element}-gcsT', 1);#{menu.elementLabel}computeGCS($('#{menu.element}-gcsT'));">+1m</a> ! <a href="javascript:addMinutes('#{menu.element}-gcsT', 10);#{menu.elementLabel}computeGCS($('#{menu.element}-gcsT'));">+10m</a> ! <a href="javascript:addHours('#{menu.element}-gcsT', 1);#{menu.elementLabel}computeGCS($('#{menu.element}-gcsT'));">+1h</a> <br/> </fieldset> ! <fieldset id="#{menu.element}-eye"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.element}-','eye');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Best eye response (E) </legend> ! <label><input name="#{menu.element}-gcsE" type="radio" value="4" onchange="#{menu.elementLabel}computeGCS(this);"/>Eyes opening spontaneously</label><br /> ! <label><input name="#{menu.element}-gcsE" type="radio" value="3" onchange="#{menu.elementLabel}computeGCS(this);"/>Eye opening to speech</label><br /> ! <label><input name="#{menu.element}-gcsE" type="radio" value="2" onchange="#{menu.elementLabel}computeGCS(this);"/>Eye opening to pain</label><br /> ! <label><input name="#{menu.element}-gcsE" type="radio" value="1" onchange="#{menu.elementLabel}computeGCS(this);"/>No eye opening</label><br /> ! <label><input name="#{menu.element}-gcsE" type="radio" value="" checked="checked" onchange="#{menu.elementLabel}computeGCS(this);"/>Not assessed</label><br /> </fieldset> ! <fieldset id="#{menu.element}-verbal"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.element}-','verbal');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Best verbal response (V) </legend> ! <label><input name="#{menu.element}-gcsV" type="radio" value="5" onchange="#{menu.elementLabel}computeGCS(this);"/>Oriented</label><br /> ! <label><input name="#{menu.element}-gcsV" type="radio" value="4" onchange="#{menu.elementLabel}computeGCS(this);"/>Confused</label><br /> ! <label><input name="#{menu.element}-gcsV" type="radio" value="3" onchange="#{menu.elementLabel}computeGCS(this);"/>Inappropriate words</label><br /> ! <label><input name="#{menu.element}-gcsV" type="radio" value="2" onchange="#{menu.elementLabel}computeGCS(this);"/>Incomprehensible sounds</label><br /> ! <label><input name="#{menu.element}-gcsV" type="radio" value="1" onchange="#{menu.elementLabel}computeGCS(this);"/>None</label><br /> ! <label><input name="#{menu.element}-gcsV" type="radio" value="" checked="checked" onchange="#{menu.elementLabel}computeGCS(this);"/>Not assessed</label><br /> </fieldset> ! <fieldset id="#{menu.element}-motor"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.element}-','motor');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Best motor response (M) </legend> ! <label><input name="#{menu.element}-gcsM" type="radio" value="6" onchange="#{menu.elementLabel}computeGCS(this);"/>Obeys commands</label><br /> ! <label><input name="#{menu.element}-gcsM" type="radio" value="5" onchange="#{menu.elementLabel}computeGCS(this);" />Localizes to pain</label><br /> ! <label><input name="#{menu.element}-gcsM" type="radio" value="4" onchange="#{menu.elementLabel}computeGCS(this);" />Withdraws from pain</label><br /> ! <label><input name="#{menu.element}-gcsM" type="radio" value="3" onchange="#{menu.elementLabel}computeGCS(this);" />Flexion to pain</label><br /> ! <label><input name="#{menu.element}-gcsM" type="radio" value="2" onchange="#{menu.elementLabel}computeGCS(this);" />Extension to pain</label><br /> ! <label><input name="#{menu.element}-gcsM" type="radio" value="1" onchange="#{menu.elementLabel}computeGCS(this);" />No motor response</label><br /> ! <label><input name="#{menu.element}-gcsM" type="radio" value="" checked="checked" onchange="#{menu.elementLabel}computeGCS(this);"/>Not assessed</label><br /> </fieldset> </div> ! <div class="help" id="#{menu.element}-timeHelp" style="display:none"> <h1>Assessment Time</h1> <p>The time when the assessment was done, accurate to 5 minutes.</p> <p>Use the +/- controls to adjust the assessment time. Now resets the time to now.</p> </div> ! <div class="help" id="#{menu.element}-eyeHelp" style="display:none"> <h1>Eye Response</h1> <p>Do not confuse "Eye opening to speech" with an awaking of a sleeping person which would score 4, not 3.</p> --- 50,103 ---- <div class="step" title="Glasgow Coma Scale" > <div class="pagesm"> ! <fieldset id="#{menu.elementLabel}time"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.elementLabel}','time');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Assessment Time (T)</legend> ! <input id="#{menu.elementLabel}gcsT" name="#{menu.elementLabel}gcsT" readonly="true" type="text" value="" size="30"/><br /> ! <a href="javascript:addHours('#{menu.elementLabel}gcsT',-1);#{menu.elementLabel}computeGCS($('#{menu.elementLabel}gcsT'));">-1h</a> ! <a href="javascript:addMinutes('#{menu.elementLabel}gcsT',-10);#{menu.elementLabel}computeGCS($('#{menu.elementLabel}gcsT'));">-10m</a> ! <a href="javascript:addMinutes('#{menu.elementLabel}gcsT',-1);#{menu.elementLabel}computeGCS($('#{menu.elementLabel}gcsT'));">-1m</a> ! <a href="javascript:setNow('#{menu.elementLabel}gcsT');#{menu.elementLabel}computeGCS($('#{menu.elementLabel}gcsT'));">now</a> ! <a href="javascript:addMinutes('#{menu.elementLabel}gcsT', 1);#{menu.elementLabel}computeGCS($('#{menu.elementLabel}gcsT'));">+1m</a> ! <a href="javascript:addMinutes('#{menu.elementLabel}gcsT', 10);#{menu.elementLabel}computeGCS($('#{menu.elementLabel}gcsT'));">+10m</a> ! <a href="javascript:addHours('#{menu.elementLabel}gcsT', 1);#{menu.elementLabel}computeGCS($('#{menu.elementLabel}gcsT'));">+1h</a> <br/> </fieldset> ! <fieldset id="#{menu.elementLabel}eye"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.elementLabel}','eye');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Best eye response (E) </legend> ! <label><input name="#{menu.elementLabel}gcsE" type="radio" value="4" onchange="#{menu.elementLabel}computeGCS(this);"/>Eyes opening spontaneously</label><br /> ! <label><input name="#{menu.elementLabel}gcsE" type="radio" value="3" onchange="#{menu.elementLabel}computeGCS(this);"/>Eye opening to speech</label><br /> ! <label><input name="#{menu.elementLabel}gcsE" type="radio" value="2" onchange="#{menu.elementLabel}computeGCS(this);"/>Eye opening to pain</label><br /> ! <label><input name="#{menu.elementLabel}gcsE" type="radio" value="1" onchange="#{menu.elementLabel}computeGCS(this);"/>No eye opening</label><br /> ! <label><input name="#{menu.elementLabel}gcsE" type="radio" value="" checked="checked" onchange="#{menu.elementLabel}computeGCS(this);"/>Not assessed</label><br /> </fieldset> ! <fieldset id="#{menu.elementLabel}verbal"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.elementLabel}','verbal');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Best verbal response (V) </legend> ! <label><input name="#{menu.elementLabel}gcsV" type="radio" value="5" onchange="#{menu.elementLabel}computeGCS(this);"/>Oriented</label><br /> ! <label><input name="#{menu.elementLabel}gcsV" type="radio" value="4" onchange="#{menu.elementLabel}computeGCS(this);"/>Confused</label><br /> ! <label><input name="#{menu.elementLabel}gcsV" type="radio" value="3" onchange="#{menu.elementLabel}computeGCS(this);"/>Inappropriate words</label><br /> ! <label><input name="#{menu.elementLabel}gcsV" type="radio" value="2" onchange="#{menu.elementLabel}computeGCS(this);"/>Incomprehensible sounds</label><br /> ! <label><input name="#{menu.elementLabel}gcsV" type="radio" value="1" onchange="#{menu.elementLabel}computeGCS(this);"/>None</label><br /> ! <label><input name="#{menu.elementLabel}gcsV" type="radio" value="" checked="checked" onchange="#{menu.elementLabel}computeGCS(this);"/>Not assessed</label><br /> </fieldset> ! <fieldset id="#{menu.elementLabel}motor"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.elementLabel}','motor');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Best motor response (M) </legend> ! <label><input name="#{menu.elementLabel}gcsM" type="radio" value="6" onchange="#{menu.elementLabel}computeGCS(this);"/>Obeys commands</label><br /> ! <label><input name="#{menu.elementLabel}gcsM" type="radio" value="5" onchange="#{menu.elementLabel}computeGCS(this);" />Localizes to pain</label><br /> ! <label><input name="#{menu.elementLabel}gcsM" type="radio" value="4" onchange="#{menu.elementLabel}computeGCS(this);" />Withdraws from pain</label><br /> ! <label><input name="#{menu.elementLabel}gcsM" type="radio" value="3" onchange="#{menu.elementLabel}computeGCS(this);" />Flexion to pain</label><br /> ! <label><input name="#{menu.elementLabel}gcsM" type="radio" value="2" onchange="#{menu.elementLabel}computeGCS(this);" />Extension to pain</label><br /> ! <label><input name="#{menu.elementLabel}gcsM" type="radio" value="1" onchange="#{menu.elementLabel}computeGCS(this);" />No motor response</label><br /> ! <label><input name="#{menu.elementLabel}gcsM" type="radio" value="" checked="checked" onchange="#{menu.elementLabel}computeGCS(this);"/>Not assessed</label><br /> </fieldset> </div> ! <div class="help" id="#{menu.elementLabel}timeHelp" style="display:none"> <h1>Assessment Time</h1> <p>The time when the assessment was done, accurate to 5 minutes.</p> <p>Use the +/- controls to adjust the assessment time. Now resets the time to now.</p> </div> ! <div class="help" id="#{menu.elementLabel}eyeHelp" style="display:none"> <h1>Eye Response</h1> <p>Do not confuse "Eye opening to speech" with an awaking of a sleeping person which would score 4, not 3.</p> *************** *** 104,108 **** supraorbital and sternal pressure/rub.</p> </div> ! <div class="help" id="#{menu.element}-verbalHelp" style="display:none"> <h1>Verbal Response</h1> <p>Do not confuse "Eye opening to speech" with an awaking of a sleeping person which would score 4, not 3.</p> --- 105,109 ---- supraorbital and sternal pressure/rub.</p> </div> ! <div class="help" id="#{menu.elementLabel}verbalHelp" style="display:none"> <h1>Verbal Response</h1> <p>Do not confuse "Eye opening to speech" with an awaking of a sleeping person which would score 4, not 3.</p> *************** *** 110,114 **** supraorbital and sternal pressure/rub.</p> </div> ! <div class="help" id="#{menu.element}-motorHelp" style="display:none"> <h1>Motor Response</h1> <p>Do not confuse "Eye opening to speech" with an awaking of a sleeping person which would score 4, not 3.</p> --- 111,115 ---- supraorbital and sternal pressure/rub.</p> </div> ! <div class="help" id="#{menu.elementLabel}motorHelp" style="display:none"> <h1>Motor Response</h1> <p>Do not confuse "Eye opening to speech" with an awaking of a sleeping person which would score 4, not 3.</p> *************** *** 119,145 **** <div class="step" title="Finish"> <div class="pagesm"> ! <fieldset id="#{menu.element}-Score"> <legend>Score </legend> ! <label><input id="#{menu.element}-gcsTVal" name="#{menu.element}-gcsTVal" readonly="true" type="text" size="30"/> Time</label><br /> ! <label><input id="#{menu.element}-gcsEVal" name="#{menu.element}-gcsEVal" readonly="true" type="text" style="text-align:right" size="4"/> Eye Score</label><br /> ! <label><input id="#{menu.element}-gcsVVal" name="#{menu.element}-gcsVVal" readonly="true" type="text" style="text-align:right" size="4"/> Verbal Score</label><br /> ! <label><input id="#{menu.element}-gcsMVal" name="#{menu.element}-gcsMVal" readonly="true" type="text" style="text-align:right" size="4"/> Motor Score</label><br /> ! <label><input id="#{menu.element}-gcsScore" name="#{menu.element}-gcsScore" readonly="true" type="text" size="60"/> Total Score </label><br /> </fieldset> ! <fieldset id="#{menu.element}-interpretation"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.element}-','interpretation');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Interpretation </legend> ! <label><input id="#{menu.element}-gcsInterpret" name="#{menu.element}-gcsInterpret" type="text" readonly="true" /> Computed</label><br /> </fieldset> ! <fieldset id="#{menu.element}-submission"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.element}-','submission');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Submission </legend> ! <label><input id="#{menu.element}-author" name="#{menu.element}-author" type="text" readonly="true" value="#{top.tp.givenName} #{top.tp.sn}"/> Author</label><br /> ! <label><input id="#{menu.element}-time" name="#{menu.element}-time" type="text" size="30" readonly="true" value="#{top.serverTime}"/> Submission Time</label><br /> ! <input type="submit" value="Submit" disabled="true" /> ! <div id="#{menu.element}-rslt" style="width:100%; height:3em; background-color:#FFFFDD;"/> </fieldset> </div> ! <div class="help" id="#{menu.element}-interpretationHelp" style="display:none"> <h1>Interpretation</h1> <p>Generally, comas are classified as:</p> --- 120,147 ---- <div class="step" title="Finish"> <div class="pagesm"> ! <fieldset id="#{menu.elementLabel}Score"> <legend>Score </legend> ! <label><input id="#{menu.elementLabel}gcsTVal" name="#{menu.elementLabel}gcsTVal" readonly="true" type="text" size="30"/> Time</label><br /> ! <label><input id="#{menu.elementLabel}gcsEVal" name="#{menu.elementLabel}gcsEVal" readonly="true" type="text" style="text-align:right" size="4"/> Eye Score</label><br /> ! <label><input id="#{menu.elementLabel}gcsVVal" name="#{menu.elementLabel}gcsVVal" readonly="true" type="text" style="text-align:right" size="4"/> Verbal Score</label><br /> ! <label><input id="#{menu.elementLabel}gcsMVal" name="#{menu.elementLabel}gcsMVal" readonly="true" type="text" style="text-align:right" size="4"/> Motor Score</label><br /> ! <label><input id="#{menu.elementLabel}gcsScore" name="#{menu.elementLabel}gcsScore" readonly="true" type="text" size="60"/> Total Score </label><br /> </fieldset> ! <fieldset id="#{menu.elementLabel}interpretation"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.elementLabel}','interpretation');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Interpretation </legend> ! <label><input id="#{menu.elementLabel}gcsInterpret" name="#{menu.elementLabel}gcsInterpret" type="text" readonly="true" /> Computed</label><br /> </fieldset> ! <fieldset id="#{menu.elementLabel}submission"> ! <div align="right" style="margin-top:5px; padding-top:5px; float:right"><a title="More information" href="javascript:toggleHelp('#{menu.elementLabel}','submission');"><img src="../images/img_help_t.jpg" border="0" /></a></div> <legend>Submission </legend> ! <label><input id="#{menu.elementLabel}author" name="#{menu.elementLabel}author" type="text" readonly="true" value="#{top.tp.givenName} #{top.tp.sn}"/> Author</label><br /> ! <label><input id="#{menu.elementLabel}time" name="#{menu.elementLabel}time" type="text" size="30" readonly="true" value="#{top.serverTime}"/> Submission Time</label><br /> ! <!-- input type="submit" value="Submit" disabled="false" /--> ! <h:commandButton id="#{menu.elementLabel}submit" action="#{menu.submit}" value="Submit"/> ! <div id="#{menu.elementLabel}rslt" style="width:100%; height:3em; background-color:#FFFFDD;"/> </fieldset> </div> ! <div class="help" id="#{menu.elementLabel}interpretationHelp" style="display:none"> <h1>Interpretation</h1> <p>Generally, comas are classified as:</p> *************** *** 153,157 **** </div> ! <div class="help" id="#{menu.element}-submissionHelp" style="display:none"> <h1>Submission</h1> <p>The Submit button remains disabled until all entered data is validated and has been stored on the server in your private holding area. --- 155,159 ---- </div> ! <div class="help" id="#{menu.elementLabel}submissionHelp" style="display:none"> <h1>Submission</h1> <p>The Submit button remains disabled until all entered data is validated and has been stored on the server in your private holding area. Index: wizTemplate.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/wizard/wizTemplate.xhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wizTemplate.xhtml 29 Nov 2006 01:35:32 -0000 1.3 --- wizTemplate.xhtml 7 Feb 2007 01:40:32 -0000 1.4 *************** *** 26,39 **** <body> <ui:composition> <script language="JavaScript" type="text/javascript"> // <![CDATA[ ! $('#{menu.element}-').setAttribute( 'currentStep', 0 ); ! $('#{menu.element}-').setAttribute( 'lastStep', 0 ); ! setupWizSteps('#{menu.element}-', 1); // ]]> </script> ! <div class="wizard" id="#{menu.element}-"> ! <form onsubmit="return false;"> <div class="infobar" > <table width="100%"> --- 26,39 ---- <body> <ui:composition> + <div class="wizard" id="#{menu.elementLabel}"> <script language="JavaScript" type="text/javascript"> // <![CDATA[ ! $('#{menu.elementLabel}').setAttribute( 'currentStep', 0 ); ! $('#{menu.elementLabel}').setAttribute( 'lastStep', 0 ); ! setupWizSteps('#{menu.elementLabel}', 1); // ]]> </script> ! <h:form id="#{menu.elementLabel}" onsubmit="return ajaxSubmit2(this);"> <div class="infobar" > <table width="100%"> *************** *** 52,62 **** <tbody> <tr> ! <td width="300px" id="#{menu.element}-stepHeadings"/> <td align="center"> ! <ul id="#{menu.element}-stepIcons"/> </td> <td width="50px"> <div align="right" title="Toggle Help"> ! <a href="#" onclick="toggleHelp('#{menu.element}-');"> <img src="../images/img_help.jpg" border="0" /> </a> --- 52,62 ---- <tbody> <tr> ! <td width="300px" id="#{menu.elementLabel}stepHeadings"/> <td align="center"> ! <ul id="#{menu.elementLabel}stepIcons"/> </td> <td width="50px"> <div align="right" title="Toggle Help"> ! <a href="#" onclick="toggleHelp('#{menu.elementLabel}');"> <img src="../images/img_help.jpg" border="0" /> </a> *************** *** 79,90 **** <tr> <td align="center" > ! <input id="#{menu.element}-stopButton" type="submit" value="Stop" style="display:none"/> ! <input id="#{menu.element}-prevButton" type="submit" value="Previous" onclick="prevStep('#{menu.element}-' );self.scrollTo(0, 0);"/> ! <input id="#{menu.element}-nextButton" type="submit" value="Next" onclick="nextStep('#{menu.element}-' );self.scrollTo(0, 0);"/> </td> </tr> </table> </div> ! </form> </div> </ui:composition> --- 79,90 ---- <tr> <td align="center" > ! <input id="#{menu.elementLabel}stopButton" type="submit" value="Stop" style="display:none"/> ! <input id="#{menu.elementLabel}prevButton" type="submit" value="Previous" onclick="prevStep('#{menu.elementLabel}' );self.scrollTo(0, 0);"/> ! <input id="#{menu.elementLabel}nextButton" type="submit" value="Next" onclick="nextStep('#{menu.elementLabel}' );self.scrollTo(0, 0);"/> </td> </tr> </table> </div> ! </h:form> </div> </ui:composition> |
From: John C. <jc...@us...> - 2007-02-07 01:40:35
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/index In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21995/src/org/tolven/index Modified Files: Browse.java BrowseBase.java BrowseTransactionFilter.java Log Message: New update logic Index: BrowseTransactionFilter.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/index/BrowseTransactionFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BrowseTransactionFilter.java 23 Jan 2007 14:44:15 -0000 1.2 --- BrowseTransactionFilter.java 7 Feb 2007 01:40:33 -0000 1.3 *************** *** 32,36 **** finally { try { ! ut.rollback(); } catch (Exception e) { e.printStackTrace(); --- 32,36 ---- finally { try { ! ut.commit(); } catch (Exception e) { e.printStackTrace(); Index: BrowseBase.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/index/BrowseBase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BrowseBase.java 23 Jan 2007 14:44:15 -0000 1.2 --- BrowseBase.java 7 Feb 2007 01:40:33 -0000 1.3 *************** *** 13,16 **** --- 13,17 ---- import javax.servlet.http.HttpServletResponse; + import org.tolven.app.CreatorLocal; import org.tolven.app.MenuLocal; import org.tolven.doc.DocumentLocal; *************** *** 26,29 **** --- 27,31 ---- // private ServletContext context = null; @EJB protected MenuLocal menuLocal; + @EJB protected CreatorLocal creatorLocal; @EJB protected DocumentLocal documentLocal; @EJB protected XMLProtectedLocal xmlProtectedBean; *************** *** 36,39 **** --- 38,42 ---- InitialContext ctx = new InitialContext(); menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); + creatorLocal = (CreatorLocal) ctx.lookup("tolven/CreatorBean/local"); documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); xmlProtectedBean = (XMLProtectedLocal) ctx.lookup("tolven/XMLProtectedBean/local"); *************** *** 72,75 **** --- 75,79 ---- writer.write( " | <a href='view.browse'>Instance Data Viewer</a>"); writer.write( " | <a href='metadata.browse'>View All Metadata</a>"); + writer.write( " | <a href='testGCS.browse'>Test GCS</a>"); writer.write( "</p>\n"); } Index: Browse.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/index/Browse.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Browse.java 23 Jan 2007 14:43:44 -0000 1.6 --- Browse.java 7 Feb 2007 01:40:33 -0000 1.7 *************** *** 5,8 **** --- 5,9 ---- import java.util.Date; import java.util.Enumeration; + import java.util.HashMap; import java.util.LinkedList; import java.util.List; *************** *** 12,15 **** --- 13,17 ---- import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import javax.xml.bind.JAXBException; import org.tolven.app.bean.MenuPath; *************** *** 20,23 **** --- 22,27 ---- import org.tolven.core.entity.AccountUser; import org.tolven.doc.entity.DocBase; + import org.tolven.doc.entity.DocXML; + import org.tolven.trim.util.TRIMException; /** *************** *** 66,70 **** return; } ! if( uri.endsWith("view.browse")) { // Prepare response back to client --- 70,80 ---- return; } ! if( uri.endsWith("testGCS.browse")) { ! Map<String, String> context = new HashMap<String, String>( 2); ! context.put("echr:patient", "echr:patient-658609"); ! DocXML doc = creatorLocal.instantiate(11800, "echr:gcs", context); ! creatorLocal.submit( doc, doc.getContent() ); ! return; ! } if( uri.endsWith("view.browse")) { // Prepare response back to client |
From: John C. <jc...@us...> - 2007-02-07 01:37:52
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20665/src/org/tolven/app/bean Modified Files: AppEvalAdaptor.java MenuBean.java CreatorBean.java Log Message: New update logic Index: MenuBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean/MenuBean.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** MenuBean.java 4 Feb 2007 16:39:58 -0000 1.44 --- MenuBean.java 7 Feb 2007 01:37:50 -0000 1.45 *************** *** 218,222 **** return rslt.longValue(); } ! /** --- 218,234 ---- return rslt.longValue(); } ! /** ! * Remove any menuData item that references the specified document. This is usually done when a new document is submitted to ! * remove it from "to do" lists. The rules will put the document back on any lists it should be on now that the ! * document is "actionable". ! * @return the number of rows actually deleted. ! */ ! public int removeReferencingMenuData( long accountId, long documentId) { ! if (0!=documentId) return 0; ! Query query = em.createQuery("DELETE FROM MenuData md WHERE md.account.id = :account and md.documentId = :docId"); ! query.setParameter( "account", accountId ); ! query.setParameter( "docId", documentId ); ! return query.executeUpdate(); ! } /** Index: CreatorBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean/CreatorBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CreatorBean.java 4 Feb 2007 16:39:58 -0000 1.1 --- CreatorBean.java 7 Feb 2007 01:37:50 -0000 1.2 *************** *** 3,7 **** --- 3,9 ---- import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; + import java.security.GeneralSecurityException; import java.util.Map; + import java.util.Set; import javax.annotation.EJB; *************** *** 11,26 **** --- 13,42 ---- import javax.ejb.Remote; import javax.ejb.Stateless; + import javax.jms.ConnectionFactory; + import javax.jms.Queue; + import javax.security.auth.Subject; + import javax.security.jacc.PolicyContext; + import javax.security.jacc.PolicyContextException; import javax.xml.bind.JAXBException; + import org.jboss.annotation.security.SecurityDomain; import org.tolven.app.CreatorLocal; import org.tolven.app.CreatorRemote; import org.tolven.app.MenuLocal; + import org.tolven.app.entity.MenuData; import org.tolven.app.entity.MenuStructure; import org.tolven.core.ActivationLocal; + import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.TolvenUser; + import org.tolven.core.util.Queuer; import org.tolven.doc.DocumentLocal; import org.tolven.doc.XMLLocal; + import org.tolven.doc.XMLProtectedLocal; + import org.tolven.doc.bean.TolvenMessage; import org.tolven.doc.entity.CCRException; import org.tolven.doc.entity.DocXML; + import org.tolven.security.key.PrivateKeyRing; + import org.tolven.security.key.UserPrivateKey; + import org.tolven.security.key.UserPublicKey; import org.tolven.trim.Act; import org.tolven.trim.ActBind; *************** *** 42,45 **** --- 58,62 ---- @Local(CreatorLocal.class) @Remote(CreatorRemote.class) + @SecurityDomain( "tolvenLDAP") public class CreatorBean implements CreatorLocal, CreatorRemote { *************** *** 49,54 **** @EJB DocumentLocal documentBean; @EJB XMLLocal xmlBean; ! @Resource EJBContext ejbContext; static final String TRIM_NS = "urn:astm-org:trim:4.0"; --- 66,78 ---- @EJB DocumentLocal documentBean; @EJB XMLLocal xmlBean; + @EJB XMLProtectedLocal xmlProtectedBean; ! @Resource(mappedName="java:/JmsXA") ! private ConnectionFactory connectionFactory; ! ! @Resource(mappedName="queue/rule") ! private Queue ruleQueue; ! ! @Resource EJBContext ejbContext; static final String TRIM_NS = "urn:astm-org:trim:4.0"; *************** *** 158,161 **** --- 182,186 ---- // Document remains in new status, but is saved (persist/merge) documentBean.saveDocument(docXML); + System.out.println( "Document saved, id: " + docXML.getId()); return docXML; } *************** *** 175,177 **** --- 200,299 ---- } + /** + * Instantiate a new document and new Menudata item pointing to it. + * @param accountId + * @param ms + * @param parent + * @return MenuData + * @throws JAXBException + * @throws TRIMException + */ + // Not done yet (we'll prototype in MenuAction + public MenuData createTRIMInstance( long accountId, String path, Map<String, String> context ) throws JAXBException, TRIMException { + MenuStructure ms = menuBean.findMenuStructure(accountId, path); + DocXML doc = instantiate( ms, context); + MenuData md = new MenuData(); + md.setMenuStructure(ms); + md.setAccount(doc.getAccount()); + // md.setParent01(patient); + // md.setDate01(getNow()); + // md.setString01("GCS"); + md.setString02( "new"); + menuBean.persistMenuData(md); + return md; + } + + /** + * Submit the document associated with this menuData item + * @throws Exception + */ + public void submit( MenuData md ) throws Exception { + if (0==md.getDocumentId()) throw new IllegalArgumentException( "Submitted menu data item, " + md.getId() + " must have a document id"); + submit(md.getDocumentId() ); + } + + /** + * Submit the specified document for processing (remote-friendly). + */ + public void submit( long documentId ) throws Exception { + if (0==documentId) throw new IllegalArgumentException( "Submitted DocumentId must not be 0"); + DocXML docXML = (DocXML) documentBean.findDocument(documentId); + submit( docXML, docXML.getContent() ); + } + + /** + * Submit the specified document for processing. + */ + public void submit( DocXML docXML, byte[] payload ) throws Exception { + System.out.println( "Submitting document: " + docXML.getId()); + // System.out.println( "Try to unmarshal " + docXML.getId()); + // Trim trim = (Trim) xmlProtectedBean.unmarshal(docXML); + // System.out.println( "Unmarshalled " + docXML.getId()); + Queuer q = new Queuer(); + q.init(connectionFactory, ruleQueue); + TolvenMessage tm = new TolvenMessage(); + tm.setAccountId(docXML.getAccount().getId()); + tm.setAuthorId(docXML.getAuthor().getId()); + tm.setDocumentId(docXML.getId() ); + tm.setXmlNS( TRIM_NS); + // ByteArrayOutputStream output = new ByteArrayOutputStream( ); + // xmlBean.marshalTRIM( trim, output ); + tm.setPayload(payload); + // tm.setPayload(docXML.getContent()); + // System.out.println( "Payload: " + new String(tm.getPayload())); + q.send( tm ); + System.out.println( "Document sent: " + docXML.getId()); + } + + // /** + // * Return the PrivateKeyRing for the user + // * @return + // * @throws PolicyContextException + // * @throws GeneralSecurityException + // */ + // private PrivateKeyRing getPrivateKeyRing() throws PolicyContextException, GeneralSecurityException { + // Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); + // if (subject == null) + // throw new GeneralSecurityException("No Subject found in PolicyContext for " + ejbContext.getCallerPrincipal()); + // Set privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); + // if (privateCredentials.isEmpty()) + // throw new GeneralSecurityException(": No PrivateKeyRing found for " + ejbContext.getCallerPrincipal()); + // return (PrivateKeyRing) privateCredentials.iterator().next(); + // } + // + // + // /** + // * Update the PrivateKeyRing with the AccountPrivateKey of the Account that the user is currently logged into + // * @throws PolicyContextException + // * @throws GeneralSecurityException + // */ + // private void updatePrivateKeyRing(long accountUserId) throws PolicyContextException, GeneralSecurityException { + // PrivateKeyRing privateKeyRing = getPrivateKeyRing(); + // AccountUser accountUser = activationBean.findAccountUser(accountUserId); + // if (accountUser == null) + // throw new GeneralSecurityException(": No AccountUser found for " + ejbContext.getCallerPrincipal()); + // privateKeyRing.setAccountPrivateKey(accountUser.getAccountPrivateKey()); + // } + + } Index: AppEvalAdaptor.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean/AppEvalAdaptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AppEvalAdaptor.java 4 Feb 2007 16:39:58 -0000 1.1 --- AppEvalAdaptor.java 7 Feb 2007 01:37:50 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- import org.tolven.app.entity.MenuStructure; import org.tolven.core.entity.Account; + import org.tolven.doc.entity.DocBase; /** *************** *** 74,77 **** --- 75,85 ---- return menuBean.findMenuDataItem(ctrl); } + /** + * Remove all menuData items that reference this document. + * @param docBase + */ + public void removeReferencingMenuData( DocBase docBase ) { + menuBean.removeReferencingMenuData( getAccount().getId(), docBase.getId()); + } public Account getAccount() { |
From: John C. <jc...@us...> - 2007-02-07 01:37:51
|
Update of /cvsroot/tolven/tolvenEJB/resources/rules In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20665/resources/rules Modified Files: echr.drl Log Message: New update logic Index: echr.drl =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/resources/rules/echr.drl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** echr.drl 4 Feb 2007 21:31:23 -0000 1.1 --- echr.drl 7 Feb 2007 01:37:51 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- import java.util.*; import org.tolven.trim.*; + import org.tolven.doc.entity.*; import java.lang.Integer; import org.tolven.app.entity.MenuStructure; *************** *** 9,12 **** --- 10,22 ---- global org.tolven.app.bean.AppEvalAdaptor app; + rule "Document rule" + when + $doc: DocXML() + then + // to start, remove all menudata associated with this document + // We'll decide where it should go in these rule now that the document is submitted. + app.removeReferencingMenuData( $doc ); + end + /** * See what we can do with a TRIM object |
From: John C. <jc...@us...> - 2007-02-07 01:37:51
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20665/src/org/tolven/doc/bean Modified Files: Evaluator.java TolvenMessage.java RulesBaseFactory.java Log Message: New update logic Index: Evaluator.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/Evaluator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Evaluator.java 4 Feb 2007 16:39:51 -0000 1.5 --- Evaluator.java 7 Feb 2007 01:37:50 -0000 1.6 *************** *** 89,98 **** public void processTRIM( TolvenMessage tm ) throws Exception { System.out.println( "Processing TRIM document for account: " + tm.getAccountId()); ! DocXML docXML = documentLocal.createXMLDocument( tm.getXmlNS(), tm.getAuthorId(), tm.getAccountId() ); ! System.out.println( "Document created, id: " + docXML.getId()); ! docXML.setContent(tm.getPayload()); ! // System.out.println( "Document set payload, id: " + docXML.getId()); ! documentLocal.finalizeDocument(docXML); ! // System.out.println( "Finalized Document, id: " + docXML.getId()); // Get type of account String accountType = docXML.getAccount().getAccountType().getKnownType(); --- 89,109 ---- public void processTRIM( TolvenMessage tm ) throws Exception { System.out.println( "Processing TRIM document for account: " + tm.getAccountId()); ! DocXML docXML; ! // If the sender has never heard of our document, then create the document now. ! if (0==tm.getDocumentId()) { ! docXML = documentLocal.createXMLDocument( tm.getXmlNS(), tm.getAuthorId(), tm.getAccountId() ); ! System.out.println( "Document created, id: " + docXML.getId()); ! docXML.setContent(tm.getPayload()); ! System.out.println( "Document set payload, id: " + docXML.getId()); ! documentLocal.finalizeDocument(docXML); ! System.out.println( "Finalized Document, id: " + docXML.getId()); ! } else { ! // Document already exists, so get it. ! docXML = (DocXML) documentLocal.findDocument(tm.getDocumentId() ); ! System.out.println( "Document, id: " + docXML.getId() + " already exists"); ! } ! // We probably can't read the document we already have so we must use the payload ! // that was decrypted and sent to us. ! // Get type of account String accountType = docXML.getAccount().getAccountType().getKnownType(); *************** *** 103,106 **** --- 114,119 ---- AppEvalAdaptor app = new AppEvalAdaptor( docXML.getAccount()); app.init(menuLocal, workingMemory); + // Assert the document itself. + workingMemory.assertObject(docXML); // Assert a trim object and see what the rules do with it workingMemory.assertObject(trim); Index: RulesBaseFactory.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/RulesBaseFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RulesBaseFactory.java 4 Feb 2007 16:39:51 -0000 1.1 --- RulesBaseFactory.java 7 Feb 2007 01:37:50 -0000 1.2 *************** *** 28,66 **** public RuleBase open( String ruleFile) throws Exception { ! RuleBase ruleBase = ruleBases.get(ruleFile); ! if (ruleBase==null) { ! //read in the source ! ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); ! InputStream inputStream = classLoader.getResourceAsStream( ruleFile ); ! Reader source = new InputStreamReader( inputStream ); ! ! //optionally read in the DSL (if you are using it). ! //Reader dsl = new InputStreamReader( DroolsTest.class.getResourceAsStream( "/mylang.dsl" ) ); ! ! //Use package builder to build up a rule package. ! //An alternative lower level class called "DrlParser" can also be used... ! PackageBuilderConfiguration conf = new PackageBuilderConfiguration(); ! conf.setJavaLanguageLevel( "1.5" ); ! PackageBuilder builder = new PackageBuilder(conf); ! ! //this wil parse and compile in one step ! //NOTE: There are 2 methods here, the one argument one is for normal DRL. ! builder.addPackageFromDrl( source ); ! ! //Use the following instead of above if you are using a DSL: ! //builder.addPackageFromDrl( source, dsl ); ! ! //get the compiled package (which is serializable) ! Package pkg = builder.getPackage(); ! ! //add the package to a rulebase (deploy the rule package). ! ruleBase = RuleBaseFactory.newRuleBase(); ! ! ruleBase.addPackage( pkg ); ! // In any case, be sure we use equality, not identity for facts. ! System.setProperty(RuleBaseConfiguration.PROPERTY_ASSERT_BEHAVIOR, RuleBaseConfiguration.WM_BEHAVIOR_EQUALITY ); } - return ruleBase; } --- 28,72 ---- public RuleBase open( String ruleFile) throws Exception { ! System.out.println( "Opening rule file: " + ruleFile); ! try { ! RuleBase ruleBase = ruleBases.get(ruleFile); ! if (ruleBase==null) { ! //read in the source ! ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); ! InputStream inputStream = classLoader.getResourceAsStream( ruleFile ); ! Reader source = new InputStreamReader( inputStream ); ! ! //optionally read in the DSL (if you are using it). ! //Reader dsl = new InputStreamReader( DroolsTest.class.getResourceAsStream( "/mylang.dsl" ) ); ! //Use package builder to build up a rule package. ! //An alternative lower level class called "DrlParser" can also be used... ! PackageBuilderConfiguration conf = new PackageBuilderConfiguration(); ! conf.setJavaLanguageLevel( "1.5" ); ! PackageBuilder builder = new PackageBuilder(conf); ! ! //this wil parse and compile in one step ! //NOTE: There are 2 methods here, the one argument one is for normal DRL. ! builder.addPackageFromDrl( source ); ! ! //Use the following instead of above if you are using a DSL: ! //builder.addPackageFromDrl( source, dsl ); ! ! //get the compiled package (which is serializable) ! Package pkg = builder.getPackage(); ! ! //add the package to a rulebase (deploy the rule package). ! ruleBase = RuleBaseFactory.newRuleBase(); ! ! ruleBase.addPackage( pkg ); ! ! // In any case, be sure we use equality, not identity for facts. ! System.setProperty(RuleBaseConfiguration.PROPERTY_ASSERT_BEHAVIOR, RuleBaseConfiguration.WM_BEHAVIOR_EQUALITY ); ! } ! return ruleBase; ! } catch (Exception e) { ! System.out.println( "Error opening RuleBase: " + ruleFile + e.getMessage()); ! throw e; } } Index: TolvenMessage.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/TolvenMessage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TolvenMessage.java 20 Jan 2007 19:23:17 -0000 1.2 --- TolvenMessage.java 7 Feb 2007 01:37:50 -0000 1.3 *************** *** 18,21 **** --- 18,23 ---- private long authorId; + private long documentId; + public long getAccountId() { return accountId; *************** *** 27,30 **** --- 29,38 ---- return payload; } + /** + * Specify the document payload, eg a CCR or TRIM XML document. Upon receipt, the tolven evaluator + * will create a document containing this payload if the documentID is 0, otherwise, it will + * just verify that the doument exists. + * @return + */ public void setPayload(byte[] payload) { this.payload = payload; *************** *** 65,68 **** --- 73,90 ---- this.sender = sender; } + /** + * Specify that the target document, which should be in Active status and thus be immutable. + * the evaluator won't actually try to access the document contents directly since it will probably + * be encrypted under some else's id. + * If documentId is zero, then the evaluator will create a new document containing the payload of this + * message (creating a document is not subject to the same encryption restriction as reading it). + * @return + */ + public long getDocumentId() { + return documentId; + } + public void setDocumentId(long documentId) { + this.documentId = documentId; + } } |
From: John C. <jc...@us...> - 2007-02-07 01:37:51
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/app In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20665/src/org/tolven/app Modified Files: MenuLocal.java CreatorRemote.java CreatorLocal.java Log Message: New update logic Index: CreatorRemote.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/CreatorRemote.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CreatorRemote.java 4 Feb 2007 16:39:58 -0000 1.1 --- CreatorRemote.java 7 Feb 2007 01:37:50 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- import javax.xml.bind.JAXBException; + import org.tolven.app.entity.MenuData; import org.tolven.doc.entity.DocXML; import org.tolven.trim.util.TRIMException; *************** *** 20,22 **** --- 21,29 ---- */ public DocXML instantiate( long accountId, String path, Map<String, String> context ) throws JAXBException, TRIMException; + + /** + * Submit the specified document for processing (remote-friendly). + */ + public void submit( long documentId ) throws Exception; + } Index: CreatorLocal.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/CreatorLocal.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CreatorLocal.java 4 Feb 2007 16:39:58 -0000 1.1 --- CreatorLocal.java 7 Feb 2007 01:37:50 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- import javax.xml.bind.JAXBException; + import org.tolven.app.entity.MenuData; import org.tolven.app.entity.MenuStructure; import org.tolven.doc.entity.DocXML; *************** *** 23,25 **** --- 24,37 ---- public DocXML instantiate( long accountId, String path, Map<String, String> context ) throws JAXBException, TRIMException; + /** + * Submit the document associated with this menuData item + * @throws Exception + */ + public void submit( MenuData md ) throws Exception; + + /** + * Submit the specified document for processing. + */ + public void submit( DocXML docXML, byte[] payload ) throws Exception; + } Index: MenuLocal.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/MenuLocal.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MenuLocal.java 4 Feb 2007 16:39:58 -0000 1.15 --- MenuLocal.java 7 Feb 2007 01:37:50 -0000 1.16 *************** *** 179,181 **** --- 179,192 ---- */ public void loadTRIM( long accountId, String name, byte[] trimXML ); + + /** + * Remove any menuData item that references the specified document. This is usually done when a new document is submitted to + * remove it from "to do" lists. The rules will put the document back on any lists it should be on now that the + * document is "actionable". + * @param accountId + * @param documentId + * @return the number of rows actually deleted. + */ + public int removeReferencingMenuData( long accountId, long documentId); + } |
From: John C. <jc...@us...> - 2007-02-07 01:36:09
|
Update of /cvsroot/tolven/tolvenClient In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20160 Removed Files: jndi.properties Log Message: New tolvenClient code --- jndi.properties DELETED --- |
From: John C. <jc...@us...> - 2007-02-07 01:35:49
|
Update of /cvsroot/tolven/tolvenClient/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19795/src Added Files: jndi.properties Log Message: New tolvenClient code --- NEW FILE: jndi.properties --- java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=jnp://localhost:1099 java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces |
From: John C. <jc...@us...> - 2007-02-07 01:35:49
|
Update of /cvsroot/tolven/tolvenClient In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19795 Added Files: gcs.trim Log Message: New tolvenClient code --- NEW FILE: gcs.trim --- <?xml version="1.0" encoding="UTF-8"?> <trim xmlns="urn:tolven-org:trim:4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:tolven-org:trim:4.0 E:\tolvenWS\tolvenEJB\resources\xsd\trim4.xsd"> <act xsi:type="Act"> <!--templateId>urn:wikihit-org:PATIENT-ACT:0</templateId--> <classCode>OBS</classCode> <moodCode>EVN</moodCode> <code> <CD codeSystemName="UMLS" codeSystemVersion="2006AC" code="C0017594"/> </code> <title> <ST>Glasgow Coma Scale</ST> </title> <effectiveTime> <TS>123</TS> </effectiveTime> <activityTime> <null>ASKU</null> </activityTime> <observation> <value> <PQ> <value>23.0</value> <unit>mg/dL</unit> </PQ> </value> </observation> <participation typeCode="SBJ"> <role xsi:type="RoleBind"> <classCode>PAT</classCode> <templateId>echr:patient</templateId> </role> </participation> </act> </trim> |
Update of /cvsroot/tolven/tolvenClient/src/org/tolven/client In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19795/src/org/tolven/client Added Files: LoadTRIM.java TolvenClient.java CreateGCS.java Test2.java SendTolvenMessage.java TestLogin.java Log Message: New tolvenClient code --- NEW FILE: TolvenClient.java --- package org.tolven.client; import java.io.IOException; import java.security.GeneralSecurityException; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; import javax.security.jacc.PolicyContextException; import org.tolven.app.CreatorRemote; import org.tolven.app.MenuRemote; import org.tolven.core.AccountDAORemote; import org.tolven.core.ActivationRemote; import org.tolven.core.entity.AccountUser; import org.tolven.doc.DocumentRemote; import org.tolven.security.LoginRemote; import org.tolven.security.key.PrivateKeyRing; import org.tolven.security.key.UserKeyRing; import org.tolven.security.key.UserPrivateKey; public abstract class TolvenClient { public static final long accountId = 11800; public static final String uid = "cal"; public static final String password = "cal"; protected DocumentRemote docBean; protected AccountDAORemote accountBean; protected ActivationRemote activationBean; protected LoginRemote loginBean; protected MenuRemote menuBean; protected CreatorRemote creatorBean; private LoginContext lc; protected AccountUser accountUser; public TolvenClient() throws NamingException { InitialContext ctx = new InitialContext(); // Bind to the remote session bean interface in the running server via JNDI/RMI docBean = (DocumentRemote) ctx.lookup("tolven/DocumentBean/remote"); accountBean = (AccountDAORemote) ctx.lookup("tolven/AccountDAOBean/remote"); activationBean = (ActivationRemote) ctx.lookup("tolven/ActivationBean/remote"); loginBean = (LoginRemote) ctx.lookup("tolven/LoginBean/remote"); creatorBean = (CreatorRemote) ctx.lookup("tolven/CreatorBean/remote"); menuBean = (MenuRemote) ctx.lookup("tolven/MenuBean/remote"); } protected void setupPrivateKeyRing(AccountUser accountUser, Subject subject, UserKeyRing userKeyRing) throws PolicyContextException, GeneralSecurityException, IOException { UserPrivateKey userPrivateKey = null; userPrivateKey = userKeyRing.getUserPrivateKey(); userPrivateKey.unlockPrivateKey("cal".toCharArray()); PrivateKeyRing privateKeyRing = new PrivateKeyRing(userPrivateKey); subject.getPrivateCredentials().add(privateKeyRing); privateKeyRing.setAccountPrivateKey(accountUser.getAccountPrivateKey()); } static class UsernamePasswordHandler implements CallbackHandler { String username; char[] password; public UsernamePasswordHandler(String username, char[] password) { this.username = username; this.password = password; } public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { int len = callbacks.length; Callback cb; for(int i=0; i<len; i++) { cb = callbacks[i]; if(cb instanceof NameCallback) { NameCallback ncb = (NameCallback)cb; ncb.setName(username); } else if (cb instanceof PasswordCallback) { PasswordCallback pcb = (PasswordCallback)cb; pcb.setPassword(password); } else { throw new UnsupportedCallbackException(cb, "Unknown callback request"); } } } }; protected void login( String username, String password, long accountId ) throws PolicyContextException, GeneralSecurityException, IOException { // Login now System.out.println("Attempting to log in"); System.setProperty("java.security.auth.login.config", "tolven.auth"); UsernamePasswordHandler handler = new UsernamePasswordHandler(username, password.toCharArray()); lc = new LoginContext("tolvenLDAP", handler); lc.login(); // Get accountUser // This is unprotected (no login required) System.out.println("Attempting to get AccountUser for user: " + username + " Account: "+ accountId); accountUser = accountBean.findAccountUser( username, accountId); System.out.println("AccountUser id: " + accountUser.getId()); System.out.println("User logged in as:" + lc.getSubject().getPrincipals()); // This isn't actually used because we've commented the decryption below. // if ("true".equalsIgnoreCase(System.getProperty("tolven.security.keys.activate"))) { setupPrivateKeyRing( accountUser, lc.getSubject(), loginBean.findUserKeyRing(username) ); // } } protected void logout( ) throws LoginException { if (lc!=null) lc.logout(); lc = null; } } --- NEW FILE: LoadTRIM.java --- package org.tolven.client; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import javax.naming.NamingException; public class LoadTRIM extends TolvenClient { public LoadTRIM() throws NamingException { super(); // TODO Auto-generated constructor stub } private static long accountId = 11800; private static String directory = "."; private static String EXTENSION = ".trim"; static class TrimFilter implements FilenameFilter { public boolean accept(File dir, String name) { if (name.endsWith(EXTENSION)) return true; return false; } } public void runit() throws IOException { File dir = new File( directory ); File files[] = dir.listFiles(new TrimFilter()); for (File file : files) { InputStream input = new BufferedInputStream( new FileInputStream(file)); ByteArrayOutputStream trimXML = new ByteArrayOutputStream( ); int b; while( (b = input.read()) >=0 ) { trimXML.write(b); } String templateName = file.getName().substring(0, file.getName().length()-EXTENSION.length()); menuBean.loadTRIM( accountId, templateName, trimXML.toByteArray()); System.out.println( "File: " + file.getName()); } } /** * Load trim definitions to an account. * @param args * @throws Exception */ public static void main(String[] args) throws Exception { LoadTRIM lt = new LoadTRIM(); lt.runit(); } } --- NEW FILE: CreateGCS.java --- package org.tolven.client; import java.util.HashMap; import java.util.Map; import javax.naming.NamingException; import javax.xml.bind.JAXBException; import org.tolven.doc.entity.DocXML; import org.tolven.trim.util.TRIMException; public class CreateGCS extends TolvenClient { public CreateGCS() throws NamingException { super(); } /** * This depends on loadTRIM having been run with the GCS.trim xml file. * @throws JAXBException * @throws TRIMException */ public DocXML instantiate() throws JAXBException, TRIMException { Map<String, String> context = new HashMap<String, String>( 2); context.put("echr:patient", "echr:patient-658609"); DocXML doc = creatorBean.instantiate(11800, "echr:gcs", context); return doc; } public void submit( DocXML doc ) throws Exception { creatorBean.submit( doc.getId() ); } /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { CreateGCS gcs = new CreateGCS(); gcs.login(uid, password, accountId); DocXML doc = gcs.instantiate(); gcs.submit( doc); gcs.logout(); } } --- NEW FILE: SendTolvenMessage.java --- package org.tolven.client; import java.io.ByteArrayOutputStream; import javax.jms.ConnectionFactory; import javax.jms.Queue; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.security.auth.login.LoginContext; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import org.tolven.client.Test1.UsernamePasswordHandler; import org.tolven.core.AccountDAORemote; import org.tolven.core.ActivationRemote; import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.TolvenUser; import org.tolven.core.util.Queuer; import org.tolven.doc.DocumentRemote; import org.tolven.security.LoginRemote; import org.tolven.trim.Act; import org.tolven.trim.ActClass; import org.tolven.trim.ActMood; import org.tolven.trim.ActParticipation; import org.tolven.trim.ParticipationType; import org.tolven.trim.Role; import org.tolven.trim.RoleClass; import org.tolven.trim.RoleInternal; import org.tolven.trim.Trim; import org.tolven.trim.util.TrimFactory; public class SendTolvenMessage extends TolvenClient{ public static final long accountId = 11800; public static final long accountTypeId = 100; public static final String uid = "cal"; public static final String password = "cal"; static final String TRIM_NS = "urn:astm-org:trim:4.0"; static final String TRIM_Package = "org.tolven.trim"; static JAXBContext jc; static TrimFactory factory = new TrimFactory(); public SendTolvenMessage() throws NamingException { super(); } static JAXBContext setupJAXBContext() throws JAXBException { if( jc==null) { jc = JAXBContext.newInstance( TRIM_Package ); } return jc; } public static Trim createTrim1( ) { Act act = factory.createAct(ActClass.OBS, ActMood.EVN); // act.setInternalId("92994566"); factory.setCodeAsCD( act, "CBC", "MyRADSystem"); factory.addId( act, "4.5.6.7", "id12345"); factory.addId( act, "4.5.6.8", "xxxx9998-123"); addPatient( act, "echr:patient-659122" ); Trim trim = factory.createTrim(); trim.getActs().add(act); return trim; } public static void addPatient( Act act, String patientId ) { RoleInternal role = factory.createRoleInternal( RoleClass.PAT, patientId ); ActParticipation part = factory.createActParticipation(ParticipationType.SBJ, role); factory.addParticipation(act, part ); } void runit( ) throws Exception { Trim trim = createTrim1(); JAXBContext jc = setupJAXBContext( ); ByteArrayOutputStream output = new ByteArrayOutputStream( ); Marshaller m = jc.createMarshaller(); m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE ); m.marshal( trim, output ); docBean.queueMessage( output.toByteArray(), "urn:astm-org:trim:4.0", accountId, accountUser.getUser().getId()); // // This approach queues the message directly from the client // // But this doesn't work yet, not configured. // ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("/ConnectionFactory"); // Queue queue = (Queue) ctx.lookup("/queue/rule"); // Queuer q = new Queuer(); // q.init(connectionFactory, queue); // // q.close(); } public static void main(String[] args) throws Exception { SendTolvenMessage stm = new SendTolvenMessage(); stm.login(uid, password, accountId); stm.runit(); stm.logout(); } } --- NEW FILE: TestLogin.java --- package org.tolven.client; import javax.naming.NamingException; public class TestLogin extends TolvenClient { public static final long accountId = 11800; public static final String uid = "cal"; public static final String password = "cal"; public TestLogin() throws NamingException { super(); } public static void main(String[] args) throws Exception { TestLogin t = new TestLogin(); t.login(uid, password, accountId); t.logout(); } } --- NEW FILE: Test2.java --- package org.tolven.client; import javax.naming.InitialContext; import javax.naming.NamingException; import org.tolven.doc.DocumentRemote; public class Test2 { /** * Simple test calling Tolven via J2EE remote * @param args * @throws Exception * @throws GeneralSecurityException * @throws PolicyContextException * @throws IOException */ public static void main(String[] args) throws Exception { InitialContext ctx = new InitialContext(); // Bind to the remote session bean interface in the running server via JNDI/RMI DocumentRemote docBean = (DocumentRemote) ctx.lookup("tolven/DocumentBean/remote"); docBean.ruleTest(); } } |
From: Joseph I. <jos...@us...> - 2007-02-06 09:12:18
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19457/src/org/tolven/web Modified Files: TopAction.java Log Message: Removed the only two set methods for the accountUser instance variables in TopAction. They were noop anyway. Index: TopAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/TopAction.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** TopAction.java 6 Feb 2007 09:08:17 -0000 1.35 --- TopAction.java 6 Feb 2007 09:12:15 -0000 1.36 *************** *** 424,431 **** } - public void setAccountId(long accountId) { - //noop since this is now read from accountUser - } - public String getAccountTitle() { if(accountUser == null) { --- 424,427 ---- *************** *** 436,442 **** } - public void setAccountTitle(String accountTitle) { - //noop since this is now read from accountUser - } /** * Read-only attribute indicating if this user has permission to administer account or not. --- 432,435 ---- *************** *** 482,488 **** } } ! public void setAccountTimeZone(String accountTimeZone) { ! //noop since this is now read from accountUser ! } public String getAccountType() { if(accountUser == null) { --- 475,479 ---- } } ! public String getAccountType() { if(accountUser == null) { |
From: Joseph I. <jos...@us...> - 2007-02-06 09:08:19
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17760/src/org/tolven/web Modified Files: TopAction.java Log Message: Removed instance variables in favor of direct retrieval from accountUser. Index: TopAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/TopAction.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** TopAction.java 4 Feb 2007 06:23:53 -0000 1.34 --- TopAction.java 6 Feb 2007 09:08:17 -0000 1.35 *************** *** 16,20 **** import java.io.IOException; import java.security.GeneralSecurityException; - import java.util.Collection; import java.util.LinkedList; import java.util.List; --- 16,19 ---- *************** *** 23,27 **** import java.util.Set; - import javax.annotation.EJB; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; --- 22,25 ---- *************** *** 36,40 **** import org.tolven.core.ActivationLocal; import org.tolven.core.InvitationLocal; - import org.tolven.core.TolvenPropertiesLocal; import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.Status; --- 34,37 ---- *************** *** 61,77 **** private String startPage; - private String accountTitle; private long invitationId; private TolvenUser user; - private String accountType; private String timeZone; - private String accountTimeZone; private String postLoginAction; private TolvenPerson tp; private long accountUserId; - private long accountId; - private boolean accountAdmin; // One-time ignore default account --- 58,70 ---- private String startPage; private long invitationId; private TolvenUser user; private String timeZone; private String postLoginAction; private TolvenPerson tp; + AccountUser accountUser; private long accountUserId; // One-time ignore default account *************** *** 143,147 **** if (accountUserId!=0) { accountUser = activation.findAccountUser(accountUserId ); - accountType = accountUser.getAccount().getAccountType().getKnownType(); setPostLoginAction(accountUser.getAccount().getAccountType().getHomePage()); return "dispatch"; --- 136,139 ---- *************** *** 221,238 **** public void setAccountUser(AccountUser accountUser) throws PolicyContextException, GeneralSecurityException { accountUserId = accountUser.getId(); - // Save the account Id - we'll need it in subsequent requests - accountId = accountUser.getAccount().getId(); - setAccountTitle( accountUser.getAccount().getTitle()); - setAccountTimeZone( accountUser.getAccount().getTimeZone()); - accountType = accountUser.getAccount().getAccountType().getKnownType(); // Ensure that this user has a menu structure setup menuLocal.createDefaultMenuStructure( accountUser.getAccount() ); - // Before we get started, we need to tuck away the accountId in the session context since we'll need it - // during non-Faces interactions, notably AjaxServlet.java - // HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); - // session.setAttribute("accountId", accountId); // no longer needed - using top instead. - accountAdmin = accountUser.isAccountPermission(); - } --- 213,220 ---- public void setAccountUser(AccountUser accountUser) throws PolicyContextException, GeneralSecurityException { + this.accountUser = accountUser; accountUserId = accountUser.getId(); // Ensure that this user has a menu structure setup menuLocal.createDefaultMenuStructure( accountUser.getAccount() ); } *************** *** 435,451 **** public long getAccountId() { ! return accountId; } public void setAccountId(long accountId) { ! this.accountId = accountId; } public String getAccountTitle() { ! return accountTitle; } public void setAccountTitle(String accountTitle) { ! this.accountTitle = accountTitle; } /** --- 417,441 ---- public long getAccountId() { ! if(accountUser == null) { ! return 0; ! } else { ! return accountUser.getAccount().getId(); ! } } public void setAccountId(long accountId) { ! //noop since this is now read from accountUser } public String getAccountTitle() { ! if(accountUser == null) { ! return null; ! } else { ! return accountUser.getAccount().getTitle(); ! } } public void setAccountTitle(String accountTitle) { ! //noop since this is now read from accountUser } /** *************** *** 455,459 **** */ public boolean isAccountAdmin() { ! return accountAdmin; } --- 445,453 ---- */ public boolean isAccountAdmin() { ! if(accountUser == null) { ! return false; ! } else { ! return accountUser.isAccountPermission(); ! } } *************** *** 482,492 **** public String getAccountTimeZone() { ! return accountTimeZone; } public void setAccountTimeZone(String accountTimeZone) { ! this.accountTimeZone = accountTimeZone; } public String getAccountType() { ! return accountType; } --- 476,494 ---- public String getAccountTimeZone() { ! if(accountUser == null) { ! return null; ! } else { ! return accountUser.getAccount().getTimeZone(); ! } } public void setAccountTimeZone(String accountTimeZone) { ! //noop since this is now read from accountUser } public String getAccountType() { ! if(accountUser == null) { ! return null; ! } else { ! return accountUser.getAccount().getAccountType().getKnownType(); ! } } |
From: Joseph I. <jos...@us...> - 2007-02-06 08:18:42
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28233/src/org/tolven/web/security Modified Files: SecurityFilter.java VestibuleSecurityFilter.java GeneralSecurityFilter.java Log Message: GeneralSecurity now intercepts dispatch.jsf and interprets it as a home page request. Index: VestibuleSecurityFilter.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/VestibuleSecurityFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VestibuleSecurityFilter.java 6 Feb 2007 05:02:34 -0000 1.1 --- VestibuleSecurityFilter.java 6 Feb 2007 08:18:40 -0000 1.2 *************** *** 58,62 **** public class VestibuleSecurityFilter extends SecurityFilter implements Filter { - private static String TOP = "top"; private static String INVITATION_ID = "invitationId"; private static String TOLVEN_NOW = "tolvenNow"; --- 58,61 ---- *************** *** 84,88 **** } } - } --- 83,86 ---- Index: GeneralSecurityFilter.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/GeneralSecurityFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GeneralSecurityFilter.java 6 Feb 2007 05:02:34 -0000 1.1 --- GeneralSecurityFilter.java 6 Feb 2007 08:18:40 -0000 1.2 *************** *** 19,22 **** --- 19,24 ---- import java.util.Set; + import javax.naming.InitialContext; + import javax.naming.NamingException; import javax.security.auth.Subject; import javax.security.jacc.PolicyContext; *************** *** 30,35 **** --- 32,41 ---- import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import javax.servlet.http.HttpSession; + import org.tolven.core.ActivationLocal; + import org.tolven.core.entity.AccountUser; import org.tolven.security.key.PrivateKeyRing; + import org.tolven.web.TopAction; /** *************** *** 40,44 **** --- 46,60 ---- public class GeneralSecurityFilter extends SecurityFilter implements Filter { + private ActivationLocal activation; + public void init(FilterConfig config) throws ServletException { + if ("true".equalsIgnoreCase(System.getProperty("tolven.security.filter.activate"))) { + try { + InitialContext ctx = new InitialContext(); + activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); + } catch (NamingException e) { + throw new ServletException(e); + } + } } *************** *** 53,57 **** return; } ! Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); if (subject == null) { --- 69,73 ---- return; } ! Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); if (subject == null) { *************** *** 73,77 **** return; } ! Set<PrivateKeyRing> privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); if (privateCredentials.isEmpty()) { --- 89,93 ---- return; } ! Set<PrivateKeyRing> privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); if (privateCredentials.isEmpty()) { *************** *** 84,87 **** --- 100,124 ---- return; } + if (request.getRequestURL().indexOf("dispatch.jsf") != -1) { + HttpSession session = request.getSession(); + TopAction top = (TopAction) session.getAttribute(TOP); + System.out.println(getClass() + " :TOP=" + top); + try { + if (top == null) { + top = new TopAction(); + session.setAttribute(TOP, top); + } + AccountUser accountUser = activation.findAccountUser(top.getAccountUserId()); + if (accountUser == null) { + response.sendRedirect("../vestibule/selectAccount.jsf"); + return; + } + ((HttpServletResponse) servletResponse).sendRedirect("../private/" + accountUser.getAccount().getAccountType().getHomePage()); + } catch (Exception ex) { + ex.printStackTrace(); + response.sendRedirect("../vestibule/selectAccount.jsf"); + return; + } + } } catch (PolicyContextException ex) { ex.printStackTrace(); Index: SecurityFilter.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/SecurityFilter.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SecurityFilter.java 6 Feb 2007 05:02:34 -0000 1.8 --- SecurityFilter.java 6 Feb 2007 08:18:40 -0000 1.9 *************** *** 27,30 **** --- 27,32 ---- */ public abstract class SecurityFilter implements Filter { + + protected static String TOP = "top"; public void logout(String reason, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { |
From: Joseph I. <jos...@us...> - 2007-02-06 06:30:32
|
Update of /cvsroot/tolven/tolvenWEB/web/WEB-INF In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13198/web/WEB-INF Modified Files: web.xml Log Message: Divded the SecurityFilter into two classes: GeneralSecurityFilter and VestibuleSecurityFilter, protecting /private and /vestibule respectively. Index: web.xml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/WEB-INF/web.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** web.xml 4 Feb 2007 07:34:48 -0000 1.16 --- web.xml 6 Feb 2007 06:30:31 -0000 1.17 *************** *** 83,98 **** <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener--> <filter> ! <filter-name>SecurityFilter</filter-name> ! <filter-class>org.tolven.web.security.SecurityFilter</filter-class> </filter> <filter-mapping> ! <filter-name>SecurityFilter</filter-name> ! <url-pattern>/private/createAccount.jsf</url-pattern> </filter-mapping> <filter-mapping> ! <filter-name>SecurityFilter</filter-name> ! <url-pattern>/private/selectAccount.jsf</url-pattern> </filter-mapping> <servlet> <servlet-name>Faces Servlet</servlet-name> --- 83,105 ---- <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener--> + <filter> ! <filter-name>VestibuleSecurityFilter</filter-name> ! <filter-class>org.tolven.web.security.VestibuleSecurityFilter</filter-class> </filter> <filter-mapping> ! <filter-name>VestibuleSecurityFilter</filter-name> ! <url-pattern>/vestibule/*</url-pattern> </filter-mapping> + + <filter> + <filter-name>GeneralSecurityFilter</filter-name> + <filter-class>org.tolven.web.security.GeneralSecurityFilter</filter-class> + </filter> <filter-mapping> ! <filter-name>GeneralSecurityFilter</filter-name> ! <url-pattern>/private/*</url-pattern> </filter-mapping> + <servlet> <servlet-name>Faces Servlet</servlet-name> *************** *** 218,221 **** --- 225,243 ---- </user-data-constraint> </security-constraint> + <security-constraint> + <web-resource-collection> + <web-resource-name>Protected Area</web-resource-name> + <!-- Define the context-relative URL(s) to be protected --> + <!-- All resources protected unless otherwise listed in previous security-constraints --> + <url-pattern>/vestibule/*</url-pattern> + </web-resource-collection> + <auth-constraint> + <!-- Anyone with one of the listed roles may access this area --> + <role-name>*</role-name> + </auth-constraint> + <user-data-constraint> + <transport-guarantee>CONFIDENTIAL</transport-guarantee> + </user-data-constraint> + </security-constraint> <login-config> <auth-method>FORM</auth-method> |
From: Joseph I. <jos...@us...> - 2007-02-06 05:02:41
|
Update of /cvsroot/tolven/tolvenWEB/web/vestibule In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8094/web/vestibule Added Files: selectAccount.xhtml loggedOut.xhtml createAccount.xhtml Log Message: Divded the SecurityFilter into two classes: GeneralSecurityFilter and VestibuleSecurityFilter, protecting /private and /vestibule respectively. --- NEW FILE: createAccount.xhtml --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <ui:composition template="../templates/portalTemplate.xhtml"> <ui:param name="brand" value="brandt"/> <ui:param name="skin" value="echr"/> <ui:define name="content"> <h:form id="newAccountForm" > <h2>Create a new health record account</h2> <h:panelGrid columns="2"> <h:outputText value="Account Type"/> <h:selectOneMenu value="#{reg.newAccountTypeStr}" > <f:selectItems value="#{reg.accountDescs}" /> </h:selectOneMenu> <h:outputText value="Account Title"/> <h:inputText value="#{reg.newAccountTitle}" size="50" /> <h:outputText value="Timezone"/> <h:selectOneMenu value="#{reg.newTimeZone}" > <f:selectItems value="#{reg.timeZones}" /> </h:selectOneMenu> <h:selectBooleanCheckbox value="#{reg.genDemoData}" /> <h:outputText value="Add demo data to the account you create*"/> </h:panelGrid> <p>* If checked, a small family for a personal account or about 50 new patients will be created in a clinical account. </p> <h5>Clinical Account</h5> <p><b>This will take a few minutes.</b> You can add more patients to a clinical account later from the Account Administration page. </p> <p>The generated patients will have names and dates of birth corresponding to US population distribution. Addresses and zip codes are within the US roughly in proportion to US demographics. Patients may have been diagnosed with a disease many years ago but the data represented in this account will only go back 10 years or so. Not all pregnancies and not all diagnoses result in data being generated. This accounts for people that go elsewhere for care or decide not to seek further care. Only a few diagnoses are generated (so far). They are generated roughly in proportion to the occurance in the US population.</p> <p>As each patient is added to the patient list for the clinical account, each adult patient is given a user id consisting of the first and last name of the patient with a dot in between. eg Ficticious patient Nancy Cartwright would be given a username and password of nancy.cartwright (all lower case). Married couples will have their records in a combined family account. Some family accounts also have kids but the kids usually don't have a user id and therefore cannot login. Some people will just have one user and one medical record, their own, in an account.</p> <p>you can create a personal account for a family or just for yourself. However, for demo purposes, you should create a clinical account and then generate patients. This will also populate personal accounts which you can then access.</p> <h:commandButton action="cancel" immediate="true" value="Cancel"/> <h:commandButton action="#{reg.createNewAccount}" value="Create Account"/> </h:form> </ui:define> </ui:composition> </body> </html> --- NEW FILE: loggedOut.xhtml --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Cache-Control" content="no-cache" /> <title>Logged out of Tolven</title> <link rel="stylesheet" href="#{facesContext.externalContext.request.contextPath}/styles/tolven6.css" type="text/css" /> </head> <body> <div class="header"> <div class="brandt"></div> </div> <h1>Logged Out</h1> <div class="pane"> <p>Thank you for using Tolven. You are now logged out. <h:outputLink value="#{facesContext.externalContext.request.contextPath}/private/dispatch.jsf"> <h:outputText value=" login again"/> </h:outputLink> </p> </div> </body> </html> --- NEW FILE: selectAccount.xhtml --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <ui:composition template="../templates/portalTemplate.xhtml"> <ui:param name="brand" value="brandt"/> <ui:param name="skin" value="echr"/> <ui:define name="content"> <div id="paneArea" class="pane"> <h:form id="accountForm" > <h:panelGroup rendered="#{invitation.openInvitationCount!=0}"> <h2>You have the following Invitations</h2> <h:dataTable id="invites" value="#{invitation.openInvitations}" var="item" border="1" cellspacing="0"> <f:facet name="header"> <h:outputText value="Invitations"/> </f:facet> <h:column> <f:facet name="header"> <h:outputText value="InvitationId"/> </f:facet> <h:outputText value="#{item.id}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Purpose"/> </f:facet> <h:commandLink action="#{invitation.executeInvitation}" > <f:param name="invitationId" value="${item.id}"/> <h:outputText value="#{item.title}"/> </h:commandLink> </h:column> </h:dataTable> </h:panelGroup> <h:panelGroup rendered="#{acc.accountUserCount!=0}"> <h2>Select the account you would like to log into</h2> <h:selectBooleanCheckbox value="#{top.rememberDefault}"/> <h:outputText value="Remember my choice below and go there directly the next time I login"/> <h:dataTable id="accounts" value="#{acc.accountUsers}" var="item" border="1" cellspacing="0"> <f:facet name="header"> <h:outputText value="Accounts"/> </f:facet> <h:column> <f:facet name="header"> <h:outputText value="AccountId"/> </f:facet> <h:outputText value="#{item.account.id}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Account Type"/> </f:facet> <h:outputText value="#{item.account.accountType.knownType}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Title"/> </f:facet> <h:outputText value="#{item.account.title}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Action"/> </f:facet> <h:commandLink action="#{top.postLogin}" value="Login"> <f:param name="accountUserId" value="${item.id}"/> </h:commandLink> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Comments"/> </f:facet> </h:column> </h:dataTable> </h:panelGroup> <h:commandLink action="createAccount"> <h:outputText value="Create a new clinical or personal account"/> </h:commandLink> </h:form> </div> </ui:define> </ui:composition> </body> </html> |
From: Joseph I. <jos...@us...> - 2007-02-06 05:02:41
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8094/src/org/tolven/web/security Modified Files: SecurityFilter.java Added Files: VestibuleSecurityFilter.java GeneralSecurityFilter.java Log Message: Divded the SecurityFilter into two classes: GeneralSecurityFilter and VestibuleSecurityFilter, protecting /private and /vestibule respectively. --- NEW FILE: VestibuleSecurityFilter.java --- /* * Copyright (C) 2006 Tolven Inc * * This library is free software; you can redistribute it and/or modify it under the terms of * the GNU Lesser General Public License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Contact: in...@to... */ package org.tolven.web.security; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.Principal; import java.security.acl.Group; import java.util.Date; import java.util.Set; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.security.auth.Subject; import javax.security.jacc.PolicyContext; import javax.security.jacc.PolicyContextException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.xml.bind.JAXBException; import org.tolven.core.ActivationLocal; import org.tolven.core.InvitationLocal; import org.tolven.core.bean.InvitationException; import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.Status; import org.tolven.core.entity.TolvenUser; import org.tolven.security.LoginLocal; import org.tolven.security.key.PrivateKeyRing; import org.tolven.security.key.UserPrivateKey; import org.tolven.security.key.UserPublicKey; import org.tolven.web.TolvenContext; import org.tolven.web.TopAction; /** * The original post-login code, which was located in the class TopAction (author John Churin), has been copied to this * location in order to use filters to provide greater flexibility in controlling access to accounts after login * * @author Joseph Isaac */ public class VestibuleSecurityFilter extends SecurityFilter implements Filter { private static String TOP = "top"; private static String INVITATION_ID = "invitationId"; private static String TOLVEN_NOW = "tolvenNow"; private static String ACCOUNTUSER_ID = "accountUserId"; private ActivationLocal activation; private LoginLocal loginBean; private InvitationLocal invitationBean; private TolvenContext tolvenContext; public void init(FilterConfig config) throws ServletException { if ("true".equalsIgnoreCase(System.getProperty("tolven.security.filter.activate"))) { try { InitialContext ctx = new InitialContext(); activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); loginBean = (LoginLocal) ctx.lookup("tolven/LoginBean/local"); invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); //TODO: This needs to be done once per deployment and thus may need to be moved if (tolvenContext == null) { tolvenContext = new TolvenContext(); tolvenContext.initialize(); } } catch (NamingException e) { throw new ServletException(e); } } } public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { if ("true".equalsIgnoreCase(System.getProperty("tolven.security.filter.activate"))) { try { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; System.out.println(getClass() + " :REQUEST=" + request.getRequestURL()); if (!request.isRequestedSessionIdValid()) { logout("INVALID SESSION", request, response); return; } Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); if (subject == null) { logout("NO SUBJECT", request, response); return; } Principal principal = null; Object obj = null; for (java.util.Iterator iter = subject.getPrincipals().iterator(); iter.hasNext();) { obj = iter.next(); if (obj instanceof Principal && !(obj instanceof Group)) { principal = (Principal) obj; break; } } if (principal == null) { logout("NO PRINCIPAL", request, response); return; } String principalName = principal.getName(); Set<PrivateKeyRing> privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); if (privateCredentials.isEmpty()) { logout("NO PRIVATE KEY RING", request, response); return; } PrivateKeyRing privateKeyRing = (PrivateKeyRing) privateCredentials.iterator().next(); // PHASE ONE: User Authentication HttpSession session = request.getSession(); TopAction top = (TopAction) session.getAttribute(TOP); if (top == null) { top = new TopAction(); session.setAttribute(TOP, top); } TolvenUser user = top.getUser(); boolean justLoggedIn = user == null; if (justLoggedIn) { user = activation.loginUser(principalName, (Date) request.getAttribute(TOLVEN_NOW)); top.setUser(user); } if ((user == null || Status.NEW_LOGIN.value().equalsIgnoreCase(user.getStatus())) && request.getParameter(INVITATION_ID) != null) { // Since we have no user yet, we'll try executing an activation invitation (if it works) long invitationId = Long.parseLong(request.getParameter(INVITATION_ID)); Date now = (Date) request.getAttribute(TOLVEN_NOW); if (!loginBean.activate(principalName, invitationId, now)) { logout("COULD NOT ACTIVATE INVITATION", request, response); return; } // try TolvenUser again user = activation.loginUser(principalName, now); if (user == null) { logout("COULD NOT COMPLETE ACTIVATION", request, response); return; } else { top.setUser(user); } invitationBean.executeInvitation(invitationId, now); } if (user == null) { logout("USER IS NULL", request, response); return; } if (!user.hasUserPrivateKey()) { addKeysToUser(user, subject); } // PHASE TWO: Account Authentication String accountUserIdString = request.getParameter(ACCOUNTUSER_ID); if (accountUserIdString != null && accountUserIdString.trim().length() > 0) { // User has selected an account home page, identify the page and let them through AccountUser accountUser = activation.findAccountUser(Long.parseLong(accountUserIdString.trim())); if (accountUser == null) { logout("ACCOUNTUSER IS NULL", request, response); return; } // SAFETY CHECK HERE - Don't trust the accountUserId alone, it must match user. if (accountUser.getUser().getId() != user.getId()) { logout("ACCOUNTUSER DOES NOT BELONG TO USER", request, response); return; } // Give TolvenUser the AccountPrivateKey for the selected account privateKeyRing.setAccountPrivateKey(accountUser.getAccountPrivateKey()); top.setAccountUser(accountUser); ((HttpServletResponse) servletResponse).sendRedirect("../private/" + accountUser.getAccount().getAccountType().getHomePage()); return; } // If user has not been sent on there way by here, take away the user's AccountPrivateKey for the current account if one exists privateKeyRing.setAccountPrivateKey(null); if (justLoggedIn) { // Allow through...No password is required } else { // sendRedirect to password page } } catch (PolicyContextException ex) { ex.printStackTrace(); throw new ServletException(ex); } catch (NamingException ex) { ex.printStackTrace(); throw new ServletException(ex); } catch (InvitationException ex) { ex.printStackTrace(); throw new ServletException(ex); } catch (JAXBException ex) { ex.printStackTrace(); throw new ServletException(ex); } catch (GeneralSecurityException ex) { ex.printStackTrace(); throw new ServletException(ex); } } chain.doFilter(servletRequest, servletResponse); } /** * Add Keys from the Subject to what should be a new TolvenUser who is logging in * @throws PolicyContextException * @throws GeneralSecurityException */ private void addKeysToUser(TolvenUser aTolvenUser, Subject subject) throws GeneralSecurityException { Set<PrivateKeyRing> privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); if (privateCredentials.isEmpty()) throw new GeneralSecurityException(getClass() + " :No PrivateKeyRing found for " + aTolvenUser.getLdapUID()); UserPrivateKey userPrivateKey = privateCredentials.iterator().next().getUserPrivateKey(); if (userPrivateKey == null) throw new GeneralSecurityException(getClass() + " :No UserPrivateKey found for " + aTolvenUser.getLdapUID()); Set<UserPublicKey> publicCredentials = subject.getPublicCredentials(UserPublicKey.class); if (publicCredentials.isEmpty()) throw new GeneralSecurityException(getClass() + " :No UserPublicKey found for " + aTolvenUser.getLdapUID()); if (!aTolvenUser.hasUserPrivateKey()) { aTolvenUser.setUserPrivateKey(userPrivateKey); aTolvenUser.setUserPublicKey(publicCredentials.iterator().next()); } } public void destroy() { } } --- NEW FILE: GeneralSecurityFilter.java --- /* * Copyright (C) 2006 Tolven Inc * * This library is free software; you can redistribute it and/or modify it under the terms of * the GNU Lesser General Public License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Contact: in...@to... */ package org.tolven.web.security; import java.io.IOException; import java.security.Principal; import java.security.acl.Group; import java.util.Set; import javax.security.auth.Subject; import javax.security.jacc.PolicyContext; import javax.security.jacc.PolicyContextException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.tolven.security.key.PrivateKeyRing; /** * This class guards the /private area, checking that users are logged into both Tolven and restricted to an Account * * @author Joseph Isaac */ public class GeneralSecurityFilter extends SecurityFilter implements Filter { public void init(FilterConfig config) throws ServletException { } public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { if ("true".equalsIgnoreCase(System.getProperty("tolven.security.filter.activate"))) { try { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; System.out.println(getClass() + " :REQUEST=" + request.getRequestURL()); if (!request.isRequestedSessionIdValid()) { logout("INVALID SESSION", request, response); return; } Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); if (subject == null) { logout("NO SUBJECT", request, response); return; } Principal principal = null; Object obj = null; for (java.util.Iterator iter = subject.getPrincipals().iterator(); iter.hasNext();) { obj = iter.next(); if (obj instanceof Principal && !(obj instanceof Group)) { principal = (Principal) obj; break; } } if (principal == null) { logout("NO PRINCIPAL", request, response); return; } Set<PrivateKeyRing> privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); if (privateCredentials.isEmpty()) { logout("NO PRIVATE KEY RING", request, response); return; } PrivateKeyRing privateKeyRing = (PrivateKeyRing) privateCredentials.iterator().next(); if (privateKeyRing.getAccountPrivateKey() == null) { response.sendRedirect("../vestibule/selectAccount.jsf"); return; } } catch (PolicyContextException ex) { ex.printStackTrace(); throw new ServletException(ex); } } chain.doFilter(servletRequest, servletResponse); } public void destroy() { } } Index: SecurityFilter.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/SecurityFilter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SecurityFilter.java 5 Feb 2007 00:08:30 -0000 1.7 --- SecurityFilter.java 6 Feb 2007 05:02:34 -0000 1.8 *************** *** 15,229 **** import java.io.IOException; - import java.security.GeneralSecurityException; - import java.security.Principal; - import java.security.acl.Group; - import java.util.Date; - import java.util.Set; - - import javax.naming.InitialContext; - import javax.naming.NamingException; - import javax.security.auth.Subject; - import javax.security.jacc.PolicyContext; - import javax.security.jacc.PolicyContextException; import javax.servlet.Filter; - import javax.servlet.FilterChain; - import javax.servlet.FilterConfig; import javax.servlet.ServletException; - import javax.servlet.ServletRequest; - import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import javax.servlet.http.HttpSession; - import javax.xml.bind.JAXBException; - import org.tolven.core.ActivationLocal; - import org.tolven.core.InvitationLocal; - import org.tolven.core.bean.InvitationException; - import org.tolven.core.entity.AccountUser; - import org.tolven.core.entity.Status; - import org.tolven.core.entity.TolvenUser; - import org.tolven.security.LoginLocal; - import org.tolven.security.key.PrivateKeyRing; - import org.tolven.security.key.UserPrivateKey; - import org.tolven.security.key.UserPublicKey; - import org.tolven.web.TolvenContext; - import org.tolven.web.TopAction; /** ! * The original post-login code, which was located in the class TopAction (author John Churin), has been copied to this ! * location in order to use filters to provide greater flexibility in controlling access to accounts after login * * @author Joseph Isaac */ ! public class SecurityFilter implements Filter { ! ! private static String TOP = "top"; ! private static String INVITATION_ID = "invitationId"; ! private static String TOLVEN_NOW = "tolvenNow"; ! private static String ACCOUNTUSER_ID = "accountUserId"; ! ! private ActivationLocal activation; ! private LoginLocal loginBean; ! private InvitationLocal invitationBean; ! private TolvenContext tolvenContext; ! ! public void init(FilterConfig config) throws ServletException { ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.filter.activate"))) { ! try { ! InitialContext ctx = new InitialContext(); ! activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); ! loginBean = (LoginLocal) ctx.lookup("tolven/LoginBean/local"); ! invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); ! //TODO: This needs to be done once per deployment and thus may need to be moved ! if (tolvenContext == null) { ! tolvenContext = new TolvenContext(); ! tolvenContext.initialize(); ! } ! } catch (NamingException e) { ! throw new ServletException(e); ! } ! } ! ! } ! ! public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.filter.activate"))) { ! try { ! HttpServletRequest request = (HttpServletRequest) servletRequest; ! Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); ! if (subject != null) { ! Principal principal = null; ! Object obj = null; ! for (java.util.Iterator iter = subject.getPrincipals().iterator(); iter.hasNext();) { ! obj = iter.next(); ! if (obj instanceof Principal && !(obj instanceof Group)) { ! principal = (Principal) obj; ! break; ! } ! } ! if (principal == null) { ! System.out.println(getClass() + ": NO PRINCIPAL REDIRECT TO NOWHERE"); ! ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); ! return; ! } ! String principalName = principal.getName(); ! // PHASE ONE: User Authentication ! HttpSession session = request.getSession(); ! TopAction top = (TopAction) session.getAttribute(TOP); ! if (top == null) ! session.setAttribute(TOP, new TopAction()); ! TolvenUser user = top.getUser(); ! boolean justLoggedIn = user == null; ! if (justLoggedIn) { ! user = activation.loginUser(principalName, (Date) request.getAttribute(TOLVEN_NOW)); ! top.setUser(user); ! } ! if ((user == null || Status.NEW_LOGIN.value().equalsIgnoreCase(user.getStatus())) && request.getParameter(INVITATION_ID) != null) { ! // Since we have no user yet, we'll try executing an activation invitation (if it works) ! long invitationId = Long.parseLong(request.getParameter(INVITATION_ID)); ! Date now = (Date) request.getAttribute(TOLVEN_NOW); ! if (!loginBean.activate(principalName, invitationId, now)) { ! System.out.println(getClass() + ": COULD NOT ACTIVATE INVITATION REDIRECT TO NOWHERE"); ! ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); ! return; ! } ! // try TolvenUser again ! user = activation.loginUser(principalName, now); ! if (user == null) { ! System.out.println(getClass() + ": COULD NOT COMPLETE ACTIVATION REDIRECT TO NOWHERE"); ! ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); ! return; ! } else { ! top.setUser(user); ! } ! invitationBean.executeInvitation(invitationId, now); ! } ! if (user == null) { ! System.out.println(getClass() + ": USER IS NULL REDIRECT TO NOWHERE"); ! ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); ! return; ! } ! if (!user.hasUserPrivateKey()) { ! addKeysToUser(user, subject); ! } ! // PHASE TWO: Account Authentication ! Set<PrivateKeyRing> privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); ! if (privateCredentials.isEmpty()) { ! System.out.println(getClass() + ": NO PRIVATE KEY RING REDIRECT TO NOWHERE"); ! ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); ! return; ! } ! PrivateKeyRing privateKeyRing = (PrivateKeyRing) privateCredentials.iterator().next(); ! String accountUserIdString = request.getParameter(ACCOUNTUSER_ID); ! if (accountUserIdString != null && accountUserIdString.trim().length() > 0) { ! // User has selected an account home page ! AccountUser accountUser = activation.findAccountUser(Long.parseLong(accountUserIdString.trim())); ! if (accountUser == null) { ! System.out.println(getClass() + ": NO ACCOUNTUSER REDIRECT TO NOWHERE"); ! ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); ! return; ! } ! // SAFETY CHECK HERE - Don't trust the accountUserId alone, it must match user. ! if (accountUser.getUser().getId() != user.getId()) { ! System.out.println(getClass() + ": ACCOUNTUSER DOES NOT BELONG TO USER REDIRECT TO NOWHERE"); ! ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); ! return; ! } ! // Give TolvenUser the AccountPrivateKey for the selected account ! privateKeyRing.setAccountPrivateKey(accountUser.getAccountPrivateKey()); ! top.setAccountUser(accountUser); ! ((HttpServletResponse) servletResponse).sendRedirect(accountUser.getAccount().getAccountType().getHomePage()); ! return; ! } ! // Take away the user's AccountPrivateKey for the current account if one exists ! privateKeyRing.setAccountPrivateKey(null); ! if (justLoggedIn) { ! // Allow through...No password is required ! } else { ! // sendRedirect to password page ! } ! } ! } catch (PolicyContextException ex) { ! ex.printStackTrace(); ! throw new ServletException(ex); ! } catch (NamingException ex) { ! ex.printStackTrace(); ! throw new ServletException(ex); ! } catch (InvitationException ex) { ! ex.printStackTrace(); ! throw new ServletException(ex); ! } catch (JAXBException ex) { ! ex.printStackTrace(); ! throw new ServletException(ex); ! } catch (GeneralSecurityException ex) { ! ex.printStackTrace(); ! throw new ServletException(ex); ! } ! } ! chain.doFilter(servletRequest, servletResponse); ! } ! ! /** ! * Add Keys from the Subject to what should be a new TolvenUser who is logging in ! * @throws PolicyContextException ! * @throws GeneralSecurityException ! */ ! private void addKeysToUser(TolvenUser aTolvenUser, Subject subject) throws GeneralSecurityException { ! Set<PrivateKeyRing> privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); ! if (privateCredentials.isEmpty()) ! throw new GeneralSecurityException(getClass() + ": No PrivateKeyRing found for " + aTolvenUser.getLdapUID()); ! UserPrivateKey userPrivateKey = privateCredentials.iterator().next().getUserPrivateKey(); ! if (userPrivateKey == null) ! throw new GeneralSecurityException(getClass() + ": No UserPrivateKey found for " + aTolvenUser.getLdapUID()); ! Set<UserPublicKey> publicCredentials = subject.getPublicCredentials(UserPublicKey.class); ! if (publicCredentials.isEmpty()) ! throw new GeneralSecurityException(getClass() + ": No UserPublicKey found for " + aTolvenUser.getLdapUID()); ! if (!aTolvenUser.hasUserPrivateKey()) { ! aTolvenUser.setUserPrivateKey(userPrivateKey); ! aTolvenUser.setUserPublicKey(publicCredentials.iterator().next()); ! } ! } ! ! public void destroy() { } --- 15,35 ---- import java.io.IOException; import javax.servlet.Filter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** ! * An abstract class to handle common security filtering operations * * @author Joseph Isaac */ ! public abstract class SecurityFilter implements Filter { ! ! public void logout(String reason, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ! System.out.println(getClass() + ":INVALIDATE SESSION: " + reason + " : LOGOUT"); ! request.getSession().invalidate(); ! response.sendRedirect("../vestibule/loggedOut.jsf"); } |
From: Joseph I. <jos...@us...> - 2007-02-06 05:02:41
|
Update of /cvsroot/tolven/tolvenWEB/web/vestibule In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8084/web/vestibule Log Message: Directory /cvsroot/tolven/tolvenWEB/web/vestibule added to the repository |
From: Joseph I. <jos...@us...> - 2007-02-05 00:08:31
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16842/src/org/tolven/web/security Modified Files: SecurityFilter.java Log Message: minor comment changes Index: SecurityFilter.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/SecurityFilter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SecurityFilter.java 4 Feb 2007 22:13:17 -0000 1.6 --- SecurityFilter.java 5 Feb 2007 00:08:30 -0000 1.7 *************** *** 93,97 **** Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); if (subject != null) { - System.out.println(getClass() + ": Subject=" + subject); Principal principal = null; Object obj = null; --- 93,96 ---- *************** *** 104,108 **** } if (principal == null) { ! System.out.println(getClass() + ": NO FILTER REDIRECT TO NOWHERE"); ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); return; --- 103,107 ---- } if (principal == null) { ! System.out.println(getClass() + ": NO PRINCIPAL REDIRECT TO NOWHERE"); ((HttpServletResponse) servletResponse).sendRedirect("nowhere.jsf"); return; |
From: Joseph I. <jos...@us...> - 2007-02-04 22:13:19
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv971/src/org/tolven/web/security Modified Files: SecurityFilter.java Log Message: The property for activating the filter is now: tolven.security.filter.activate Index: SecurityFilter.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/SecurityFilter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SecurityFilter.java 4 Feb 2007 08:39:08 -0000 1.5 --- SecurityFilter.java 4 Feb 2007 22:13:17 -0000 1.6 *************** *** 69,84 **** public void init(FilterConfig config) throws ServletException { ! try { ! InitialContext ctx = new InitialContext(); ! activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); ! loginBean = (LoginLocal) ctx.lookup("tolven/LoginBean/local"); ! invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); ! //TODO: This needs to be done once per deployment and thus may need to be moved ! if (tolvenContext == null) { ! tolvenContext = new TolvenContext(); ! tolvenContext.initialize(); } - } catch (NamingException e) { - throw new ServletException(e); } --- 69,86 ---- public void init(FilterConfig config) throws ServletException { ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.filter.activate"))) { ! try { ! InitialContext ctx = new InitialContext(); ! activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); ! loginBean = (LoginLocal) ctx.lookup("tolven/LoginBean/local"); ! invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); ! //TODO: This needs to be done once per deployment and thus may need to be moved ! if (tolvenContext == null) { ! tolvenContext = new TolvenContext(); ! tolvenContext.initialize(); ! } ! } catch (NamingException e) { ! throw new ServletException(e); } } *************** *** 86,90 **** public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.keys.activate"))) { try { HttpServletRequest request = (HttpServletRequest) servletRequest; --- 88,92 ---- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.filter.activate"))) { try { HttpServletRequest request = (HttpServletRequest) servletRequest; |
From: John C. <jc...@us...> - 2007-02-04 21:31:24
|
Update of /cvsroot/tolven/tolvenEJB/resources/rules In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv15480/resources/rules Added Files: echr.drl Log Message: initial checkin of preliminary rules --- NEW FILE: echr.drl --- package test.rules import java.util.*; import org.tolven.trim.*; import java.lang.Integer; import org.tolven.app.entity.MenuStructure; import org.tolven.app.entity.MenuData; global org.tolven.app.bean.AppEvalAdaptor app; /** * See what we can do with a TRIM object */ rule "trim" when $trim: Trim() then for (ActSlot act : $trim.getActs()) assert( act ); end rule "act rule" when $act: Act( $id : id, $effectiveTime : effectiveTime ) then assert( $id ); assert( $effectiveTime ); for (ActParticipation part : $act.getParticipations() ) { assert ( part ); } System.out.println( "Act: " + $act ); end /** * Match a subject participation. * There may be more than one subject. If it results in the same patient, then that gets reduced to * a single facts since we manage facts by equality (not identity). */ rule "subject rule" when $subject: ActParticipation( typeCode == ParticipationType.SBJ ) then assert( $subject.getRole() ); System.out.println( "Got a subject" ); end /** * If we get a pointer to a patient, and there's metadata that cares about patient, * lookup the patient explicitly. We then bind to the menuData * thereafter. */ rule "Patient rule" when $pat: RoleInternal( classCode == RoleClass.PAT, $internalId : internalId ) $ms: MenuStructure( role == "placeholder", path == "echr:patient" ) then assert( app.findMenuData( $ms, $internalId ) ); System.out.println( "Got a patient id" + $internalId ); end /** * Really just to prove that we got the menuData item */ rule "Patient menuData rule" when $ms: MenuStructure( role == "placeholder", path == "echr:patient" ) $md: MenuData( menuStructure == $ms, $id : id, $path : path, $name : string01 ) then System.out.println( "MenuData id: " + $id + " Path: " + $path + " Name: " + $name ); end rule "act is event rule" when $act: Act( moodCode == ActMood.EVN ) then System.out.println( "Act: " + $act + " is in event mood" ); end rule "act is obs rule" when $act: Act( classCode == ActClass.OBS ) then System.out.println( "Act: " + $act + " is an Observation" ); end rule "act is event observation rule" when $act: Act( moodCode == ActMood.EVN, classCode == ActClass.OBS ) then System.out.println( "Act: " + $act + " is an observation event" ); end rule "Display ID slot" when $slot: SETIISlot() then for (II ii : $slot.getIIS( )) assert( ii ); end rule "display II" when $ii: II(); then System.out.println( "ID: " + $ii.getRoot() + "/" + $ii.getExtension() ); end rule "Display GTS slot" when $slot: GTSSlot() then System.out.println( "TS:" + $slot.getTS( )); end rule "Display MS placeholders" when $ms: MenuStructure( role == "placeholder") then System.out.println( "Placeholder: " + $ms.getPath( )); end /* Not a very interesting rule right now rule "Display MS lists" when $ms: MenuStructure( role == "list") then System.out.println( "Account: " + app.getAccount().getId() + " List: " + $ms.getPath( )); end */ |
From: John C. <jc...@us...> - 2007-02-04 16:43:34
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23026/src/org/tolven/web Modified Files: MenuAction.java Log Message: Adding support for instantiation Index: MenuAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/MenuAction.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** MenuAction.java 21 Jan 2007 00:00:45 -0000 1.30 --- MenuAction.java 4 Feb 2007 16:43:00 -0000 1.31 *************** *** 39,42 **** --- 39,43 ---- import org.jfree.data.xy.XYDataset; import org.jfree.ui.RectangleInsets; + import org.tolven.app.CreatorLocal; import org.tolven.app.MenuLocal; import org.tolven.app.bean.MenuPath; *************** *** 48,53 **** --- 49,57 ---- import org.tolven.doc.XMLLocal; import org.tolven.doc.XMLProtectedLocal; + import org.tolven.doc.bean.XMLBean; + import org.tolven.doc.entity.CCRException; import org.tolven.doc.entity.DocBase; import org.tolven.doc.entity.DocCCR; + import org.tolven.doc.entity.DocXML; /** * Faces Action Bean concerned with menu configuration and display. Note that menus include both metadata (MenuStructure) and *************** *** 69,72 **** --- 73,78 ---- private DocumentLocal documentLocal; private XMLProtectedLocal xmlProtectedLocal; + private CreatorLocal creatorBean; + private String givenName; private List<MenuStructure> menus = null; *************** *** 78,81 **** --- 84,88 ---- InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 + creatorBean = (CreatorLocal) ctx.lookup("tolven/CreatorBean/local"); menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); *************** *** 425,428 **** --- 432,483 ---- return graphURL; } + static final String TRIM_NS = "urn:astm-org:trim:4.0"; + + /** + * Create a brand new patient + * @return + * @throws CCRException + */ + public String createPatient() throws CCRException { + // Get the menu metadata for a patient + MenuStructure msPatient = menuLocal.findMenuStructure( getAccountId(), "echr:patient" ); + // We'll create the new instance right here (for simplicity) + // Start with a document + DocXML doc = documentLocal.createXMLDocument(TRIM_NS, getTop().getUser().getId(), getAccountId()); + + // Create a new MenuData (placeholder) + MenuData newPatient = new MenuData(); + newPatient.setMenuStructure(msPatient); + newPatient.setAccount(doc.getAccount()); + newPatient.setDocumentId(doc.getId()); + newPatient.setString01("New"); + newPatient.setString02( "Patient"); + newPatient.setString03( "X"); + newPatient.setDate01(getNow()); + menuLocal.persistMenuData(newPatient); + System.out.println( "[createPatient] patient=" + newPatient.getId() + " Doc id: " + doc.getId() ); + + return "success"; + } + + // /** + // * When selecting a trim metadata item, we instantiate the trim object into a document which can + // * then be edited. The document we create remains a working document until the user submits/signs + // * it at which time it becomes immutable and is sent to the evaluator. + // */ + // public String instantiate() { + // String patientPath = getTargetMenuPath().getSubPath("patient"); + // MenuStructure patientMS = menuLocal.findMenuStructure( getAccountId(), patientPath ); + // creatorBean.instantiate(ms, context); + // return "success"; + // } + // + // /** + // * Submit the current menu item, which must be a wizard + // * @return + // */ + // public String submit( ) { + // + // } /** *************** *** 487,489 **** --- 542,558 ---- return "success"; } + + public String getGivenName() { + return givenName; + } + + public void setGivenName(String givenName) { + this.givenName = givenName; + } + + public void submitPersonal( ) { + String patientPath = getTargetMenuPath().getSubPathWithIds("patient"); + System.out.println( "Account: " + getAccountId() + " Path: " + patientPath +" Name is: " + getGivenName() ); + } + } \ No newline at end of file |
From: John C. <jc...@us...> - 2007-02-04 16:43:08
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/ajax In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23026/src/org/tolven/ajax Modified Files: DocServlet.java Log Message: Adding support for instantiation Index: DocServlet.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/ajax/DocServlet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DocServlet.java 16 Jan 2007 06:26:19 -0000 1.7 --- DocServlet.java 4 Feb 2007 16:43:00 -0000 1.8 *************** *** 105,125 **** String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); ! // TOTO less than int bytes int sizeInBytes = (int)item.getSize(); DocImage doc = new DocImage(); doc.setMediaType( contentType ); if (isInMemory) { ! doc.setContent( item.get() ); } else { InputStream uploadedStream = item.getInputStream(); byte[] b = new byte[sizeInBytes]; uploadedStream.read( b ); ! doc.setContent( b ); uploadedStream.close(); } ! // Get the logged in user and set as the author ! long accountId = top.getAccountId(); ! long userId = top.getUser().getId(); ! id = docBean.createImage( doc, userId, accountId ); } // writer.write( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<html>\n" + --- 105,128 ---- String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); ! // TODO less than int bytes int sizeInBytes = (int)item.getSize(); DocImage doc = new DocImage(); doc.setMediaType( contentType ); + // Get the logged in user and set as the author + long accountId = top.getAccountId(); + long userId = top.getUser().getId(); + // id = docBean.createImage( doc, userId, accountId ); if (isInMemory) { ! id = docBean.createImage( doc, userId, accountId, item.get() ); ! // doc.setContent( item.get() ); } else { InputStream uploadedStream = item.getInputStream(); byte[] b = new byte[sizeInBytes]; uploadedStream.read( b ); ! id = docBean.createImage( doc, userId, accountId, b ); ! // doc.setContent( b ); uploadedStream.close(); } ! docBean.finalizeDocument(doc); } // writer.write( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<html>\n" + |
From: John C. <jc...@us...> - 2007-02-04 16:43:05
|
Update of /cvsroot/tolven/tolvenWEB/web/WEB-INF In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23026/web/WEB-INF Modified Files: faces-config.xml Log Message: Adding support for instantiation Index: faces-config.xml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/WEB-INF/faces-config.xml,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** faces-config.xml 20 Jan 2007 19:25:51 -0000 1.32 --- faces-config.xml 4 Feb 2007 16:43:03 -0000 1.33 *************** *** 455,458 **** --- 455,466 ---- <navigation-rule> + <from-view-id>/five/patients.xhtml</from-view-id> + <navigation-case> + <from-action>#{menu.createPatient}</from-action> + <from-outcome>success</from-outcome> + <to-view-id>/five/patients.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> <from-view-id>/five/assAll.xhtml</from-view-id> <navigation-case> *************** *** 465,468 **** --- 473,481 ---- <from-view-id>/ajax/paneDispatch.xhtml</from-view-id> <navigation-case> + <from-action>#{menu.createPatient}</from-action> + <from-outcome>success</from-outcome> + <to-view-id>/five/patients.xhtml</to-view-id> + </navigation-case> + <navigation-case> <from-action>#{menu.createAssessment}</from-action> <from-outcome>success</from-outcome> |