001: package org.apache.jsp;
002:
003: import javax.servlet.*;
004: import javax.servlet.http.*;
005: import javax.servlet.jsp.*;
006: import org.apache.jasper.runtime.*;
007: import java.util.*;
008: import java.io.*;
009: import java.net.*;
010: import java.sql.*;
011: import org.w3c.dom.*;
012: import org.ofbiz.security.*;
013: import org.ofbiz.entity.*;
014: import org.ofbiz.base.util.*;
015: import org.ofbiz.content.webapp.pseudotag.*;
016: import org.ofbiz.entity.model.*;
017: import org.ofbiz.entity.config.*;
018: import org.ofbiz.entity.jdbc.*;
019: import org.ofbiz.entity.util.*;
020:
021: public class install_jsp extends HttpJspBase {
022:
023: private static java.util.Vector _jspx_includes;
024:
025: private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_ofbiz_url;
026:
027: public install_jsp() {
028: _jspx_tagPool_ofbiz_url = new org.apache.jasper.runtime.TagHandlerPool();
029: }
030:
031: public java.util.List getIncludes() {
032: return _jspx_includes;
033: }
034:
035: public void _jspDestroy() {
036: _jspx_tagPool_ofbiz_url.release();
037: }
038:
039: public void _jspService(HttpServletRequest request,
040: HttpServletResponse response) throws java.io.IOException,
041: ServletException {
042:
043: JspFactory _jspxFactory = null;
044: javax.servlet.jsp.PageContext pageContext = null;
045: HttpSession session = null;
046: ServletContext application = null;
047: ServletConfig config = null;
048: JspWriter out = null;
049: Object page = this ;
050: JspWriter _jspx_out = null;
051:
052: try {
053: _jspxFactory = JspFactory.getDefaultFactory();
054: response.setContentType("text/html;charset=ISO-8859-1");
055: pageContext = _jspxFactory.getPageContext(this , request,
056: response, null, true, 8192, true);
057: application = pageContext.getServletContext();
058: config = pageContext.getServletConfig();
059: session = pageContext.getSession();
060: out = pageContext.getOut();
061: _jspx_out = out;
062:
063: out.write("\r\n\r\n");
064: out.write("\r\n");
065: out.write("\r\n");
066: out.write("\r\n\r\n");
067: out.write("\r\n\r\n");
068: org.ofbiz.security.Security security = null;
069: synchronized (request) {
070: security = (org.ofbiz.security.Security) pageContext
071: .getAttribute("security",
072: PageContext.REQUEST_SCOPE);
073: if (security == null) {
074: throw new java.lang.InstantiationException(
075: "bean security not found within scope");
076: }
077: }
078: out.write("\r\n");
079: org.ofbiz.entity.GenericDelegator delegator = null;
080: synchronized (request) {
081: delegator = (org.ofbiz.entity.GenericDelegator) pageContext
082: .getAttribute("delegator",
083: PageContext.REQUEST_SCOPE);
084: if (delegator == null) {
085: throw new java.lang.InstantiationException(
086: "bean delegator not found within scope");
087: }
088: }
089: out.write("\r\n\r\n");
090:
091: String groupfile = request.getParameter("groupfile");
092: String loadFile = request.getParameter("loadFile");
093: String groupName = request.getParameter("groupName");
094: String helperName = delegator.getGroupHelperName(groupName);
095: String paths = EntityDataLoader.getPathsString(helperName);
096: List urlList = EntityDataLoader.getUrlList(helperName);
097:
098: out.write("\r\n");
099: out
100: .write("<br>\r\nSpecify the group name for the entity group whose data you want to load:");
101: out.write("<br>\r\n");
102: out.write("<form method=post action='");
103: if (_jspx_meth_ofbiz_url_0(pageContext))
104: return;
105: out.write("'>\r\n Group Name: ");
106: out
107: .write("<INPUT type=text class=\"inputBox\" name='groupName' value='");
108: out.print(groupName != null ? groupName : "org.ofbiz");
109: out.write("' size='60'>\r\n ");
110: out
111: .write("<INPUT type=submit style=\"font-size: x-small;\" value='Load Data'>\r\n");
112: out.write("</form>\r\n");
113: out
114: .write("<br>\r\nOR Specify the filename of a \".xml\" file to load:");
115: out.write("<br>\r\n");
116: out.write("<form method=post action='");
117: if (_jspx_meth_ofbiz_url_1(pageContext))
118: return;
119: out.write("'>\r\n Server File Path/Name: ");
120: out
121: .write("<INPUT type=text class=\"inputBox\" name='loadFile' value='");
122: out.print(loadFile != null ? loadFile : "");
123: out.write("' size='60'>\r\n ");
124: out
125: .write("<INPUT type=submit style=\"font-size: x-small;\" value='Load Data File'>\r\n");
126: out.write("</form>\r\n");
127: out.write("<div>OR click ");
128: out.write("<a href='");
129: if (_jspx_meth_ofbiz_url_2(pageContext))
130: return;
131: out.write("'>here");
132: out
133: .write("</a> for entity granularity security settings only (auto generated, not in a file)");
134: out.write("</div>\r\n");
135: out.write("<hr>\r\n");
136: if ("group".equals(groupfile)) {
137: out.write("\r\n ");
138: if (groupName != null && groupName.length() > 0) {
139: out.write("\r\n ");
140: if (request.getParameter("loadfiles") == null) {
141: out.write("\r\n ");
142: out.write("<br>\r\n ");
143: out
144: .write("<DIV class='head1'>Open For Business Installation (Data Load) Page");
145: out.write("</DIV>\r\n ");
146: out
147: .write("<DIV class='head2'>Do you want to load the following XML files?");
148: out.write("</DIV>\r\n ");
149: out
150: .write("<DIV class='tabletext'>(From component resources and the path list: \"");
151: out.print(UtilFormatOut.checkNull(paths));
152: out.write("\")");
153: out.write("</DIV>\r\n ");
154: out.write("<UL>\r\n ");
155: if (urlList.size() > 0) {
156: out.write("\r\n ");
157: Iterator urlIter = urlList.iterator();
158: out.write("\r\n ");
159: while (urlIter.hasNext()) {
160: out.write("\r\n ");
161: URL dataUrl = (URL) urlIter.next();
162: out.write("\r\n ");
163: out.write("<LI>");
164: out.write("<DIV class='tabletext'>");
165: out.print(dataUrl.toExternalForm());
166: out.write("</DIV>\r\n ");
167: }
168: out.write("\r\n ");
169: } else {
170: out.write("\r\n ");
171: out.write("<LI>");
172: out
173: .write("<DIV class='tabletext'>No XML Files found.");
174: out.write("</DIV>\r\n ");
175: }
176: out.write("\r\n ");
177: out.write("</UL>\r\n ");
178: out.write("<A href='");
179: /* ---- ofbiz:url ---- */
180: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_3 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
181: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
182: _jspx_th_ofbiz_url_3
183: .setPageContext(pageContext);
184: _jspx_th_ofbiz_url_3.setParent(null);
185: int _jspx_eval_ofbiz_url_3 = _jspx_th_ofbiz_url_3
186: .doStartTag();
187: if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
188: if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
189: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
190: .pushBody();
191: out = _bc;
192: _jspx_th_ofbiz_url_3
193: .setBodyContent(_bc);
194: _jspx_th_ofbiz_url_3.doInitBody();
195: }
196: do {
197: out
198: .write("/install?loadfiles=true&groupfile=group&groupName=");
199: out.print(groupName);
200: int evalDoAfterBody = _jspx_th_ofbiz_url_3
201: .doAfterBody();
202: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
203: break;
204: } while (true);
205: if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
206: out = pageContext.popBody();
207: }
208: if (_jspx_th_ofbiz_url_3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
209: return;
210: _jspx_tagPool_ofbiz_url
211: .reuse(_jspx_th_ofbiz_url_3);
212: out
213: .write("' class='buttontext'>[Yes, Load Now]");
214: out.write("</A>\r\n ");
215: } else {
216: out.write("\r\n ");
217: List errorMessages = new LinkedList();
218: out.write("\r\n ");
219: out.write("<br>\r\n ");
220: out
221: .write("<DIV class='head1'>Open For Business Installation (Data Load) Page");
222: out.write("</DIV>\r\n ");
223: out
224: .write("<DIV class='head2'>Loading the XML files...");
225: out.write("</DIV>\r\n ");
226: out
227: .write("<DIV class='tabletext'>(From component resources and the path list: \"");
228: out.print(UtilFormatOut.checkNull(paths));
229: out.write("\")");
230: out.write("</DIV>\r\n ");
231: out.write("<UL>\r\n ");
232: int totalRowsChanged = 0;
233: out.write("\r\n ");
234: if (urlList.size() > 0) {
235: out.write("\r\n ");
236: Iterator urlIter = urlList.iterator();
237: out.write("\r\n ");
238: while (urlIter.hasNext()) {
239: out.write("\r\n ");
240: URL dataUrl = (URL) urlIter.next();
241: out.write("\r\n ");
242: int rowsChanged = EntityDataLoader
243: .loadData(dataUrl, helperName,
244: delegator,
245: errorMessages);
246: out.write("\r\n ");
247: totalRowsChanged += rowsChanged;
248: out.write("\r\n ");
249: out.write("<LI>");
250: out
251: .write("<DIV class='tabletext'>Loaded ");
252: out.print(rowsChanged);
253: out.write(" rows from ");
254: out.print(dataUrl.toExternalForm());
255: out.write(" (");
256: out.print(totalRowsChanged);
257: out.write(" total rows so far)");
258: out.write("</DIV>\r\n ");
259: }
260: out.write("\r\n ");
261: } else {
262: out.write("\r\n ");
263: out.write("<LI>");
264: out
265: .write("<DIV class='tabletext'>No XML Files found.");
266: out.write("</DIV>\r\n ");
267: }
268: out.write("\r\n ");
269: out.write("</UL>\r\n ");
270: out
271: .write("<DIV class='head2'>Finished loading all data; ");
272: out.print(totalRowsChanged);
273: out.write(" total rows updated.");
274: out.write("</DIV>\r\n\r\n ");
275: out.write("<DIV class='head2'>Error Messages:");
276: out.write("</DIV>\r\n ");
277: out.write("<UL>\r\n ");
278: Iterator errIter = errorMessages.iterator();
279: out.write("\r\n ");
280: while (errIter.hasNext()) {
281: out.write("\r\n ");
282: out.write("<LI>");
283: out.print((String) errIter.next());
284: out.write("\r\n ");
285: }
286: out.write("\r\n ");
287: out.write("</UL>\r\n\r\n ");
288: }
289: out.write("\r\n ");
290: }
291: out.write("\r\n");
292: } else if ("file".equals(groupfile)) {
293: out.write("\r\n ");
294: if (loadFile != null && loadFile.length() > 0) {
295: out.write("\r\n ");
296: URL dataUrl = UtilURL.fromFilename(loadFile);
297: out.write("\r\n ");
298: List errorMessages = new LinkedList();
299: out.write("\r\n ");
300: int rowsChanged = EntityDataLoader.loadData(
301: dataUrl, helperName, delegator,
302: errorMessages);
303: out.write("\r\n ");
304: out
305: .write("<DIV class='head2'>Finished loading file data; ");
306: out.print(rowsChanged);
307: out.write(" total rows updated.");
308: out.write("</DIV>\r\n\r\n ");
309: out.write("<DIV class='head2'>Error Messages:");
310: out.write("</DIV>\r\n ");
311: out.write("<UL>\r\n ");
312: Iterator errIter = errorMessages.iterator();
313: out.write("\r\n ");
314: while (errIter.hasNext()) {
315: out.write("\r\n ");
316: out.write("<LI>");
317: out.print((String) errIter.next());
318: out.write("\r\n ");
319: }
320: out.write("\r\n ");
321: out.write("</UL>\r\n ");
322: }
323: out.write("\r\n");
324: } else if ("gensecurity".equals(groupfile)) {
325: out.write("\r\n ");
326: List errorMessages = new LinkedList();
327: out.write("\r\n ");
328: int rowsChanged = EntityDataLoader.generateData(
329: delegator, errorMessages);
330: out.write("\r\n ");
331: out
332: .write("<DIV class='head2'>Finished loading file data; ");
333: out.print(rowsChanged);
334: out.write(" total rows updated.");
335: out.write("</DIV>\r\n\r\n ");
336: out.write("<DIV class='head2'>Error Messages:");
337: out.write("</DIV>\r\n ");
338: out.write("<UL>\r\n ");
339: Iterator errIter = errorMessages.iterator();
340: out.write("\r\n ");
341: while (errIter.hasNext()) {
342: out.write("\r\n ");
343: out.write("<LI>");
344: out.print((String) errIter.next());
345: out.write("\r\n ");
346: }
347: out.write("\r\n ");
348: out.write("</UL>\r\n");
349: }
350: out.write("\r\n");
351: } catch (Throwable t) {
352: out = _jspx_out;
353: if (out != null && out.getBufferSize() != 0)
354: out.clearBuffer();
355: if (pageContext != null)
356: pageContext.handlePageException(t);
357: } finally {
358: if (_jspxFactory != null)
359: _jspxFactory.releasePageContext(pageContext);
360: }
361: }
362:
363: private boolean _jspx_meth_ofbiz_url_0(
364: javax.servlet.jsp.PageContext pageContext) throws Throwable {
365: JspWriter out = pageContext.getOut();
366: /* ---- ofbiz:url ---- */
367: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_0 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
368: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
369: _jspx_th_ofbiz_url_0.setPageContext(pageContext);
370: _jspx_th_ofbiz_url_0.setParent(null);
371: int _jspx_eval_ofbiz_url_0 = _jspx_th_ofbiz_url_0.doStartTag();
372: if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
373: if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
374: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
375: .pushBody();
376: out = _bc;
377: _jspx_th_ofbiz_url_0.setBodyContent(_bc);
378: _jspx_th_ofbiz_url_0.doInitBody();
379: }
380: do {
381: out.write("/install?groupfile=group");
382: int evalDoAfterBody = _jspx_th_ofbiz_url_0
383: .doAfterBody();
384: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
385: break;
386: } while (true);
387: if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
388: out = pageContext.popBody();
389: }
390: if (_jspx_th_ofbiz_url_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
391: return true;
392: _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_0);
393: return false;
394: }
395:
396: private boolean _jspx_meth_ofbiz_url_1(
397: javax.servlet.jsp.PageContext pageContext) throws Throwable {
398: JspWriter out = pageContext.getOut();
399: /* ---- ofbiz:url ---- */
400: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_1 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
401: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
402: _jspx_th_ofbiz_url_1.setPageContext(pageContext);
403: _jspx_th_ofbiz_url_1.setParent(null);
404: int _jspx_eval_ofbiz_url_1 = _jspx_th_ofbiz_url_1.doStartTag();
405: if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
406: if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
407: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
408: .pushBody();
409: out = _bc;
410: _jspx_th_ofbiz_url_1.setBodyContent(_bc);
411: _jspx_th_ofbiz_url_1.doInitBody();
412: }
413: do {
414: out.write("/install?groupfile=file");
415: int evalDoAfterBody = _jspx_th_ofbiz_url_1
416: .doAfterBody();
417: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
418: break;
419: } while (true);
420: if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
421: out = pageContext.popBody();
422: }
423: if (_jspx_th_ofbiz_url_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
424: return true;
425: _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_1);
426: return false;
427: }
428:
429: private boolean _jspx_meth_ofbiz_url_2(
430: javax.servlet.jsp.PageContext pageContext) throws Throwable {
431: JspWriter out = pageContext.getOut();
432: /* ---- ofbiz:url ---- */
433: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_2 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
434: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
435: _jspx_th_ofbiz_url_2.setPageContext(pageContext);
436: _jspx_th_ofbiz_url_2.setParent(null);
437: int _jspx_eval_ofbiz_url_2 = _jspx_th_ofbiz_url_2.doStartTag();
438: if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
439: if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
440: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
441: .pushBody();
442: out = _bc;
443: _jspx_th_ofbiz_url_2.setBodyContent(_bc);
444: _jspx_th_ofbiz_url_2.doInitBody();
445: }
446: do {
447: out.write("/install?groupfile=gensecurity");
448: int evalDoAfterBody = _jspx_th_ofbiz_url_2
449: .doAfterBody();
450: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
451: break;
452: } while (true);
453: if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
454: out = pageContext.popBody();
455: }
456: if (_jspx_th_ofbiz_url_2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
457: return true;
458: _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_2);
459: return false;
460: }
461: }
|