private void printRemainingDataSourcesList(PrintWriter out, User user, ConnectToDB ctdb) throws SQLException { DataSource dataSource = null; String dataSourceName = null; Vector remainingDataSourcesList = ctdb.getDataSourceListsDifference( this.dataSourceVectorForDataSourceNames( ctdb.getValuesVectorForOneColumnUnderOneCondition( new Column("DATASOURCENAME"), new Column("ISCANDIDATE", "no"), "ACDATASOURCE")), user.getDataSourceList()); if (remainingDataSourcesList.size() == 0) { out.println("<table class=transparenttable>"); out.println("<tr><td><FONT COLOR=#000000>No virtaul sensor is available.</td></tr>"); out.println("</table>"); } else { out.println("<table>"); out.println("<tr><th> virtual sensor name </th>"); out.println("<th> access right</th></tr>"); for (int i = 0; i < remainingDataSourcesList.size(); i++) { dataSource = (DataSource) (remainingDataSourcesList.get(i)); dataSourceName = dataSource.getDataSourceName(); if (ctdb.valueExistsForThisColumnUnderTwoConditions( new Column("ISUSERWAITING", "yes"), new Column("USERNAME", user.getUserName()), new Column("DATASOURCENAME", dataSource.getDataSourceName()), "ACUSER_ACDATASOURCE")) { out.println("<tr><td>" + dataSourceName + " </td>"); } else { out.println("<FORM ACTION=/gsn/MyUpdateUserWaitingForDataSourceServlet METHOD=POST>"); out.println("<tr><td>" + dataSourceName + " </td>"); out.println("<td><INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE= 1> read "); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE= 2> write "); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE=3> read/write "); } if (ctdb.valueExistsForThisColumnUnderTwoConditions( new Column("ISUSERWAITING", "yes"), new Column("USERNAME", user.getUserName()), new Column("DATASOURCENAME", dataSource.getDataSourceName()), "ACUSER_ACDATASOURCE")) { out.println("<td>" + "<FONT COLOR=#0000FF>in updates waiting list!</td></tr>"); } else { out.println( "   <INPUT TYPE=SUBMIT TYPE=SUBMIT class= buttonstyle VALUE=\"add\"></td></tr>"); out.println("</FORM>"); } } out.println("</table>"); } }
private void printGroupDataSourceList(PrintWriter out, Group group) { DataSource ds = null; String dsname = null; String dstype = null; String label = null; out.println("<table >"); out.println(" <caption>" + group.getGroupName() + " combination</caption>"); out.println("<tr><th> virtual sensor name </th>"); out.println("<th> access right</th></tr>"); for (int j = 0; j < group.getDataSourceList().size(); j++) { ds = (DataSource) group.getDataSourceList().get(j); dsname = ds.getDataSourceName(); dstype = ds.getDataSourceType(); if (dstype.charAt(0) == '1') { label = "read"; } else if (dstype.charAt(0) == '2') { label = "write"; } else if (dstype.charAt(0) == '3') { label = "read/write"; } out.println("<tr><td>" + dsname + "</td>"); out.println("<td>" + label + "</td></tr>"); } out.println("</table>"); }
private void printUserDataSourceList(PrintWriter out, User user) { String userName = user.getUserName(); DataSource ds = null; String dsname = null; String dstype = null; String ownerDecision = null; String label = null; if (user.getDataSourceList().size() == 0) { out.println("<p>No virtaul sensor is selected.</p>"); out.println("<BR>"); } else { out.println("<table>"); out.println("<tr><th> virtual sensor name </th>"); out.println("<th> access right</th>"); out.println("<th> owner decision</th>"); out.println("<th> admin decision</th>"); out.println("<th> admin decision</th></tr>"); for (int i = 0; i < user.getDataSourceList().size(); i++) { ds = (DataSource) (user.getDataSourceList().get(i)); dsname = ds.getDataSourceName(); dstype = ds.getDataSourceType(); ownerDecision = ds.getOwnerDecision(); if (dstype.charAt(1) == '1') { label = "read"; } else if (dstype.charAt(1) == '2') { label = "write"; } else if (dstype.charAt(1) == '3') { label = "read/write"; } else if (dstype.charAt(1) == '0') { label = "delete"; } if (ownerDecision.equals("notreceived")) { ownerDecision = "not received"; } out.println("<tr><td>" + dsname + "</td>"); out.println("<td>" + label + "</td>"); out.println("<td>" + ownerDecision + "</td>"); out.println("<FORM ACTION=/gsn/MyUpdateUserDataSourceServlet METHOD=POST>"); out.println("<INPUT TYPE=HIDDEN NAME=username VALUE= " + userName + ">"); out.println("<INPUT TYPE=HIDDEN NAME= datasourcename VALUE= " + dsname + "> "); out.println("<INPUT TYPE=HIDDEN NAME= datasourcetype VALUE= " + dstype + "> "); out.println("<INPUT TYPE=HIDDEN NAME=update VALUE= yes>"); out.println( "<td><INPUT TYPE=SUBMIT class=creategroupbuttonstyle VALUE=\"agree to update \"></td>"); out.println("</FORM>"); out.println("<FORM ACTION=/gsn/MyUpdateUserDataSourceServlet METHOD=POST>"); out.println("<INPUT TYPE=HIDDEN NAME=username VALUE= " + userName + ">"); out.println("<INPUT TYPE=HIDDEN NAME= datasourcename VALUE= " + dsname + "> "); out.println("<INPUT TYPE=HIDDEN NAME= datasourcetype VALUE= " + dstype + "> "); out.println("<INPUT TYPE=HIDDEN NAME=update VALUE= no>"); out.println( "<td><INPUT TYPE=SUBMIT class=creategroupbuttonstyle VALUE=\"refuse to update\"></td></tr>"); out.println("</FORM>"); } } out.println("</table>"); }
private void printUserDataSourceList(PrintWriter out, User user, ConnectToDB ctdb) throws SQLException { DataSource dataSource = null; String dataSourceName = null; String dataSourceType = null; if (user.getDataSourceList().size() == 0) { out.println("<table class =transparenttable>"); out.println("<tr><td><FONT COLOR=#000000>No virtaul sensor is available.</td></tr>"); out.println("</table>"); } else { out.println("<table>"); out.println("<tr><th> virtual sensor name </th>"); out.println("<th> access right</th></tr>"); for (int j = 0; j < user.getDataSourceList().size(); j++) { dataSource = (DataSource) user.getDataSourceList().get(j); dataSourceName = dataSource.getDataSourceName(); dataSourceType = dataSource.getDataSourceType(); if (dataSourceType.equals("4")) { out.println("<tr><td>" + dataSourceName + " </td>"); out.println("<td>own</td></tr>"); } else { if (ctdb.valueExistsForThisColumnUnderTwoConditions( new Column("ISUSERWAITING", "yes"), new Column("USERNAME", user.getUserName()), new Column("DATASOURCENAME", dataSourceName), "ACUSER_ACDATASOURCE")) { out.println("<tr><td>" + dataSourceName + " </td>"); } else { out.println("<FORM ACTION=/gsn/MyUpdateUserWaitingForDataSourceServlet METHOD=POST>"); out.println("<tr><td>" + dataSourceName + " </td>"); if (dataSourceType.charAt(0) == '1') { out.println( "<td><INPUT CHECKED TYPE=RADIO NAME=" + dataSourceName + " VALUE= 1>read"); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE= 2>write "); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE=3>read/write"); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE=0>delete "); } if (dataSourceType.charAt(0) == '2') { out.println("<td><INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE= 1> read "); out.println("<INPUT CHECKED TYPE=RADIO NAME=" + dataSourceName + " VALUE= 2> write "); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE=3> read/write "); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE=0> delete "); } if (dataSourceType.charAt(0) == '3') { out.println("<td><INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE= 1> read "); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE= 2> write "); out.println( "<INPUT CHECKED TYPE=RADIO NAME=" + dataSourceName + " VALUE=3> read/write "); out.println("<INPUT TYPE=RADIO NAME=" + dataSourceName + " VALUE=0> delete "); } } if (ctdb.valueExistsForThisColumnUnderTwoConditions( new Column("ISUSERWAITING", "yes"), new Column("USERNAME", user.getUserName()), new Column("DATASOURCENAME", dataSourceName), "ACUSER_ACDATASOURCE")) { out.println("<td>" + "<FONT COLOR=#0000FF>in updates waiting list!</td></tr>"); } else { out.println( "   <INPUT TYPE=SUBMIT class= buttonstyle VALUE=\"update\"></td></tr>"); out.println("</FORM>"); } } } out.println("</table>"); } }