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: Joseph I. <jos...@us...> - 2007-01-23 09:12:43
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/index In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13272/src/org/tolven/index Modified Files: BrowseSecurityFilter.java Log Message: In order to activate encryption, the the tolven property must be set to true, rather than any value: tolven.security.keys.activate=true Index: BrowseSecurityFilter.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/index/BrowseSecurityFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BrowseSecurityFilter.java 23 Jan 2007 03:13:41 -0000 1.1 --- BrowseSecurityFilter.java 23 Jan 2007 09:12:42 -0000 1.2 *************** *** 230,234 **** // Expose AccountUser to the application for this request. request.setAttribute("accountUser", accountUser); ! if (System.getProperty("tolven.security.keys.activate") != null) { updatePrivateKeyRing( accountUser ); } --- 230,234 ---- // Expose AccountUser to the application for this request. request.setAttribute("accountUser", accountUser); ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.keys.activate"))) { updatePrivateKeyRing( accountUser ); } |
From: Joseph I. <jos...@us...> - 2007-01-23 09:12:43
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/auth In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13272/src/org/tolven/web/security/auth Modified Files: KeyLoginModule.java Log Message: In order to activate encryption, the the tolven property must be set to true, rather than any value: tolven.security.keys.activate=true Index: KeyLoginModule.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/auth/KeyLoginModule.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeyLoginModule.java 20 Jan 2007 19:24:28 -0000 1.3 --- KeyLoginModule.java 23 Jan 2007 09:12:42 -0000 1.4 *************** *** 98,102 **** System.out.println(getClass() + ": begin commit"); try { ! if (System.getProperty("tolven.security.keys.activate") != null) { // Obtain the UserKeyPair if it exists InitialContext ictx = new InitialContext(); --- 98,102 ---- System.out.println(getClass() + ": begin commit"); try { ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.keys.activate"))) { // Obtain the UserKeyPair if it exists InitialContext ictx = new InitialContext(); |
From: Joseph I. <jos...@us...> - 2007-01-23 09:12:43
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13272/src/org/tolven/web Modified Files: TopAction.java RegisterAction.java Log Message: In order to activate encryption, the the tolven property must be set to true, rather than any value: tolven.security.keys.activate=true Index: TopAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/TopAction.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** TopAction.java 20 Jan 2007 19:25:05 -0000 1.32 --- TopAction.java 23 Jan 2007 09:12:42 -0000 1.33 *************** *** 181,185 **** } ! if (System.getProperty("tolven.security.keys.activate") != null) { if (!getUser().hasUserPrivateKey()) { addKeysToUser(); --- 181,185 ---- } ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.keys.activate"))) { if (!getUser().hasUserPrivateKey()) { addKeysToUser(); *************** *** 213,217 **** return "dispatch"; } ! if (System.getProperty("tolven.security.keys.activate") != null) updatePrivateKeyRing(); accountUserId = accountUser.getId(); --- 213,217 ---- return "dispatch"; } ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.keys.activate"))) updatePrivateKeyRing(); accountUserId = accountUser.getId(); Index: RegisterAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/RegisterAction.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** RegisterAction.java 20 Jan 2007 19:25:05 -0000 1.35 --- RegisterAction.java 23 Jan 2007 09:12:42 -0000 1.36 *************** *** 381,385 **** ldap.updatePerson( getTp() ); boolean forceLogin = false; ! if (System.getProperty("tolven.security.keys.activate") != null) { if (getOldUserPassword() != null && getOldUserPassword().trim().length() > 0) { UserPrivateKey userPrivateKey = UserPrivateKey.getInstance(); --- 381,385 ---- ldap.updatePerson( getTp() ); boolean forceLogin = false; ! if ("true".equalsIgnoreCase(System.getProperty("tolven.security.keys.activate"))) { if (getOldUserPassword() != null && getOldUserPassword().trim().length() > 0) { UserPrivateKey userPrivateKey = UserPrivateKey.getInstance(); *************** *** 648,652 **** } AccountUser accountUser = null; ! if (System.getProperty("tolven.security.keys.activate") == null) { //TODO: For backward compatibility, a null UserPublicKey is allowed, to support the existence of no encryption keys existed accountUser = accountBean.inviteAccountUser(getAccount(), activation.findAccountUser(getTop().getAccountUserId()), user, null, getNow(), false); --- 648,652 ---- } AccountUser accountUser = null; ! if (!"true".equalsIgnoreCase(System.getProperty("tolven.security.keys.activate"))) { //TODO: For backward compatibility, a null UserPublicKey is allowed, to support the existence of no encryption keys existed accountUser = accountBean.inviteAccountUser(getAccount(), activation.findAccountUser(getTop().getAccountUserId()), user, null, getNow(), false); |
From: John C. <jc...@us...> - 2007-01-23 03:13:43
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/index In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21600/src/org/tolven/index Modified Files: Browse.java Added Files: BrowseSecurityFilter.java BrowseBase.java BrowseTransactionFilter.java Log Message: New and improved "Browse Everything" Servlet - includes transaction and security filters thus simplifying the main part of the application. PUT/GET should now work properly without any special intervention. --- NEW FILE: BrowseSecurityFilter.java --- package org.tolven.index; import java.io.IOException; import java.io.Writer; import java.security.GeneralSecurityException; import java.util.Date; import java.util.List; import java.util.Set; import javax.annotation.EJB; 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.PolicyContext; import javax.security.jacc.PolicyContextException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; 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 org.tolven.core.ActivationLocal; import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.TolvenUser; import org.tolven.security.key.PrivateKeyRing; import org.tolven.security.key.UserPrivateKey; import org.tolven.security.key.UserPublicKey; /** * In our simple servlet sample application we still need to satisfy security requirements we'll * create a LoginContext so that credentials needed by the application are available. * We willl not use the usual built-in formAuthenticator so as to make this part of the * process explicit. * We need username, password, and account number (we assume the user knows the account * number they want to log into for this simple application). If we don't have that information * yet, we turn the user to the login form. * But username, password, and account can also be supplied proactively. If so supplied, * we save the information in the session. * @author John Churin * */ public class BrowseSecurityFilter implements Filter { private ServletContext context = null; @EJB protected ActivationLocal activateLocal; class UsernamePasswordHandler implements CallbackHandler { HttpSession session; public UsernamePasswordHandler(HttpSession session) { this.session = session; } 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((String)session.getAttribute("username")); } else if (cb instanceof PasswordCallback) { PasswordCallback pcb = (PasswordCallback)cb; pcb.setPassword(((String)session.getAttribute("password")).toCharArray()); } else { throw new UnsupportedCallbackException(cb, "Unknown callback request"); } } } }; /** * Return the PrivateKeyRing for the user * @return * @throws PolicyContextException * @throws GeneralSecurityException */ public 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 " ); Set privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); if (privateCredentials.isEmpty()) throw new GeneralSecurityException(": No PrivateKeyRing found for " ); return (PrivateKeyRing) privateCredentials.iterator().next(); } /** * Return the PublicKey for the user * @return * @throws PolicyContextException * @throws GeneralSecurityException */ public UserPublicKey getUserPublicKey() 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 " ); Set publicCredentials = subject.getPublicCredentials(UserPublicKey.class); if (publicCredentials.isEmpty()) throw new GeneralSecurityException(": No UserPublicKey found for "); return (UserPublicKey) publicCredentials.iterator().next(); } /** * Return the UserPrivateKey for the user * @return * @throws PolicyContextException * @throws GeneralSecurityException */ public UserPrivateKey getUserPrivateKey() throws PolicyContextException, GeneralSecurityException { return getPrivateKeyRing().getUserPrivateKey(); } /** * Add Keys from the Subject to what should be a new TolvenUser who is logging in * @throws PolicyContextException * @throws GeneralSecurityException */ private void addKeysToUser(TolvenUser tolvenUser) throws PolicyContextException, GeneralSecurityException { UserPrivateKey userPrivateKey = getUserPrivateKey(); if (userPrivateKey == null) throw new GeneralSecurityException("User has no UserPrivateKey and none found in Subject"); if (!tolvenUser.hasUserPrivateKey()) { tolvenUser.setUserPrivateKey(userPrivateKey); tolvenUser.setUserPublicKey(getUserPublicKey()); } } void loginForm( Writer writer ) throws IOException { writer.write( "<form method=\"get\" action=\"login.browse\" >" ); writer.write( "User Id<br/>"); writer.write( "<input type=\"text\" name=\"username\" size=\"30\" />"); writer.write( "<br/>"); writer.write( "Password<br/><input name=\"password\" type=\"password\" value=\"\" size=\"20\" />"); writer.write( "<br/>"); writer.write( "Account<br/><input name=\"account\" type=\"text\" value=\"\" size=\"8\" />"); writer.write( "<input type=\"submit\" name=\"Submit\" value=\"Login\" /><br/>"); writer.write( "</form>"); } /** * Update the PrivateKeyRing with the AccountPrivateKey of the Account that the user is currently logged into * @throws PolicyContextException * @throws GeneralSecurityException */ protected void updatePrivateKeyRing(AccountUser accountUser) throws PolicyContextException, GeneralSecurityException { PrivateKeyRing privateKeyRing = getPrivateKeyRing(); privateKeyRing.setAccountPrivateKey(accountUser.getAccountPrivateKey()); } public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest)req; HttpServletResponse response = (HttpServletResponse)resp; LoginContext lc = null; try { UsernamePasswordHandler handler = new UsernamePasswordHandler(request.getSession()); String uri = request.getRequestURI(); // Let the login page through, already logged in or not. // Login doesn't need authorization. // If the login has needed params, we'll attempt a login, otherwise, we just go back // to the login page. if( uri.endsWith("login.browse")) { if (null!=request.getParameter("username") && null!=request.getParameter("password") && null!=request.getParameter("account")) { // Move key parameters to session request.getSession().setAttribute("username", request.getParameter("username")); request.getSession().setAttribute("password", request.getParameter("password")); request.getSession().setAttribute("account", request.getParameter("account")); request.getSession().setAttribute("subject", null); // Not logged in yet so... lc = new LoginContext("tolvenLDAP", handler); lc.login(); System.out.println( "Password verified"); TolvenUser user = activateLocal.loginUser( (String)request.getSession().getAttribute("username"), new Date() ); System.out.println( "TolvenUser accepted"); // This simulates the SelectAccount page List<AccountUser> accountUsers = activateLocal.findUserAccounts(user); long accountId = Long.parseLong((String)request.getSession().getAttribute("account")); AccountUser accountUser = null; // Select the most recent AccountUser and use that account for ( AccountUser au : accountUsers ) { if (accountId==au.getAccount().getId() ) { accountUser = au; accountId = au.getAccount().getId(); break; } } if (accountUser==null) throw new ServletException( "Account not valid for this user"); System.out.println( "Account id " + Long.toString(accountId) + " accepted"); // Remember this accountUser request.getSession().setAttribute("accountUserId", new Long(accountUser.getId())); // Save subject for use during logged in session request.getSession().setAttribute("subject", lc.getSubject()); // // At this point we want to direct the user to the first page response.sendRedirect("view.browse"); return; } // Just let the login page display chain.doFilter(request, response); return; } // OK, we assume the user is logged in. But we recheck before doing anything. Subject subject = (Subject) request.getSession().getAttribute("subject"); // Not logged in, back to login. if (null==subject) { throw new ServletException( "BrowseSecurityFilter: user not logged in"); } // Setup login context based on stored subject lc = new LoginContext( "tolvenLDAP", subject, handler); lc.login(); long accountUserId = (Long) request.getSession(false).getAttribute("accountUserId"); AccountUser accountUser = activateLocal.findAccountUser(accountUserId); if (null==accountUser) { throw new ServletException( "Invalid account specified"); } // Expose AccountUser to the application for this request. request.setAttribute("accountUser", accountUser); if (System.getProperty("tolven.security.keys.activate") != null) { updatePrivateKeyRing( accountUser ); } chain.doFilter(request, response); } catch (Exception e) { throw new ServletException( "Error in BrowseSecurityFilter", e); // response.sendRedirect("login.browse"); } finally { // Clear login state from this thread before we leave (no matter what) if (null!=lc) try { lc.logout(); } catch (LoginException e) { e.printStackTrace(); } } } public void init(FilterConfig config) throws ServletException { context = config.getServletContext(); try { InitialContext ctx = new InitialContext(); activateLocal = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); } catch (NamingException e) { throw new RuntimeException(e); } } public void destroy() { // TODO Auto-generated method stub } } --- NEW FILE: BrowseTransactionFilter.java --- package org.tolven.index; import java.io.IOException; import java.util.Date; import javax.naming.InitialContext; import javax.naming.NamingException; 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.transaction.Status; import javax.transaction.SystemException; import javax.transaction.UserTransaction; /** * A stripped-down transaction filter for our sample application * @author John Churin */ public class BrowseTransactionFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { UserTransaction ut = null; try { InitialContext ctx = new InitialContext(); ut = (UserTransaction) ctx.lookup("UserTransaction"); ut.begin(); // Establish a consistent "Now" time for the duration of the transaction request.setAttribute( "tolvenNow", new Date() ); chain.doFilter(request, response); } catch (Exception e) { throw new ServletException( "Exception thrown in BrowseTransactionFilter: ", e); } finally { try { ut.rollback(); } catch (Exception e) { e.printStackTrace(); } } } public void init(FilterConfig config) throws ServletException { } public void destroy() { } } --- NEW FILE: BrowseBase.java --- package org.tolven.index; import java.io.IOException; import java.io.Writer; import javax.annotation.EJB; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.ServletConfig; //import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.tolven.app.MenuLocal; import org.tolven.doc.DocumentLocal; import org.tolven.doc.XMLProtectedLocal; /** * The base class for sample HTTP functions. We supply page header and footer functions here. * @author John Churin * */ public class BrowseBase extends HttpServlet{ private static final long serialVersionUID = 1L; // private ServletContext context = null; @EJB protected MenuLocal menuLocal; @EJB protected DocumentLocal documentLocal; @EJB protected XMLProtectedLocal xmlProtectedBean; @Override public void init(ServletConfig config) throws ServletException { // context = config.getServletContext(); try { InitialContext ctx = new InitialContext(); menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); xmlProtectedBean = (XMLProtectedLocal) ctx.lookup("tolven/XMLProtectedBean/local"); } catch (NamingException e) { throw new RuntimeException(e); } super.init(config); } protected Writer openPage( HttpServletRequest request, HttpServletResponse response ) throws IOException { response.setContentType("text/html"); response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT"); // Set standard HTTP/1.1 no-cache headers. response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // Set IE extended HTTP/1.1 no-cache headers (use addHeader). response.addHeader("Cache-Control", "post-check=0, pre-check=0"); // Set standard HTTP/1.0 no-cache header. response.setHeader("Pragma", "no-cache"); Writer writer=response.getWriter(); writer.write( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\" >"); writer.write( "<html>\n" ); writer.write( "<head>\n"); writer.write( "</head>\n"); writer.write( "<body>\n"); // If logged in, show a few things and allow the user to log out if (null!=request.getSession().getAttribute("subject")) { writer.write( "<p>"); writer.write( " Username: <em>" ); writer.write( (String) request.getSession().getAttribute("username")); writer.write( "</em> Account: <em>"); writer.write( (String) request.getSession().getAttribute("account")); writer.write( "</em>"); writer.write( " <a href='logout.browse'>Logout</a>"); writer.write( "</p>\n"); } return writer; } void closePage( Writer writer ) throws IOException { writer.write( "</body>\n"); writer.write( "</html>\n"); writer.close(); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub super.doGet(request, response); } @Override public void destroy() { // TODO Auto-generated method stub super.destroy(); } } Index: Browse.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/index/Browse.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Browse.java 20 Jan 2007 19:25:05 -0000 1.4 --- Browse.java 23 Jan 2007 03:13:41 -0000 1.5 *************** *** 7,241 **** import java.util.LinkedList; import java.util.List; - import javax.annotation.EJB; - import javax.naming.InitialContext; - import javax.naming.NamingException; - 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.servlet.ServletConfig; - import javax.servlet.ServletContext; import javax.servlet.ServletException; - import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import javax.transaction.Status; - import javax.transaction.UserTransaction; - import org.tolven.app.MenuLocal; import org.tolven.app.bean.MenuPath; import org.tolven.app.bean.MenuQueryControl; 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.doc.DocumentLocal; ! import org.tolven.security.TolvenPerson; /** ! * <p>This servlet provides an all-in-one-place way to browse through all MenuData for an account. * Only useful for development, primarily for testing and viewing metadata and as a way to understand how * the application works without the burden of AJAX, Faces, Facelets, context management, etc.</p> ! * <p>This module also handles its own login and logout in order to make those processes explicit. It still uses * JAAS-based LDAP authentication but not the usual FormAuthenticator (j_security_check). ! * ! * The output has several sections: * <ol> * <li>The query elements of the current query, including defaults supplied in this module.</li> - * <li>A list of all MenuStructure data pplicable to the currently selected item</li> * <li>If the current item is a list, then the actual data in that list is displayed.</li> * <li>The current item, if any, is displayed in full.</li> * </ol> ! * <p>The main query itself can be found in showMenuData. findMenuData.</p> * * @author John Churin * */ ! public class Browse extends HttpServlet { private static final long serialVersionUID = 1L; - private ServletContext context = null; - @EJB private MenuLocal menuLocal; - @EJB private ActivationLocal activateLocal; - @EJB private DocumentLocal documentLocal; - - @Override - public void init(ServletConfig config) throws ServletException { - context = config.getServletContext(); - // try - // { - // InitialContext ctx = new InitialContext(); - // activateLocal = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); - // menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); - // documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); - // } - // catch (NamingException e) - // { - // throw new RuntimeException(e); - // } - super.init(config); - } - class UsernamePasswordHandler implements CallbackHandler { - TolvenPerson tp; - - public UsernamePasswordHandler(TolvenPerson tp) { - this.tp = tp; - } - - 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(tp.getUid()); - } - else if (cb instanceof PasswordCallback) { - PasswordCallback pcb = (PasswordCallback)cb; - pcb.setPassword(tp.getUserPassword().toCharArray()); - } else { - throw new UnsupportedCallbackException(cb, "Unknown callback request"); - } - } - } - }; - - /** - * Log the user in using username and password supplied by the client. - * @param request - * @return - * @throws LoginException - * @throws ServletException - */ - void login( HttpServletRequest request ) throws LoginException, ServletException { - if (null==request.getParameter("username") || - null==request.getParameter("password") || - null==request.getParameter("account")) { - throw new ServletException( "Missing account, username, and/or password"); - } - TolvenPerson tp = new TolvenPerson(); - tp.setUid(request.getParameter("username")); - tp.setUserPassword(request.getParameter("password")); - System.out.println( "Logging in user: " + tp.getUid()); - UsernamePasswordHandler handler = new UsernamePasswordHandler(tp); - LoginContext lc = new LoginContext("tolvenApplicationLDAP", handler); - // System.out.println( "Created login context"); - lc.login(); - System.out.println( "Password verified"); - TolvenUser user = activateLocal.loginUser( tp.getUid(), new Date() ); - // This simulates the SelectAccount page - List<AccountUser> accountUsers = activateLocal.findUserAccounts(user); - long accountId = Long.parseLong(request.getParameter("account")); - long accountUserId = 0; - // Select the most recent AccountUser and use that account - for ( AccountUser au : accountUsers ) { - if (accountId==au.getAccount().getId() ) { - accountUserId = au.getId(); - accountId = au.getAccount().getId(); - } - } - if (accountUserId==0) { - throw new ServletException( "Invalid account specified"); - } - System.out.println( "Selected account: " + Long.toString(accountId)); - request.getSession().setAttribute("accountUser", new Long(accountUserId)); - // lc.logout(); - } - @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - InitialContext ctx; - UserTransaction ut = null; try { ! ctx = new InitialContext(); ! ut = (UserTransaction) ctx.lookup("UserTransaction"); ! if(ut.getStatus()!=Status.STATUS_ACTIVE) { ! ut.begin(); } } catch (Exception e) { ! throw new ServletException("[BrowseServlet] Error setting up UserTransaction or starting a transaction", e); ! } ! String uri = request.getRequestURI(); ! if( uri.endsWith("login.browse")) { ! try { ! login( request ); ! } catch (LoginException e ) { ! throw new ServletException( "Login failed"); ! } ! // Now that the user is logged in, redirect them to the view page ! response.sendRedirect("view.browse"); ! try { ! ut.rollback(); ! } catch (Exception e) { ! throw new ServletException( "[BrowseServlet] Rollback Exception", e ); ! } ! return; ! } ! // See if we have an account user id. Can't go on without it. ! if (null==request.getSession(true).getAttribute("accountUser")) { ! try { ! ut.rollback(); ! } catch (Exception e) { ! throw new ServletException( "[BrowseServlet] Rollback Exception", e ); ! } ! throw new ServletException( "Not logged in or invalid account selected"); ! } ! ! // Get AccountUser from the current session ! // String accountUserString = (String) request.getSession(true).getAttribute("accountUser"); ! long accountUserId = (Long) request.getSession(false).getAttribute("accountUser"); ! AccountUser accountUser = activateLocal.findAccountUser(accountUserId); ! System.out.println( "Using account: " + Long.toString(accountUser.getAccount().getId())); ! ! // Prepare response back to client ! response.setContentType("text/html"); ! response.setHeader("Cache-Control", "no-cache"); ! Writer writer=response.getWriter(); ! writer.write( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\" >"); ! writer.write( "<html>\n" ); ! writer.write( "<head>\n"); ! writer.write( "</head>\n"); ! writer.write( "<body>\n"); ! ! if( uri.endsWith("view.browse")) { ! // Get key parameters from the request ! String element = request.getParameter( "element"); ! ! showLists( accountUser, writer, element); ! // Display the requested memu data, if any ! if (element!=null) { ! // System.out.println( "Showing: " + element); ! MenuQueryControl ctrl = setupControl( request, accountUser ); ! if ("placeholder".equals(ctrl.getMenuStructure().getRole())) { ! // System.out.println( "Showing detail"); ! showMenuDataDetail( accountUser, writer, ctrl ); ! } ! if ("list".equals(ctrl.getMenuStructure().getRole())) { ! // System.out.println( "Showing lists"); ! showMenuDataList( accountUser, writer, ctrl); ! } ! } ! writer.write( "<p><a href='logout.browse'>Logout</a></p>\n"); ! } ! else if( uri.endsWith("logout.browse")) { ! request.getSession(false).invalidate(); ! writer.write( "<p>Logged out</p>\n"); ! writer.write( "<p><a href='login.browse'>Login</a></p>\n"); } - writer.write( "</body>\n"); - writer.write( "</html>\n"); - writer.close(); - // This module is all about read-only so rollback in all cases - try { - ut.rollback(); - } catch (Exception e) { - throw new ServletException( "[BrowseServlet] Rollback Exception", e ); - } } --- 7,104 ---- import java.util.LinkedList; import java.util.List; + import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.tolven.app.bean.MenuPath; import org.tolven.app.bean.MenuQueryControl; import org.tolven.app.entity.MenuData; import org.tolven.app.entity.MenuStructure; import org.tolven.core.entity.AccountUser; ! import org.tolven.doc.entity.DocBase; /** ! * <p>This servlet provides a moderately straightforward way to browse through all MenuData ! * for an account. * Only useful for development, primarily for testing and viewing metadata and as a way to understand how * the application works without the burden of AJAX, Faces, Facelets, context management, etc.</p> ! * <p>This module also handles its own login and logout in order to make those processes explicit. It is still uses * JAAS-based LDAP authentication but not the usual FormAuthenticator (j_security_check). ! * </p> ! * <p>Security warning: This servlet, and it's associated filters should be disabled for production.</p> ! * The MenuData output has several sections: * <ol> + * <li>A list of all MenuStructure data applicable to the currently selected item. If nothing is selected, then those + * MenuStructures applicable without context such as patient list.</li> * <li>The query elements of the current query, including defaults supplied in this module.</li> * <li>If the current item is a list, then the actual data in that list is displayed.</li> * <li>The current item, if any, is displayed in full.</li> + * <li>If the current item refers to a document, then the document is decrypted and displayed.</li> * </ol> ! * <p>The main MenuData query itself can be found in the showMenuData method. Look for the call to findMenuData. Just ! * about all of the data shown in the real application comes from this type of query.</p> * * @author John Churin * */ ! public class Browse extends BrowseBase { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { ! String uri = request.getRequestURI(); ! // User asked for the login form (or security filter forced it) ! if( uri.endsWith("login.browse")) { ! Writer writer = openPage( request, response ); ! loginForm( writer ); ! closePage( writer ); ! return; } + // See if we have an account user id. Can't go on without it. + AccountUser accountUser = (AccountUser) request.getAttribute("accountUser"); + if (null==accountUser) { + response.sendRedirect("login.browse"); + return; + } + + if( uri.endsWith("view.browse")) { + // Prepare response back to client + Writer writer = openPage( request, response ); + // Get key parameters from the request + String element = request.getParameter( "element"); + + showLists( accountUser, writer, element); + // Display the requested memu data, if any + if (element!=null) { + // System.out.println( "Showing: " + element); + MenuQueryControl ctrl = setupControl( request, accountUser ); + if ("placeholder".equals(ctrl.getMenuStructure().getRole())) { + // System.out.println( "Showing detail"); + showMenuDataDetail( accountUser, writer, ctrl ); + } + if ("list".equals(ctrl.getMenuStructure().getRole())) { + // System.out.println( "Showing lists"); + showMenuDataList( accountUser, writer, ctrl); + } + } + closePage(writer); + return; + } + if( uri.endsWith("logout.browse")) { + request.getSession(false).invalidate(); + // Prepare response back to client + Writer writer = openPage( request, response ); + writer.write( "<p>Logged out</p>\n"); + writer.write( "<p><a href='login.browse'>Login</a></p>\n"); + closePage(writer); + } + // This module is all about read-only so rollback in all cases + // ut.rollback(); } catch (Exception e) { ! throw new ServletException( "[BrowseServlet] Exception", e ); } } *************** *** 264,271 **** for (MenuStructure ms : menus) { if ("list".equals(ms.getRole()) ) { ! List<MenuStructure> placeholders = getPlaceholders( ms ); // System.out.println( "found placeholders for: " + ms.getPath()); // We filter the list of lists to only those that could yield a result. ! if (placeholders.size() > 0 ) { writer.write( "<tr>" ); writer.write( "<td>" + getMSRef(ms, elementPath ) + "</td>"); --- 127,134 ---- for (MenuStructure ms : menus) { if ("list".equals(ms.getRole()) ) { ! String rslt = getPlaceholders( elementPath, ms ); // System.out.println( "found placeholders for: " + ms.getPath()); // We filter the list of lists to only those that could yield a result. ! if (rslt!=null ) { writer.write( "<tr>" ); writer.write( "<td>" + getMSRef(ms, elementPath ) + "</td>"); *************** *** 273,277 **** writer.write( "<td>" + ms.getRole() + "</td>"); writer.write( "<td>" + ms.getText() + "</td>"); ! writer.write( "<td>"); showPlaceholders( placeholders, writer); writer.write( "</td>" ); writer.write( "</tr>\n"); } --- 136,140 ---- writer.write( "<td>" + ms.getRole() + "</td>"); writer.write( "<td>" + ms.getText() + "</td>"); ! writer.write( "<td>"); writer.write(rslt); writer.write( "</td>" ); writer.write( "</tr>\n"); } *************** *** 295,299 **** String repeatingBase = ms.getRepeating(); ctrl.setMenuStructure( ms ); ! ctrl.setNow( new Date() ); if (request.getParameter( "offset")!=null) { ctrl.setOffset( Integer.parseInt( request.getParameter( "offset")) ); --- 158,162 ---- String repeatingBase = ms.getRepeating(); ctrl.setMenuStructure( ms ); ! ctrl.setNow( (Date) request.getAttribute("tolvenNow") ); if (request.getParameter( "offset")!=null) { ctrl.setOffset( Integer.parseInt( request.getParameter( "offset")) ); *************** *** 368,372 **** } ! /** * Display the detail for a single menu data item --- 231,260 ---- } ! /** ! * Show the document associated with this menu data item, if there is one ! * @param md ! * @param writer ! * @throws IOException ! */ ! void showDocument( MenuData md, Writer writer) throws IOException { ! long docId = md.getDocumentId(); ! if (0==docId) return; ! writer.write( "<p>Document referenced by this menuData item: " + docId + "</p>"); ! DocBase doc = documentLocal.findDocument(docId); ! writer.write( "<pre>"); ! String str = doc.getContentString(); ! for ( int x = 0; x < str.length(); x++ ) { ! char c = str.charAt(x); ! switch ( c ) { ! case '<' : writer.write( "<");break; ! case '>' : writer.write( ">");break; ! case '&' : writer.write( "&");break; ! case '"' : writer.write( """);break; ! default : writer.write(c); ! } ! } ! writer.write( "</pre><br/>"); ! } ! /** * Display the detail for a single menu data item *************** *** 410,413 **** --- 298,302 ---- if (null!=md.getReference()) writer.write( "<tr><td>Reference</td><td>" + md.getReference().getPath() + "</td></tr>\n"); writer.write( "</table>\n"); + showDocument( md, writer); } *************** *** 476,500 **** * Find out where this item is in the hierarchy of entities (placeholders) * @param ms ! * @return */ ! List<MenuStructure> getPlaceholders( MenuStructure ms ) { ! LinkedList<MenuStructure> p = new LinkedList<MenuStructure>(); ! try { ! // Metadata tells us the kind of repeating data in this list ! String placeholderPath = ms.getRepeating(); ! if (placeholderPath==null) { ! return p; ! } ! // System.out.println( "Find placeholder for: " + ms.getPath()); ! MenuStructure msPlaceholder = menuLocal.findMenuStructure( ms.getAccount().getId(), placeholderPath); ! while ( null!=msPlaceholder ) { ! if (!"placeholder".equals(msPlaceholder.getRole())) return p; ! p.addFirst( msPlaceholder); ! msPlaceholder = msPlaceholder.getParent(); } - return p; - } catch (RuntimeException e) { - return p; } } --- 365,402 ---- * Find out where this item is in the hierarchy of entities (placeholders) * @param ms ! * @return A string such as echr:patient-1234 */ ! String getPlaceholders( MenuPath element, MenuStructure ms ) { ! LinkedList<MenuStructure> placeholders = new LinkedList<MenuStructure>(); ! // Metadata tells us the kind of repeating data in this list ! String placeholderPath = ms.getRepeating(); ! if (placeholderPath==null) { ! // System.out.println( "list " + ms.getPath()+ " has no repeating placeholder " ); ! return null; ! } ! // System.out.println( "Element: " + element.getPathString() ); ! MenuStructure msPlaceholder = menuLocal.findMenuStructure( ms.getAccount().getId(), placeholderPath); ! // System.out.println( "Placeholder: " + msPlaceholder.getPath() ); ! ! MenuPath path = new MenuPath( msPlaceholder.getPath(), element ); ! // System.out.println( "Path: " + path ); ! // Get a preordered list of placeholders ! while ( null!=msPlaceholder ) { ! placeholders.addFirst(msPlaceholder); ! msPlaceholder = msPlaceholder.getParent(); ! } ! int missing = 0; ! Map<String, Long> nodeValues = path.getNodeValues(); ! // Figure out how many of the placeholder nodes would be satisfied by the current element MenuPath ! for (MenuStructure msp : placeholders) { ! if ("placeholder".equals(msp.getRole()) ! && nodeValues.get(msp.getNode()) == 0) { ! missing++; } } + // System.out.println( "Missing node value count: " + missing ); + if (missing > 1) return null; + if (missing == 1) return path.getPathString(); + return placeholderPath; } *************** *** 514,530 **** } } ! ! @Override ! protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ! // TODO Auto-generated method stub ! super.doPost(request, response); ! } ! ! @Override ! public void destroy() { ! // TODO Auto-generated method stub ! super.destroy(); } - - } --- 416,435 ---- } } ! ! /** ! * A simple login form needed to collect username, password, and account ! * @param writer ! * @throws IOException ! */ ! void loginForm( Writer writer ) throws IOException { ! writer.write( "<form method=\"post\" action=\"login.browse\" >" ); ! writer.write( "User Id<br/>"); ! writer.write( "<input type=\"text\" name=\"username\" size=\"30\" />"); ! writer.write( "<br/>"); ! writer.write( "Password<br/><input name=\"password\" type=\"password\" value=\"\" size=\"20\" />"); ! writer.write( " Don't count on this sample app being secure<br/>"); ! writer.write( "Account<br/><input name=\"account\" type=\"text\" value=\"\" size=\"8\" />"); ! writer.write( "<input type=\"submit\" name=\"Submit\" value=\"Login\" /><br/>"); ! writer.write( "</form>"); } } |
From: John C. <jc...@us...> - 2007-01-23 03:13:42
|
Update of /cvsroot/tolven/tolvenWEB/web/WEB-INF In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21600/web/WEB-INF Modified Files: web.xml Log Message: New and improved "Browse Everything" Servlet - includes transaction and security filters thus simplifying the main part of the application. PUT/GET should now work properly without any special intervention. Index: web.xml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/WEB-INF/web.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** web.xml 17 Jan 2007 18:43:01 -0000 1.14 --- web.xml 23 Jan 2007 03:13:41 -0000 1.15 *************** *** 138,141 **** --- 138,157 ---- <url-pattern>*.browse</url-pattern> </servlet-mapping> + <filter> + <filter-name>BrowseTransactionFilter</filter-name> + <filter-class>org.tolven.index.BrowseTransactionFilter</filter-class> + </filter> + <filter-mapping> + <filter-name>BrowseTransactionFilter</filter-name> + <servlet-name>Browse Index Servlet</servlet-name> + </filter-mapping> + <filter> + <filter-name>BrowseSecurityFilter</filter-name> + <filter-class>org.tolven.index.BrowseSecurityFilter</filter-class> + </filter> + <filter-mapping> + <filter-name>BrowseSecurityFilter</filter-name> + <servlet-name>Browse Index Servlet</servlet-name> + </filter-mapping> <session-config><session-timeout> |
From: John C. <jc...@us...> - 2007-01-23 03:10:41
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20633/src/org/tolven/app/bean Modified Files: MenuBean.java Log Message: Fix organization of Lab test results in placeholders Index: MenuBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean/MenuBean.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** MenuBean.java 17 Jan 2007 18:43:06 -0000 1.41 --- MenuBean.java 23 Jan 2007 03:10:38 -0000 1.42 *************** *** 512,516 **** em.persist( result ); MenuStructure test = new MenuStructure( ! account, result, "test.xhtml", "testLink.xhtml", -1, "test", "Test", "false", "test", "placeholder" ); em.persist( test ); MenuStructure order = new MenuStructure( --- 512,516 ---- em.persist( result ); MenuStructure test = new MenuStructure( ! account, patient, "test.xhtml", "testLink.xhtml", -1, "test", "Test", "false", "test", "placeholder" ); em.persist( test ); MenuStructure order = new MenuStructure( *************** *** 579,583 **** MenuStructure labAll = new MenuStructure( ! account, patResults, "lab.xhtml", null, 40, "lab", "Lab", "true", root.getPath() +":patient:result:test", "list" ); em.persist( labAll ); em.persist( new MSColumn( labAll, 1, "Date", "date01", "MMM-dd-yyyy hh:mm") ); --- 579,583 ---- MenuStructure labAll = new MenuStructure( ! account, patResults, "lab.xhtml", null, 40, "lab", "Lab", "true", root.getPath() +":patient:test", "list" ); em.persist( labAll ); em.persist( new MSColumn( labAll, 1, "Date", "date01", "MMM-dd-yyyy hh:mm") ); *************** *** 590,606 **** MenuStructure lipids = new MenuStructure( ! account, patResults, "graphLipids.xhtml", null, 999, "lipids", "Lipids", "true", root.getPath() +":patient:result:test", "list" ); em.persist( lipids ); MenuStructure pathology = new MenuStructure( ! account, patResults, "pathology.xhtml", null, 50, "pathology", "Pathology", "true", root.getPath() +":patient:result:test", "list" ); em.persist( pathology ); MenuStructure selfMon = new MenuStructure( ! account, patResults, "selfMon.xhtml", null, 60, "self", "Self Monitoring", "true", root.getPath() +":patient:result:test", "list" ); em.persist( selfMon ); MenuStructure rad = new MenuStructure( ! account, patResults, "rad.xhtml", null, 70, "rad", "Radiology", "true", root.getPath() +":patient:result:test", "list" ); em.persist( rad ); em.persist( new MSColumn( rad, 1, "Date", "date01", "MMM-dd-yyyy hh:mm") ); --- 590,606 ---- MenuStructure lipids = new MenuStructure( ! account, patResults, "graphLipids.xhtml", null, 999, "lipids", "Lipids", "true", root.getPath() +":patient:test", "list" ); em.persist( lipids ); MenuStructure pathology = new MenuStructure( ! account, patResults, "pathology.xhtml", null, 50, "pathology", "Pathology", "true", root.getPath() +":patient:test", "list" ); em.persist( pathology ); MenuStructure selfMon = new MenuStructure( ! account, patResults, "selfMon.xhtml", null, 60, "self", "Self Monitoring", "true", root.getPath() +":patient:test", "list" ); em.persist( selfMon ); MenuStructure rad = new MenuStructure( ! account, patResults, "rad.xhtml", null, 70, "rad", "Radiology", "true", root.getPath() +":patient:test", "list" ); em.persist( rad ); em.persist( new MSColumn( rad, 1, "Date", "date01", "MMM-dd-yyyy hh:mm") ); *************** *** 611,619 **** MenuStructure physio = new MenuStructure( ! account, patResults, "physio.xhtml", null, 80, "physio", "Physio", "true", root.getPath() +":patient:result:test", "list" ); em.persist( physio ); MenuStructure images = new MenuStructure( ! account, patResults, "images.xhtml", null, 90, "images", "Images", "true", root.getPath() +":patient:result:test", "list" ); em.persist( images ); --- 611,619 ---- MenuStructure physio = new MenuStructure( ! account, patResults, "physio.xhtml", null, 80, "physio", "Physio", "true", root.getPath() +":patient:test", "list" ); em.persist( physio ); MenuStructure images = new MenuStructure( ! account, patResults, "images.xhtml", null, 90, "images", "Images", "true", root.getPath() +":patient:test", "list" ); em.persist( images ); |
From: John C. <jc...@us...> - 2007-01-23 03:10:41
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20633/src/org/tolven/doc/bean Modified Files: Evaluator.java Log Message: Fix organization of Lab test results in placeholders Index: Evaluator.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/Evaluator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Evaluator.java 20 Jan 2007 19:23:17 -0000 1.2 --- Evaluator.java 23 Jan 2007 03:10:37 -0000 1.3 *************** *** 204,208 **** if (ccr.getBody()!=null && ccr.getBody().getResults()!=null) { MenuStructure msResult = menuLocal.findDescendentMenuStructure(docCCR.getAccount().getId(), msPatient, "result"); ! MenuStructure msTest = menuLocal.findDescendentMenuStructure(docCCR.getAccount().getId(), msResult, "test"); MenuStructure msResultsLab = menuLocal.findDescendentMenuStructure(docCCR.getAccount().getId(), msPatient, "results:lab"); for (ResultType result : ccr.getBody().getResults().getResult()) { --- 204,208 ---- if (ccr.getBody()!=null && ccr.getBody().getResults()!=null) { MenuStructure msResult = menuLocal.findDescendentMenuStructure(docCCR.getAccount().getId(), msPatient, "result"); ! MenuStructure msTest = menuLocal.findDescendentMenuStructure(docCCR.getAccount().getId(), msPatient, "test"); MenuStructure msResultsLab = menuLocal.findDescendentMenuStructure(docCCR.getAccount().getId(), msPatient, "results:lab"); for (ResultType result : ccr.getBody().getResults().getResult()) { *************** *** 217,221 **** mdResult.setString02(result.getStatusText()); menuLocal.persistMenuData(mdResult); ! // We also need to represent individual test results for (TestType test : result.getTest()) { MenuData mdTest = new MenuData(); --- 217,221 ---- mdResult.setString02(result.getStatusText()); menuLocal.persistMenuData(mdResult); ! // We also need to represent individual test results (independent of result) for (TestType test : result.getTest()) { MenuData mdTest = new MenuData(); *************** *** 224,228 **** mdTest.setAccount(docCCR.getAccount()); mdTest.setParent01(mdPatient); ! mdTest.setParent02(mdResult); mdTest.setString01(test.getDescriptionText()); // Note date is copied from the result (parent), not the test (child) --- 224,228 ---- mdTest.setAccount(docCCR.getAccount()); mdTest.setParent01(mdPatient); ! mdTest.setParent02(mdTest); mdTest.setString01(test.getDescriptionText()); // Note date is copied from the result (parent), not the test (child) |
From: John C. <jc...@us...> - 2007-01-21 00:01:35
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/core/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14460/src/org/tolven/core/bean Modified Files: ActivationBean.java Log Message: Separate reading a document (protected) from writing a document (not so protected). Index: ActivationBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/core/bean/ActivationBean.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ActivationBean.java 20 Jan 2007 19:23:17 -0000 1.28 --- ActivationBean.java 21 Jan 2007 00:01:34 -0000 1.29 *************** *** 55,59 **** @Stateless @Local(ActivationLocal.class) ! //@SecurityDomain("tolvenLDAP") public class ActivationBean implements ActivationLocal { @PersistenceContext private EntityManager em; --- 55,59 ---- @Stateless @Local(ActivationLocal.class) ! @SecurityDomain("tolvenLDAP") public class ActivationBean implements ActivationLocal { @PersistenceContext private EntityManager em; |
From: John C. <jc...@us...> - 2007-01-21 00:00:48
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14000/src/org/tolven/web Modified Files: MenuAction.java DocAction.java Log Message: Separate reading a document (protected) from writing a document (not so protected). Index: DocAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/DocAction.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DocAction.java 20 Jan 2007 19:25:05 -0000 1.10 --- DocAction.java 21 Jan 2007 00:00:45 -0000 1.11 *************** *** 31,34 **** --- 31,35 ---- import org.tolven.doc.DocumentLocal; import org.tolven.doc.XMLLocal; + import org.tolven.doc.XMLProtectedLocal; import org.tolven.doc.entity.DocBase; import org.tolven.doc.entity.DocCCR; *************** *** 53,57 **** @EJB protected DocumentLocal docBean; ! @EJB protected XMLLocal xmlBean; /** Creates a new instance of DocAction --- 54,58 ---- @EJB protected DocumentLocal docBean; ! @EJB protected XMLProtectedLocal xmlProtectedBean; /** Creates a new instance of DocAction *************** *** 62,66 **** // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 docBean = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); ! xmlBean = (XMLLocal) ctx.lookup("tolven/XMLBean/local"); setContent("This is some more content in B64 - We'll see how big it can be and if it can handle non-printable characters in a while" ); } --- 63,67 ---- // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 docBean = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); ! xmlProtectedBean = (XMLProtectedLocal) ctx.lookup("tolven/XMLProtectedBean/local"); setContent("This is some more content in B64 - We'll see how big it can be and if it can handle non-printable characters in a while" ); } Index: MenuAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/MenuAction.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** MenuAction.java 20 Jan 2007 19:25:05 -0000 1.29 --- MenuAction.java 21 Jan 2007 00:00:45 -0000 1.30 *************** *** 47,50 **** --- 47,51 ---- import org.tolven.doc.DocumentLocal; import org.tolven.doc.XMLLocal; + import org.tolven.doc.XMLProtectedLocal; import org.tolven.doc.entity.DocBase; import org.tolven.doc.entity.DocCCR; *************** *** 67,71 **** private Long menuDataCount = null; private DocumentLocal documentLocal; ! private XMLLocal xmlLocal; private List<MenuStructure> menus = null; --- 68,72 ---- private Long menuDataCount = null; private DocumentLocal documentLocal; ! private XMLProtectedLocal xmlProtectedLocal; private List<MenuStructure> menus = null; *************** *** 79,83 **** menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); ! xmlLocal = (XMLLocal) ctx.lookup("tolven/XMLBean/local"); } --- 80,84 ---- menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); ! xmlProtectedLocal = (XMLProtectedLocal) ctx.lookup("tolven/XMLProtectedBean/local"); } *************** *** 321,325 **** public ContinuityOfCareRecord getCcr( ) throws Exception { if (ccr==null) { ! ccr = (ContinuityOfCareRecord) xmlLocal.unmarshal(getDocCCR() ); } return ccr; --- 322,326 ---- public ContinuityOfCareRecord getCcr( ) throws Exception { if (ccr==null) { ! ccr = (ContinuityOfCareRecord) xmlProtectedLocal.unmarshal(getDocCCR() ); } return ccr; |
From: John C. <jc...@us...> - 2007-01-21 00:00:48
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web/ccr In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14000/src/org/tolven/web/ccr Modified Files: CCRAction.java Log Message: Separate reading a document (protected) from writing a document (not so protected). Index: CCRAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/ccr/CCRAction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CCRAction.java 20 Jan 2007 19:25:05 -0000 1.3 --- CCRAction.java 21 Jan 2007 00:00:46 -0000 1.4 *************** *** 128,132 **** if (getDocXML()==null) return null; if (!(getDocXML() instanceof DocCCR)) return null; ! ccr = (ContinuityOfCareRecord) xmlBean.unmarshal(getDocXML()); } return ccr; --- 128,132 ---- if (getDocXML()==null) return null; if (!(getDocXML() instanceof DocCCR)) return null; ! ccr = (ContinuityOfCareRecord) xmlProtectedBean.unmarshal(getDocXML()); } return ccr; |
From: John C. <jc...@us...> - 2007-01-21 00:00:43
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/doc In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13984/src/org/tolven/doc Modified Files: XMLLocal.java Added Files: XMLProtectedLocal.java Log Message: Separate reading a document (protected) from writing a document (not so protected). --- NEW FILE: XMLProtectedLocal.java --- package org.tolven.doc; import javax.xml.bind.JAXBException; import org.tolven.doc.entity.DocXML; public interface XMLProtectedLocal { /** * <p>This method will unmarshal the XML content of the specified document * into an object graph and return the head of that graph. Subsequent calls to get the graph will * not unmarshal the XML again.</p> * @return the object graph * @throws JAXBException */ public Object unmarshal(DocXML doc) throws JAXBException; } Index: XMLLocal.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/XMLLocal.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLLocal.java 20 Jan 2007 19:23:17 -0000 1.1 --- XMLLocal.java 21 Jan 2007 00:00:42 -0000 1.2 *************** *** 12,23 **** public interface XMLLocal { - /** - * <p>This method will unmarshal the XML content of the specified document - * into an object graph and return the head of that graph. Subsequent calls to get the graph will - * not unmarshal the XML again.</p> - * @return the object graph - * @throws JAXBException - */ - public Object unmarshal(DocXML doc) throws JAXBException; /** --- 12,15 ---- |
From: John C. <jc...@us...> - 2007-01-21 00:00:43
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13984/src/org/tolven/doc/bean Modified Files: XMLBean.java Added Files: XMLProtectedBean.java Log Message: Separate reading a document (protected) from writing a document (not so protected). --- NEW FILE: XMLProtectedBean.java --- package org.tolven.doc.bean; import java.io.ByteArrayInputStream; import javax.ejb.Local; import javax.ejb.Stateless; import javax.xml.bind.JAXBException; import org.jboss.annotation.security.SecurityDomain; import org.tolven.doc.XMLProtectedLocal; import org.tolven.doc.entity.DocXML; @Stateless() @Local(XMLProtectedLocal.class) @SecurityDomain("tolvenLDAP") public class XMLProtectedBean extends XMLBean implements XMLProtectedLocal { /** * <p>This method will unmarshal the XML content of the specified document * into an object graph and return the head of that graph. Subsequent calls to get the graph will * not unmarshal the XML again.</p> * @return the object graph * @throws JAXBException */ public Object unmarshal(DocXML doc) throws JAXBException { byte[] c = doc.getContent(); if (c==null) return null; return unmarshal( doc.getXmlNS(), new ByteArrayInputStream( c )); } } Index: XMLBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/XMLBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLBean.java 20 Jan 2007 19:23:17 -0000 1.1 --- XMLBean.java 21 Jan 2007 00:00:42 -0000 1.2 *************** *** 25,29 **** @Stateless() @Local(XMLLocal.class) - //@SecurityDomain("tolvenLDAP") public class XMLBean implements XMLLocal { static final String CCR_NS = "urn:astm-org:CCR"; --- 25,28 ---- *************** *** 57,86 **** return null; } - - /** - * <p>This method will unmarshal the XML content of the specified document - * into an object graph and return the head of that graph. Subsequent calls to get the graph will - * not unmarshal the XML again.</p> - * @return the object graph - * @throws JAXBException - */ - public Object unmarshal(DocXML doc) throws JAXBException { - byte[] c = doc.getContent(); - if (c==null) return null; - return unmarshal( doc.getXmlNS(), new ByteArrayInputStream( c )); - } - - /** - * <p>This method will unmarshal the XML into an object graph and return the head of that graph. </p> - * @return the object graph - * @throws JAXBException - */ - public Object unmarshal(String ns, InputStream input) throws JAXBException { - JAXBContext jc = setupJAXBContext(decodeBindingContext(ns)); - Unmarshaller u = jc.createUnmarshaller(); - return u.unmarshal( new StreamSource( input ) ); - } - - public void marshalCCR( ContinuityOfCareRecord ccr, OutputStream output ) throws JAXBException, CCRException { // Reset the actors list with the actors we now have in the transient map --- 56,59 ---- *************** *** 99,103 **** --- 72,88 ---- } + /** + * <p>This method will unmarshal the XML into an object graph and return the head of that graph. </p> + * @return the object graph + * @throws JAXBException + */ + public Object unmarshal(String ns, InputStream input) throws JAXBException { + JAXBContext jc = setupJAXBContext(decodeBindingContext(ns)); + Unmarshaller u = jc.createUnmarshaller(); + return u.unmarshal( new StreamSource( input ) ); + } + + } |
From: John C. <jc...@us...> - 2007-01-20 22:40:41
|
Update of /cvsroot/tolven/tolvenWEB/web/five/test In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv11486/web/five/test Modified Files: docList.xhtml Log Message: Cosmetic Index: docList.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/test/docList.xhtml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** docList.xhtml 20 Jan 2007 19:25:51 -0000 1.6 --- docList.xhtml 20 Jan 2007 22:40:35 -0000 1.7 *************** *** 30,34 **** <p>To see encrypted documents, you must have more than one account in the Select Account page presented when you logged in.</p> ! <div style="border: 1px solid #E1E1E1;width:800px"> <table id="#{menu.element}LG_header"> <thead> --- 30,34 ---- <p>To see encrypted documents, you must have more than one account in the Select Account page presented when you logged in.</p> ! <div style="width:800px"> <table id="#{menu.element}LG_header"> <thead> |
From: John C. <jc...@us...> - 2007-01-20 22:34:09
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/core/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8899/src/org/tolven/core/bean Modified Files: InvitationBean.java Log Message: Fix unmarshal bug in executeInvitation Index: InvitationBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/core/bean/InvitationBean.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** InvitationBean.java 20 Jan 2007 19:23:17 -0000 1.18 --- InvitationBean.java 20 Jan 2007 22:34:08 -0000 1.19 *************** *** 318,322 **** JAXBContext jc = setupJAXBContext(); Unmarshaller u = jc.createUnmarshaller(); ! Details detailGraph = (Details)u.unmarshal( new StreamSource( new ByteArrayInputStream( invitation.getDetailContent()) ) ); List<AdministrativeDetail> details = detailGraph.getDetail(); for (AdministrativeDetail detail : details) { --- 318,324 ---- JAXBContext jc = setupJAXBContext(); Unmarshaller u = jc.createUnmarshaller(); ! JAXBElement element = (JAXBElement)u.unmarshal( new StreamSource( new ByteArrayInputStream( invitation.getDetailContent()) ) ); ! // System.out.println("Unmarshal: " + element.getClass().getName() + ", " + element.getValue().getClass().getName()); ! Details detailGraph = (Details) element.getValue(); List<AdministrativeDetail> details = detailGraph.getDetail(); for (AdministrativeDetail detail : details) { |
From: John C. <jc...@us...> - 2007-01-20 19:43:56
|
Update of /cvsroot/tolven/tolvenWEB/web/templates In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv2022/web/templates Modified Files: portalTemplate.xhtml Log Message: Remove temporary link to sample menu data browser - accessed separately. Index: portalTemplate.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/templates/portalTemplate.xhtml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** portalTemplate.xhtml 17 Jan 2007 18:43:01 -0000 1.16 --- portalTemplate.xhtml 20 Jan 2007 19:43:54 -0000 1.17 *************** *** 73,77 **** <h:panelGroup rendered="#{top.accountUserId!=0}"> <li><a href="javascript:getRemoteContent(visiblePage);" >[Refresh]</a></li> - <li><a href="top.browse" >[Technical]</a></li> </h:panelGroup> </ul> --- 73,76 ---- |
From: John C. <jc...@us...> - 2007-01-20 19:25:55
|
Update of /cvsroot/tolven/tolvenWEB/web/WEB-INF In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27018/web/WEB-INF Modified Files: faces-config.xml Log Message: Refactoring to support Encryption Index: faces-config.xml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/WEB-INF/faces-config.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** faces-config.xml 16 Jan 2007 06:48:19 -0000 1.31 --- faces-config.xml 20 Jan 2007 19:25:51 -0000 1.32 *************** *** 504,512 **** <to-view-id>/five/test/docList.xhtml</to-view-id> </navigation-case> - <navigation-case> - <from-action>#{ccr.addPatient}</from-action> - <from-outcome>success</from-outcome> - <to-view-id>/five/test/docDetail.xhtml</to-view-id> - </navigation-case> </navigation-rule> --- 504,507 ---- *************** *** 523,531 **** <to-view-id>/five/test/docDetail.xhtml</to-view-id> </navigation-case> - <navigation-case> - <from-action>#{ccr.addPatient}</from-action> - <from-outcome>success</from-outcome> - <to-view-id>/five/test/docDetail.xhtml</to-view-id> - </navigation-case> </navigation-rule> --- 518,521 ---- |
From: John C. <jc...@us...> - 2007-01-20 19:25:54
|
Update of /cvsroot/tolven/tolvenWEB/web/five/test In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27018/web/five/test Modified Files: docList.xhtml docDetail.xhtml Log Message: Refactoring to support Encryption Index: docDetail.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/test/docDetail.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** docDetail.xhtml 28 Sep 2006 19:12:08 -0000 1.2 --- docDetail.xhtml 20 Jan 2007 19:25:51 -0000 1.3 *************** *** 39,45 **** <h:commandButton action="#{ccr.newCCR}" value="New CCR"/> </h:form> - <h:form id="docDetail3" onsubmit="return ajaxSubmit2(this);"> - <h:commandButton action="#{ccr.addPatient}" value="Add Patient"/> - </h:form> <pre> #{ccr.docXML.contentString} --- 39,42 ---- Index: docList.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/test/docList.xhtml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** docList.xhtml 16 Jan 2007 06:40:38 -0000 1.5 --- docList.xhtml 20 Jan 2007 19:25:51 -0000 1.6 *************** *** 30,34 **** <p>To see encrypted documents, you must have more than one account in the Select Account page presented when you logged in.</p> ! <div style="border: 1px solid #E1E1E1;width:590px"> <table id="#{menu.element}LG_header"> <thead> --- 30,34 ---- <p>To see encrypted documents, you must have more than one account in the Select Account page presented when you logged in.</p> ! <div style="border: 1px solid #E1E1E1;width:800px"> <table id="#{menu.element}LG_header"> <thead> |
From: John C. <jc...@us...> - 2007-01-20 19:25:54
|
Update of /cvsroot/tolven/tolvenWEB/web/five In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27018/web/five Modified Files: personal.xhtml Log Message: Refactoring to support Encryption Index: personal.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/personal.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** personal.xhtml 29 Aug 2006 07:35:30 -0000 1.2 --- personal.xhtml 20 Jan 2007 19:25:51 -0000 1.3 *************** *** 12,46 **** <h:panelGrid columns="2"> <h:outputText value="First Name:"/> ! <h:outputText value="#{menu.docCCR.patientActor.person.name.currentName.given[0]}"/> <h:outputText value="Middle:"/> ! <h:outputText value="#{menu.docCCR.patientActor.person.name.currentName.middle[0]}"/> <h:outputText value="Last Name:"/> ! <h:outputText value="#{menu.docCCR.patientActor.person.name.currentName.family[0]}"/> <h:panelGroup><hr/></h:panelGroup> <h:panelGroup><hr/></h:panelGroup> <h:outputText value="Date of Birth:"/> ! <h:outputText value="#{menu.docCCR.patientActor.person.dateOfBirth.exactDateTime}"/> <h:panelGroup><hr/></h:panelGroup> <h:panelGroup><hr/></h:panelGroup> <h:outputText value="Gender:"/> ! <h:outputText value="#{menu.docCCR.patientActor.person.gender.text}"/> <h:panelGroup><hr/></h:panelGroup> <h:panelGroup><hr/></h:panelGroup> <h:outputText value="Address line 1:"/> ! <h:outputText value="#{menu.docCCR.patientActor.address[0].line1}"/> <h:outputText value="Address line 2:"/> ! <h:outputText value="#{menu.docCCR.patientActor.address[0].line2}"/> <h:outputText value="City:"/> ! <h:outputText value="#{menu.docCCR.patientActor.address[0].city}"/> <h:outputText value="State/Province:"/> ! <h:outputText value="#{menu.docCCR.patientActor.address[0].state}"/> <h:outputText value="Country:"/> ! <h:outputText value="#{menu.docCCR.patientActor.address[0].country}"/> <h:outputText value="Zip/Postal Code:"/> ! <h:outputText value="#{menu.docCCR.patientActor.address[0].postalCode}"/> <h:panelGroup><hr/></h:panelGroup> <h:panelGroup><hr/></h:panelGroup> </h:panelGrid> ! <h:outputText value="#{menu.docCCR.patientActor.actorObjectID}"/> </ui:composition> --- 12,46 ---- <h:panelGrid columns="2"> <h:outputText value="First Name:"/> ! <h:outputText value="#{menu.ccr.patientActor.person.name.currentName.given[0]}"/> <h:outputText value="Middle:"/> ! <h:outputText value="#{menu.ccr.patientActor.person.name.currentName.middle[0]}"/> <h:outputText value="Last Name:"/> ! <h:outputText value="#{menu.ccr.patientActor.person.name.currentName.family[0]}"/> <h:panelGroup><hr/></h:panelGroup> <h:panelGroup><hr/></h:panelGroup> <h:outputText value="Date of Birth:"/> ! <h:outputText value="#{menu.ccr.patientActor.person.dateOfBirth.exactDateTime}"/> <h:panelGroup><hr/></h:panelGroup> <h:panelGroup><hr/></h:panelGroup> <h:outputText value="Gender:"/> ! <h:outputText value="#{menu.ccr.patientActor.person.gender.text}"/> <h:panelGroup><hr/></h:panelGroup> <h:panelGroup><hr/></h:panelGroup> <h:outputText value="Address line 1:"/> ! <h:outputText value="#{menu.ccr.patientActor.address[0].line1}"/> <h:outputText value="Address line 2:"/> ! <h:outputText value="#{menu.ccr.patientActor.address[0].line2}"/> <h:outputText value="City:"/> ! <h:outputText value="#{menu.ccr.patientActor.address[0].city}"/> <h:outputText value="State/Province:"/> ! <h:outputText value="#{menu.ccr.patientActor.address[0].state}"/> <h:outputText value="Country:"/> ! <h:outputText value="#{menu.ccr.patientActor.address[0].country}"/> <h:outputText value="Zip/Postal Code:"/> ! <h:outputText value="#{menu.ccr.patientActor.address[0].postalCode}"/> <h:panelGroup><hr/></h:panelGroup> <h:panelGroup><hr/></h:panelGroup> </h:panelGrid> ! <h:outputText value="#{menu.ccr.patientActor.actorObjectID}"/> </ui:composition> |
From: John C. <jc...@us...> - 2007-01-20 19:25:10
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web/ccr In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26576/src/org/tolven/web/ccr Modified Files: CCRAction.java Log Message: Refactoring to support Encryption Index: CCRAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/ccr/CCRAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CCRAction.java 16 Jan 2007 06:28:22 -0000 1.2 --- CCRAction.java 20 Jan 2007 19:25:05 -0000 1.3 *************** *** 5,8 **** --- 5,9 ---- import java.util.List; + import javax.annotation.EJB; import javax.el.ELException; import javax.faces.application.Application; *************** *** 16,19 **** --- 17,21 ---- import org.tolven.ccr.PersonNameType; import org.tolven.ccr.ContinuityOfCareRecord.Patient; + import org.tolven.doc.XMLLocal; import org.tolven.doc.entity.CCRException; import org.tolven.doc.entity.DocBase; *************** *** 26,30 **** private ActorType actor; private List<SelectItem> ccrPathItems = null; ! private boolean debug; --- 28,33 ---- private ActorType actor; private List<SelectItem> ccrPathItems = null; ! private ContinuityOfCareRecord ccr; ! private boolean debug; *************** *** 69,74 **** if (ccrPathItems==null) { ccrPathItems = new ArrayList<SelectItem>( 30 ); ! ContinuityOfCareRecord ccr = getCCR(); ! if (ccr==null) return ccrPathItems; addCCRPath( "#{ccr.CCR.CCRDocumentObjectID}" ); addCCRPath( "#{ccr.CCR.version}" ); --- 72,76 ---- if (ccrPathItems==null) { ccrPathItems = new ArrayList<SelectItem>( 30 ); ! if (getCCR()==null) return ccrPathItems; addCCRPath( "#{ccr.CCR.CCRDocumentObjectID}" ); addCCRPath( "#{ccr.CCR.version}" ); *************** *** 104,119 **** setDoc( docCCR ); System.out.println( "...created id " + getDoc().getId()); ! docBean.persistCCRDocument(docCCR, false); ! // docBean.submitDocument(docCCR); return "success"; } ! public String addPatient( ) throws Exception { ! getDocCCR().addNewPatient(); ! System.out.println( "Patient added to " + getDocCCR().getId()); ! docBean.persistCCRDocument(getDocCCR(), false); ! // docBean.submitDocument(getDocCCR()); ! return "success"; ! } /** --- 106,120 ---- setDoc( docCCR ); System.out.println( "...created id " + getDoc().getId()); ! docBean.saveDocument(docCCR); return "success"; } ! // public String addPatient( ) throws Exception { ! // getDocCCR().addNewPatient(); ! // System.out.println( "Patient added to " + getDocCCR().getId()); ! // docBean.persistCCRDocument(getDocCCR(), false); ! //// docBean.submitDocument(getDocCCR()); ! // return "success"; ! // } /** *************** *** 124,131 **** */ public ContinuityOfCareRecord getCCR() throws JAXBException, Exception { ! if (getDocXML()==null) return null; ! if (!(getDocXML() instanceof DocCCR)) return null; ! DocCCR ccr = (DocCCR) getDocXML(); ! return (ContinuityOfCareRecord) ccr.getCCR(); } --- 125,134 ---- */ public ContinuityOfCareRecord getCCR() throws JAXBException, Exception { ! if (ccr==null) { ! if (getDocXML()==null) return null; ! if (!(getDocXML() instanceof DocCCR)) return null; ! ccr = (ContinuityOfCareRecord) xmlBean.unmarshal(getDocXML()); ! } ! return ccr; } |
From: John C. <jc...@us...> - 2007-01-20 19:25:08
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26576/src/org/tolven/web Modified Files: PersonGenAction.java LDAPAction.java AccountAction.java RegisterAction.java MenuAction.java TopAction.java DocAction.java UMLSAction.java InvitationAction.java Log Message: Refactoring to support Encryption Index: AccountAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/AccountAction.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AccountAction.java 17 Oct 2006 03:03:10 -0000 1.8 --- AccountAction.java 20 Jan 2007 19:25:05 -0000 1.9 *************** *** 16,50 **** import java.util.List; import javax.naming.InitialContext; import javax.naming.NamingException; - import org.tolven.admin.JoinNewAccountInvitation; - import org.tolven.core.AccountDAOLocal; import org.tolven.core.ActivationLocal; - import org.tolven.core.entity.Account; import org.tolven.core.entity.AccountUser; - import org.tolven.core.entity.HealthRecord; - import org.tolven.doc.entity.Invitation; public class AccountAction extends TolvenAction { private List<AccountUser> accountUsers = null; ! // @EJB ! private ActivationLocal activation; private AccountUser accountUser; ! public AccountAction() { super(); - try - { InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 so we'll self-wire // I think this is a JBOSS-only scam. activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); - } - catch (NamingException e) - { - throw new RuntimeException(e); - } } --- 16,39 ---- import java.util.List; + import javax.annotation.EJB; import javax.naming.InitialContext; import javax.naming.NamingException; import org.tolven.core.ActivationLocal; import org.tolven.core.entity.AccountUser; public class AccountAction extends TolvenAction { private List<AccountUser> accountUsers = null; ! ! @EJB private ActivationLocal activation; private AccountUser accountUser; ! public AccountAction() throws NamingException { super(); InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 so we'll self-wire // I think this is a JBOSS-only scam. activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); } *************** *** 84,94 **** return getAccountUsers().size(); } - - /** - * Get a list of health records for the current account - */ - public List<HealthRecord> getHealthRecords( ) { - return activation.findHealthRecords( getAccountUser().getAccount(), 10000, 0, "id", "ASC" ); - } - } --- 73,75 ---- Index: UMLSAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/UMLSAction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UMLSAction.java 21 Aug 2006 00:20:06 -0000 1.3 --- UMLSAction.java 20 Jan 2007 19:25:05 -0000 1.4 *************** *** 158,166 **** } ! /** Creates a new instance of UMLSAction */ ! public UMLSAction() { ! System.out.println("********Initializing new UMLSAction backing bean*********"); ! try ! { InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 --- 158,164 ---- } ! /** Creates a new instance of UMLSAction ! * @throws NamingException */ ! public UMLSAction() throws NamingException { InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 *************** *** 169,177 **** mrconsoLoader = (LoadMrconsoLocal) ctx.lookup("tolven/LoadMrconsoBean/local"); conceptDAO = (ConceptDAO) ctx.lookup("tolven/ConceptDAOBean/local"); - } - catch (NamingException e) - { - throw new RuntimeException(e); - } path = "F:\\2006AA-RRF\\2006AA\\META\\"; --- 167,170 ---- Index: RegisterAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/RegisterAction.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** RegisterAction.java 16 Jan 2007 06:36:07 -0000 1.34 --- RegisterAction.java 20 Jan 2007 19:25:05 -0000 1.35 *************** *** 45,51 **** import org.tolven.gen.Generator; import org.tolven.gen.bean.GenControlAccount; import org.tolven.security.TolvenPerson; import org.tolven.web.security.auth.KeyLdapCallbackHandler; - import org.tolven.security.bean.LDAPLocal; import org.tolven.security.key.UserPrivateKey; --- 45,52 ---- import org.tolven.gen.Generator; import org.tolven.gen.bean.GenControlAccount; + import org.tolven.security.LDAPLocal; + import org.tolven.security.LoginLocal; import org.tolven.security.TolvenPerson; import org.tolven.web.security.auth.KeyLdapCallbackHandler; import org.tolven.security.key.UserPrivateKey; *************** *** 56,74 **** public class RegisterAction extends TolvenAction { - // @EJB private ActivationLocal activation; ! // @EJB private LDAPLocal ldap; - // @EJB - private TolvenPropertiesLocal propertyBean; - // @EJB private InvitationLocal invitationBean; - // @EJB private MenuLocal menu; - // @EJB private DocumentLocal doc; - // @EJB private AccountDAOLocal accountBean; - // @EJB private Generator chrGen; --- 57,67 ---- public class RegisterAction extends TolvenAction { private ActivationLocal activation; ! private LoginLocal loginBean; private LDAPLocal ldap; private InvitationLocal invitationBean; private MenuLocal menu; private DocumentLocal doc; private AccountDAOLocal accountBean; private Generator chrGen; *************** *** 123,145 **** private List<AccountUser> accountUsers; ! /** Creates a new instance of RegisterAction */ ! public RegisterAction() { ! try ! { InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 ldap = (LDAPLocal) ctx.lookup("tolven/LDAPBean/local"); activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); accountBean = (AccountDAOLocal) ctx.lookup("tolven/AccountDAOBean/local"); - propertyBean = (TolvenPropertiesLocal) ctx.lookup("tolven/TolvenProperties/local"); invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); menu = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); doc = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); chrGen = (Generator) ctx.lookup("tolven/GeneratorBean/local"); - } - catch (NamingException e) - { - throw new RuntimeException(e); - } maxResults = 100; timeLimit = 1000; --- 116,132 ---- private List<AccountUser> accountUsers; ! /** Creates a new instance of RegisterAction ! * @throws NamingException */ ! public RegisterAction() throws NamingException { InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 ldap = (LDAPLocal) ctx.lookup("tolven/LDAPBean/local"); activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); + loginBean = (LoginLocal) ctx.lookup("tolven/LoginBean/local"); accountBean = (AccountDAOLocal) ctx.lookup("tolven/AccountDAOBean/local"); invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); menu = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); doc = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); chrGen = (Generator) ctx.lookup("tolven/GeneratorBean/local"); maxResults = 100; timeLimit = 1000; *************** *** 228,232 **** */ public String register() throws Exception { ! if (!Boolean.parseBoolean(propertyBean.getProperties().getProperty("tolven.login.create.activatedUser"))) { throw new SecurityException( "tolven property tolven.login.create.activatedUser must be true"); } --- 215,219 ---- */ public String register() throws Exception { ! if (!Boolean.parseBoolean(System.getProperty("tolven.login.create.activatedUser"))) { throw new SecurityException( "tolven property tolven.login.create.activatedUser must be true"); } *************** *** 257,261 **** if (this.isNoActivation()) { try { ! activation.registerAndActivate( tp, getNow() ); } catch (Throwable e) { while (e.getCause()!=null) { --- 244,248 ---- if (this.isNoActivation()) { try { ! loginBean.registerAndActivate( tp, getNow() ); } catch (Throwable e) { while (e.getCause()!=null) { *************** *** 273,277 **** // Create the user and the invitation. The user will be invited to join a new, empty account. // Other invitations may reference an existing account or a referral account. ! activation.register( getTp(), getNow()); } catch (Throwable e) { while (e.getCause()!=null) { --- 260,264 ---- // Create the user and the invitation. The user will be invited to join a new, empty account. // Other invitations may reference an existing account or a referral account. ! loginBean.register( getTp(), getNow()); } catch (Throwable e) { while (e.getCause()!=null) { *************** *** 298,302 **** public String activate() throws Exception { ! if (!Boolean.parseBoolean(propertyBean.getProperties().getProperty("tolven.login.create.demoUser"))) { throw new SecurityException( "tolven property tolven.login.create.demoUser must be true"); } --- 285,289 ---- public String activate() throws Exception { ! if (!Boolean.parseBoolean(System.getProperty("tolven.login.create.demoUser"))) { throw new SecurityException( "tolven property tolven.login.create.demoUser must be true"); } *************** *** 327,331 **** try { ! activation.registerAndActivate( tp, getNow() ); } catch (Exception e) { Throwable ex = e; --- 314,318 ---- try { ! loginBean.registerAndActivate( tp, getNow() ); } catch (Exception e) { Throwable ex = e; *************** *** 591,595 **** public TolvenUser getUser() throws NamingException, IOException { ! if (user==null) user=accountBean.findUser( getTp().getUid()); return user; } --- 578,582 ---- public TolvenUser getUser() throws NamingException, IOException { ! if (user==null) user=activation.findUser( getTp().getUid()); return user; } *************** *** 655,659 **** if (getNewDemoUser()==null) return "success"; String uid = getNewDemoUser().toLowerCase().trim(); ! TolvenUser user = accountBean.findUser(uid); if (user==null) { FacesContext.getCurrentInstance().addMessage( "accountAdmin:uid", new FacesMessage("Demo user " + uid + " not found")); --- 642,646 ---- if (getNewDemoUser()==null) return "success"; String uid = getNewDemoUser().toLowerCase().trim(); ! TolvenUser user = activation.findUser(uid); if (user==null) { FacesContext.getCurrentInstance().addMessage( "accountAdmin:uid", new FacesMessage("Demo user " + uid + " not found")); *************** *** 718,722 **** public boolean isReferenceRequired() throws IOException { if (referenceRequired==null) { ! referenceRequired = Boolean.parseBoolean(propertyBean.getProperties().getProperty("tolven.register.referenceRequired")); } return referenceRequired; --- 705,709 ---- public boolean isReferenceRequired() throws IOException { if (referenceRequired==null) { ! referenceRequired = Boolean.parseBoolean(System.getProperty("tolven.register.referenceRequired")); } return referenceRequired; Index: LDAPAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/LDAPAction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LDAPAction.java 21 Aug 2006 00:20:06 -0000 1.5 --- LDAPAction.java 20 Jan 2007 19:25:05 -0000 1.6 *************** *** 14,25 **** package org.tolven.web; - import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; - import java.util.Properties; import javax.faces.model.SelectItem; - import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingEnumeration; --- 14,22 ---- *************** *** 30,35 **** import javax.naming.ldap.LdapContext; - import org.tolven.core.TolvenPropertiesLocal; - import org.tolven.gen.PersonGenerator; import org.tolven.security.TolvenPerson; --- 27,30 ---- *************** *** 42,46 **** private String url; private String baseDN; - private Properties properties = null; // User needed for updates // Criteria --- 37,40 ---- *************** *** 56,106 **** private List<SelectItem> baseDNs = null; ! // @EJB ! PersonGenerator personGenerator; ! // @EJB ! private TolvenPropertiesLocal propertyBean; ! /** Creates a new instance of LDAPAction */ public LDAPAction() { - try - { - InitialContext ctx = new InitialContext(); - personGenerator = (PersonGenerator) ctx.lookup("tolven/PersonGeneratorDAO/local"); - propertyBean = (TolvenPropertiesLocal) ctx.lookup("tolven/TolvenProperties/local"); - } - catch (NamingException e) - { - throw new RuntimeException(e); - } - resetDefaults(); } - /** - * Restore settings to their defaults - */ - public String resetDefaults() { - url = properties.getProperty("tolven.ldap.url"); - baseDNs = new ArrayList<SelectItem>(); - baseDNs.add( new SelectItem("ou=people,dc=tolven,dc=com", "people") ); - baseDNs.add( new SelectItem( "ou=testpeople,dc=tolven,dc=com", "testpeople" ) ); - baseDN = baseDNs.get(0).getValue().toString(); - // User needed for updates - // Criteria - criteria = "*"; - field = "sn="; - maxResults = 1000; - timeLimit = 10; // In milliseconds - numberToCreate = 100; - elapsedTime = null; - - return "success"; - } - - private Properties getProperties() throws IOException { - if (properties==null) { - properties = propertyBean.getProperties(); - } - return properties; - } /** --- 50,58 ---- private List<SelectItem> baseDNs = null; ! /** Creates a new instance of LDAPAction */ public LDAPAction() { } /** *************** *** 126,148 **** /** - * Add a new person to LDAP DB. Note: We let LDAP take care of replica propagation. - */ - public String addPerson( ) throws NamingException, Exception { - Object base; - long startTime = System.currentTimeMillis(); - connectLDAP(); - for (int n = 0; n < this.getNumberToCreate();n++) { - TolvenPerson curPerson = new TolvenPerson( personGenerator.generatePerson() ); - curPerson.generateDN( baseDN ); - // Create the context - Context result = ctx.createSubcontext(curPerson.getDn(), curPerson.dirAttributes(false)); - } - closeLDAP(); - double elapsed = (System.currentTimeMillis() - startTime); - elapsedTime = String.format("Elapsed: %.3f sec ", elapsed/1000); - return "success"; - } - - /** * Search for matching names. If not connected yet, we'll connect to LDAP now. */ --- 78,81 ---- Index: MenuAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/MenuAction.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** MenuAction.java 16 Jan 2007 06:35:13 -0000 1.28 --- MenuAction.java 20 Jan 2007 19:25:05 -0000 1.29 *************** *** 44,48 **** --- 44,50 ---- import org.tolven.app.entity.MenuData; import org.tolven.app.entity.MenuStructure; + import org.tolven.ccr.ContinuityOfCareRecord; import org.tolven.doc.DocumentLocal; + import org.tolven.doc.XMLLocal; import org.tolven.doc.entity.DocBase; import org.tolven.doc.entity.DocCCR; *************** *** 65,84 **** private Long menuDataCount = null; private DocumentLocal documentLocal; private List<MenuStructure> menus = null; ! public MenuAction() { super(); - try - { InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); ! } ! catch (NamingException e) ! { ! throw new RuntimeException(e); ! } } --- 67,83 ---- private Long menuDataCount = null; private DocumentLocal documentLocal; + private XMLLocal xmlLocal; private List<MenuStructure> menus = null; + // The CCR document for this menuDataItem, if any + private ContinuityOfCareRecord ccr; ! public MenuAction() throws NamingException { super(); InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); ! xmlLocal = (XMLLocal) ctx.lookup("tolven/XMLBean/local"); } *************** *** 320,324 **** } ! /** * Creates a chart based on MenuData * @param dataset a dataset --- 319,329 ---- } ! public ContinuityOfCareRecord getCcr( ) throws Exception { ! if (ccr==null) { ! ccr = (ContinuityOfCareRecord) xmlLocal.unmarshal(getDocCCR() ); ! } ! return ccr; ! } ! /** * Creates a chart based on MenuData * @param dataset a dataset Index: TopAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/TopAction.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** TopAction.java 20 Jan 2007 08:10:14 -0000 1.31 --- TopAction.java 20 Jan 2007 19:25:05 -0000 1.32 *************** *** 23,26 **** --- 23,27 ---- import java.util.Set; + import javax.annotation.EJB; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; *************** *** 36,45 **** import org.tolven.core.InvitationLocal; import org.tolven.core.TolvenPropertiesLocal; - import org.tolven.core.entity.AccountType; import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.Status; import org.tolven.core.entity.TolvenUser; import org.tolven.security.TolvenPerson; - import org.tolven.security.bean.LDAPLocal; import org.tolven.security.key.PrivateKeyRing; import org.tolven.security.key.UserPrivateKey; --- 37,46 ---- import org.tolven.core.InvitationLocal; import org.tolven.core.TolvenPropertiesLocal; import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.Status; import org.tolven.core.entity.TolvenUser; + import org.tolven.security.LDAPLocal; + import org.tolven.security.LoginLocal; import org.tolven.security.TolvenPerson; import org.tolven.security.key.PrivateKeyRing; import org.tolven.security.key.UserPrivateKey; *************** *** 52,66 **** public class TopAction extends TolvenAction { ! // @EJB ! private ActivationLocal activation; ! // @EJB ! private LDAPLocal ldap; ! // @EJB ! private InvitationLocal invitationBean; ! // @EJB ! private TolvenPropertiesLocal propertyBean; ! // @EJB ! private MenuLocal menuLocal; ! private String startPage; --- 53,62 ---- public class TopAction extends TolvenAction { ! private LDAPLocal ldap; ! private ActivationLocal activation; ! private LoginLocal loginBean; ! private InvitationLocal invitationBean; ! private MenuLocal menuLocal; ! private String startPage; *************** *** 87,119 **** private int dummyCount; ! ! private PropertyResolver tpr; ! ! private Properties properties = null; ! ! /** Creates a new instance of TopAction */ ! public TopAction() { dummyCount = 0; invitationId = 0; rememberDefault = false; - try - { InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 - ldap = (LDAPLocal) ctx.lookup("tolven/LDAPBean/local"); - menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); ! propertyBean = (TolvenPropertiesLocal) ctx.lookup("tolven/TolvenProperties/local"); ! } ! catch (NamingException e) ! { ! throw new RuntimeException(e); ! } ignoreDefault = false; // setStartPage( "../private/myHome.jsf" ); } /** * Return a list of the last 100 server transaction elapsed times for this session --- 83,106 ---- private int dummyCount; ! ! /** Creates a new instance of TopAction ! * @throws NamingException */ ! public TopAction() throws NamingException { dummyCount = 0; invitationId = 0; rememberDefault = false; InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); + loginBean = (LoginLocal) ctx.lookup("tolven/LoginBean/local"); + menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); invitationBean = (InvitationLocal) ctx.lookup("tolven/InvitationBean/local"); ! ldap = (LDAPLocal) ctx.lookup("tolven/LDAPBean/local"); ignoreDefault = false; // setStartPage( "../private/myHome.jsf" ); } + /** * Return a list of the last 100 server transaction elapsed times for this session *************** *** 161,164 **** --- 148,160 ---- } info = "Login Processing: " + getTp().getUid(); + System.out.println( info ); + // Subject subject; + // try { + // subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); + // } catch (PolicyContextException e) { + // throw new IllegalStateException("[WEB] PolicyContext exception", e); + // } + // if (subject == null) + // throw new IllegalStateException("[WEB] No Subject found in PolicyContext"); // Get the TolvenUser setUser( activation.loginUser( getTp().getUid(), getNow() ) ); *************** *** 167,171 **** if ((getUser()==null || Status.NEW_LOGIN.value().equalsIgnoreCase(getUser().getStatus())) && getInvitationId()!=0) { // Since we have no user yet, we'll try executing an activation invitation (if it works) ! if (!activation.activate(getTp().getUid(), getInvitationId(), getNow())) { return dispatchingLogout("invalidInvitation"); } --- 163,167 ---- if ((getUser()==null || Status.NEW_LOGIN.value().equalsIgnoreCase(getUser().getStatus())) && getInvitationId()!=0) { // Since we have no user yet, we'll try executing an activation invitation (if it works) ! if (!loginBean.activate(getTp().getUid(), getInvitationId(), getNow())) { return dispatchingLogout("invalidInvitation"); } *************** *** 184,188 **** return dispatchingLogout("missingUserObject"); } ! if (System.getProperty("tolven.security.keys.activate") != null) { if (!getUser().hasUserPrivateKey()) { --- 180,184 ---- return dispatchingLogout("missingUserObject"); } ! if (System.getProperty("tolven.security.keys.activate") != null) { if (!getUser().hasUserPrivateKey()) { *************** *** 237,240 **** --- 233,241 ---- } + + public Properties getProperties( ) { + return System.getProperties(); + } + public String logout(){ return dispatchingLogout("loggedOut"); *************** *** 309,313 **** return getPrivateKeyRing().getUserPrivateKey(); } ! /** * Add Keys from the Subject to what should be a new TolvenUser who is logging in --- 310,314 ---- return getPrivateKeyRing().getUserPrivateKey(); } ! /** * Add Keys from the Subject to what should be a new TolvenUser who is logging in *************** *** 394,461 **** } - class PropertyResolver implements Map { - Properties properties = null; - - public PropertyResolver() throws IOException { - properties = propertyBean.getProperties(); - } - - public void clear() { - } - - public boolean containsKey(Object key) { - return false; - } - - public boolean containsValue(Object value) { - return false; - } - - public Set entrySet() { - return null; - } - - public Object get(Object key) { - // TODO Auto-generated method stub - return properties.getProperty((String) key); - } - - public boolean isEmpty() { - return false; - } - - public Set keySet() { - return null; - } - - public Object put(Object key, Object value) { - return null; - } - - public void putAll(Map t) { - } - - public Object remove(Object key) { - return null; - } - - public int size() { - return 0; - } - - public Collection values() { - return null; - } - - } - public Map getProperties() throws IOException { - if (tpr==null) tpr = new PropertyResolver(); - return tpr; - } - - public void setProperties(Properties properties) { - this.properties = properties; - } - public boolean isRememberDefault() { return rememberDefault; --- 395,398 ---- *************** *** 532,536 **** if (timeZone==null && getUser()!=null) timeZone = getUser().getTimeZone(); if (timeZone==null) timeZone = getAccountTimeZone(); ! if (timeZone==null) timeZone = propertyBean.getProperties().getProperty("tolven.timezone"); if (timeZone==null) timeZone = java.util.TimeZone.getDefault().getID(); return timeZone; --- 469,473 ---- if (timeZone==null && getUser()!=null) timeZone = getUser().getTimeZone(); if (timeZone==null) timeZone = getAccountTimeZone(); ! if (timeZone==null) timeZone = System.getProperty("tolven.timezone"); if (timeZone==null) timeZone = java.util.TimeZone.getDefault().getID(); return timeZone; Index: DocAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/DocAction.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DocAction.java 16 Jan 2007 06:29:18 -0000 1.9 --- DocAction.java 20 Jan 2007 19:25:05 -0000 1.10 *************** *** 18,21 **** --- 18,22 ---- import java.util.Map; + import javax.annotation.EJB; import javax.el.ELException; import javax.faces.application.Application; *************** *** 29,32 **** --- 30,34 ---- import org.tolven.ccr.ContinuityOfCareRecord; import org.tolven.doc.DocumentLocal; + import org.tolven.doc.XMLLocal; import org.tolven.doc.entity.DocBase; import org.tolven.doc.entity.DocCCR; *************** *** 50,55 **** private String test; ! // @EJB ! protected DocumentLocal docBean; /** Creates a new instance of DocAction --- 52,57 ---- private String test; ! @EJB protected DocumentLocal docBean; ! @EJB protected XMLLocal xmlBean; /** Creates a new instance of DocAction *************** *** 60,63 **** --- 62,66 ---- // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 docBean = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); + xmlBean = (XMLLocal) ctx.lookup("tolven/XMLBean/local"); setContent("This is some more content in B64 - We'll see how big it can be and if it can handle non-printable characters in a while" ); } *************** *** 125,129 **** Map<String,Object> reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap(); MenuAction menuAction = (MenuAction) reqMap.get( "menu"); ! if (menuAction==null) menuAction = new MenuAction(); Map<String, Long> keys = menuAction.getTargetMenuPath().getNodeValues(); documentId = keys.get("detail"); --- 128,132 ---- Map<String,Object> reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap(); MenuAction menuAction = (MenuAction) reqMap.get( "menu"); ! // if (menuAction==null) menuAction = new MenuAction(); Map<String, Long> keys = menuAction.getTargetMenuPath().getNodeValues(); documentId = keys.get("detail"); Index: PersonGenAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/PersonGenAction.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PersonGenAction.java 16 Jan 2007 06:38:55 -0000 1.17 --- PersonGenAction.java 20 Jan 2007 19:25:05 -0000 1.18 *************** *** 18,21 **** --- 18,22 ---- import java.util.Map; + import javax.annotation.EJB; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; *************** *** 36,41 **** import org.tolven.gen.entity.FamilyMember; import org.tolven.gen.entity.FamilyUnit; import org.tolven.security.TolvenPerson; - import org.tolven.security.bean.LDAPLocal; /** --- 37,43 ---- import org.tolven.gen.entity.FamilyMember; import org.tolven.gen.entity.FamilyUnit; + import org.tolven.security.LDAPLocal; + import org.tolven.security.LoginLocal; import org.tolven.security.TolvenPerson; /** *************** *** 44,62 **** * @author John Churin */ ! public class PersonGenAction extends TolvenAction implements Serializable { ! // @EJB ! private PersonGenerator personGen; ! // @EJB ! private Generator chrGen; ! // @EJB ! private ActivationLocal activation; ! // @EJB private AccountDAOLocal accountBean; ! // @EJB ! private LDAPLocal ldap; - // @EJB - private MenuLocal menu; - private int numberToGenerate; --- 46,56 ---- * @author John Churin */ ! public class PersonGenAction extends TolvenAction { ! private PersonGenerator personGen; ! private Generator chrGen; ! private LoginLocal loginBean; private AccountDAOLocal accountBean; ! private LDAPLocal ldap; private int numberToGenerate; *************** *** 78,99 **** return "success"; } ! /** Creates a new instance of PersonGenAction */ ! public PersonGenAction() { numberToGenerate = 100; - try - { InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 ! ldap = (LDAPLocal) ctx.lookup("tolven/LDAPBean/local"); ! activation = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); accountBean = (AccountDAOLocal) ctx.lookup("tolven/AccountDAOBean/local"); personGen = (PersonGenerator) ctx.lookup("tolven/PersonGeneratorDAO/local"); chrGen = (Generator) ctx.lookup("tolven/GeneratorBean/local"); ! menu = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); ! } ! catch (NamingException e) ! { ! throw new RuntimeException(e); ! } } --- 72,86 ---- return "success"; } ! /** Creates a new instance of PersonGenAction ! * @throws NamingException */ ! public PersonGenAction() throws NamingException { numberToGenerate = 100; InitialContext ctx = new InitialContext(); // J2EE 1.5 has not yet defined exact XML <ejb-ref> syntax for EJB3 ! loginBean = (LoginLocal) ctx.lookup("tolven/LoginBean/local"); accountBean = (AccountDAOLocal) ctx.lookup("tolven/AccountDAOBean/local"); personGen = (PersonGenerator) ctx.lookup("tolven/PersonGeneratorDAO/local"); chrGen = (Generator) ctx.lookup("tolven/GeneratorBean/local"); ! ldap = (LDAPLocal) ctx.lookup("tolven/LDAPBean/local"); } *************** *** 126,130 **** Map<String,Object> reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap(); MenuAction menuAction = (MenuAction) reqMap.get( "menu"); ! if (menuAction==null) menuAction = new MenuAction(); Map<String, Long> keys = menuAction.getTargetMenuPath().getNodeValues(); long id = keys.get("detail"); --- 113,117 ---- Map<String,Object> reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap(); MenuAction menuAction = (MenuAction) reqMap.get( "menu"); ! // if (menuAction==null) menuAction = new MenuAction(); Map<String, Long> keys = menuAction.getTargetMenuPath().getNodeValues(); long id = keys.get("detail"); *************** *** 182,186 **** tp.setUserPassword( this.getPassword()); tp.setCn( this.getFirstName() + " " + this.getLastName()); ! TolvenUser user = activation.registerAndActivate( tp, getNow() ); AccountUser au = accountBean.addAccountUser(accountBean.createAccount( accountType ), user, getNow(), true ); FacesContext.getCurrentInstance().addMessage( null, new FacesMessage("User " + this.getUid() +" created")); --- 169,173 ---- tp.setUserPassword( this.getPassword()); tp.setCn( this.getFirstName() + " " + this.getLastName()); ! TolvenUser user = loginBean.registerAndActivate( tp, getNow() ); AccountUser au = accountBean.addAccountUser(accountBean.createAccount( accountType ), user, getNow(), true ); FacesContext.getCurrentInstance().addMessage( null, new FacesMessage("User " + this.getUid() +" created")); Index: InvitationAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/InvitationAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** InvitationAction.java 3 Sep 2006 01:13:12 -0000 1.6 --- InvitationAction.java 20 Jan 2007 19:25:05 -0000 1.7 *************** *** 30,35 **** private long invitationId; private Invitation invitation; ! // @EJB ! private InvitationLocal invitationBean; public InvitationAction() throws NamingException { --- 30,35 ---- private long invitationId; private Invitation invitation; ! ! private InvitationLocal invitationBean; public InvitationAction() throws NamingException { *************** *** 82,87 **** * @throws IOException * @throws JAXBException */ ! public String executeInvitation( ) throws InvitationException, JAXBException, IOException { long invitationId = getRequestParameterAsLong( "invitationId" ); invitationBean.executeInvitation( invitationId, getNow()); --- 82,88 ---- * @throws IOException * @throws JAXBException + * @throws NamingException */ ! public String executeInvitation( ) throws InvitationException, JAXBException, IOException, NamingException { long invitationId = getRequestParameterAsLong( "invitationId" ); invitationBean.executeInvitation( invitationId, getNow()); |
From: John C. <jc...@us...> - 2007-01-20 19:25:06
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/index In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26576/src/org/tolven/index Modified Files: Browse.java Log Message: Refactoring to support Encryption Index: Browse.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/index/Browse.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Browse.java 18 Jan 2007 03:45:44 -0000 1.3 --- Browse.java 20 Jan 2007 19:25:05 -0000 1.4 *************** *** 8,11 **** --- 8,12 ---- import java.util.List; + import javax.annotation.EJB; import javax.naming.InitialContext; import javax.naming.NamingException; *************** *** 59,81 **** private static final long serialVersionUID = 1L; - private DocumentLocal documentLocal; private ServletContext context = null; ! private MenuLocal menuLocal; ! private ActivationLocal activateLocal; @Override public void init(ServletConfig config) throws ServletException { context = config.getServletContext(); ! try ! { ! InitialContext ctx = new InitialContext(); ! documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); ! menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); ! activateLocal = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); ! } ! catch (NamingException e) ! { ! throw new RuntimeException(e); ! } super.init(config); } --- 60,82 ---- private static final long serialVersionUID = 1L; private ServletContext context = null; ! @EJB private MenuLocal menuLocal; ! @EJB private ActivationLocal activateLocal; ! @EJB private DocumentLocal documentLocal; @Override public void init(ServletConfig config) throws ServletException { context = config.getServletContext(); ! // try ! // { ! // InitialContext ctx = new InitialContext(); ! // activateLocal = (ActivationLocal) ctx.lookup("tolven/ActivationBean/local"); ! // menuLocal = (MenuLocal) ctx.lookup("tolven/MenuBean/local"); ! // documentLocal = (DocumentLocal) ctx.lookup("tolven/DocumentBean/local"); ! // } ! // catch (NamingException e) ! // { ! // throw new RuntimeException(e); ! // } super.init(config); } *************** *** 135,139 **** // Select the most recent AccountUser and use that account for ( AccountUser au : accountUsers ) { ! if (8300==au.getAccount().getId() ) { accountUserId = au.getId(); accountId = au.getAccount().getId(); --- 136,140 ---- // Select the most recent AccountUser and use that account for ( AccountUser au : accountUsers ) { ! if (accountId==au.getAccount().getId() ) { accountUserId = au.getId(); accountId = au.getAccount().getId(); |
From: John C. <jc...@us...> - 2007-01-20 19:24:29
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/auth In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26552/src/org/tolven/web/security/auth Modified Files: KeyLoginModule.java Log Message: Use LoginBean instead of ActivationBean (which requires a logged in user) Index: KeyLoginModule.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/security/auth/KeyLoginModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeyLoginModule.java 20 Jan 2007 08:10:13 -0000 1.2 --- KeyLoginModule.java 20 Jan 2007 19:24:28 -0000 1.3 *************** *** 34,37 **** --- 34,38 ---- import org.tolven.core.ActivationLocal; + import org.tolven.security.LoginLocal; import org.tolven.security.TolvenPrincipal; import org.tolven.security.acl.TolvenGroup; *************** *** 100,104 **** // Obtain the UserKeyPair if it exists InitialContext ictx = new InitialContext(); ! ActivationLocal activation = (ActivationLocal) ictx.lookup("tolven/ActivationBean/local"); if (activation == null) throw new LoginException(getClass() + ": Could not locate the LoginLocal"); --- 101,105 ---- // Obtain the UserKeyPair if it exists InitialContext ictx = new InitialContext(); ! LoginLocal activation = (LoginLocal) ictx.lookup("tolven/LoginBean/local"); if (activation == null) throw new LoginException(getClass() + ": Could not locate the LoginLocal"); |
From: John C. <jc...@us...> - 2007-01-20 19:23:24
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv25963/src/org/tolven/doc/bean Modified Files: Evaluator.java DocumentBean.java TolvenMessage.java Added Files: XMLBean.java Log Message: Refactoring to support Encryption --- NEW FILE: XMLBean.java --- package org.tolven.doc.bean; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; import javax.ejb.Local; import javax.ejb.Stateless; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.namespace.QName; import javax.xml.transform.stream.StreamSource; import org.jboss.annotation.security.SecurityDomain; import org.tolven.ccr.ContinuityOfCareRecord; import org.tolven.doc.XMLLocal; import org.tolven.doc.entity.CCRException; import org.tolven.doc.entity.DocXML; @Stateless() @Local(XMLLocal.class) //@SecurityDomain("tolvenLDAP") public class XMLBean implements XMLLocal { static final String CCR_NS = "urn:astm-org:CCR"; private Map<String, JAXBContext> jaxbContexts; /** * Create or use a JAXB context. We keep a map of already-used bindings in a static variable. * @return A JAXB context. * @throws JAXBException */ protected JAXBContext setupJAXBContext(String bindingContext) throws JAXBException { if (bindingContext==null) throw new IllegalArgumentException( "JAXB binding context missing" ); JAXBContext jc; if (jaxbContexts==null) jaxbContexts = new HashMap<String, JAXBContext>( 4 ); if( jaxbContexts.containsKey(bindingContext) ) { jc = jaxbContexts.get(bindingContext); } else { jc = JAXBContext.newInstance( bindingContext, XMLBean.class.getClassLoader() ); jaxbContexts.put(bindingContext, jc); } return jc; } /** * Given a namespace, return the binding context that understands it, if any * @param ns * @return */ public String decodeBindingContext( String ns) { if (CCR_NS.equals(ns)) return "org.tolven.ccr"; return null; } /** * <p>This method will unmarshal the XML content of the specified document * into an object graph and return the head of that graph. Subsequent calls to get the graph will * not unmarshal the XML again.</p> * @return the object graph * @throws JAXBException */ public Object unmarshal(DocXML doc) throws JAXBException { byte[] c = doc.getContent(); if (c==null) return null; return unmarshal( doc.getXmlNS(), new ByteArrayInputStream( c )); } /** * <p>This method will unmarshal the XML into an object graph and return the head of that graph. </p> * @return the object graph * @throws JAXBException */ public Object unmarshal(String ns, InputStream input) throws JAXBException { JAXBContext jc = setupJAXBContext(decodeBindingContext(ns)); Unmarshaller u = jc.createUnmarshaller(); return u.unmarshal( new StreamSource( input ) ); } public void marshalCCR( ContinuityOfCareRecord ccr, OutputStream output ) throws JAXBException, CCRException { // Reset the actors list with the actors we now have in the transient map ContinuityOfCareRecord.Actors actors = new ContinuityOfCareRecord.Actors(); actors.getActor().addAll(ccr.getActorMap().values()); ccr.setActors(actors); if (ccr.getPatient().size()>2) throw new CCRException( "No more than two patients allowed A2.5.2.6(3) "); if (ccr.getPatient().size()==0) throw new CCRException("Patient required A2.5.2.6(1)" ); JAXBContext jc = setupJAXBContext( decodeBindingContext(CCR_NS)); JAXBElement<ContinuityOfCareRecord> root = new JAXBElement<ContinuityOfCareRecord>(new QName( CCR_NS, "ContinuityOfCareRecord"), ContinuityOfCareRecord.class, ccr); Marshaller m = jc.createMarshaller(); m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE ); m.marshal( root, output ); // StringWriter result = new StringWriter( 10000 ); // return result.toString(); } } Index: DocumentBean.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/DocumentBean.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** DocumentBean.java 17 Jan 2007 07:56:20 -0000 1.17 --- DocumentBean.java 20 Jan 2007 19:23:17 -0000 1.18 *************** *** 39,42 **** --- 39,43 ---- import org.tolven.core.TolvenPropertiesLocal; import org.tolven.core.entity.Account; + import org.tolven.core.entity.Status; import org.tolven.core.entity.TolvenUser; import org.tolven.doc.DocumentLocal; *************** *** 83,90 **** * @param accountId * @return * @throws IOException * @throws CCRException */ ! public DocCCR createCCRDocument( long userId, long accountId ) throws IOException, CCRException { DocCCR doc = new DocCCR(); // doc.setAuthor(em.getReference( TolvenUser.class, userId )); --- 84,92 ---- * @param accountId * @return + * @throws CCRException * @throws IOException * @throws CCRException */ ! public DocCCR createCCRDocument( long userId, long accountId ) throws CCRException { DocCCR doc = new DocCCR(); // doc.setAuthor(em.getReference( TolvenUser.class, userId )); *************** *** 92,134 **** // em.persist( doc ); createDocument( doc, userId, accountId ); ! String oid = propertyBean.getProperties().getProperty("tolven.repository.oid"); doc.createCCR(oid); return doc; } ! /** ! * We've actually persisted the document already, this performs an update containing ! * the validated XML content. And the status is changed to active if the validate flag is true. ! * @param doc ! * @throws CCRException ! * @throws IOException ! * @throws JAXBException ! */ ! public void persistCCRDocument( DocCCR doc, boolean validate ) throws JAXBException, IOException, CCRException { ! doc.marshallXML(validate); ! if (validate) doc.setStatus("active"); ! em.merge(doc); ! } ! ! /** ! * When we get a new tolven message, persist it as a document. ! * @param tm ! * @return ! */ ! public DocCCR persistMessage( TolvenMessage tm ) { ! DocCCR docCCR = new DocCCR(); ! docCCR.setAccount(em.getReference(Account.class, tm.getAccountId())); ! docCCR.setAuthor(em.getReference(TolvenUser.class, tm.getAuthorId())); ! docCCR.setContentString(tm.getPayload()); ! docCCR.setStatus("active"); ! docCCR.setMediaType("text/xml"); ! em.persist(docCCR); ! return docCCR; ! } ! /** * Persist a new document and return it's ID. This is not a final submission. ! * At this point the document is persisted by not actionable. It can still be edited. ! * When the document is ready for submission, the submitDocument method should be called. * @param doc * @param userId of the author --- 94,109 ---- // em.persist( doc ); createDocument( doc, userId, accountId ); ! String oid = System.getProperty("tolven.repository.oid"); ! doc.setMediaType("text/xml"); doc.createCCR(oid); return doc; } ! /** * Persist a new document and return it's ID. This is not a final submission. ! * At this point the document is persisted but not actionable. It can still be edited. ! * When the document is ready for submission, the finalizeDocument method should be called. ! * TODO: Prior to finalization, the document can also be digitally signed. * @param doc * @param userId of the author *************** *** 136,140 **** */ public long createDocument( DocBase doc, long userId, long accountId ) { ! doc.setStatus("new"); doc.setAuthor(em.getReference( TolvenUser.class, userId )); doc.setAccount(em.getReference( Account.class, accountId )); --- 111,115 ---- */ public long createDocument( DocBase doc, long userId, long accountId ) { ! doc.setStatus(Status.NEW.value()); doc.setAuthor(em.getReference( TolvenUser.class, userId )); doc.setAccount(em.getReference( Account.class, accountId )); *************** *** 142,147 **** return doc.getId(); } ! /** * Not a very practical method but we'll use it for testing. * @return --- 117,144 ---- return doc.getId(); } + + /** + * Complete the document submission process by rendering the document immutable. A merge will be done + * in case the finalization occurs in a different transaction as the creation. + * @param doc + */ + public void finalizeDocument( DocBase doc) { + doc.setStatus(Status.ACTIVE.value()); + saveDocument( doc ); + } ! /** ! * Save the document without finalizing. A merge will be done ! * in case the save occurs in a different transaction from the creation. ! * Note: Withholding a "Save" does not imply a rollback. For example, a document ! * that has been created or fetched and then modified within the same local VM and same transaction ! * will "automatically" be saved. So this method simply ensures that documents in other states will also be saved. ! * @param doc ! */ ! public void saveDocument( DocBase doc) { ! em.merge( doc ); ! } ! ! /** * Not a very practical method but we'll use it for testing. * @return Index: Evaluator.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/Evaluator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Evaluator.java 16 Jan 2007 06:20:30 -0000 1.1 --- Evaluator.java 20 Jan 2007 19:23:17 -0000 1.2 *************** *** 18,31 **** import javax.annotation.EJB; - import javax.annotation.Resource; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; - import javax.ejb.MessageDrivenContext; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.ObjectMessage; - import javax.persistence.EntityManager; - import javax.persistence.PersistenceContext; import javax.xml.bind.JAXBException; --- 18,27 ---- *************** *** 34,47 **** import org.tolven.app.entity.MenuStructure; import org.tolven.ccr.ActorType; - import org.tolven.ccr.CodedDescriptionType; import org.tolven.ccr.ContinuityOfCareRecord; - import org.tolven.ccr.ProblemType; import org.tolven.ccr.DateTimeType; import org.tolven.ccr.PersonNameType; import org.tolven.ccr.ResultType; import org.tolven.ccr.TestType; import org.tolven.doc.DocumentLocal; import org.tolven.doc.entity.CCRException; - import org.tolven.doc.entity.DocBase; import org.tolven.doc.entity.DocCCR; /** --- 30,42 ---- import org.tolven.app.entity.MenuStructure; import org.tolven.ccr.ActorType; import org.tolven.ccr.ContinuityOfCareRecord; import org.tolven.ccr.DateTimeType; import org.tolven.ccr.PersonNameType; + import org.tolven.ccr.ProblemType; import org.tolven.ccr.ResultType; import org.tolven.ccr.TestType; import org.tolven.doc.DocumentLocal; + import org.tolven.doc.XMLLocal; import org.tolven.doc.entity.CCRException; import org.tolven.doc.entity.DocCCR; /** *************** *** 62,68 **** @EJB private DocumentLocal documentLocal; @EJB private MenuLocal menuLocal; - @Resource private MessageDrivenContext ctx; - public void onMessage(Message msg) { String msgId = "<tbd>"; --- 57,62 ---- @EJB private DocumentLocal documentLocal; @EJB private MenuLocal menuLocal; + @EJB private XMLLocal xmlBean; public void onMessage(Message msg) { String msgId = "<tbd>"; *************** *** 71,76 **** TolvenMessage tm = (TolvenMessage) ((ObjectMessage)msg).getObject(); // System.out.println( tm.getPayload()); ! DocCCR docCCR = documentLocal.persistMessage(tm); ! processCCR(docCCR); // System.out.println( docCCR.getPatientActor().getPerson().getName().getCurrentName().getFamilyString()); } catch (JMSException e) { --- 65,69 ---- TolvenMessage tm = (TolvenMessage) ((ObjectMessage)msg).getObject(); // System.out.println( tm.getPayload()); ! processCCR(tm); // System.out.println( docCCR.getPatientActor().getPerson().getName().getCurrentName().getFamilyString()); } catch (JMSException e) { *************** *** 78,87 **** --- 71,86 ---- e.printStackTrace(); } catch (JAXBException e) { + System.out.println( "Msg Failed: " + msgId); // TODO Auto-generated catch block e.printStackTrace(); } catch (CCRException e) { + System.out.println( "Msg Failed: " + msgId); // TODO Auto-generated catch block e.printStackTrace(); } catch (ParseException e) { + System.out.println( "Msg Failed: " + msgId); + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); *************** *** 90,105 **** /** ! * Process a single CCR message ! * @param docCCR * @throws JAXBException * @throws CCRException * @throws ParseException */ ! public void processCCR( DocCCR docCCR ) throws JAXBException, CCRException, ParseException { // Get type of account String accountType = docCCR.getAccount().getAccountType().getKnownType(); if (!"echr".equals(accountType)) return; ! ContinuityOfCareRecord ccr = docCCR.getCCR(); ! // All of this will be placeholders in the first pass. // Start with patient MenuStructure msPatient = menuLocal.findMenuStructure(docCCR.getAccount().getId(), "echr:patient"); --- 89,111 ---- /** ! * Process a single CCR message. Verify the account and user ! * @param tm A TolvenMessage * @throws JAXBException * @throws CCRException * @throws ParseException + * @throws CCRException + * @throws IOException + * @throws IOException */ ! public void processCCR( TolvenMessage tm ) throws JAXBException, ParseException, CCRException, IOException { ! System.out.println( "Processing CCR document for account: " + tm.getAccountId()); ! DocCCR docCCR = documentLocal.createCCRDocument( tm.getAuthorId(), tm.getAccountId() ); ! docCCR.setContent(tm.getPayload()); ! documentLocal.finalizeDocument(docCCR); // Get type of account String accountType = docCCR.getAccount().getAccountType().getKnownType(); if (!"echr".equals(accountType)) return; ! ContinuityOfCareRecord ccr = (ContinuityOfCareRecord) xmlBean.unmarshal(tm.getXmlNS(), tm.getPayloadInputStream()); ! // All of this will be entities (placeholders in MenuStructure-speak) in the first pass. // Start with patient MenuStructure msPatient = menuLocal.findMenuStructure(docCCR.getAccount().getId(), "echr:patient"); *************** *** 108,112 **** mdPatient.setDocumentId(docCCR.getId()); mdPatient.setAccount(docCCR.getAccount()); ! ActorType pat = docCCR.getPatientActor(); DateTimeType dob = pat.getPerson().getDateOfBirth(); if (dob.getExactDateTime()!=null) { --- 114,119 ---- mdPatient.setDocumentId(docCCR.getId()); mdPatient.setAccount(docCCR.getAccount()); ! // OK, get started... ! ActorType pat = ccr.getPatientActor(); DateTimeType dob = pat.getPerson().getDateOfBirth(); if (dob.getExactDateTime()!=null) { Index: TolvenMessage.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/doc/bean/TolvenMessage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TolvenMessage.java 16 Jan 2007 06:20:30 -0000 1.1 --- TolvenMessage.java 20 Jan 2007 19:23:17 -0000 1.2 *************** *** 1,4 **** --- 1,8 ---- package org.tolven.doc.bean; + import java.io.ByteArrayInputStream; + import java.io.ByteArrayOutputStream; + import java.io.InputStream; + import java.io.OutputStream; import java.io.Serializable; *************** *** 6,13 **** private static final long serialVersionUID = 1L; ! private String payload; private String xmlNS; private String xmlName; private long accountId; private long authorId; --- 10,19 ---- private static final long serialVersionUID = 1L; ! private byte[] payload; private String xmlNS; private String xmlName; private long accountId; + private String sender; + private String recipient; private long authorId; *************** *** 18,27 **** this.accountId = accountId; } ! public String getPayload() { return payload; } ! public void setPayload(String payload) { this.payload = payload; } public String getXmlName() { return xmlName; --- 24,38 ---- this.accountId = accountId; } ! public byte[] getPayload() { return payload; } ! public void setPayload(byte[] payload) { this.payload = payload; } + + public InputStream getPayloadInputStream() { + return new ByteArrayInputStream( payload ); + } + public String getXmlName() { return xmlName; *************** *** 42,45 **** --- 53,68 ---- this.authorId = authorId; } + public String getRecipient() { + return recipient; + } + public void setRecipient(String recipient) { + this.recipient = recipient; + } + public String getSender() { + return sender; + } + public void setSender(String sender) { + this.sender = sender; + } } |
From: John C. <jc...@us...> - 2007-01-20 19:23:23
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/ccr In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv25963/src/org/tolven/ccr Modified Files: ContinuityOfCareRecord.java Log Message: Refactoring to support Encryption Index: ContinuityOfCareRecord.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/ccr/ContinuityOfCareRecord.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ContinuityOfCareRecord.java 28 Sep 2006 19:06:01 -0000 1.3 --- ContinuityOfCareRecord.java 20 Jan 2007 19:23:18 -0000 1.4 *************** *** 10,21 **** --- 10,28 ---- import java.util.ArrayList; + import java.util.HashMap; import java.util.List; + import java.util.Map; + import javax.persistence.Transient; + import javax.xml.bind.JAXBException; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; + import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; + import org.tolven.doc.entity.CCRException; + /** *************** *** 71,74 **** --- 78,181 ---- protected Signatures signatures; + @XmlTransient + private Map<String, ActorType> actorMap; + + /** + * We build and maintain a transient map of ActorType instances in the document. + * Thus, when an object has an ActorLink, we can easily find the actor. + * We keep this map up if we create another actor. + * If the object graph already exists and this is the first time we've been asked for the actorMap, + * then walk through the object graph to get the actors. + * @return + * @throws JAXBException + */ + public Map<String, ActorType> getActorMap() { + if (actorMap==null) { + actorMap = new HashMap<String, ActorType>( 10 ); + ContinuityOfCareRecord.Actors ccrActors = getActors(); + if (ccrActors!=null) + for (ActorType actor : ccrActors.getActor()) { + actorMap.put(actor.getActorObjectID(), actor); + } + } + return actorMap; + } + + public void setActorMap(Map<String, ActorType> actorMap) { + this.actorMap = actorMap; + } + + /** + * A convenience method that finds the patient object which just contains an actorId and + * then returns the actor. + * @return the actor or null if no patient yet. + * @throws JAXBException + * @throws CCRException + */ + public ActorType getPatientActor() throws JAXBException, CCRException { + List<ContinuityOfCareRecord.Patient> pats = getPatient(); + if (pats.size()>1) throw new CCRException( "[tolven Compliance Issue]Siamese twins not supported" ); + if (pats.size()==0) return null; + ContinuityOfCareRecord.Patient pat = pats.get(0); + ActorType actor = getActorMap().get(pat.getActorID()); + if (actor==null) throw new CCRException( "Missing Actor for Patient A2.5.2.6(1)" ); + // System.out.println( "PatientActor: " + actor.getActorObjectID()); + return actor; + } + /** + * Create a new actor. It should be referenced from at least one place in the + * document. Use convenience methods such as addNewPatient instead of this method in most cases. + * @return The new Actor + * @throws CCRException + * @throws JAXBException + */ + public ActorType addNewActor( ) throws CCRException, JAXBException { + ActorType actor = new ActorType(); + // Creating a unique id is a little tricky since we may not have created the original + // scheme so we'll just guess at numbers til we find something unique. + for (int x = 1; x < 1000000; x++) { + String id = String.format("A%06d", x); + if (null==getActorMap().get(id)) { + actor.setActorObjectID(id); + break; + } + } + // Remember that we're storing actors at the Tolven document level until marshall time + // when we put it in the CCR document. + getActorMap().put(actor.getActorObjectID(), actor); + // System.out.println( "Adding Actor: " + actor.getActorObjectID()); + return actor; + } + + /** + * Add a new patient actor to the document and return the actor. the caller is expected to fill out the + * actor at this point. The Id has already been populated. + * @return the Actor + * @throws CCRException + * @throws JAXBException + */ + public ActorType addNewPatient( ) throws CCRException, JAXBException { + // Create the actor + ActorType actor = addNewActor(); + // Make this actor the patient + addPatient( actor ); + return actor; + } + + /** + * The actor already exists, we're just adding this actor as the patient. + * Only do this once or you're violating CCR semantics (except for Siamese twins). + * We won't complain now, but it could fail during validation. + * @param actor + * @return + * @throws CCRException + * @throws JAXBException + */ + public void addPatient( ActorType actor ) throws CCRException, JAXBException { + ContinuityOfCareRecord.Patient pat = new ContinuityOfCareRecord.Patient(); + pat.setActorID(actor.getActorObjectID()); + getPatient().add(pat); + } + /** * Gets the value of the ccrDocumentObjectID property. |
From: John C. <jc...@us...> - 2007-01-20 19:23:22
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/gen/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv25963/src/org/tolven/gen/bean Modified Files: GenDriver.java Log Message: Refactoring to support Encryption Index: GenDriver.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/gen/bean/GenDriver.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GenDriver.java 16 Jan 2007 06:12:47 -0000 1.3 --- GenDriver.java 20 Jan 2007 19:23:18 -0000 1.4 *************** *** 14,32 **** package org.tolven.gen.bean; import java.io.StringWriter; import javax.annotation.EJB; - import javax.annotation.PostConstruct; - import javax.annotation.PreDestroy; import javax.annotation.Resource; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; - import javax.ejb.MessageDrivenContext; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; - import javax.jms.MessageProducer; import javax.jms.ObjectMessage; import javax.jms.Queue; --- 14,28 ---- package org.tolven.gen.bean; + import java.io.ByteArrayOutputStream; import java.io.StringWriter; import javax.annotation.EJB; import javax.annotation.Resource; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.ObjectMessage; import javax.jms.Queue; *************** *** 39,45 **** import org.tolven.ccr.ContinuityOfCareRecord; import org.tolven.core.util.Queuer; ! import org.tolven.doc.DocumentLocal; import org.tolven.doc.bean.TolvenMessage; - import org.tolven.gen.PersonGenerator; import org.tolven.gen.entity.FamilyMember; import org.tolven.gen.entity.FamilyUnit; --- 35,40 ---- import org.tolven.ccr.ContinuityOfCareRecord; import org.tolven.core.util.Queuer; ! import org.tolven.doc.XMLLocal; import org.tolven.doc.bean.TolvenMessage; import org.tolven.gen.entity.FamilyMember; import org.tolven.gen.entity.FamilyUnit; *************** *** 73,89 **** private Queue ruleQueue; ! private JAXBContext jc = null; ! ! public String marshall( ContinuityOfCareRecord ccr ) throws JAXBException { ! if (jc==null) { ! jc = JAXBContext.newInstance( "org.tolven.ccr", GenDriver.class.getClassLoader() ); ! } ! JAXBElement<ContinuityOfCareRecord> root = new JAXBElement<ContinuityOfCareRecord>(new QName( "urn:astm-org:CCR", "ContinuityOfCareRecord"), ContinuityOfCareRecord.class, ccr); ! Marshaller m = jc.createMarshaller(); ! m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE ); ! StringWriter result = new StringWriter( 10000 ); ! m.marshal( root, result ); ! return result.toString(); ! } public void onMessage(Message msg) { --- 68,86 ---- private Queue ruleQueue; ! @EJB private XMLLocal xmlBean; ! ! // private JAXBContext jc = null; ! // ! // public String marshall( ContinuityOfCareRecord ccr ) throws JAXBException { ! // if (jc==null) { ! // jc = JAXBContext.newInstance( "org.tolven.ccr", GenDriver.class.getClassLoader() ); ! // } ! // JAXBElement<ContinuityOfCareRecord> root = new JAXBElement<ContinuityOfCareRecord>(new QName( "urn:astm-org:CCR", "ContinuityOfCareRecord"), ContinuityOfCareRecord.class, ccr); ! // Marshaller m = jc.createMarshaller(); ! // m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE ); ! // StringWriter result = new StringWriter( 10000 ); ! // m.marshal( root, result ); ! // return result.toString(); ! // } public void onMessage(Message msg) { *************** *** 137,141 **** tm.setXmlName("ContinuityOfCareRecord"); tm.setXmlNS( "urn:astm-org:CCR"); ! tm.setPayload(marshall( ccr)); q.send( tm ); // System.out.println(tm.getPayload()); --- 134,140 ---- tm.setXmlName("ContinuityOfCareRecord"); tm.setXmlNS( "urn:astm-org:CCR"); ! ByteArrayOutputStream output = new ByteArrayOutputStream( ); ! xmlBean.marshalCCR( ccr, output ); ! tm.setPayload(output.toByteArray()); q.send( tm ); // System.out.println(tm.getPayload()); |