| 1 |
<%@ page import="java.util.Map" |
|---|
| 2 |
%><%@ page import="com.qwirx.db.sql.*" |
|---|
| 3 |
%><%@ page import="com.qwirx.lex.*" |
|---|
| 4 |
%><%@ page import="com.qwirx.lex.emdros.*" |
|---|
| 5 |
%><%@ page import="com.qwirx.crosswire.kjv.KJV" |
|---|
| 6 |
%><%@ page import="jemdros.*" |
|---|
| 7 |
%><%@ page import="org.crosswire.jsword.book.*" |
|---|
| 8 |
%><% |
|---|
| 9 |
|
|---|
| 10 |
String pathInfo = request.getPathInfo(); |
|---|
| 11 |
// String clauseIdString = pathInfo.substring(1, pathInfo.indexOf('/', 1)); |
|---|
| 12 |
String clauseIdString = request.getParameter("clause"); |
|---|
| 13 |
EmdrosDatabase emdros = null; |
|---|
| 14 |
|
|---|
| 15 |
String username = request.getRemoteUser(); |
|---|
| 16 |
if (username == null) |
|---|
| 17 |
{ |
|---|
| 18 |
username = "anonymous"; |
|---|
| 19 |
} |
|---|
| 20 |
String hostname = request.getRemoteAddr(); |
|---|
| 21 |
|
|---|
| 22 |
try |
|---|
| 23 |
{ |
|---|
| 24 |
SqlDatabase sql = Lex.getSqlDatabase(username); |
|---|
| 25 |
emdros = Lex.getEmdrosDatabase(username, hostname, sql); |
|---|
| 26 |
int min_m = emdros.getMinM(), max_m = emdros.getMaxM(); |
|---|
| 27 |
|
|---|
| 28 |
Sheaf sheaf = emdros.getSheaf |
|---|
| 29 |
( |
|---|
| 30 |
"SELECT ALL OBJECTS IN " + |
|---|
| 31 |
"{" + emdros.getMinM() + "-" + emdros.getMaxM() + "} " + |
|---|
| 32 |
"WHERE " + |
|---|
| 33 |
"[verse GET book, chapter, verse " + |
|---|
| 34 |
" [clause self = " + clauseIdString + " " + |
|---|
| 35 |
" [word GET phrase_dependent_part_of_speech, person, gender, " + |
|---|
| 36 |
" number, state, wordnet_gloss, lexeme, tense, stem, " + |
|---|
| 37 |
" graphical_preformative, graphical_root_formation, " + |
|---|
| 38 |
" graphical_lexeme, graphical_verbal_ending, " + |
|---|
| 39 |
" graphical_nominal_ending, graphical_pron_suffix, " + |
|---|
| 40 |
" suffix_person, suffix_number, suffix_gender] " + |
|---|
| 41 |
" ]"+ |
|---|
| 42 |
"]" |
|---|
| 43 |
); |
|---|
| 44 |
|
|---|
| 45 |
SheafConstIterator sci = sheaf.const_iterator(); |
|---|
| 46 |
if (!sci.hasNext()) return; |
|---|
| 47 |
Straw straw = sci.next(); |
|---|
| 48 |
StrawConstIterator swci = straw.const_iterator(); |
|---|
| 49 |
if (!swci.hasNext()) return; |
|---|
| 50 |
MatchedObject verse = swci.next(); |
|---|
| 51 |
|
|---|
| 52 |
Map bookNumToNameMap = emdros.getEnumerationConstants("book_name_e", |
|---|
| 53 |
false); |
|---|
| 54 |
|
|---|
| 55 |
String bookName = (String)bookNumToNameMap.get( |
|---|
| 56 |
"" + verse.getEMdFValue("book").getEnum()); |
|---|
| 57 |
|
|---|
| 58 |
BookData verseData = KJV.getVerse(emdros, bookName, |
|---|
| 59 |
verse.getEMdFValue("chapter").getInt(), |
|---|
| 60 |
verse.getEMdFValue("verse").getInt()); |
|---|
| 61 |
|
|---|
| 62 |
sci = verse.getSheaf().const_iterator(); |
|---|
| 63 |
if (!sci.hasNext()) return; |
|---|
| 64 |
straw = sci.next(); |
|---|
| 65 |
swci = straw.const_iterator(); |
|---|
| 66 |
if (!swci.hasNext()) return; |
|---|
| 67 |
MatchedObject clause = swci.next(); |
|---|
| 68 |
|
|---|
| 69 |
response.setContentType("text/x-gen; charset=UTF-8"); |
|---|
| 70 |
response.setHeader("Content-disposition", |
|---|
| 71 |
"attachment; filename=export.gen"); |
|---|
| 72 |
response.getWriter().print( |
|---|
| 73 |
new GenExporter().export(clause, verseData, sql, |
|---|
| 74 |
request.getParameter("hebrew").equals("y"))); |
|---|
| 75 |
} |
|---|
| 76 |
finally |
|---|
| 77 |
{ |
|---|
| 78 |
if (emdros != null) |
|---|
| 79 |
{ |
|---|
| 80 |
Lex.putEmdrosDatabase(emdros); |
|---|
| 81 |
} |
|---|
| 82 |
} |
|---|
| 83 |
%> |
|---|