You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(141) |
Sep
(184) |
Oct
(159) |
Nov
(77) |
Dec
(114) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(212) |
Feb
(302) |
Mar
(323) |
Apr
(360) |
May
(302) |
Jun
(392) |
Jul
(299) |
Aug
(858) |
Sep
(499) |
Oct
(489) |
Nov
(324) |
Dec
(438) |
2008 |
Jan
(449) |
Feb
(388) |
Mar
(811) |
Apr
(583) |
May
(949) |
Jun
(1431) |
Jul
(943) |
Aug
(527) |
Sep
(576) |
Oct
(440) |
Nov
(1046) |
Dec
(658) |
2009 |
Jan
(259) |
Feb
(192) |
Mar
(495) |
Apr
(2322) |
May
(2023) |
Jun
(1387) |
Jul
(722) |
Aug
(771) |
Sep
(167) |
Oct
(142) |
Nov
(384) |
Dec
(884) |
2010 |
Jan
(344) |
Feb
(82) |
Mar
(248) |
Apr
(341) |
May
(389) |
Jun
(289) |
Jul
(19) |
Aug
(478) |
Sep
(274) |
Oct
(431) |
Nov
(322) |
Dec
(207) |
2011 |
Jan
(125) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: John C. <jc...@us...> - 2007-02-24 09:03:50
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/comm In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29080/src/org/tolven/mobile/client/comm Added Files: Session.java ServerRequestListener.java ServerRequest.java ServerProgress.java LoginRequest.java SubmitMenuData.java MenuDataRequest.java Log Message: Tolven Mobile Client --- NEW FILE: ServerRequest.java --- package org.tolven.mobile.client.comm; import java.io.IOException; import java.io.InputStream; import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.HttpsConnection; /** * * @author John Churin * */ public class ServerRequest extends Thread { private String response; private String page; private StringBuffer query; private Session session; private ServerRequestListener listener; private int responseCode = 0; private String method; private String redirect; public ServerRequest( Session session, ServerRequestListener listener ) { this.session = session; this.listener = listener; reset(); } /** * Reset request to starting state (GET/no query parameters) */ public void reset() { query = null; method = HttpConnection.GET; } /** * Add a query parameter to the connection * @param name * @param value */ public void addParameter( String name, String value) { if (query==null) { query = new StringBuffer(); query.append("?"); } else { query.append("&"); } query.append(name); query.append("="); for ( int x = 0; x < value.length(); x++ ) { char ch = value.charAt(x); switch( ch) { case ' ': query.append("%20"); break; case '/': query.append("%2F"); break; case ',': query.append("%2C"); break; case '%': query.append("%25"); break; case '=': query.append("%3D"); break; case '?': query.append("%3F"); break; case '#': query.append("%23"); break; default: query.append(ch); break; } } // System.out.println("Query: " + query.toString()); } public void run() { setResponseCode( 0 ); try { try { // Thread.yield(); Thread.sleep(500); // Allow progress bar to display } catch (InterruptedException ie) {} getViaHttpConnection(session.getUrl()+getPage()+getQueryString()); if (getResponseCode() == HttpConnection.HTTP_MOVED_TEMP ) { // System.out.println( "Redirecting to: " + getRedirect()); getViaHttpConnection(getRedirect()); } // System.out.println( "Cookie: " + cookie ); // tell the requester that we're done listener.serverRequestAction(this); } catch (Exception e) { e.printStackTrace(); } } public void setPage(String page) { this.page = page; } public String getPage( ) { if (page==null) return ""; return page; } public String getQueryString() { return query.toString(); } void getViaHttpConnection(String url) throws IOException { HttpConnection connection = null; InputStream is = null; try { // System.out.println( "Open connection " ); connection = (HttpConnection)Connector.open(url); connection.setRequestMethod(getMethod()); if (session.getCookie()!=null) connection.setRequestProperty("Cookie", session.getCookie()); // Getting the response code will open the connection, // send the request, and read the HTTP response headers. // The headers are stored until requested. setResponseCode(connection.getResponseCode()); String cookie = connection.getHeaderField("Set-Cookie"); if (cookie!=null) { System.out.println( "Cookie: " + cookie ); session.setCookie(cookie); } if (getResponseCode() == HttpConnection.HTTP_OK) { is = connection.openInputStream(); // Get the ContentType String type = connection.getType(); // Get the length and process the data int len = (int)connection.getLength(); if (len > 0) { int actual = 0; int bytesread = 0 ; byte[] data = new byte[len]; while ((bytesread != len) && (actual != -1)) { actual = is.read(data, bytesread, len - bytesread); bytesread += actual; } response = new String( data ); } else { StringBuffer rawResponse = new StringBuffer( ); int ch; while ((ch = is.read()) != -1) { rawResponse.append(ch); } response = rawResponse.toString(); // System.out.println( "Response: " + response ); } } else if (getResponseCode() == HttpConnection.HTTP_MOVED_TEMP) { setRedirect(connection.getHeaderField("Location")); // System.out.println( "Redirect: " + getRedirect() ); } else { // System.out.println( "Error: " + Integer.toString(getResponseCode()) ); response = "Server error: " + Integer.toString(getResponseCode()); } } catch (ClassCastException e) { throw new IllegalArgumentException("Not an HTTP URL"); } finally { if (is != null) is.close(); if (connection != null) // System.out.println( "Close connection " ); connection.close(); } } /** * Return true if the query is done and was OK * @return */ public boolean isSuccess() { return (getResponseCode() == HttpConnection.HTTP_OK ); } public String getResponse() { return response; } public int getResponseCode() { return responseCode; } protected void setResponseCode(int responseCode) { this.responseCode = responseCode; } public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public Session getSession() { return session; } public void setSession(Session session) { this.session = session; } public String getRedirect() { return redirect; } public void setRedirect(String redirect) { this.redirect = redirect; } } --- NEW FILE: ServerProgress.java --- package org.tolven.mobile.client.comm; import javax.microedition.lcdui.Gauge; public class ServerProgress extends Gauge implements Runnable { private boolean done = false; /** * The constructor initializes the gauge. */ public ServerProgress(String label) { super(label, false, Gauge.INDEFINITE, Gauge.INCREMENTAL_IDLE); new Thread(this).start(); } /** * This method moves the gauge left and right. */ public void run() { while (!done) { setValue(Gauge.INCREMENTAL_UPDATING); try { Thread.currentThread().sleep(1000); } catch (InterruptedException err) { } } } public void setDone() { done = true; } } --- NEW FILE: ServerRequestListener.java --- package org.tolven.mobile.client.comm; public interface ServerRequestListener { /** * A serverRequest has completed. Deal with it. * @param request */ public void serverRequestAction (ServerRequest request); } --- NEW FILE: MenuDataRequest.java --- package org.tolven.mobile.client.comm; public class MenuDataRequest extends ServerRequest { public MenuDataRequest(Session session, ServerRequestListener listener, String element) { super(session, listener); addParameter("element", element); setPage( "list.mobile"); } } --- NEW FILE: SubmitMenuData.java --- package org.tolven.mobile.client.comm; import org.tolven.mobile.client.data.MenuData; public class SubmitMenuData extends ServerRequest { public SubmitMenuData(Session session, ServerRequestListener listener, MenuData menuData) { super(session, listener); // This does all the work in prepareing the request menuData.setUploadParameters(this); } } --- NEW FILE: Session.java --- package org.tolven.mobile.client.comm; /** * A session object contains the information needed to connect to the server. * First, it contains the url. * It also includes username, password, and account. * Also, it includes the session cookie JSESSIONID needed by the server. * @author John Churin */ public class Session { private String url; private String cookie; private String userName; private String password; private String accountId; private boolean recovered; /** * True if the settings have been recovered from persistent store, otherwise, false * @return */ public boolean isRecovered() { return recovered; } public void setRecovered(boolean recovered) { this.recovered = recovered; } public Session() { } public String getAccountId() { return accountId; } public void setAccountId(String accountId) { this.accountId = accountId; } public String getCookie() { return cookie; } public void setCookie(String cookie) { this.cookie = cookie; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } } --- NEW FILE: LoginRequest.java --- package org.tolven.mobile.client.comm; import javax.microedition.io.HttpConnection; public class LoginRequest extends ServerRequest { public LoginRequest( Session session, ServerRequestListener listener) { super(session, listener); } public void login( ) { reset(); setPage( "login.mobile"); setMethod( HttpConnection.GET); addParameter( "username", getSession().getUserName()); addParameter( "password", getSession().getPassword()); addParameter( "account", getSession().getAccountId()); } public void setupLogin( ) { reset(); setPage( "j_security_check"); setMethod( HttpConnection.POST); addParameter( "j_username", getSession().getUserName()); addParameter( "j_password", getSession().getPassword()); } public void setupAccount( ) { reset(); setPage( "login2.mobile"); setMethod( HttpConnection.GET); addParameter( "account", getSession().getAccountId()); } } |
From: John C. <jc...@us...> - 2007-02-24 09:03:47
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/view/list In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile/client/view/list Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/view/list added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:46
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile/client Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:44
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/data In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile/client/data Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/data added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:44
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/view/form In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile/client/view/form Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/view/form added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:44
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/control In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile/client/control Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/control added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:44
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/util In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile/client/util Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/util added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:44
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/view In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile/client/view Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/view added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:44
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/comm In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile/client/comm Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile/client/comm added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:43
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven/mobile Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven/mobile added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:43
|
Update of /cvsroot/tolven/tolvenMobileClient/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:43
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org/tolven In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org/tolven Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org/tolven added to the repository |
From: John C. <jc...@us...> - 2007-02-24 09:03:43
|
Update of /cvsroot/tolven/tolvenMobileClient/src/org In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29004/src/org Log Message: Directory /cvsroot/tolven/tolvenMobileClient/src/org added to the repository |
From: John C. <jc...@us...> - 2007-02-24 08:15:58
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8923/src/org/tolven/web Modified Files: RegisterAction.java Log Message: Move LoginModule Key handler back to EJB tier Index: RegisterAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/RegisterAction.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** RegisterAction.java 17 Feb 2007 23:07:33 -0000 1.43 --- RegisterAction.java 24 Feb 2007 08:15:53 -0000 1.44 *************** *** 35,39 **** import org.tolven.core.InvitationLocal; import org.tolven.core.SponsoredUser; - import org.tolven.core.TolvenPropertiesLocal; import org.tolven.core.entity.Account; import org.tolven.core.entity.AccountType; --- 35,38 ---- *************** *** 44,48 **** import org.tolven.doc.DocumentLocal; import org.tolven.gen.Generator; - import org.tolven.gen.bean.GenControlAccount; import org.tolven.gen.bean.GenControlCHRAccount; import org.tolven.gen.bean.GenControlPHRAccount; --- 43,46 ---- *************** *** 50,56 **** import org.tolven.security.LoginLocal; import org.tolven.security.TolvenPerson; ! import org.tolven.web.security.VestibuleSecurityFilter; ! import org.tolven.web.security.auth.KeyLdapCallbackHandler; import org.tolven.security.key.UserPrivateKey; /** --- 48,54 ---- import org.tolven.security.LoginLocal; import org.tolven.security.TolvenPerson; ! import org.tolven.security.auth.KeyLdapCallbackHandler; import org.tolven.security.key.UserPrivateKey; + import org.tolven.web.security.VestibuleSecurityFilter; /** |
From: John C. <jc...@us...> - 2007-02-24 08:14:57
|
Update of /cvsroot/tolven/tolvenWEB/web/five In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8512/web/five Modified Files: obsSummary.xhtml Log Message: Fix missing PQ field in summary list for observations. Index: obsSummary.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/five/obsSummary.xhtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** obsSummary.xhtml 4 Dec 2006 08:59:00 -0000 1.2 --- obsSummary.xhtml 24 Feb 2007 08:14:55 -0000 1.3 *************** *** 25,29 **** </h:column> <h:column> ! <h:outputText value="#{md.string02}"/> </h:column> </h:dataTable> --- 25,29 ---- </h:column> <h:column> ! <h:outputText value="#{md.pqStringVal01} #{md.pqUnits01}"/> </h:column> </h:dataTable> |
From: John C. <jc...@us...> - 2007-02-24 08:13:56
|
Update of /cvsroot/tolven/tolvenWEB/web/wizard In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8103/web/wizard Modified Files: wizTemplate.xhtml observation.xhtml Log Message: Data entry-related changes - Requires LoadTRIM.java to place TRIM objects in menuData. Index: observation.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/wizard/observation.xhtml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** observation.xhtml 16 Feb 2007 04:19:32 -0000 1.1 --- observation.xhtml 24 Feb 2007 08:13:56 -0000 1.2 *************** *** 21,27 **** <p>Observation test</p> <p>Click the next button when you're ready to begin.</p> <h:commandButton id="#{menu.elementLabel}submit" action="#{menu.submit}" value="Submit"/> </div> ! <div class="help" id="#{menu.elementLabel}submissionHelp" style="display:none"> <h1>Submission</h1> <p>The Submit button remains disabled until all entered data is validated and has been stored on the server in your private holding area. --- 21,28 ---- <p>Observation test</p> <p>Click the next button when you're ready to begin.</p> + Value <h:inputText value="#{menu.value}"/><br/> <h:commandButton id="#{menu.elementLabel}submit" action="#{menu.submit}" value="Submit"/> </div> ! <div class="help" id="#{menu.elementLabel}help1" style="display:none"> <h1>Submission</h1> <p>The Submit button remains disabled until all entered data is validated and has been stored on the server in your private holding area. Index: wizTemplate.xhtml =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/web/wizard/wizTemplate.xhtml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wizTemplate.xhtml 10 Feb 2007 17:25:05 -0000 1.5 --- wizTemplate.xhtml 24 Feb 2007 08:13:56 -0000 1.6 *************** *** 35,39 **** </script> ! <h:form id="#{menu.elementLabel}" onsubmit="return ajaxSubmit2(this);"> <div class="infobar" > <table width="100%"> --- 35,39 ---- </script> ! <h:form id="#{menu.elementLabel}" onsubmit="ajaxSubmit2(this);closeTab('#{menu.element}');return false;"> <div class="infobar" > <table width="100%"> |
From: John C. <jc...@us...> - 2007-02-24 08:08:23
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/security/auth In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv5855/src/org/tolven/security/auth Added Files: KeyLdapCallbackHandler.java Log Message: Move LoginModule Key handler back to EJB tier --- NEW FILE: KeyLdapCallbackHandler.java --- package org.tolven.security.auth; import java.io.IOException; 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; /** * This class, in conjuction with the tolvenLDAP security domain to provides a way to verify a user's identity. * * @author Joseph Isaac * */ public class KeyLdapCallbackHandler implements CallbackHandler { private String username; private char[] password; public KeyLdapCallbackHandler(String username, char[] password) { this.username = username; this.password = password; } public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof NameCallback) { NameCallback nc = (NameCallback) callbacks[i]; nc.setName(username); } else if (callbacks[i] instanceof PasswordCallback) { PasswordCallback pc = (PasswordCallback) callbacks[i]; pc.setPassword(password); } else { throw new UnsupportedCallbackException(callbacks[i], "Unsupported Callback"); } } } } |
From: John C. <jc...@us...> - 2007-02-24 07:58:31
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1614/src/org/tolven/app/bean Modified Files: AppEvalAdaptor.java Log Message: Changes due to data entry Index: AppEvalAdaptor.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/bean/AppEvalAdaptor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AppEvalAdaptor.java 8 Feb 2007 04:47:29 -0000 1.3 --- AppEvalAdaptor.java 24 Feb 2007 07:58:30 -0000 1.4 *************** *** 131,134 **** --- 131,154 ---- return this.getClass().getName() + " for account " + getAccount().getId(); } + /// TODO: UNCOMMENT when JBoss-Rules can HANDLE VARIABLE method PARAMETER LIST + // /** + // * Create a new menu data item given the menuStructure item + // * @param ms + // * @param documentId + // * @return + // */ + // public MenuData createMenuData( MenuStructure ms, long documentId, MenuData... parents ) { + // if (getAccount().getId()!=ms.getAccount().getId()) { + // throw new IllegalArgumentException( "Illegal to create menu data in another account"); + // } + // MenuData md = new MenuData(); + // md.setMenuStructure(ms); + // md.setDocumentId(documentId); + // md.setAccount(ms.getAccount()); + // md.setParents( parents ); + // menuBean.persistMenuData(md); + // return md; + // } + /** * Create a new menu data item given the menuStructure item *************** *** 137,141 **** * @return */ ! public MenuData createMenuData( MenuStructure ms, long documentId ) { if (getAccount().getId()!=ms.getAccount().getId()) { throw new IllegalArgumentException( "Illegal to create menu data in another account"); --- 157,161 ---- * @return */ ! public MenuData createMenuData( MenuStructure ms, long documentId, MenuData... parents ) { if (getAccount().getId()!=ms.getAccount().getId()) { throw new IllegalArgumentException( "Illegal to create menu data in another account"); *************** *** 145,148 **** --- 165,170 ---- md.setDocumentId(documentId); md.setAccount(ms.getAccount()); + md.setParents( parents ); + menuBean.persistMenuData(md); return md; } *************** *** 154,158 **** * @return */ ! public MenuData createMenuData( String path, long documentId ) { MenuStructure ms = getMenuBean().findMenuStructure(getAccount().getId(), path); if (null==ms) throw new IllegalArgumentException( "Path " + path + " is not valid for account" + getAccount().getId()); --- 176,180 ---- * @return */ ! public MenuData createMenuData( String path, long documentId, MenuData... parents ) { MenuStructure ms = getMenuBean().findMenuStructure(getAccount().getId(), path); if (null==ms) throw new IllegalArgumentException( "Path " + path + " is not valid for account" + getAccount().getId()); *************** *** 160,164 **** throw new IllegalArgumentException( "Illegal to create menu data in another account"); } ! return createMenuData( ms, documentId); } --- 182,186 ---- throw new IllegalArgumentException( "Illegal to create menu data in another account"); } ! return createMenuData( ms, documentId, parents); } |
From: John C. <jc...@us...> - 2007-02-24 07:58:31
|
Update of /cvsroot/tolven/tolvenEJB/src/org/tolven/app/entity In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1614/src/org/tolven/app/entity Modified Files: MenuData.java Log Message: Changes due to data entry Index: MenuData.java =================================================================== RCS file: /cvsroot/tolven/tolvenEJB/src/org/tolven/app/entity/MenuData.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MenuData.java 16 Feb 2007 04:02:33 -0000 1.15 --- MenuData.java 24 Feb 2007 07:58:30 -0000 1.16 *************** *** 15,18 **** --- 15,19 ---- import java.io.Serializable; + import java.util.Collection; import java.util.Date; import java.util.Map; *************** *** 769,772 **** --- 770,774 ---- this.expirationTime = expirationTime; } + /** * <p>A MenuStructure item can define a repeating data item. For example, *************** *** 811,814 **** --- 813,828 ---- this.parent04 = parent04; } + + public void setParents( MenuData parents[]) { + int count = 0; + for (MenuData parent : parents ) { + count++; + if (count==1) setParent01( parent ); + if (count==2) setParent02( parent ); + if (count==3) setParent03( parent ); + if (count==4) setParent04( parent ); + } + } + /** * Account is denormalized here (from MenuStructure) for performance and security: A user cannot access MenuData beyond their account. |
From: John C. <jc...@us...> - 2007-02-24 07:57:38
|
Update of /cvsroot/tolven/tolvenWEB/src/org/tolven/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1202/src/org/tolven/web Modified Files: MenuAction.java Log Message: Add value to backing bean Index: MenuAction.java =================================================================== RCS file: /cvsroot/tolven/tolvenWEB/src/org/tolven/web/MenuAction.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** MenuAction.java 17 Feb 2007 23:07:32 -0000 1.35 --- MenuAction.java 24 Feb 2007 07:57:36 -0000 1.36 *************** *** 81,84 **** --- 81,85 ---- protected CreatorLocal creatorBean; private String givenName; + private String value; private List<MenuStructure> menus = null; *************** *** 596,599 **** --- 597,602 ---- try { MenuData md = getMenuDataItem( ); + md.setString03(getValue()); + System.out.println("Submitted value: " + md.getString03()); creatorBean.submit(md); } catch (Exception e) { *************** *** 616,618 **** --- 619,629 ---- } + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } \ No newline at end of file |
From: John C. <jc...@us...> - 2007-02-24 07:56:34
|
Update of /cvsroot/tolven/tolvenMobileServer/web/WEB-INF In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv787/web/WEB-INF Added Files: web.xml jboss-web.xml Log Message: New mobile client --- NEW FILE: jboss-web.xml --- <?xml version="1.0" encoding="UTF-8"?> <jboss-web> <security-domain>java:/jaas/tolvenLDAP</security-domain> </jboss-web> --- NEW FILE: web.xml --- <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>MobileServlet</servlet-name> <servlet-class>org.tolven.mobile.Mobile</servlet-class> <load-on-startup>8</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MobileServlet</servlet-name> <url-pattern>*.mobile</url-pattern> </servlet-mapping> <filter> <filter-name>BrowseTransactionFilter</filter-name> <filter-class>org.tolven.mobile.MobileTransactionFilter</filter-class> </filter> <filter-mapping> <filter-name>BrowseTransactionFilter</filter-name> <servlet-name>MobileServlet</servlet-name> </filter-mapping> <filter> <filter-name>MobileSecurityFilter</filter-name> <filter-class>org.tolven.mobile.MobileSecurityFilter</filter-class> </filter> <filter-mapping> <filter-name>MobileSecurityFilter</filter-name> <servlet-name>MobileServlet</servlet-name> </filter-mapping> <session-config><session-timeout> 300 </session-timeout> </session-config> <security-constraint> <web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <!-- Define the context-relative URL(s) to be protected --> <!-- All resources protected unless otherwise listed in previous security-constraints --> <url-pattern>*.mobile</url-pattern> </web-resource-collection> <auth-constraint> <!-- Anyone with one of the listed roles may access this area --> <role-name>*</role-name> </auth-constraint> <user-data-constraint> <transport-guarantee>NONE</transport-guarantee> </user-data-constraint> </security-constraint> <login-config> <auth-method>FORM</auth-method> <form-login-config> <form-login-page>/login.mobile</form-login-page> <form-error-page>/fail_login.html</form-error-page> </form-login-config> </login-config> <security-role> <role-name>*</role-name> </security-role> </web-app> |
From: John C. <jc...@us...> - 2007-02-24 07:56:31
|
Update of /cvsroot/tolven/tolvenMobileServer/web/WEB-INF In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv771/web/WEB-INF Log Message: Directory /cvsroot/tolven/tolvenMobileServer/web/WEB-INF added to the repository |
From: John C. <jc...@us...> - 2007-02-24 07:56:31
|
Update of /cvsroot/tolven/tolvenMobileServer/web In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv771/web Log Message: Directory /cvsroot/tolven/tolvenMobileServer/web added to the repository |
From: John C. <jc...@us...> - 2007-02-24 07:52:35
|
Update of /cvsroot/tolven/tolvenMobileServer/src/org/tolven/mobile In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv31538/src/org/tolven/mobile Added Files: MobileBase.java Mobile.java MobileTransactionFilter.java MobileSecurityFilter.java Log Message: Mobile server --- NEW FILE: MobileSecurityFilter.java --- package org.tolven.mobile; import java.io.IOException; import java.io.Writer; import java.security.Principal; import java.security.acl.Group; 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.jacc.PolicyContext; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.tolven.core.ActivationLocal; import org.tolven.core.entity.AccountUser; import org.tolven.core.entity.TolvenUser; import org.tolven.security.key.PrivateKeyRing; /** * 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 MobileSecurityFilter implements Filter { @EJB protected ActivationLocal activateLocal; public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { System.out.println(getClass() + " : doFilter"); HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; Subject subject = null; Principal principal = null; try { subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); if (subject == null) throw new ServletException("No Subject in PolicyContext - Not logged In"); principal = null; Object obj = null; for (java.util.Iterator iter = subject.getPrincipals().iterator(); iter.hasNext();) { obj = iter.next(); if (obj instanceof Principal && !(obj instanceof Group)) { principal = (Principal) obj; break; } } } catch (Exception ex) { throw new ServletException("Problem with Subject in PolicyContext"); } try { String uri = request.getRequestURI(); if (!uri.endsWith("accounts.mobile")) { if (request.getParameter("account") == null && request.getSession().getAttribute("accountUserId") == null) { response.sendRedirect("accounts.mobile"); return; } if (request.getSession().getAttribute("accountUserId") == null) { TolvenUser user = activateLocal.loginUser(principal.getName(), new Date()); // This simulates the SelectAccount page List<AccountUser> accountUsers = activateLocal.findUserAccounts(user); long accountId = Long.parseLong((String) request.getParameter("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"); long accountUserId = new Long(accountUser.getId()); Set<PrivateKeyRing> privateCredentials = subject.getPrivateCredentials(PrivateKeyRing.class); if (privateCredentials.isEmpty()) throw new ServletException("No PrivateKeyRing"); PrivateKeyRing privateKeyRing = (PrivateKeyRing) privateCredentials.iterator().next(); privateKeyRing.setAccountPrivateKey(accountUser.getAccountPrivateKey()); request.getSession().setAttribute("accountUserId", accountUserId); } } long accountUserId = (Long)request.getSession().getAttribute("accountUserId"); request.setAttribute("accountUser", activateLocal.findAccountUser(accountUserId)); chain.doFilter(request, response); } catch (Exception e) { throw new ServletException("Error in BrowseSecurityFilter", e); // response.sendRedirect("login.browse"); } } public void init(FilterConfig config) throws ServletException { 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: MobileTransactionFilter.java --- package org.tolven.mobile; import java.io.IOException; import java.util.Date; import javax.naming.InitialContext; 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.UserTransaction; /** * A stripped-down transaction filter for our sample application * @author John Churin */ public class MobileTransactionFilter 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.commit(); } catch (Exception e) { e.printStackTrace(); } } } public void init(FilterConfig config) throws ServletException { } public void destroy() { } } --- NEW FILE: MobileBase.java --- package org.tolven.mobile; import java.io.IOException; import java.io.Writer; import java.util.HashMap; import javax.annotation.EJB; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.ServletConfig; 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 MobileBase extends HttpServlet{ private static final long serialVersionUID = 1L; // public static HashMap postSessions = new HashMap(); // 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/plain"); 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(); return writer; } void closePage( Writer writer ) throws IOException { 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(); } } --- NEW FILE: Mobile.java --- package org.tolven.mobile; import java.io.IOException; import java.io.Writer; import java.io.DataOutputStream; import java.io.ByteArrayOutputStream; import java.util.Date; import java.util.Enumeration; 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 javax.servlet.ServletInputStream; import org.tolven.app.bean.MenuPath; import org.tolven.app.bean.MenuQueryControl; import org.tolven.app.entity.MSColumn; 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 * about all of the data shown in the real application comes from this type of query.</p> * * @author John Churin * */ public class Mobile extends MobileBase { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println( "doGetEntry"); try { String uri = request.getRequestURI(); // User asked for the login form (or security filter forced it) if( uri.endsWith("login.mobile")) { Writer writer = openPage( request, response ); writer.write( "Login"); closePage( writer ); return; } // See if we have an account user id. Can't go on without it. AccountUser accountUser = (AccountUser) request.getAttribute("accountUser"); // User asked for the login form (or security filter forced it) if( uri.endsWith("login2.mobile")) { Writer writer = openPage( request, response ); writer.write( accountUser.getAccount().getAccountType().getKnownType()); closePage( writer ); return; } if( uri.endsWith("list.mobile")) { // Prepare response back to client Writer writer = openPage( request, response ); // Get key parameters from the request String element = request.getParameter( "element"); // Display the requested memu data, if any if (element!=null) { // System.out.println( "Showing: " + element); MenuQueryControl ctrl = setupControl( request, accountUser ); showMenuDataList( accountUser, writer, ctrl); } closePage(writer); return; } if( uri.endsWith("submit.mobile")) { // Prepare response back to client Writer writer = openPage( request, response ); String path = submit( accountUser, request ); // Display the requested memu data, if any writer.write(path); writer.close(); return; } if( uri.endsWith("logout.mobile")) { request.getSession(false).invalidate(); // Prepare response back to client Writer writer = openPage( request, response ); 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 ); } } /** * Submit */ String submit( AccountUser accountUser, HttpServletRequest request) { // Find the patient long parent01 = Long.parseLong(request.getParameter("parent01")); MenuData mdParent01 = menuLocal.findMenuDataItem(parent01); MenuStructure ms = menuLocal.findMenuStructure( accountUser.getAccount().getId(), "ephr:patient:observation" ); MenuStructure msObsList = menuLocal.findMenuStructure( accountUser.getAccount().getId(), "ephr:patient:doc:obs:values" ); MenuStructure msObsSummList = menuLocal.findMenuStructure( accountUser.getAccount().getId(), "ephr:patient:summary:obssum" ); MenuData md = new MenuData(); md.setAccount(accountUser.getAccount()); md.setMenuStructure(ms); md.setParent01(mdParent01); // Patient md.setDate01(new Date( Long.parseLong(request.getParameter("date01")))); md.setString01(request.getParameter("string01")); md.setString02(request.getParameter("string02")); md.setString03(request.getParameter("string03")); md.setString04(request.getParameter("string04")); md.setPqStringVal01(request.getParameter("pqValue01")); md.setPqUnits01(request.getParameter("pqUnits01")); md.setPqStringVal02(request.getParameter("pqValue02")); md.setPqUnits02(request.getParameter("pqUnits02")); md.setPqStringVal03(request.getParameter("pqValue03")); md.setPqUnits03(request.getParameter("pqUnits03")); menuLocal.persistMenuData(md); MenuData mdObsList = new MenuData(); mdObsList.setAccount(accountUser.getAccount()); mdObsList.setReference(md); mdObsList.setMenuStructure(msObsList); mdObsList.setParent01(mdParent01); // Patient mdObsList.setDate01(new Date( Long.parseLong(request.getParameter("date01")))); mdObsList.setString01(request.getParameter("string01")); mdObsList.setString02(request.getParameter("string02")); mdObsList.setString03(request.getParameter("string03")); mdObsList.setString04(request.getParameter("string04")); mdObsList.setPqStringVal01(request.getParameter("pqValue01")); mdObsList.setPqUnits01(request.getParameter("pqUnits01")); mdObsList.setPqStringVal02(request.getParameter("pqValue02")); mdObsList.setPqUnits02(request.getParameter("pqUnits02")); mdObsList.setPqStringVal03(request.getParameter("pqValue03")); mdObsList.setPqUnits03(request.getParameter("pqUnits03")); menuLocal.persistMenuData(mdObsList); MenuData mdObsSummList = new MenuData(); mdObsSummList.setAccount(accountUser.getAccount()); mdObsSummList.setReference(md); mdObsSummList.setMenuStructure(msObsSummList); mdObsSummList.setParent01(mdParent01); // Patient mdObsSummList.setDate01(new Date( Long.parseLong(request.getParameter("date01")))); mdObsSummList.setString01(request.getParameter("string01")); mdObsSummList.setPqStringVal01(request.getParameter("pqValue01")); mdObsSummList.setPqUnits01(request.getParameter("pqUnits01")); menuLocal.persistMenuData(mdObsSummList); // Return the new ID return Long.toString(md.getId()); } /** * Collect several parameters and setup the MenuData Query. * @param request The HTTP request * @param top Provide access to the logged in context * @return */ MenuQueryControl setupControl( HttpServletRequest request, AccountUser au) { MenuQueryControl ctrl = new MenuQueryControl(); String element = request.getParameter( "element"); MenuPath path = new MenuPath( element ); // Based on the path we get in the element parameter, get the corresponding menuStructure (metadata) MenuStructure ms = menuLocal.findMenuStructure( au.getAccount().getId(), path.getPath() ); ctrl.setMenuStructure( ms ); ctrl.setNow( (Date) request.getAttribute("tolvenNow") ); if (request.getParameter( "offset")!=null) { ctrl.setOffset( Integer.parseInt( request.getParameter( "offset")) ); } else { ctrl.setOffset( 0 ); } if (request.getParameter( "page_size" )!=null) { ctrl.setLimit( Integer.parseInt( request.getParameter( "page_size" )) ); } else { ctrl.setLimit( 100 ); } ctrl.setOriginalTargetPath( path ); ctrl.setRequestedPath( path ); if (request.getParameter( "sort_dir")!=null) { ctrl.setSortDirection( request.getParameter( "sort_dir") ); } else { ctrl.setSortDirection( "asc"); } ctrl.setSortOrder( request.getParameter( "sort_col") ); // Any attribute name that ends with "Filter" (exactly) is taken as a filter parameter (but we don't store the 'filter suffix') Enumeration<String> params = request.getParameterNames(); while (params.hasMoreElements() ) { String param = params.nextElement(); if (param.endsWith("Filter")) { ctrl.getFilters().put(param.substring(0, param.length()-6), request.getParameter(param)); } } return ctrl; } /** * Display the contents of the list specified in the query criterie * @param top * @param writer * @param ctrl * @throws IOException */ void showMenuDataList( AccountUser au, Writer writer, MenuQueryControl ctrl ) throws IOException { List<MenuData> rows = menuLocal.findMenuData( ctrl ); // Output results System.out.println( "Mobile Response: " + ctrl.getRequestedPath().getPath()); if ("ephr:family:myfam:members".equals(ctrl.getRequestedPath().getPath())) { for (MenuData md : rows) { MenuData reference = md.getReference(); if (null!=reference) { writer.write( Long.toString(reference.getId()));writer.write("|"); writer.write( reference.getPath());writer.write("|"); } else { writer.write( Long.toString(md.getId()));writer.write("|"); writer.write( md.getPath());writer.write("|"); } writer.write( md.getString01());writer.write("|"); // first writer.write( md.getString02());writer.write("|"); // Middle writer.write( md.getString03());writer.write("|"); // Last if (null!=md.getDate01()) { writer.write( Long.toString(md.getDate01().getTime()));} writer.write("|"); writer.write( md.getString04()); writer.write("\n"); } return; } for (MenuData md : rows) { MenuData reference = md.getReference(); if (null!=reference) { writer.write( Long.toString(reference.getId()));writer.write("|"); writer.write( reference.getPath());writer.write("|"); } else { writer.write( Long.toString(md.getId()));writer.write("|"); writer.write( md.getPath());writer.write("|"); } if (null!=md.getString01()) {writer.write( md.getString01());}writer.write("|"); if (null!=md.getString02()) {writer.write( md.getString02());}writer.write("|"); if (null!=md.getString03()) {writer.write( md.getString03());}writer.write("|"); if (null!=md.getString04()) {writer.write( md.getString04());}writer.write("|"); if (null!=md.getDate01()) { writer.write( Long.toString(md.getDate01().getTime()));} writer.write("|"); if (null!=md.getDate02()) { writer.write( Long.toString(md.getDate02().getTime()));} writer.write("|"); if (null!=md.getDate03()) { writer.write( Long.toString(md.getDate03().getTime()));} writer.write("|"); if (null!=md.getDate04()) { writer.write( Long.toString(md.getDate04().getTime()));} writer.write("|"); if (null!=md.getPqStringVal01()) {writer.write( md.getPqStringVal01());}writer.write("|"); if (null!=md.getPqUnits01()) {writer.write( md.getPqUnits01());}writer.write("|"); if (null!=md.getPqStringVal02()) {writer.write( md.getPqStringVal02());}writer.write("|"); if (null!=md.getPqUnits02()) {writer.write( md.getPqUnits02());}writer.write("|"); if (null!=md.getPqStringVal03()) {writer.write( md.getPqStringVal03());}writer.write("|"); if (null!=md.getPqUnits03()) {writer.write( md.getPqUnits03());}writer.write("|"); if (null!=md.getPqStringVal04()) {writer.write( md.getPqStringVal04());}writer.write("|"); if (null!=md.getPqUnits04()) {writer.write( md.getPqUnits04());}writer.write("|"); writer.write( "\n"); } } /** * Create a URL to the menu data for this MenuStructure item. In other words, a drilldown. * @param md * @return */ String getMSRef( MenuStructure ms, MenuPath element) { StringBuffer sb = new StringBuffer(); // Must be a list if (!"list".equals(ms.getRole())) return Long.toString(ms.getId()); // Attempt to construct a path MenuPath path = new MenuPath( ms.getPath(), element ); sb.append("<a href='"); sb.append("?element=" ); sb.append(path.getPathString()); sb.append( "'>"); sb.append(ms.getId()); sb.append("</a>"); return sb.toString(); } /** * Selecting a menu data item sends that item back so that we can display other lists * available from that item. * @param md * @return */ String getMDRef( MenuData md) { StringBuffer sb = new StringBuffer(); MenuData reference = md.getReference(); if (null==reference) return Long.toString(md.getId()); // Let the user drill down on this item sb.append("<a href='"); sb.append("?element=" ); sb.append(reference.getPath()); sb.append( "'>"); sb.append(md.getId()); sb.append("</a>"); return sb.toString(); } /** * 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; } /** * For a given list, display the placeholders (entities) involved in that list * @param top * @param writer * @param msList * @throws IOException */ void showPlaceholders( List<MenuStructure> msList, Writer writer ) throws IOException { boolean firstTime = true; for ( MenuStructure ms : msList ) { if (firstTime) firstTime = false; else writer.write( ", "); writer.write( ms.getNode()); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet( request, response ); } } |
From: John C. <jc...@us...> - 2007-02-24 07:52:27
|
Update of /cvsroot/tolven/tolvenMobileServer/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv31504/src Log Message: Directory /cvsroot/tolven/tolvenMobileServer/src added to the repository |