|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| AdminAction.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* AdminAction.java
|
|
| 3 |
* Copyright 2002-2004 Bill2, Inc.
|
|
| 4 |
*
|
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
| 7 |
* You may obtain a copy of the License at
|
|
| 8 |
*
|
|
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
| 10 |
*
|
|
| 11 |
* Unless required by applicable law or agreed to in writing, software
|
|
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
| 14 |
* See the License for the specific language governing permissions and
|
|
| 15 |
* limitations under the License.
|
|
| 16 |
*/
|
|
| 17 |
|
|
| 18 |
package example.web;
|
|
| 19 |
|
|
| 20 |
import org.apache.struts.action.ActionForm;
|
|
| 21 |
import org.apache.struts.action.ActionForward;
|
|
| 22 |
import org.apache.struts.action.ActionMapping;
|
|
| 23 |
import org.apache.struts.actions.DispatchAction;
|
|
| 24 |
|
|
| 25 |
import javax.servlet.http.HttpServletRequest;
|
|
| 26 |
import javax.servlet.http.HttpServletResponse;
|
|
| 27 |
|
|
| 28 |
/**
|
|
| 29 |
* @struts.action name="adminForm"
|
|
| 30 |
* path="/admin/admin"
|
|
| 31 |
* scope="session"
|
|
| 32 |
* validate="false"
|
|
| 33 |
* unknown="false"
|
|
| 34 |
* parameter="m"
|
|
| 35 |
* @struts.action-forward name="viewTable" path="/admin/viewTable.jsp"
|
|
| 36 |
*/
|
|
| 37 |
public class AdminAction extends DispatchAction { |
|
| 38 | 0 |
public ActionForward viewItem(ActionMapping mapping,
|
| 39 |
ActionForm form, |
|
| 40 |
HttpServletRequest request, |
|
| 41 |
HttpServletResponse response) |
|
| 42 |
throws Exception {
|
|
| 43 |
|
|
| 44 | 0 |
String className = request.getParameter("class");
|
| 45 | 0 |
String column = request.getParameter("col");
|
| 46 | 0 |
Long id = Long.decode(request.getParameter("id"));
|
| 47 |
//////////////////////////////
|
|
| 48 |
// do some error checking here
|
|
| 49 |
//////////////////////////////
|
|
| 50 | 0 |
String query = "select obj." + column + ".elements from obj in class " + className + " where obj.id=" + id.toString(); |
| 51 |
// Scroller s = ScrollerUtil.getHome().create(query);
|
|
| 52 |
// request.getSession().setAttribute("scroller", s);
|
|
| 53 |
|
|
| 54 | 0 |
return mapping.findForward("viewTable"); |
| 55 |
} |
|
| 56 |
|
|
| 57 |
/**
|
|
| 58 |
*
|
|
| 59 |
* @param mapping The ActionMapping used to select this instance
|
|
| 60 |
* @param form The optional ActionForm bean for this request (if any)
|
|
| 61 |
* @param request The HTTP request we are processing
|
|
| 62 |
* @param response The HTTP response we are creating
|
|
| 63 |
*
|
|
| 64 |
* @exception Exception if an exception occurs
|
|
| 65 |
*/
|
|
| 66 | 0 |
public ActionForward viewTable(ActionMapping mapping,
|
| 67 |
ActionForm form, |
|
| 68 |
HttpServletRequest request, |
|
| 69 |
HttpServletResponse response) |
|
| 70 |
throws Exception {
|
|
| 71 |
|
|
| 72 | 0 |
String className = request.getParameter("class");
|
| 73 |
|
|
| 74 |
//////////////////////////////
|
|
| 75 |
// do some error checking here
|
|
| 76 |
//////////////////////////////
|
|
| 77 |
|
|
| 78 |
// this query should be more like the OSUser query with parameterized and aliased Class object
|
|
| 79 | 0 |
String query = null;
|
| 80 |
|
|
| 81 | 0 |
String idStr = request.getParameter("id");
|
| 82 | 0 |
String column = request.getParameter("col");
|
| 83 | 0 |
query = "from " + className;
|
| 84 | 0 |
if (idStr != null && column != null) { |
| 85 | 0 |
try {
|
| 86 | 0 |
Long id = Long.decode(idStr); |
| 87 | 0 |
query = "select obj." + column + ".elements from obj in class " + className + " where obj.id=" + id.toString(); |
| 88 |
} catch (Exception e) {
|
|
| 89 |
} |
|
| 90 |
} else {
|
|
| 91 | 0 |
query = "select obj from obj in class " + className;
|
| 92 |
} |
|
| 93 |
|
|
| 94 |
// Scroller s = ScrollerUtil.getHome().create(query);
|
|
| 95 |
// request.getSession().setAttribute("scroller", s);
|
|
| 96 |
|
|
| 97 | 0 |
return mapping.findForward("viewTable"); |
| 98 |
} |
|
| 99 |
|
|
| 100 | 0 |
public ActionForward browse(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| 101 |
// ScrollerBean scroller = (ScrollerBean) request.getSession().getAttribute("scroller");
|
|
| 102 |
// if (scroller == null) {
|
|
| 103 |
// return mapping.findForward("listSearch");
|
|
| 104 |
// }
|
|
| 105 |
|
|
| 106 | 0 |
if (request.getParameter("pager.offset") != null) { |
| 107 | 0 |
try {
|
| 108 | 0 |
int offset = Integer.parseInt(request.getParameter("pager.offset")); |
| 109 |
// scroller.setFirstResult(offset);
|
|
| 110 |
} catch (NumberFormatException e) {
|
|
| 111 |
} |
|
| 112 |
} |
|
| 113 | 0 |
return mapping.findForward("mailBrowser"); |
| 114 |
} |
|
| 115 |
|
|
| 116 |
|
|
| 117 |
} |
|
||||||||||