diff --git a/solr/apache-solr-1.4.1.war b/solr/apache-solr-1.4.1.war deleted file mode 100644 index 7a5de7ca3..000000000 Binary files a/solr/apache-solr-1.4.1.war and /dev/null differ diff --git a/solr/apache-solr-3.1.0.war b/solr/apache-solr-3.1.0.war new file mode 100644 index 000000000..7c27bb483 Binary files /dev/null and b/solr/apache-solr-3.1.0.war differ diff --git a/solr/build.xml b/solr/build.xml index 5b1fefd18..a73733704 100644 --- a/solr/build.xml +++ b/solr/build.xml @@ -12,7 +12,7 @@ - + - - + + + diff --git a/solr/exampleSolr/conf/elevate.xml b/solr/exampleSolr/conf/elevate.xml index 7630ebe20..b91e75cec 100644 --- a/solr/exampleSolr/conf/elevate.xml +++ b/solr/exampleSolr/conf/elevate.xml @@ -1,36 +1,36 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/solr/exampleSolr/conf/mapping-FoldToASCII.txt b/solr/exampleSolr/conf/mapping-FoldToASCII.txt new file mode 100644 index 000000000..020f833b6 --- /dev/null +++ b/solr/exampleSolr/conf/mapping-FoldToASCII.txt @@ -0,0 +1,3813 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# This map converts alphabetic, numeric, and symbolic Unicode characters +# which are not in the first 127 ASCII characters (the "Basic Latin" Unicode +# block) into their ASCII equivalents, if one exists. +# +# Characters from the following Unicode blocks are converted; however, only +# those characters with reasonable ASCII alternatives are converted: +# +# - C1 Controls and Latin-1 Supplement: http://www.unicode.org/charts/PDF/U0080.pdf +# - Latin Extended-A: http://www.unicode.org/charts/PDF/U0100.pdf +# - Latin Extended-B: http://www.unicode.org/charts/PDF/U0180.pdf +# - Latin Extended Additional: http://www.unicode.org/charts/PDF/U1E00.pdf +# - Latin Extended-C: http://www.unicode.org/charts/PDF/U2C60.pdf +# - Latin Extended-D: http://www.unicode.org/charts/PDF/UA720.pdf +# - IPA Extensions: http://www.unicode.org/charts/PDF/U0250.pdf +# - Phonetic Extensions: http://www.unicode.org/charts/PDF/U1D00.pdf +# - Phonetic Extensions Supplement: http://www.unicode.org/charts/PDF/U1D80.pdf +# - General Punctuation: http://www.unicode.org/charts/PDF/U2000.pdf +# - Superscripts and Subscripts: http://www.unicode.org/charts/PDF/U2070.pdf +# - Enclosed Alphanumerics: http://www.unicode.org/charts/PDF/U2460.pdf +# - Dingbats: http://www.unicode.org/charts/PDF/U2700.pdf +# - Supplemental Punctuation: http://www.unicode.org/charts/PDF/U2E00.pdf +# - Alphabetic Presentation Forms: http://www.unicode.org/charts/PDF/UFB00.pdf +# - Halfwidth and Fullwidth Forms: http://www.unicode.org/charts/PDF/UFF00.pdf +# +# See: http://en.wikipedia.org/wiki/Latin_characters_in_Unicode +# +# The set of character conversions supported by this map is a superset of +# those supported by the map represented by mapping-ISOLatin1Accent.txt. +# +# See the bottom of this file for the Perl script used to generate the contents +# of this file (without this header) from ASCIIFoldingFilter.java. + + +# Syntax: +# "source" => "target" +# "source".length() > 0 (source cannot be empty.) +# "target".length() >= 0 (target can be empty.) + + +# À [LATIN CAPITAL LETTER A WITH GRAVE] +"\u00C0" => "A" + +# Á [LATIN CAPITAL LETTER A WITH ACUTE] +"\u00C1" => "A" + +#  [LATIN CAPITAL LETTER A WITH CIRCUMFLEX] +"\u00C2" => "A" + +# à [LATIN CAPITAL LETTER A WITH TILDE] +"\u00C3" => "A" + +# Ä [LATIN CAPITAL LETTER A WITH DIAERESIS] +"\u00C4" => "A" + +# Å [LATIN CAPITAL LETTER A WITH RING ABOVE] +"\u00C5" => "A" + +# Ā [LATIN CAPITAL LETTER A WITH MACRON] +"\u0100" => "A" + +# Ă [LATIN CAPITAL LETTER A WITH BREVE] +"\u0102" => "A" + +# Ą [LATIN CAPITAL LETTER A WITH OGONEK] +"\u0104" => "A" + +# Ə http://en.wikipedia.org/wiki/Schwa [LATIN CAPITAL LETTER SCHWA] +"\u018F" => "A" + +# Ǎ [LATIN CAPITAL LETTER A WITH CARON] +"\u01CD" => "A" + +# Ǟ [LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON] +"\u01DE" => "A" + +# Ǡ [LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON] +"\u01E0" => "A" + +# Ǻ [LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE] +"\u01FA" => "A" + +# Ȁ [LATIN CAPITAL LETTER A WITH DOUBLE GRAVE] +"\u0200" => "A" + +# Ȃ [LATIN CAPITAL LETTER A WITH INVERTED BREVE] +"\u0202" => "A" + +# Ȧ [LATIN CAPITAL LETTER A WITH DOT ABOVE] +"\u0226" => "A" + +# Ⱥ [LATIN CAPITAL LETTER A WITH STROKE] +"\u023A" => "A" + +# ᴀ [LATIN LETTER SMALL CAPITAL A] +"\u1D00" => "A" + +# Ḁ [LATIN CAPITAL LETTER A WITH RING BELOW] +"\u1E00" => "A" + +# Ạ [LATIN CAPITAL LETTER A WITH DOT BELOW] +"\u1EA0" => "A" + +# Ả [LATIN CAPITAL LETTER A WITH HOOK ABOVE] +"\u1EA2" => "A" + +# Ấ [LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE] +"\u1EA4" => "A" + +# Ầ [LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE] +"\u1EA6" => "A" + +# Ẩ [LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE] +"\u1EA8" => "A" + +# Ẫ [LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE] +"\u1EAA" => "A" + +# Ậ [LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW] +"\u1EAC" => "A" + +# Ắ [LATIN CAPITAL LETTER A WITH BREVE AND ACUTE] +"\u1EAE" => "A" + +# Ằ [LATIN CAPITAL LETTER A WITH BREVE AND GRAVE] +"\u1EB0" => "A" + +# Ẳ [LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE] +"\u1EB2" => "A" + +# Ẵ [LATIN CAPITAL LETTER A WITH BREVE AND TILDE] +"\u1EB4" => "A" + +# Ặ [LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW] +"\u1EB6" => "A" + +# Ⓐ [CIRCLED LATIN CAPITAL LETTER A] +"\u24B6" => "A" + +# A [FULLWIDTH LATIN CAPITAL LETTER A] +"\uFF21" => "A" + +# à [LATIN SMALL LETTER A WITH GRAVE] +"\u00E0" => "a" + +# á [LATIN SMALL LETTER A WITH ACUTE] +"\u00E1" => "a" + +# â [LATIN SMALL LETTER A WITH CIRCUMFLEX] +"\u00E2" => "a" + +# ã [LATIN SMALL LETTER A WITH TILDE] +"\u00E3" => "a" + +# ä [LATIN SMALL LETTER A WITH DIAERESIS] +"\u00E4" => "a" + +# å [LATIN SMALL LETTER A WITH RING ABOVE] +"\u00E5" => "a" + +# ā [LATIN SMALL LETTER A WITH MACRON] +"\u0101" => "a" + +# ă [LATIN SMALL LETTER A WITH BREVE] +"\u0103" => "a" + +# ą [LATIN SMALL LETTER A WITH OGONEK] +"\u0105" => "a" + +# ǎ [LATIN SMALL LETTER A WITH CARON] +"\u01CE" => "a" + +# ǟ [LATIN SMALL LETTER A WITH DIAERESIS AND MACRON] +"\u01DF" => "a" + +# ǡ [LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON] +"\u01E1" => "a" + +# ǻ [LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE] +"\u01FB" => "a" + +# ȁ [LATIN SMALL LETTER A WITH DOUBLE GRAVE] +"\u0201" => "a" + +# ȃ [LATIN SMALL LETTER A WITH INVERTED BREVE] +"\u0203" => "a" + +# ȧ [LATIN SMALL LETTER A WITH DOT ABOVE] +"\u0227" => "a" + +# ɐ [LATIN SMALL LETTER TURNED A] +"\u0250" => "a" + +# ə [LATIN SMALL LETTER SCHWA] +"\u0259" => "a" + +# ɚ [LATIN SMALL LETTER SCHWA WITH HOOK] +"\u025A" => "a" + +# ᶏ [LATIN SMALL LETTER A WITH RETROFLEX HOOK] +"\u1D8F" => "a" + +# ᶕ [LATIN SMALL LETTER SCHWA WITH RETROFLEX HOOK] +"\u1D95" => "a" + +# ạ [LATIN SMALL LETTER A WITH RING BELOW] +"\u1E01" => "a" + +# ả [LATIN SMALL LETTER A WITH RIGHT HALF RING] +"\u1E9A" => "a" + +# ạ [LATIN SMALL LETTER A WITH DOT BELOW] +"\u1EA1" => "a" + +# ả [LATIN SMALL LETTER A WITH HOOK ABOVE] +"\u1EA3" => "a" + +# ấ [LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE] +"\u1EA5" => "a" + +# ầ [LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE] +"\u1EA7" => "a" + +# ẩ [LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE] +"\u1EA9" => "a" + +# ẫ [LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE] +"\u1EAB" => "a" + +# ậ [LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW] +"\u1EAD" => "a" + +# ắ [LATIN SMALL LETTER A WITH BREVE AND ACUTE] +"\u1EAF" => "a" + +# ằ [LATIN SMALL LETTER A WITH BREVE AND GRAVE] +"\u1EB1" => "a" + +# ẳ [LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE] +"\u1EB3" => "a" + +# ẵ [LATIN SMALL LETTER A WITH BREVE AND TILDE] +"\u1EB5" => "a" + +# ặ [LATIN SMALL LETTER A WITH BREVE AND DOT BELOW] +"\u1EB7" => "a" + +# ₐ [LATIN SUBSCRIPT SMALL LETTER A] +"\u2090" => "a" + +# ₔ [LATIN SUBSCRIPT SMALL LETTER SCHWA] +"\u2094" => "a" + +# ⓐ [CIRCLED LATIN SMALL LETTER A] +"\u24D0" => "a" + +# ⱥ [LATIN SMALL LETTER A WITH STROKE] +"\u2C65" => "a" + +# Ɐ [LATIN CAPITAL LETTER TURNED A] +"\u2C6F" => "a" + +# a [FULLWIDTH LATIN SMALL LETTER A] +"\uFF41" => "a" + +# Ꜳ [LATIN CAPITAL LETTER AA] +"\uA732" => "AA" + +# Æ [LATIN CAPITAL LETTER AE] +"\u00C6" => "AE" + +# Ǣ [LATIN CAPITAL LETTER AE WITH MACRON] +"\u01E2" => "AE" + +# Ǽ [LATIN CAPITAL LETTER AE WITH ACUTE] +"\u01FC" => "AE" + +# ᴁ [LATIN LETTER SMALL CAPITAL AE] +"\u1D01" => "AE" + +# Ꜵ [LATIN CAPITAL LETTER AO] +"\uA734" => "AO" + +# Ꜷ [LATIN CAPITAL LETTER AU] +"\uA736" => "AU" + +# Ꜹ [LATIN CAPITAL LETTER AV] +"\uA738" => "AV" + +# Ꜻ [LATIN CAPITAL LETTER AV WITH HORIZONTAL BAR] +"\uA73A" => "AV" + +# Ꜽ [LATIN CAPITAL LETTER AY] +"\uA73C" => "AY" + +# ⒜ [PARENTHESIZED LATIN SMALL LETTER A] +"\u249C" => "(a)" + +# ꜳ [LATIN SMALL LETTER AA] +"\uA733" => "aa" + +# æ [LATIN SMALL LETTER AE] +"\u00E6" => "ae" + +# ǣ [LATIN SMALL LETTER AE WITH MACRON] +"\u01E3" => "ae" + +# ǽ [LATIN SMALL LETTER AE WITH ACUTE] +"\u01FD" => "ae" + +# ᴂ [LATIN SMALL LETTER TURNED AE] +"\u1D02" => "ae" + +# ꜵ [LATIN SMALL LETTER AO] +"\uA735" => "ao" + +# ꜷ [LATIN SMALL LETTER AU] +"\uA737" => "au" + +# ꜹ [LATIN SMALL LETTER AV] +"\uA739" => "av" + +# ꜻ [LATIN SMALL LETTER AV WITH HORIZONTAL BAR] +"\uA73B" => "av" + +# ꜽ [LATIN SMALL LETTER AY] +"\uA73D" => "ay" + +# Ɓ [LATIN CAPITAL LETTER B WITH HOOK] +"\u0181" => "B" + +# Ƃ [LATIN CAPITAL LETTER B WITH TOPBAR] +"\u0182" => "B" + +# Ƀ [LATIN CAPITAL LETTER B WITH STROKE] +"\u0243" => "B" + +# ʙ [LATIN LETTER SMALL CAPITAL B] +"\u0299" => "B" + +# ᴃ [LATIN LETTER SMALL CAPITAL BARRED B] +"\u1D03" => "B" + +# Ḃ [LATIN CAPITAL LETTER B WITH DOT ABOVE] +"\u1E02" => "B" + +# Ḅ [LATIN CAPITAL LETTER B WITH DOT BELOW] +"\u1E04" => "B" + +# Ḇ [LATIN CAPITAL LETTER B WITH LINE BELOW] +"\u1E06" => "B" + +# Ⓑ [CIRCLED LATIN CAPITAL LETTER B] +"\u24B7" => "B" + +# B [FULLWIDTH LATIN CAPITAL LETTER B] +"\uFF22" => "B" + +# ƀ [LATIN SMALL LETTER B WITH STROKE] +"\u0180" => "b" + +# ƃ [LATIN SMALL LETTER B WITH TOPBAR] +"\u0183" => "b" + +# ɓ [LATIN SMALL LETTER B WITH HOOK] +"\u0253" => "b" + +# ᵬ [LATIN SMALL LETTER B WITH MIDDLE TILDE] +"\u1D6C" => "b" + +# ᶀ [LATIN SMALL LETTER B WITH PALATAL HOOK] +"\u1D80" => "b" + +# ḃ [LATIN SMALL LETTER B WITH DOT ABOVE] +"\u1E03" => "b" + +# ḅ [LATIN SMALL LETTER B WITH DOT BELOW] +"\u1E05" => "b" + +# ḇ [LATIN SMALL LETTER B WITH LINE BELOW] +"\u1E07" => "b" + +# ⓑ [CIRCLED LATIN SMALL LETTER B] +"\u24D1" => "b" + +# b [FULLWIDTH LATIN SMALL LETTER B] +"\uFF42" => "b" + +# ⒝ [PARENTHESIZED LATIN SMALL LETTER B] +"\u249D" => "(b)" + +# Ç [LATIN CAPITAL LETTER C WITH CEDILLA] +"\u00C7" => "C" + +# Ć [LATIN CAPITAL LETTER C WITH ACUTE] +"\u0106" => "C" + +# Ĉ [LATIN CAPITAL LETTER C WITH CIRCUMFLEX] +"\u0108" => "C" + +# Ċ [LATIN CAPITAL LETTER C WITH DOT ABOVE] +"\u010A" => "C" + +# Č [LATIN CAPITAL LETTER C WITH CARON] +"\u010C" => "C" + +# Ƈ [LATIN CAPITAL LETTER C WITH HOOK] +"\u0187" => "C" + +# Ȼ [LATIN CAPITAL LETTER C WITH STROKE] +"\u023B" => "C" + +# ʗ [LATIN LETTER STRETCHED C] +"\u0297" => "C" + +# ᴄ [LATIN LETTER SMALL CAPITAL C] +"\u1D04" => "C" + +# Ḉ [LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE] +"\u1E08" => "C" + +# Ⓒ [CIRCLED LATIN CAPITAL LETTER C] +"\u24B8" => "C" + +# C [FULLWIDTH LATIN CAPITAL LETTER C] +"\uFF23" => "C" + +# ç [LATIN SMALL LETTER C WITH CEDILLA] +"\u00E7" => "c" + +# ć [LATIN SMALL LETTER C WITH ACUTE] +"\u0107" => "c" + +# ĉ [LATIN SMALL LETTER C WITH CIRCUMFLEX] +"\u0109" => "c" + +# ċ [LATIN SMALL LETTER C WITH DOT ABOVE] +"\u010B" => "c" + +# č [LATIN SMALL LETTER C WITH CARON] +"\u010D" => "c" + +# ƈ [LATIN SMALL LETTER C WITH HOOK] +"\u0188" => "c" + +# ȼ [LATIN SMALL LETTER C WITH STROKE] +"\u023C" => "c" + +# ɕ [LATIN SMALL LETTER C WITH CURL] +"\u0255" => "c" + +# ḉ [LATIN SMALL LETTER C WITH CEDILLA AND ACUTE] +"\u1E09" => "c" + +# ↄ [LATIN SMALL LETTER REVERSED C] +"\u2184" => "c" + +# ⓒ [CIRCLED LATIN SMALL LETTER C] +"\u24D2" => "c" + +# Ꜿ [LATIN CAPITAL LETTER REVERSED C WITH DOT] +"\uA73E" => "c" + +# ꜿ [LATIN SMALL LETTER REVERSED C WITH DOT] +"\uA73F" => "c" + +# c [FULLWIDTH LATIN SMALL LETTER C] +"\uFF43" => "c" + +# ⒞ [PARENTHESIZED LATIN SMALL LETTER C] +"\u249E" => "(c)" + +# Ð [LATIN CAPITAL LETTER ETH] +"\u00D0" => "D" + +# Ď [LATIN CAPITAL LETTER D WITH CARON] +"\u010E" => "D" + +# Đ [LATIN CAPITAL LETTER D WITH STROKE] +"\u0110" => "D" + +# Ɖ [LATIN CAPITAL LETTER AFRICAN D] +"\u0189" => "D" + +# Ɗ [LATIN CAPITAL LETTER D WITH HOOK] +"\u018A" => "D" + +# Ƌ [LATIN CAPITAL LETTER D WITH TOPBAR] +"\u018B" => "D" + +# ᴅ [LATIN LETTER SMALL CAPITAL D] +"\u1D05" => "D" + +# ᴆ [LATIN LETTER SMALL CAPITAL ETH] +"\u1D06" => "D" + +# Ḋ [LATIN CAPITAL LETTER D WITH DOT ABOVE] +"\u1E0A" => "D" + +# Ḍ [LATIN CAPITAL LETTER D WITH DOT BELOW] +"\u1E0C" => "D" + +# Ḏ [LATIN CAPITAL LETTER D WITH LINE BELOW] +"\u1E0E" => "D" + +# Ḑ [LATIN CAPITAL LETTER D WITH CEDILLA] +"\u1E10" => "D" + +# Ḓ [LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW] +"\u1E12" => "D" + +# Ⓓ [CIRCLED LATIN CAPITAL LETTER D] +"\u24B9" => "D" + +# Ꝺ [LATIN CAPITAL LETTER INSULAR D] +"\uA779" => "D" + +# D [FULLWIDTH LATIN CAPITAL LETTER D] +"\uFF24" => "D" + +# ð [LATIN SMALL LETTER ETH] +"\u00F0" => "d" + +# ď [LATIN SMALL LETTER D WITH CARON] +"\u010F" => "d" + +# đ [LATIN SMALL LETTER D WITH STROKE] +"\u0111" => "d" + +# ƌ [LATIN SMALL LETTER D WITH TOPBAR] +"\u018C" => "d" + +# ȡ [LATIN SMALL LETTER D WITH CURL] +"\u0221" => "d" + +# ɖ [LATIN SMALL LETTER D WITH TAIL] +"\u0256" => "d" + +# ɗ [LATIN SMALL LETTER D WITH HOOK] +"\u0257" => "d" + +# ᵭ [LATIN SMALL LETTER D WITH MIDDLE TILDE] +"\u1D6D" => "d" + +# ᶁ [LATIN SMALL LETTER D WITH PALATAL HOOK] +"\u1D81" => "d" + +# ᶑ [LATIN SMALL LETTER D WITH HOOK AND TAIL] +"\u1D91" => "d" + +# ḋ [LATIN SMALL LETTER D WITH DOT ABOVE] +"\u1E0B" => "d" + +# ḍ [LATIN SMALL LETTER D WITH DOT BELOW] +"\u1E0D" => "d" + +# ḏ [LATIN SMALL LETTER D WITH LINE BELOW] +"\u1E0F" => "d" + +# ḑ [LATIN SMALL LETTER D WITH CEDILLA] +"\u1E11" => "d" + +# ḓ [LATIN SMALL LETTER D WITH CIRCUMFLEX BELOW] +"\u1E13" => "d" + +# ⓓ [CIRCLED LATIN SMALL LETTER D] +"\u24D3" => "d" + +# ꝺ [LATIN SMALL LETTER INSULAR D] +"\uA77A" => "d" + +# d [FULLWIDTH LATIN SMALL LETTER D] +"\uFF44" => "d" + +# DŽ [LATIN CAPITAL LETTER DZ WITH CARON] +"\u01C4" => "DZ" + +# DZ [LATIN CAPITAL LETTER DZ] +"\u01F1" => "DZ" + +# Dž [LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON] +"\u01C5" => "Dz" + +# Dz [LATIN CAPITAL LETTER D WITH SMALL LETTER Z] +"\u01F2" => "Dz" + +# ⒟ [PARENTHESIZED LATIN SMALL LETTER D] +"\u249F" => "(d)" + +# ȸ [LATIN SMALL LETTER DB DIGRAPH] +"\u0238" => "db" + +# dž [LATIN SMALL LETTER DZ WITH CARON] +"\u01C6" => "dz" + +# dz [LATIN SMALL LETTER DZ] +"\u01F3" => "dz" + +# ʣ [LATIN SMALL LETTER DZ DIGRAPH] +"\u02A3" => "dz" + +# ʥ [LATIN SMALL LETTER DZ DIGRAPH WITH CURL] +"\u02A5" => "dz" + +# È [LATIN CAPITAL LETTER E WITH GRAVE] +"\u00C8" => "E" + +# É [LATIN CAPITAL LETTER E WITH ACUTE] +"\u00C9" => "E" + +# Ê [LATIN CAPITAL LETTER E WITH CIRCUMFLEX] +"\u00CA" => "E" + +# Ë [LATIN CAPITAL LETTER E WITH DIAERESIS] +"\u00CB" => "E" + +# Ē [LATIN CAPITAL LETTER E WITH MACRON] +"\u0112" => "E" + +# Ĕ [LATIN CAPITAL LETTER E WITH BREVE] +"\u0114" => "E" + +# Ė [LATIN CAPITAL LETTER E WITH DOT ABOVE] +"\u0116" => "E" + +# Ę [LATIN CAPITAL LETTER E WITH OGONEK] +"\u0118" => "E" + +# Ě [LATIN CAPITAL LETTER E WITH CARON] +"\u011A" => "E" + +# Ǝ [LATIN CAPITAL LETTER REVERSED E] +"\u018E" => "E" + +# Ɛ [LATIN CAPITAL LETTER OPEN E] +"\u0190" => "E" + +# Ȅ [LATIN CAPITAL LETTER E WITH DOUBLE GRAVE] +"\u0204" => "E" + +# Ȇ [LATIN CAPITAL LETTER E WITH INVERTED BREVE] +"\u0206" => "E" + +# Ȩ [LATIN CAPITAL LETTER E WITH CEDILLA] +"\u0228" => "E" + +# Ɇ [LATIN CAPITAL LETTER E WITH STROKE] +"\u0246" => "E" + +# ᴇ [LATIN LETTER SMALL CAPITAL E] +"\u1D07" => "E" + +# Ḕ [LATIN CAPITAL LETTER E WITH MACRON AND GRAVE] +"\u1E14" => "E" + +# Ḗ [LATIN CAPITAL LETTER E WITH MACRON AND ACUTE] +"\u1E16" => "E" + +# Ḙ [LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW] +"\u1E18" => "E" + +# Ḛ [LATIN CAPITAL LETTER E WITH TILDE BELOW] +"\u1E1A" => "E" + +# Ḝ [LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE] +"\u1E1C" => "E" + +# Ẹ [LATIN CAPITAL LETTER E WITH DOT BELOW] +"\u1EB8" => "E" + +# Ẻ [LATIN CAPITAL LETTER E WITH HOOK ABOVE] +"\u1EBA" => "E" + +# Ẽ [LATIN CAPITAL LETTER E WITH TILDE] +"\u1EBC" => "E" + +# Ế [LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE] +"\u1EBE" => "E" + +# Ề [LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE] +"\u1EC0" => "E" + +# Ể [LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE] +"\u1EC2" => "E" + +# Ễ [LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE] +"\u1EC4" => "E" + +# Ệ [LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW] +"\u1EC6" => "E" + +# Ⓔ [CIRCLED LATIN CAPITAL LETTER E] +"\u24BA" => "E" + +# ⱻ [LATIN LETTER SMALL CAPITAL TURNED E] +"\u2C7B" => "E" + +# E [FULLWIDTH LATIN CAPITAL LETTER E] +"\uFF25" => "E" + +# è [LATIN SMALL LETTER E WITH GRAVE] +"\u00E8" => "e" + +# é [LATIN SMALL LETTER E WITH ACUTE] +"\u00E9" => "e" + +# ê [LATIN SMALL LETTER E WITH CIRCUMFLEX] +"\u00EA" => "e" + +# ë [LATIN SMALL LETTER E WITH DIAERESIS] +"\u00EB" => "e" + +# ē [LATIN SMALL LETTER E WITH MACRON] +"\u0113" => "e" + +# ĕ [LATIN SMALL LETTER E WITH BREVE] +"\u0115" => "e" + +# ė [LATIN SMALL LETTER E WITH DOT ABOVE] +"\u0117" => "e" + +# ę [LATIN SMALL LETTER E WITH OGONEK] +"\u0119" => "e" + +# ě [LATIN SMALL LETTER E WITH CARON] +"\u011B" => "e" + +# ǝ [LATIN SMALL LETTER TURNED E] +"\u01DD" => "e" + +# ȅ [LATIN SMALL LETTER E WITH DOUBLE GRAVE] +"\u0205" => "e" + +# ȇ [LATIN SMALL LETTER E WITH INVERTED BREVE] +"\u0207" => "e" + +# ȩ [LATIN SMALL LETTER E WITH CEDILLA] +"\u0229" => "e" + +# ɇ [LATIN SMALL LETTER E WITH STROKE] +"\u0247" => "e" + +# ɘ [LATIN SMALL LETTER REVERSED E] +"\u0258" => "e" + +# ɛ [LATIN SMALL LETTER OPEN E] +"\u025B" => "e" + +# ɜ [LATIN SMALL LETTER REVERSED OPEN E] +"\u025C" => "e" + +# ɝ [LATIN SMALL LETTER REVERSED OPEN E WITH HOOK] +"\u025D" => "e" + +# ɞ [LATIN SMALL LETTER CLOSED REVERSED OPEN E] +"\u025E" => "e" + +# ʚ [LATIN SMALL LETTER CLOSED OPEN E] +"\u029A" => "e" + +# ᴈ [LATIN SMALL LETTER TURNED OPEN E] +"\u1D08" => "e" + +# ᶒ [LATIN SMALL LETTER E WITH RETROFLEX HOOK] +"\u1D92" => "e" + +# ᶓ [LATIN SMALL LETTER OPEN E WITH RETROFLEX HOOK] +"\u1D93" => "e" + +# ᶔ [LATIN SMALL LETTER REVERSED OPEN E WITH RETROFLEX HOOK] +"\u1D94" => "e" + +# ḕ [LATIN SMALL LETTER E WITH MACRON AND GRAVE] +"\u1E15" => "e" + +# ḗ [LATIN SMALL LETTER E WITH MACRON AND ACUTE] +"\u1E17" => "e" + +# ḙ [LATIN SMALL LETTER E WITH CIRCUMFLEX BELOW] +"\u1E19" => "e" + +# ḛ [LATIN SMALL LETTER E WITH TILDE BELOW] +"\u1E1B" => "e" + +# ḝ [LATIN SMALL LETTER E WITH CEDILLA AND BREVE] +"\u1E1D" => "e" + +# ẹ [LATIN SMALL LETTER E WITH DOT BELOW] +"\u1EB9" => "e" + +# ẻ [LATIN SMALL LETTER E WITH HOOK ABOVE] +"\u1EBB" => "e" + +# ẽ [LATIN SMALL LETTER E WITH TILDE] +"\u1EBD" => "e" + +# ế [LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE] +"\u1EBF" => "e" + +# ề [LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE] +"\u1EC1" => "e" + +# ể [LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE] +"\u1EC3" => "e" + +# ễ [LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE] +"\u1EC5" => "e" + +# ệ [LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW] +"\u1EC7" => "e" + +# ₑ [LATIN SUBSCRIPT SMALL LETTER E] +"\u2091" => "e" + +# ⓔ [CIRCLED LATIN SMALL LETTER E] +"\u24D4" => "e" + +# ⱸ [LATIN SMALL LETTER E WITH NOTCH] +"\u2C78" => "e" + +# e [FULLWIDTH LATIN SMALL LETTER E] +"\uFF45" => "e" + +# ⒠ [PARENTHESIZED LATIN SMALL LETTER E] +"\u24A0" => "(e)" + +# Ƒ [LATIN CAPITAL LETTER F WITH HOOK] +"\u0191" => "F" + +# Ḟ [LATIN CAPITAL LETTER F WITH DOT ABOVE] +"\u1E1E" => "F" + +# Ⓕ [CIRCLED LATIN CAPITAL LETTER F] +"\u24BB" => "F" + +# ꜰ [LATIN LETTER SMALL CAPITAL F] +"\uA730" => "F" + +# Ꝼ [LATIN CAPITAL LETTER INSULAR F] +"\uA77B" => "F" + +# ꟻ [LATIN EPIGRAPHIC LETTER REVERSED F] +"\uA7FB" => "F" + +# F [FULLWIDTH LATIN CAPITAL LETTER F] +"\uFF26" => "F" + +# ƒ [LATIN SMALL LETTER F WITH HOOK] +"\u0192" => "f" + +# ᵮ [LATIN SMALL LETTER F WITH MIDDLE TILDE] +"\u1D6E" => "f" + +# ᶂ [LATIN SMALL LETTER F WITH PALATAL HOOK] +"\u1D82" => "f" + +# ḟ [LATIN SMALL LETTER F WITH DOT ABOVE] +"\u1E1F" => "f" + +# ẛ [LATIN SMALL LETTER LONG S WITH DOT ABOVE] +"\u1E9B" => "f" + +# ⓕ [CIRCLED LATIN SMALL LETTER F] +"\u24D5" => "f" + +# ꝼ [LATIN SMALL LETTER INSULAR F] +"\uA77C" => "f" + +# f [FULLWIDTH LATIN SMALL LETTER F] +"\uFF46" => "f" + +# ⒡ [PARENTHESIZED LATIN SMALL LETTER F] +"\u24A1" => "(f)" + +# ff [LATIN SMALL LIGATURE FF] +"\uFB00" => "ff" + +# ffi [LATIN SMALL LIGATURE FFI] +"\uFB03" => "ffi" + +# ffl [LATIN SMALL LIGATURE FFL] +"\uFB04" => "ffl" + +# fi [LATIN SMALL LIGATURE FI] +"\uFB01" => "fi" + +# fl [LATIN SMALL LIGATURE FL] +"\uFB02" => "fl" + +# Ĝ [LATIN CAPITAL LETTER G WITH CIRCUMFLEX] +"\u011C" => "G" + +# Ğ [LATIN CAPITAL LETTER G WITH BREVE] +"\u011E" => "G" + +# Ġ [LATIN CAPITAL LETTER G WITH DOT ABOVE] +"\u0120" => "G" + +# Ģ [LATIN CAPITAL LETTER G WITH CEDILLA] +"\u0122" => "G" + +# Ɠ [LATIN CAPITAL LETTER G WITH HOOK] +"\u0193" => "G" + +# Ǥ [LATIN CAPITAL LETTER G WITH STROKE] +"\u01E4" => "G" + +# ǥ [LATIN SMALL LETTER G WITH STROKE] +"\u01E5" => "G" + +# Ǧ [LATIN CAPITAL LETTER G WITH CARON] +"\u01E6" => "G" + +# ǧ [LATIN SMALL LETTER G WITH CARON] +"\u01E7" => "G" + +# Ǵ [LATIN CAPITAL LETTER G WITH ACUTE] +"\u01F4" => "G" + +# ɢ [LATIN LETTER SMALL CAPITAL G] +"\u0262" => "G" + +# ʛ [LATIN LETTER SMALL CAPITAL G WITH HOOK] +"\u029B" => "G" + +# Ḡ [LATIN CAPITAL LETTER G WITH MACRON] +"\u1E20" => "G" + +# Ⓖ [CIRCLED LATIN CAPITAL LETTER G] +"\u24BC" => "G" + +# Ᵹ [LATIN CAPITAL LETTER INSULAR G] +"\uA77D" => "G" + +# Ꝿ [LATIN CAPITAL LETTER TURNED INSULAR G] +"\uA77E" => "G" + +# G [FULLWIDTH LATIN CAPITAL LETTER G] +"\uFF27" => "G" + +# ĝ [LATIN SMALL LETTER G WITH CIRCUMFLEX] +"\u011D" => "g" + +# ğ [LATIN SMALL LETTER G WITH BREVE] +"\u011F" => "g" + +# ġ [LATIN SMALL LETTER G WITH DOT ABOVE] +"\u0121" => "g" + +# ģ [LATIN SMALL LETTER G WITH CEDILLA] +"\u0123" => "g" + +# ǵ [LATIN SMALL LETTER G WITH ACUTE] +"\u01F5" => "g" + +# ɠ [LATIN SMALL LETTER G WITH HOOK] +"\u0260" => "g" + +# ɡ [LATIN SMALL LETTER SCRIPT G] +"\u0261" => "g" + +# ᵷ [LATIN SMALL LETTER TURNED G] +"\u1D77" => "g" + +# ᵹ [LATIN SMALL LETTER INSULAR G] +"\u1D79" => "g" + +# ᶃ [LATIN SMALL LETTER G WITH PALATAL HOOK] +"\u1D83" => "g" + +# ḡ [LATIN SMALL LETTER G WITH MACRON] +"\u1E21" => "g" + +# ⓖ [CIRCLED LATIN SMALL LETTER G] +"\u24D6" => "g" + +# ꝿ [LATIN SMALL LETTER TURNED INSULAR G] +"\uA77F" => "g" + +# g [FULLWIDTH LATIN SMALL LETTER G] +"\uFF47" => "g" + +# ⒢ [PARENTHESIZED LATIN SMALL LETTER G] +"\u24A2" => "(g)" + +# Ĥ [LATIN CAPITAL LETTER H WITH CIRCUMFLEX] +"\u0124" => "H" + +# Ħ [LATIN CAPITAL LETTER H WITH STROKE] +"\u0126" => "H" + +# Ȟ [LATIN CAPITAL LETTER H WITH CARON] +"\u021E" => "H" + +# ʜ [LATIN LETTER SMALL CAPITAL H] +"\u029C" => "H" + +# Ḣ [LATIN CAPITAL LETTER H WITH DOT ABOVE] +"\u1E22" => "H" + +# Ḥ [LATIN CAPITAL LETTER H WITH DOT BELOW] +"\u1E24" => "H" + +# Ḧ [LATIN CAPITAL LETTER H WITH DIAERESIS] +"\u1E26" => "H" + +# Ḩ [LATIN CAPITAL LETTER H WITH CEDILLA] +"\u1E28" => "H" + +# Ḫ [LATIN CAPITAL LETTER H WITH BREVE BELOW] +"\u1E2A" => "H" + +# Ⓗ [CIRCLED LATIN CAPITAL LETTER H] +"\u24BD" => "H" + +# Ⱨ [LATIN CAPITAL LETTER H WITH DESCENDER] +"\u2C67" => "H" + +# Ⱶ [LATIN CAPITAL LETTER HALF H] +"\u2C75" => "H" + +# H [FULLWIDTH LATIN CAPITAL LETTER H] +"\uFF28" => "H" + +# ĥ [LATIN SMALL LETTER H WITH CIRCUMFLEX] +"\u0125" => "h" + +# ħ [LATIN SMALL LETTER H WITH STROKE] +"\u0127" => "h" + +# ȟ [LATIN SMALL LETTER H WITH CARON] +"\u021F" => "h" + +# ɥ [LATIN SMALL LETTER TURNED H] +"\u0265" => "h" + +# ɦ [LATIN SMALL LETTER H WITH HOOK] +"\u0266" => "h" + +# ʮ [LATIN SMALL LETTER TURNED H WITH FISHHOOK] +"\u02AE" => "h" + +# ʯ [LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL] +"\u02AF" => "h" + +# ḣ [LATIN SMALL LETTER H WITH DOT ABOVE] +"\u1E23" => "h" + +# ḥ [LATIN SMALL LETTER H WITH DOT BELOW] +"\u1E25" => "h" + +# ḧ [LATIN SMALL LETTER H WITH DIAERESIS] +"\u1E27" => "h" + +# ḩ [LATIN SMALL LETTER H WITH CEDILLA] +"\u1E29" => "h" + +# ḫ [LATIN SMALL LETTER H WITH BREVE BELOW] +"\u1E2B" => "h" + +# ẖ [LATIN SMALL LETTER H WITH LINE BELOW] +"\u1E96" => "h" + +# ⓗ [CIRCLED LATIN SMALL LETTER H] +"\u24D7" => "h" + +# ⱨ [LATIN SMALL LETTER H WITH DESCENDER] +"\u2C68" => "h" + +# ⱶ [LATIN SMALL LETTER HALF H] +"\u2C76" => "h" + +# h [FULLWIDTH LATIN SMALL LETTER H] +"\uFF48" => "h" + +# Ƕ http://en.wikipedia.org/wiki/Hwair [LATIN CAPITAL LETTER HWAIR] +"\u01F6" => "HV" + +# ⒣ [PARENTHESIZED LATIN SMALL LETTER H] +"\u24A3" => "(h)" + +# ƕ [LATIN SMALL LETTER HV] +"\u0195" => "hv" + +# Ì [LATIN CAPITAL LETTER I WITH GRAVE] +"\u00CC" => "I" + +# Í [LATIN CAPITAL LETTER I WITH ACUTE] +"\u00CD" => "I" + +# Î [LATIN CAPITAL LETTER I WITH CIRCUMFLEX] +"\u00CE" => "I" + +# Ï [LATIN CAPITAL LETTER I WITH DIAERESIS] +"\u00CF" => "I" + +# Ĩ [LATIN CAPITAL LETTER I WITH TILDE] +"\u0128" => "I" + +# Ī [LATIN CAPITAL LETTER I WITH MACRON] +"\u012A" => "I" + +# Ĭ [LATIN CAPITAL LETTER I WITH BREVE] +"\u012C" => "I" + +# Į [LATIN CAPITAL LETTER I WITH OGONEK] +"\u012E" => "I" + +# İ [LATIN CAPITAL LETTER I WITH DOT ABOVE] +"\u0130" => "I" + +# Ɩ [LATIN CAPITAL LETTER IOTA] +"\u0196" => "I" + +# Ɨ [LATIN CAPITAL LETTER I WITH STROKE] +"\u0197" => "I" + +# Ǐ [LATIN CAPITAL LETTER I WITH CARON] +"\u01CF" => "I" + +# Ȉ [LATIN CAPITAL LETTER I WITH DOUBLE GRAVE] +"\u0208" => "I" + +# Ȋ [LATIN CAPITAL LETTER I WITH INVERTED BREVE] +"\u020A" => "I" + +# ɪ [LATIN LETTER SMALL CAPITAL I] +"\u026A" => "I" + +# ᵻ [LATIN SMALL CAPITAL LETTER I WITH STROKE] +"\u1D7B" => "I" + +# Ḭ [LATIN CAPITAL LETTER I WITH TILDE BELOW] +"\u1E2C" => "I" + +# Ḯ [LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE] +"\u1E2E" => "I" + +# Ỉ [LATIN CAPITAL LETTER I WITH HOOK ABOVE] +"\u1EC8" => "I" + +# Ị [LATIN CAPITAL LETTER I WITH DOT BELOW] +"\u1ECA" => "I" + +# Ⓘ [CIRCLED LATIN CAPITAL LETTER I] +"\u24BE" => "I" + +# ꟾ [LATIN EPIGRAPHIC LETTER I LONGA] +"\uA7FE" => "I" + +# I [FULLWIDTH LATIN CAPITAL LETTER I] +"\uFF29" => "I" + +# ì [LATIN SMALL LETTER I WITH GRAVE] +"\u00EC" => "i" + +# í [LATIN SMALL LETTER I WITH ACUTE] +"\u00ED" => "i" + +# î [LATIN SMALL LETTER I WITH CIRCUMFLEX] +"\u00EE" => "i" + +# ï [LATIN SMALL LETTER I WITH DIAERESIS] +"\u00EF" => "i" + +# ĩ [LATIN SMALL LETTER I WITH TILDE] +"\u0129" => "i" + +# ī [LATIN SMALL LETTER I WITH MACRON] +"\u012B" => "i" + +# ĭ [LATIN SMALL LETTER I WITH BREVE] +"\u012D" => "i" + +# į [LATIN SMALL LETTER I WITH OGONEK] +"\u012F" => "i" + +# ı [LATIN SMALL LETTER DOTLESS I] +"\u0131" => "i" + +# ǐ [LATIN SMALL LETTER I WITH CARON] +"\u01D0" => "i" + +# ȉ [LATIN SMALL LETTER I WITH DOUBLE GRAVE] +"\u0209" => "i" + +# ȋ [LATIN SMALL LETTER I WITH INVERTED BREVE] +"\u020B" => "i" + +# ɨ [LATIN SMALL LETTER I WITH STROKE] +"\u0268" => "i" + +# ᴉ [LATIN SMALL LETTER TURNED I] +"\u1D09" => "i" + +# ᵢ [LATIN SUBSCRIPT SMALL LETTER I] +"\u1D62" => "i" + +# ᵼ [LATIN SMALL LETTER IOTA WITH STROKE] +"\u1D7C" => "i" + +# ᶖ [LATIN SMALL LETTER I WITH RETROFLEX HOOK] +"\u1D96" => "i" + +# ḭ [LATIN SMALL LETTER I WITH TILDE BELOW] +"\u1E2D" => "i" + +# ḯ [LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE] +"\u1E2F" => "i" + +# ỉ [LATIN SMALL LETTER I WITH HOOK ABOVE] +"\u1EC9" => "i" + +# ị [LATIN SMALL LETTER I WITH DOT BELOW] +"\u1ECB" => "i" + +# ⁱ [SUPERSCRIPT LATIN SMALL LETTER I] +"\u2071" => "i" + +# ⓘ [CIRCLED LATIN SMALL LETTER I] +"\u24D8" => "i" + +# i [FULLWIDTH LATIN SMALL LETTER I] +"\uFF49" => "i" + +# IJ [LATIN CAPITAL LIGATURE IJ] +"\u0132" => "IJ" + +# ⒤ [PARENTHESIZED LATIN SMALL LETTER I] +"\u24A4" => "(i)" + +# ij [LATIN SMALL LIGATURE IJ] +"\u0133" => "ij" + +# Ĵ [LATIN CAPITAL LETTER J WITH CIRCUMFLEX] +"\u0134" => "J" + +# Ɉ [LATIN CAPITAL LETTER J WITH STROKE] +"\u0248" => "J" + +# ᴊ [LATIN LETTER SMALL CAPITAL J] +"\u1D0A" => "J" + +# Ⓙ [CIRCLED LATIN CAPITAL LETTER J] +"\u24BF" => "J" + +# J [FULLWIDTH LATIN CAPITAL LETTER J] +"\uFF2A" => "J" + +# ĵ [LATIN SMALL LETTER J WITH CIRCUMFLEX] +"\u0135" => "j" + +# ǰ [LATIN SMALL LETTER J WITH CARON] +"\u01F0" => "j" + +# ȷ [LATIN SMALL LETTER DOTLESS J] +"\u0237" => "j" + +# ɉ [LATIN SMALL LETTER J WITH STROKE] +"\u0249" => "j" + +# ɟ [LATIN SMALL LETTER DOTLESS J WITH STROKE] +"\u025F" => "j" + +# ʄ [LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK] +"\u0284" => "j" + +# ʝ [LATIN SMALL LETTER J WITH CROSSED-TAIL] +"\u029D" => "j" + +# ⓙ [CIRCLED LATIN SMALL LETTER J] +"\u24D9" => "j" + +# ⱼ [LATIN SUBSCRIPT SMALL LETTER J] +"\u2C7C" => "j" + +# j [FULLWIDTH LATIN SMALL LETTER J] +"\uFF4A" => "j" + +# ⒥ [PARENTHESIZED LATIN SMALL LETTER J] +"\u24A5" => "(j)" + +# Ķ [LATIN CAPITAL LETTER K WITH CEDILLA] +"\u0136" => "K" + +# Ƙ [LATIN CAPITAL LETTER K WITH HOOK] +"\u0198" => "K" + +# Ǩ [LATIN CAPITAL LETTER K WITH CARON] +"\u01E8" => "K" + +# ᴋ [LATIN LETTER SMALL CAPITAL K] +"\u1D0B" => "K" + +# Ḱ [LATIN CAPITAL LETTER K WITH ACUTE] +"\u1E30" => "K" + +# Ḳ [LATIN CAPITAL LETTER K WITH DOT BELOW] +"\u1E32" => "K" + +# Ḵ [LATIN CAPITAL LETTER K WITH LINE BELOW] +"\u1E34" => "K" + +# Ⓚ [CIRCLED LATIN CAPITAL LETTER K] +"\u24C0" => "K" + +# Ⱪ [LATIN CAPITAL LETTER K WITH DESCENDER] +"\u2C69" => "K" + +# Ꝁ [LATIN CAPITAL LETTER K WITH STROKE] +"\uA740" => "K" + +# Ꝃ [LATIN CAPITAL LETTER K WITH DIAGONAL STROKE] +"\uA742" => "K" + +# Ꝅ [LATIN CAPITAL LETTER K WITH STROKE AND DIAGONAL STROKE] +"\uA744" => "K" + +# K [FULLWIDTH LATIN CAPITAL LETTER K] +"\uFF2B" => "K" + +# ķ [LATIN SMALL LETTER K WITH CEDILLA] +"\u0137" => "k" + +# ƙ [LATIN SMALL LETTER K WITH HOOK] +"\u0199" => "k" + +# ǩ [LATIN SMALL LETTER K WITH CARON] +"\u01E9" => "k" + +# ʞ [LATIN SMALL LETTER TURNED K] +"\u029E" => "k" + +# ᶄ [LATIN SMALL LETTER K WITH PALATAL HOOK] +"\u1D84" => "k" + +# ḱ [LATIN SMALL LETTER K WITH ACUTE] +"\u1E31" => "k" + +# ḳ [LATIN SMALL LETTER K WITH DOT BELOW] +"\u1E33" => "k" + +# ḵ [LATIN SMALL LETTER K WITH LINE BELOW] +"\u1E35" => "k" + +# ⓚ [CIRCLED LATIN SMALL LETTER K] +"\u24DA" => "k" + +# ⱪ [LATIN SMALL LETTER K WITH DESCENDER] +"\u2C6A" => "k" + +# ꝁ [LATIN SMALL LETTER K WITH STROKE] +"\uA741" => "k" + +# ꝃ [LATIN SMALL LETTER K WITH DIAGONAL STROKE] +"\uA743" => "k" + +# ꝅ [LATIN SMALL LETTER K WITH STROKE AND DIAGONAL STROKE] +"\uA745" => "k" + +# k [FULLWIDTH LATIN SMALL LETTER K] +"\uFF4B" => "k" + +# ⒦ [PARENTHESIZED LATIN SMALL LETTER K] +"\u24A6" => "(k)" + +# Ĺ [LATIN CAPITAL LETTER L WITH ACUTE] +"\u0139" => "L" + +# Ļ [LATIN CAPITAL LETTER L WITH CEDILLA] +"\u013B" => "L" + +# Ľ [LATIN CAPITAL LETTER L WITH CARON] +"\u013D" => "L" + +# Ŀ [LATIN CAPITAL LETTER L WITH MIDDLE DOT] +"\u013F" => "L" + +# Ł [LATIN CAPITAL LETTER L WITH STROKE] +"\u0141" => "L" + +# Ƚ [LATIN CAPITAL LETTER L WITH BAR] +"\u023D" => "L" + +# ʟ [LATIN LETTER SMALL CAPITAL L] +"\u029F" => "L" + +# ᴌ [LATIN LETTER SMALL CAPITAL L WITH STROKE] +"\u1D0C" => "L" + +# Ḷ [LATIN CAPITAL LETTER L WITH DOT BELOW] +"\u1E36" => "L" + +# Ḹ [LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON] +"\u1E38" => "L" + +# Ḻ [LATIN CAPITAL LETTER L WITH LINE BELOW] +"\u1E3A" => "L" + +# Ḽ [LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW] +"\u1E3C" => "L" + +# Ⓛ [CIRCLED LATIN CAPITAL LETTER L] +"\u24C1" => "L" + +# Ⱡ [LATIN CAPITAL LETTER L WITH DOUBLE BAR] +"\u2C60" => "L" + +# Ɫ [LATIN CAPITAL LETTER L WITH MIDDLE TILDE] +"\u2C62" => "L" + +# Ꝇ [LATIN CAPITAL LETTER BROKEN L] +"\uA746" => "L" + +# Ꝉ [LATIN CAPITAL LETTER L WITH HIGH STROKE] +"\uA748" => "L" + +# Ꞁ [LATIN CAPITAL LETTER TURNED L] +"\uA780" => "L" + +# L [FULLWIDTH LATIN CAPITAL LETTER L] +"\uFF2C" => "L" + +# ĺ [LATIN SMALL LETTER L WITH ACUTE] +"\u013A" => "l" + +# ļ [LATIN SMALL LETTER L WITH CEDILLA] +"\u013C" => "l" + +# ľ [LATIN SMALL LETTER L WITH CARON] +"\u013E" => "l" + +# ŀ [LATIN SMALL LETTER L WITH MIDDLE DOT] +"\u0140" => "l" + +# ł [LATIN SMALL LETTER L WITH STROKE] +"\u0142" => "l" + +# ƚ [LATIN SMALL LETTER L WITH BAR] +"\u019A" => "l" + +# ȴ [LATIN SMALL LETTER L WITH CURL] +"\u0234" => "l" + +# ɫ [LATIN SMALL LETTER L WITH MIDDLE TILDE] +"\u026B" => "l" + +# ɬ [LATIN SMALL LETTER L WITH BELT] +"\u026C" => "l" + +# ɭ [LATIN SMALL LETTER L WITH RETROFLEX HOOK] +"\u026D" => "l" + +# ᶅ [LATIN SMALL LETTER L WITH PALATAL HOOK] +"\u1D85" => "l" + +# ḷ [LATIN SMALL LETTER L WITH DOT BELOW] +"\u1E37" => "l" + +# ḹ [LATIN SMALL LETTER L WITH DOT BELOW AND MACRON] +"\u1E39" => "l" + +# ḻ [LATIN SMALL LETTER L WITH LINE BELOW] +"\u1E3B" => "l" + +# ḽ [LATIN SMALL LETTER L WITH CIRCUMFLEX BELOW] +"\u1E3D" => "l" + +# ⓛ [CIRCLED LATIN SMALL LETTER L] +"\u24DB" => "l" + +# ⱡ [LATIN SMALL LETTER L WITH DOUBLE BAR] +"\u2C61" => "l" + +# ꝇ [LATIN SMALL LETTER BROKEN L] +"\uA747" => "l" + +# ꝉ [LATIN SMALL LETTER L WITH HIGH STROKE] +"\uA749" => "l" + +# ꞁ [LATIN SMALL LETTER TURNED L] +"\uA781" => "l" + +# l [FULLWIDTH LATIN SMALL LETTER L] +"\uFF4C" => "l" + +# LJ [LATIN CAPITAL LETTER LJ] +"\u01C7" => "LJ" + +# Ỻ [LATIN CAPITAL LETTER MIDDLE-WELSH LL] +"\u1EFA" => "LL" + +# Lj [LATIN CAPITAL LETTER L WITH SMALL LETTER J] +"\u01C8" => "Lj" + +# ⒧ [PARENTHESIZED LATIN SMALL LETTER L] +"\u24A7" => "(l)" + +# lj [LATIN SMALL LETTER LJ] +"\u01C9" => "lj" + +# ỻ [LATIN SMALL LETTER MIDDLE-WELSH LL] +"\u1EFB" => "ll" + +# ʪ [LATIN SMALL LETTER LS DIGRAPH] +"\u02AA" => "ls" + +# ʫ [LATIN SMALL LETTER LZ DIGRAPH] +"\u02AB" => "lz" + +# Ɯ [LATIN CAPITAL LETTER TURNED M] +"\u019C" => "M" + +# ᴍ [LATIN LETTER SMALL CAPITAL M] +"\u1D0D" => "M" + +# Ḿ [LATIN CAPITAL LETTER M WITH ACUTE] +"\u1E3E" => "M" + +# Ṁ [LATIN CAPITAL LETTER M WITH DOT ABOVE] +"\u1E40" => "M" + +# Ṃ [LATIN CAPITAL LETTER M WITH DOT BELOW] +"\u1E42" => "M" + +# Ⓜ [CIRCLED LATIN CAPITAL LETTER M] +"\u24C2" => "M" + +# Ɱ [LATIN CAPITAL LETTER M WITH HOOK] +"\u2C6E" => "M" + +# ꟽ [LATIN EPIGRAPHIC LETTER INVERTED M] +"\uA7FD" => "M" + +# ꟿ [LATIN EPIGRAPHIC LETTER ARCHAIC M] +"\uA7FF" => "M" + +# M [FULLWIDTH LATIN CAPITAL LETTER M] +"\uFF2D" => "M" + +# ɯ [LATIN SMALL LETTER TURNED M] +"\u026F" => "m" + +# ɰ [LATIN SMALL LETTER TURNED M WITH LONG LEG] +"\u0270" => "m" + +# ɱ [LATIN SMALL LETTER M WITH HOOK] +"\u0271" => "m" + +# ᵯ [LATIN SMALL LETTER M WITH MIDDLE TILDE] +"\u1D6F" => "m" + +# ᶆ [LATIN SMALL LETTER M WITH PALATAL HOOK] +"\u1D86" => "m" + +# ḿ [LATIN SMALL LETTER M WITH ACUTE] +"\u1E3F" => "m" + +# ṁ [LATIN SMALL LETTER M WITH DOT ABOVE] +"\u1E41" => "m" + +# ṃ [LATIN SMALL LETTER M WITH DOT BELOW] +"\u1E43" => "m" + +# ⓜ [CIRCLED LATIN SMALL LETTER M] +"\u24DC" => "m" + +# m [FULLWIDTH LATIN SMALL LETTER M] +"\uFF4D" => "m" + +# ⒨ [PARENTHESIZED LATIN SMALL LETTER M] +"\u24A8" => "(m)" + +# Ñ [LATIN CAPITAL LETTER N WITH TILDE] +"\u00D1" => "N" + +# Ń [LATIN CAPITAL LETTER N WITH ACUTE] +"\u0143" => "N" + +# Ņ [LATIN CAPITAL LETTER N WITH CEDILLA] +"\u0145" => "N" + +# Ň [LATIN CAPITAL LETTER N WITH CARON] +"\u0147" => "N" + +# Ŋ http://en.wikipedia.org/wiki/Eng_(letter) [LATIN CAPITAL LETTER ENG] +"\u014A" => "N" + +# Ɲ [LATIN CAPITAL LETTER N WITH LEFT HOOK] +"\u019D" => "N" + +# Ǹ [LATIN CAPITAL LETTER N WITH GRAVE] +"\u01F8" => "N" + +# Ƞ [LATIN CAPITAL LETTER N WITH LONG RIGHT LEG] +"\u0220" => "N" + +# ɴ [LATIN LETTER SMALL CAPITAL N] +"\u0274" => "N" + +# ᴎ [LATIN LETTER SMALL CAPITAL REVERSED N] +"\u1D0E" => "N" + +# Ṅ [LATIN CAPITAL LETTER N WITH DOT ABOVE] +"\u1E44" => "N" + +# Ṇ [LATIN CAPITAL LETTER N WITH DOT BELOW] +"\u1E46" => "N" + +# Ṉ [LATIN CAPITAL LETTER N WITH LINE BELOW] +"\u1E48" => "N" + +# Ṋ [LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW] +"\u1E4A" => "N" + +# Ⓝ [CIRCLED LATIN CAPITAL LETTER N] +"\u24C3" => "N" + +# N [FULLWIDTH LATIN CAPITAL LETTER N] +"\uFF2E" => "N" + +# ñ [LATIN SMALL LETTER N WITH TILDE] +"\u00F1" => "n" + +# ń [LATIN SMALL LETTER N WITH ACUTE] +"\u0144" => "n" + +# ņ [LATIN SMALL LETTER N WITH CEDILLA] +"\u0146" => "n" + +# ň [LATIN SMALL LETTER N WITH CARON] +"\u0148" => "n" + +# ʼn [LATIN SMALL LETTER N PRECEDED BY APOSTROPHE] +"\u0149" => "n" + +# ŋ http://en.wikipedia.org/wiki/Eng_(letter) [LATIN SMALL LETTER ENG] +"\u014B" => "n" + +# ƞ [LATIN SMALL LETTER N WITH LONG RIGHT LEG] +"\u019E" => "n" + +# ǹ [LATIN SMALL LETTER N WITH GRAVE] +"\u01F9" => "n" + +# ȵ [LATIN SMALL LETTER N WITH CURL] +"\u0235" => "n" + +# ɲ [LATIN SMALL LETTER N WITH LEFT HOOK] +"\u0272" => "n" + +# ɳ [LATIN SMALL LETTER N WITH RETROFLEX HOOK] +"\u0273" => "n" + +# ᵰ [LATIN SMALL LETTER N WITH MIDDLE TILDE] +"\u1D70" => "n" + +# ᶇ [LATIN SMALL LETTER N WITH PALATAL HOOK] +"\u1D87" => "n" + +# ṅ [LATIN SMALL LETTER N WITH DOT ABOVE] +"\u1E45" => "n" + +# ṇ [LATIN SMALL LETTER N WITH DOT BELOW] +"\u1E47" => "n" + +# ṉ [LATIN SMALL LETTER N WITH LINE BELOW] +"\u1E49" => "n" + +# ṋ [LATIN SMALL LETTER N WITH CIRCUMFLEX BELOW] +"\u1E4B" => "n" + +# ⁿ [SUPERSCRIPT LATIN SMALL LETTER N] +"\u207F" => "n" + +# ⓝ [CIRCLED LATIN SMALL LETTER N] +"\u24DD" => "n" + +# n [FULLWIDTH LATIN SMALL LETTER N] +"\uFF4E" => "n" + +# NJ [LATIN CAPITAL LETTER NJ] +"\u01CA" => "NJ" + +# Nj [LATIN CAPITAL LETTER N WITH SMALL LETTER J] +"\u01CB" => "Nj" + +# ⒩ [PARENTHESIZED LATIN SMALL LETTER N] +"\u24A9" => "(n)" + +# nj [LATIN SMALL LETTER NJ] +"\u01CC" => "nj" + +# Ò [LATIN CAPITAL LETTER O WITH GRAVE] +"\u00D2" => "O" + +# Ó [LATIN CAPITAL LETTER O WITH ACUTE] +"\u00D3" => "O" + +# Ô [LATIN CAPITAL LETTER O WITH CIRCUMFLEX] +"\u00D4" => "O" + +# Õ [LATIN CAPITAL LETTER O WITH TILDE] +"\u00D5" => "O" + +# Ö [LATIN CAPITAL LETTER O WITH DIAERESIS] +"\u00D6" => "O" + +# Ø [LATIN CAPITAL LETTER O WITH STROKE] +"\u00D8" => "O" + +# Ō [LATIN CAPITAL LETTER O WITH MACRON] +"\u014C" => "O" + +# Ŏ [LATIN CAPITAL LETTER O WITH BREVE] +"\u014E" => "O" + +# Ő [LATIN CAPITAL LETTER O WITH DOUBLE ACUTE] +"\u0150" => "O" + +# Ɔ [LATIN CAPITAL LETTER OPEN O] +"\u0186" => "O" + +# Ɵ [LATIN CAPITAL LETTER O WITH MIDDLE TILDE] +"\u019F" => "O" + +# Ơ [LATIN CAPITAL LETTER O WITH HORN] +"\u01A0" => "O" + +# Ǒ [LATIN CAPITAL LETTER O WITH CARON] +"\u01D1" => "O" + +# Ǫ [LATIN CAPITAL LETTER O WITH OGONEK] +"\u01EA" => "O" + +# Ǭ [LATIN CAPITAL LETTER O WITH OGONEK AND MACRON] +"\u01EC" => "O" + +# Ǿ [LATIN CAPITAL LETTER O WITH STROKE AND ACUTE] +"\u01FE" => "O" + +# Ȍ [LATIN CAPITAL LETTER O WITH DOUBLE GRAVE] +"\u020C" => "O" + +# Ȏ [LATIN CAPITAL LETTER O WITH INVERTED BREVE] +"\u020E" => "O" + +# Ȫ [LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON] +"\u022A" => "O" + +# Ȭ [LATIN CAPITAL LETTER O WITH TILDE AND MACRON] +"\u022C" => "O" + +# Ȯ [LATIN CAPITAL LETTER O WITH DOT ABOVE] +"\u022E" => "O" + +# Ȱ [LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON] +"\u0230" => "O" + +# ᴏ [LATIN LETTER SMALL CAPITAL O] +"\u1D0F" => "O" + +# ᴐ [LATIN LETTER SMALL CAPITAL OPEN O] +"\u1D10" => "O" + +# Ṍ [LATIN CAPITAL LETTER O WITH TILDE AND ACUTE] +"\u1E4C" => "O" + +# Ṏ [LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS] +"\u1E4E" => "O" + +# Ṑ [LATIN CAPITAL LETTER O WITH MACRON AND GRAVE] +"\u1E50" => "O" + +# Ṓ [LATIN CAPITAL LETTER O WITH MACRON AND ACUTE] +"\u1E52" => "O" + +# Ọ [LATIN CAPITAL LETTER O WITH DOT BELOW] +"\u1ECC" => "O" + +# Ỏ [LATIN CAPITAL LETTER O WITH HOOK ABOVE] +"\u1ECE" => "O" + +# Ố [LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE] +"\u1ED0" => "O" + +# Ồ [LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE] +"\u1ED2" => "O" + +# Ổ [LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE] +"\u1ED4" => "O" + +# Ỗ [LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE] +"\u1ED6" => "O" + +# Ộ [LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW] +"\u1ED8" => "O" + +# Ớ [LATIN CAPITAL LETTER O WITH HORN AND ACUTE] +"\u1EDA" => "O" + +# Ờ [LATIN CAPITAL LETTER O WITH HORN AND GRAVE] +"\u1EDC" => "O" + +# Ở [LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE] +"\u1EDE" => "O" + +# Ỡ [LATIN CAPITAL LETTER O WITH HORN AND TILDE] +"\u1EE0" => "O" + +# Ợ [LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW] +"\u1EE2" => "O" + +# Ⓞ [CIRCLED LATIN CAPITAL LETTER O] +"\u24C4" => "O" + +# Ꝋ [LATIN CAPITAL LETTER O WITH LONG STROKE OVERLAY] +"\uA74A" => "O" + +# Ꝍ [LATIN CAPITAL LETTER O WITH LOOP] +"\uA74C" => "O" + +# O [FULLWIDTH LATIN CAPITAL LETTER O] +"\uFF2F" => "O" + +# ò [LATIN SMALL LETTER O WITH GRAVE] +"\u00F2" => "o" + +# ó [LATIN SMALL LETTER O WITH ACUTE] +"\u00F3" => "o" + +# ô [LATIN SMALL LETTER O WITH CIRCUMFLEX] +"\u00F4" => "o" + +# õ [LATIN SMALL LETTER O WITH TILDE] +"\u00F5" => "o" + +# ö [LATIN SMALL LETTER O WITH DIAERESIS] +"\u00F6" => "o" + +# ø [LATIN SMALL LETTER O WITH STROKE] +"\u00F8" => "o" + +# ō [LATIN SMALL LETTER O WITH MACRON] +"\u014D" => "o" + +# ŏ [LATIN SMALL LETTER O WITH BREVE] +"\u014F" => "o" + +# ő [LATIN SMALL LETTER O WITH DOUBLE ACUTE] +"\u0151" => "o" + +# ơ [LATIN SMALL LETTER O WITH HORN] +"\u01A1" => "o" + +# ǒ [LATIN SMALL LETTER O WITH CARON] +"\u01D2" => "o" + +# ǫ [LATIN SMALL LETTER O WITH OGONEK] +"\u01EB" => "o" + +# ǭ [LATIN SMALL LETTER O WITH OGONEK AND MACRON] +"\u01ED" => "o" + +# ǿ [LATIN SMALL LETTER O WITH STROKE AND ACUTE] +"\u01FF" => "o" + +# ȍ [LATIN SMALL LETTER O WITH DOUBLE GRAVE] +"\u020D" => "o" + +# ȏ [LATIN SMALL LETTER O WITH INVERTED BREVE] +"\u020F" => "o" + +# ȫ [LATIN SMALL LETTER O WITH DIAERESIS AND MACRON] +"\u022B" => "o" + +# ȭ [LATIN SMALL LETTER O WITH TILDE AND MACRON] +"\u022D" => "o" + +# ȯ [LATIN SMALL LETTER O WITH DOT ABOVE] +"\u022F" => "o" + +# ȱ [LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON] +"\u0231" => "o" + +# ɔ [LATIN SMALL LETTER OPEN O] +"\u0254" => "o" + +# ɵ [LATIN SMALL LETTER BARRED O] +"\u0275" => "o" + +# ᴖ [LATIN SMALL LETTER TOP HALF O] +"\u1D16" => "o" + +# ᴗ [LATIN SMALL LETTER BOTTOM HALF O] +"\u1D17" => "o" + +# ᶗ [LATIN SMALL LETTER OPEN O WITH RETROFLEX HOOK] +"\u1D97" => "o" + +# ṍ [LATIN SMALL LETTER O WITH TILDE AND ACUTE] +"\u1E4D" => "o" + +# ṏ [LATIN SMALL LETTER O WITH TILDE AND DIAERESIS] +"\u1E4F" => "o" + +# ṑ [LATIN SMALL LETTER O WITH MACRON AND GRAVE] +"\u1E51" => "o" + +# ṓ [LATIN SMALL LETTER O WITH MACRON AND ACUTE] +"\u1E53" => "o" + +# ọ [LATIN SMALL LETTER O WITH DOT BELOW] +"\u1ECD" => "o" + +# ỏ [LATIN SMALL LETTER O WITH HOOK ABOVE] +"\u1ECF" => "o" + +# ố [LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE] +"\u1ED1" => "o" + +# ồ [LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE] +"\u1ED3" => "o" + +# ổ [LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE] +"\u1ED5" => "o" + +# ỗ [LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE] +"\u1ED7" => "o" + +# ộ [LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW] +"\u1ED9" => "o" + +# ớ [LATIN SMALL LETTER O WITH HORN AND ACUTE] +"\u1EDB" => "o" + +# ờ [LATIN SMALL LETTER O WITH HORN AND GRAVE] +"\u1EDD" => "o" + +# ở [LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE] +"\u1EDF" => "o" + +# ỡ [LATIN SMALL LETTER O WITH HORN AND TILDE] +"\u1EE1" => "o" + +# ợ [LATIN SMALL LETTER O WITH HORN AND DOT BELOW] +"\u1EE3" => "o" + +# ₒ [LATIN SUBSCRIPT SMALL LETTER O] +"\u2092" => "o" + +# ⓞ [CIRCLED LATIN SMALL LETTER O] +"\u24DE" => "o" + +# ⱺ [LATIN SMALL LETTER O WITH LOW RING INSIDE] +"\u2C7A" => "o" + +# ꝋ [LATIN SMALL LETTER O WITH LONG STROKE OVERLAY] +"\uA74B" => "o" + +# ꝍ [LATIN SMALL LETTER O WITH LOOP] +"\uA74D" => "o" + +# o [FULLWIDTH LATIN SMALL LETTER O] +"\uFF4F" => "o" + +# Œ [LATIN CAPITAL LIGATURE OE] +"\u0152" => "OE" + +# ɶ [LATIN LETTER SMALL CAPITAL OE] +"\u0276" => "OE" + +# Ꝏ [LATIN CAPITAL LETTER OO] +"\uA74E" => "OO" + +# Ȣ http://en.wikipedia.org/wiki/OU [LATIN CAPITAL LETTER OU] +"\u0222" => "OU" + +# ᴕ [LATIN LETTER SMALL CAPITAL OU] +"\u1D15" => "OU" + +# ⒪ [PARENTHESIZED LATIN SMALL LETTER O] +"\u24AA" => "(o)" + +# œ [LATIN SMALL LIGATURE OE] +"\u0153" => "oe" + +# ᴔ [LATIN SMALL LETTER TURNED OE] +"\u1D14" => "oe" + +# ꝏ [LATIN SMALL LETTER OO] +"\uA74F" => "oo" + +# ȣ http://en.wikipedia.org/wiki/OU [LATIN SMALL LETTER OU] +"\u0223" => "ou" + +# Ƥ [LATIN CAPITAL LETTER P WITH HOOK] +"\u01A4" => "P" + +# ᴘ [LATIN LETTER SMALL CAPITAL P] +"\u1D18" => "P" + +# Ṕ [LATIN CAPITAL LETTER P WITH ACUTE] +"\u1E54" => "P" + +# Ṗ [LATIN CAPITAL LETTER P WITH DOT ABOVE] +"\u1E56" => "P" + +# Ⓟ [CIRCLED LATIN CAPITAL LETTER P] +"\u24C5" => "P" + +# Ᵽ [LATIN CAPITAL LETTER P WITH STROKE] +"\u2C63" => "P" + +# Ꝑ [LATIN CAPITAL LETTER P WITH STROKE THROUGH DESCENDER] +"\uA750" => "P" + +# Ꝓ [LATIN CAPITAL LETTER P WITH FLOURISH] +"\uA752" => "P" + +# Ꝕ [LATIN CAPITAL LETTER P WITH SQUIRREL TAIL] +"\uA754" => "P" + +# P [FULLWIDTH LATIN CAPITAL LETTER P] +"\uFF30" => "P" + +# ƥ [LATIN SMALL LETTER P WITH HOOK] +"\u01A5" => "p" + +# ᵱ [LATIN SMALL LETTER P WITH MIDDLE TILDE] +"\u1D71" => "p" + +# ᵽ [LATIN SMALL LETTER P WITH STROKE] +"\u1D7D" => "p" + +# ᶈ [LATIN SMALL LETTER P WITH PALATAL HOOK] +"\u1D88" => "p" + +# ṕ [LATIN SMALL LETTER P WITH ACUTE] +"\u1E55" => "p" + +# ṗ [LATIN SMALL LETTER P WITH DOT ABOVE] +"\u1E57" => "p" + +# ⓟ [CIRCLED LATIN SMALL LETTER P] +"\u24DF" => "p" + +# ꝑ [LATIN SMALL LETTER P WITH STROKE THROUGH DESCENDER] +"\uA751" => "p" + +# ꝓ [LATIN SMALL LETTER P WITH FLOURISH] +"\uA753" => "p" + +# ꝕ [LATIN SMALL LETTER P WITH SQUIRREL TAIL] +"\uA755" => "p" + +# ꟼ [LATIN EPIGRAPHIC LETTER REVERSED P] +"\uA7FC" => "p" + +# p [FULLWIDTH LATIN SMALL LETTER P] +"\uFF50" => "p" + +# ⒫ [PARENTHESIZED LATIN SMALL LETTER P] +"\u24AB" => "(p)" + +# Ɋ [LATIN CAPITAL LETTER SMALL Q WITH HOOK TAIL] +"\u024A" => "Q" + +# Ⓠ [CIRCLED LATIN CAPITAL LETTER Q] +"\u24C6" => "Q" + +# Ꝗ [LATIN CAPITAL LETTER Q WITH STROKE THROUGH DESCENDER] +"\uA756" => "Q" + +# Ꝙ [LATIN CAPITAL LETTER Q WITH DIAGONAL STROKE] +"\uA758" => "Q" + +# Q [FULLWIDTH LATIN CAPITAL LETTER Q] +"\uFF31" => "Q" + +# ĸ http://en.wikipedia.org/wiki/Kra_(letter) [LATIN SMALL LETTER KRA] +"\u0138" => "q" + +# ɋ [LATIN SMALL LETTER Q WITH HOOK TAIL] +"\u024B" => "q" + +# ʠ [LATIN SMALL LETTER Q WITH HOOK] +"\u02A0" => "q" + +# ⓠ [CIRCLED LATIN SMALL LETTER Q] +"\u24E0" => "q" + +# ꝗ [LATIN SMALL LETTER Q WITH STROKE THROUGH DESCENDER] +"\uA757" => "q" + +# ꝙ [LATIN SMALL LETTER Q WITH DIAGONAL STROKE] +"\uA759" => "q" + +# q [FULLWIDTH LATIN SMALL LETTER Q] +"\uFF51" => "q" + +# ⒬ [PARENTHESIZED LATIN SMALL LETTER Q] +"\u24AC" => "(q)" + +# ȹ [LATIN SMALL LETTER QP DIGRAPH] +"\u0239" => "qp" + +# Ŕ [LATIN CAPITAL LETTER R WITH ACUTE] +"\u0154" => "R" + +# Ŗ [LATIN CAPITAL LETTER R WITH CEDILLA] +"\u0156" => "R" + +# Ř [LATIN CAPITAL LETTER R WITH CARON] +"\u0158" => "R" + +# Ȓ [LATIN CAPITAL LETTER R WITH DOUBLE GRAVE] +"\u0210" => "R" + +# Ȓ [LATIN CAPITAL LETTER R WITH INVERTED BREVE] +"\u0212" => "R" + +# Ɍ [LATIN CAPITAL LETTER R WITH STROKE] +"\u024C" => "R" + +# ʀ [LATIN LETTER SMALL CAPITAL R] +"\u0280" => "R" + +# ʁ [LATIN LETTER SMALL CAPITAL INVERTED R] +"\u0281" => "R" + +# ᴙ [LATIN LETTER SMALL CAPITAL REVERSED R] +"\u1D19" => "R" + +# ᴚ [LATIN LETTER SMALL CAPITAL TURNED R] +"\u1D1A" => "R" + +# Ṙ [LATIN CAPITAL LETTER R WITH DOT ABOVE] +"\u1E58" => "R" + +# Ṛ [LATIN CAPITAL LETTER R WITH DOT BELOW] +"\u1E5A" => "R" + +# Ṝ [LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON] +"\u1E5C" => "R" + +# Ṟ [LATIN CAPITAL LETTER R WITH LINE BELOW] +"\u1E5E" => "R" + +# Ⓡ [CIRCLED LATIN CAPITAL LETTER R] +"\u24C7" => "R" + +# Ɽ [LATIN CAPITAL LETTER R WITH TAIL] +"\u2C64" => "R" + +# Ꝛ [LATIN CAPITAL LETTER R ROTUNDA] +"\uA75A" => "R" + +# Ꞃ [LATIN CAPITAL LETTER INSULAR R] +"\uA782" => "R" + +# R [FULLWIDTH LATIN CAPITAL LETTER R] +"\uFF32" => "R" + +# ŕ [LATIN SMALL LETTER R WITH ACUTE] +"\u0155" => "r" + +# ŗ [LATIN SMALL LETTER R WITH CEDILLA] +"\u0157" => "r" + +# ř [LATIN SMALL LETTER R WITH CARON] +"\u0159" => "r" + +# ȑ [LATIN SMALL LETTER R WITH DOUBLE GRAVE] +"\u0211" => "r" + +# ȓ [LATIN SMALL LETTER R WITH INVERTED BREVE] +"\u0213" => "r" + +# ɍ [LATIN SMALL LETTER R WITH STROKE] +"\u024D" => "r" + +# ɼ [LATIN SMALL LETTER R WITH LONG LEG] +"\u027C" => "r" + +# ɽ [LATIN SMALL LETTER R WITH TAIL] +"\u027D" => "r" + +# ɾ [LATIN SMALL LETTER R WITH FISHHOOK] +"\u027E" => "r" + +# ɿ [LATIN SMALL LETTER REVERSED R WITH FISHHOOK] +"\u027F" => "r" + +# ᵣ [LATIN SUBSCRIPT SMALL LETTER R] +"\u1D63" => "r" + +# ᵲ [LATIN SMALL LETTER R WITH MIDDLE TILDE] +"\u1D72" => "r" + +# ᵳ [LATIN SMALL LETTER R WITH FISHHOOK AND MIDDLE TILDE] +"\u1D73" => "r" + +# ᶉ [LATIN SMALL LETTER R WITH PALATAL HOOK] +"\u1D89" => "r" + +# ṙ [LATIN SMALL LETTER R WITH DOT ABOVE] +"\u1E59" => "r" + +# ṛ [LATIN SMALL LETTER R WITH DOT BELOW] +"\u1E5B" => "r" + +# ṝ [LATIN SMALL LETTER R WITH DOT BELOW AND MACRON] +"\u1E5D" => "r" + +# ṟ [LATIN SMALL LETTER R WITH LINE BELOW] +"\u1E5F" => "r" + +# ⓡ [CIRCLED LATIN SMALL LETTER R] +"\u24E1" => "r" + +# ꝛ [LATIN SMALL LETTER R ROTUNDA] +"\uA75B" => "r" + +# ꞃ [LATIN SMALL LETTER INSULAR R] +"\uA783" => "r" + +# r [FULLWIDTH LATIN SMALL LETTER R] +"\uFF52" => "r" + +# ⒭ [PARENTHESIZED LATIN SMALL LETTER R] +"\u24AD" => "(r)" + +# Ś [LATIN CAPITAL LETTER S WITH ACUTE] +"\u015A" => "S" + +# Ŝ [LATIN CAPITAL LETTER S WITH CIRCUMFLEX] +"\u015C" => "S" + +# Ş [LATIN CAPITAL LETTER S WITH CEDILLA] +"\u015E" => "S" + +# Š [LATIN CAPITAL LETTER S WITH CARON] +"\u0160" => "S" + +# Ș [LATIN CAPITAL LETTER S WITH COMMA BELOW] +"\u0218" => "S" + +# Ṡ [LATIN CAPITAL LETTER S WITH DOT ABOVE] +"\u1E60" => "S" + +# Ṣ [LATIN CAPITAL LETTER S WITH DOT BELOW] +"\u1E62" => "S" + +# Ṥ [LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE] +"\u1E64" => "S" + +# Ṧ [LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE] +"\u1E66" => "S" + +# Ṩ [LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE] +"\u1E68" => "S" + +# Ⓢ [CIRCLED LATIN CAPITAL LETTER S] +"\u24C8" => "S" + +# ꜱ [LATIN LETTER SMALL CAPITAL S] +"\uA731" => "S" + +# ꞅ [LATIN SMALL LETTER INSULAR S] +"\uA785" => "S" + +# S [FULLWIDTH LATIN CAPITAL LETTER S] +"\uFF33" => "S" + +# ś [LATIN SMALL LETTER S WITH ACUTE] +"\u015B" => "s" + +# ŝ [LATIN SMALL LETTER S WITH CIRCUMFLEX] +"\u015D" => "s" + +# ş [LATIN SMALL LETTER S WITH CEDILLA] +"\u015F" => "s" + +# š [LATIN SMALL LETTER S WITH CARON] +"\u0161" => "s" + +# ſ http://en.wikipedia.org/wiki/Long_S [LATIN SMALL LETTER LONG S] +"\u017F" => "s" + +# ș [LATIN SMALL LETTER S WITH COMMA BELOW] +"\u0219" => "s" + +# ȿ [LATIN SMALL LETTER S WITH SWASH TAIL] +"\u023F" => "s" + +# ʂ [LATIN SMALL LETTER S WITH HOOK] +"\u0282" => "s" + +# ᵴ [LATIN SMALL LETTER S WITH MIDDLE TILDE] +"\u1D74" => "s" + +# ᶊ [LATIN SMALL LETTER S WITH PALATAL HOOK] +"\u1D8A" => "s" + +# ṡ [LATIN SMALL LETTER S WITH DOT ABOVE] +"\u1E61" => "s" + +# ṣ [LATIN SMALL LETTER S WITH DOT BELOW] +"\u1E63" => "s" + +# ṥ [LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE] +"\u1E65" => "s" + +# ṧ [LATIN SMALL LETTER S WITH CARON AND DOT ABOVE] +"\u1E67" => "s" + +# ṩ [LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE] +"\u1E69" => "s" + +# ẜ [LATIN SMALL LETTER LONG S WITH DIAGONAL STROKE] +"\u1E9C" => "s" + +# ẝ [LATIN SMALL LETTER LONG S WITH HIGH STROKE] +"\u1E9D" => "s" + +# ⓢ [CIRCLED LATIN SMALL LETTER S] +"\u24E2" => "s" + +# Ꞅ [LATIN CAPITAL LETTER INSULAR S] +"\uA784" => "s" + +# s [FULLWIDTH LATIN SMALL LETTER S] +"\uFF53" => "s" + +# ẞ [LATIN CAPITAL LETTER SHARP S] +"\u1E9E" => "SS" + +# ⒮ [PARENTHESIZED LATIN SMALL LETTER S] +"\u24AE" => "(s)" + +# ß [LATIN SMALL LETTER SHARP S] +"\u00DF" => "ss" + +# st [LATIN SMALL LIGATURE ST] +"\uFB06" => "st" + +# Ţ [LATIN CAPITAL LETTER T WITH CEDILLA] +"\u0162" => "T" + +# Ť [LATIN CAPITAL LETTER T WITH CARON] +"\u0164" => "T" + +# Ŧ [LATIN CAPITAL LETTER T WITH STROKE] +"\u0166" => "T" + +# Ƭ [LATIN CAPITAL LETTER T WITH HOOK] +"\u01AC" => "T" + +# Ʈ [LATIN CAPITAL LETTER T WITH RETROFLEX HOOK] +"\u01AE" => "T" + +# Ț [LATIN CAPITAL LETTER T WITH COMMA BELOW] +"\u021A" => "T" + +# Ⱦ [LATIN CAPITAL LETTER T WITH DIAGONAL STROKE] +"\u023E" => "T" + +# ᴛ [LATIN LETTER SMALL CAPITAL T] +"\u1D1B" => "T" + +# Ṫ [LATIN CAPITAL LETTER T WITH DOT ABOVE] +"\u1E6A" => "T" + +# Ṭ [LATIN CAPITAL LETTER T WITH DOT BELOW] +"\u1E6C" => "T" + +# Ṯ [LATIN CAPITAL LETTER T WITH LINE BELOW] +"\u1E6E" => "T" + +# Ṱ [LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW] +"\u1E70" => "T" + +# Ⓣ [CIRCLED LATIN CAPITAL LETTER T] +"\u24C9" => "T" + +# Ꞇ [LATIN CAPITAL LETTER INSULAR T] +"\uA786" => "T" + +# T [FULLWIDTH LATIN CAPITAL LETTER T] +"\uFF34" => "T" + +# ţ [LATIN SMALL LETTER T WITH CEDILLA] +"\u0163" => "t" + +# ť [LATIN SMALL LETTER T WITH CARON] +"\u0165" => "t" + +# ŧ [LATIN SMALL LETTER T WITH STROKE] +"\u0167" => "t" + +# ƫ [LATIN SMALL LETTER T WITH PALATAL HOOK] +"\u01AB" => "t" + +# ƭ [LATIN SMALL LETTER T WITH HOOK] +"\u01AD" => "t" + +# ț [LATIN SMALL LETTER T WITH COMMA BELOW] +"\u021B" => "t" + +# ȶ [LATIN SMALL LETTER T WITH CURL] +"\u0236" => "t" + +# ʇ [LATIN SMALL LETTER TURNED T] +"\u0287" => "t" + +# ʈ [LATIN SMALL LETTER T WITH RETROFLEX HOOK] +"\u0288" => "t" + +# ᵵ [LATIN SMALL LETTER T WITH MIDDLE TILDE] +"\u1D75" => "t" + +# ṫ [LATIN SMALL LETTER T WITH DOT ABOVE] +"\u1E6B" => "t" + +# ṭ [LATIN SMALL LETTER T WITH DOT BELOW] +"\u1E6D" => "t" + +# ṯ [LATIN SMALL LETTER T WITH LINE BELOW] +"\u1E6F" => "t" + +# ṱ [LATIN SMALL LETTER T WITH CIRCUMFLEX BELOW] +"\u1E71" => "t" + +# ẗ [LATIN SMALL LETTER T WITH DIAERESIS] +"\u1E97" => "t" + +# ⓣ [CIRCLED LATIN SMALL LETTER T] +"\u24E3" => "t" + +# ⱦ [LATIN SMALL LETTER T WITH DIAGONAL STROKE] +"\u2C66" => "t" + +# t [FULLWIDTH LATIN SMALL LETTER T] +"\uFF54" => "t" + +# Þ [LATIN CAPITAL LETTER THORN] +"\u00DE" => "TH" + +# Ꝧ [LATIN CAPITAL LETTER THORN WITH STROKE THROUGH DESCENDER] +"\uA766" => "TH" + +# Ꜩ [LATIN CAPITAL LETTER TZ] +"\uA728" => "TZ" + +# ⒯ [PARENTHESIZED LATIN SMALL LETTER T] +"\u24AF" => "(t)" + +# ʨ [LATIN SMALL LETTER TC DIGRAPH WITH CURL] +"\u02A8" => "tc" + +# þ [LATIN SMALL LETTER THORN] +"\u00FE" => "th" + +# ᵺ [LATIN SMALL LETTER TH WITH STRIKETHROUGH] +"\u1D7A" => "th" + +# ꝧ [LATIN SMALL LETTER THORN WITH STROKE THROUGH DESCENDER] +"\uA767" => "th" + +# ʦ [LATIN SMALL LETTER TS DIGRAPH] +"\u02A6" => "ts" + +# ꜩ [LATIN SMALL LETTER TZ] +"\uA729" => "tz" + +# Ù [LATIN CAPITAL LETTER U WITH GRAVE] +"\u00D9" => "U" + +# Ú [LATIN CAPITAL LETTER U WITH ACUTE] +"\u00DA" => "U" + +# Û [LATIN CAPITAL LETTER U WITH CIRCUMFLEX] +"\u00DB" => "U" + +# Ü [LATIN CAPITAL LETTER U WITH DIAERESIS] +"\u00DC" => "U" + +# Ũ [LATIN CAPITAL LETTER U WITH TILDE] +"\u0168" => "U" + +# Ū [LATIN CAPITAL LETTER U WITH MACRON] +"\u016A" => "U" + +# Ŭ [LATIN CAPITAL LETTER U WITH BREVE] +"\u016C" => "U" + +# Ů [LATIN CAPITAL LETTER U WITH RING ABOVE] +"\u016E" => "U" + +# Ű [LATIN CAPITAL LETTER U WITH DOUBLE ACUTE] +"\u0170" => "U" + +# Ų [LATIN CAPITAL LETTER U WITH OGONEK] +"\u0172" => "U" + +# Ư [LATIN CAPITAL LETTER U WITH HORN] +"\u01AF" => "U" + +# Ǔ [LATIN CAPITAL LETTER U WITH CARON] +"\u01D3" => "U" + +# Ǖ [LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON] +"\u01D5" => "U" + +# Ǘ [LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE] +"\u01D7" => "U" + +# Ǚ [LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON] +"\u01D9" => "U" + +# Ǜ [LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE] +"\u01DB" => "U" + +# Ȕ [LATIN CAPITAL LETTER U WITH DOUBLE GRAVE] +"\u0214" => "U" + +# Ȗ [LATIN CAPITAL LETTER U WITH INVERTED BREVE] +"\u0216" => "U" + +# Ʉ [LATIN CAPITAL LETTER U BAR] +"\u0244" => "U" + +# ᴜ [LATIN LETTER SMALL CAPITAL U] +"\u1D1C" => "U" + +# ᵾ [LATIN SMALL CAPITAL LETTER U WITH STROKE] +"\u1D7E" => "U" + +# Ṳ [LATIN CAPITAL LETTER U WITH DIAERESIS BELOW] +"\u1E72" => "U" + +# Ṵ [LATIN CAPITAL LETTER U WITH TILDE BELOW] +"\u1E74" => "U" + +# Ṷ [LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW] +"\u1E76" => "U" + +# Ṹ [LATIN CAPITAL LETTER U WITH TILDE AND ACUTE] +"\u1E78" => "U" + +# Ṻ [LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS] +"\u1E7A" => "U" + +# Ụ [LATIN CAPITAL LETTER U WITH DOT BELOW] +"\u1EE4" => "U" + +# Ủ [LATIN CAPITAL LETTER U WITH HOOK ABOVE] +"\u1EE6" => "U" + +# Ứ [LATIN CAPITAL LETTER U WITH HORN AND ACUTE] +"\u1EE8" => "U" + +# Ừ [LATIN CAPITAL LETTER U WITH HORN AND GRAVE] +"\u1EEA" => "U" + +# Ử [LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE] +"\u1EEC" => "U" + +# Ữ [LATIN CAPITAL LETTER U WITH HORN AND TILDE] +"\u1EEE" => "U" + +# Ự [LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW] +"\u1EF0" => "U" + +# Ⓤ [CIRCLED LATIN CAPITAL LETTER U] +"\u24CA" => "U" + +# U [FULLWIDTH LATIN CAPITAL LETTER U] +"\uFF35" => "U" + +# ù [LATIN SMALL LETTER U WITH GRAVE] +"\u00F9" => "u" + +# ú [LATIN SMALL LETTER U WITH ACUTE] +"\u00FA" => "u" + +# û [LATIN SMALL LETTER U WITH CIRCUMFLEX] +"\u00FB" => "u" + +# ü [LATIN SMALL LETTER U WITH DIAERESIS] +"\u00FC" => "u" + +# ũ [LATIN SMALL LETTER U WITH TILDE] +"\u0169" => "u" + +# ū [LATIN SMALL LETTER U WITH MACRON] +"\u016B" => "u" + +# ŭ [LATIN SMALL LETTER U WITH BREVE] +"\u016D" => "u" + +# ů [LATIN SMALL LETTER U WITH RING ABOVE] +"\u016F" => "u" + +# ű [LATIN SMALL LETTER U WITH DOUBLE ACUTE] +"\u0171" => "u" + +# ų [LATIN SMALL LETTER U WITH OGONEK] +"\u0173" => "u" + +# ư [LATIN SMALL LETTER U WITH HORN] +"\u01B0" => "u" + +# ǔ [LATIN SMALL LETTER U WITH CARON] +"\u01D4" => "u" + +# ǖ [LATIN SMALL LETTER U WITH DIAERESIS AND MACRON] +"\u01D6" => "u" + +# ǘ [LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE] +"\u01D8" => "u" + +# ǚ [LATIN SMALL LETTER U WITH DIAERESIS AND CARON] +"\u01DA" => "u" + +# ǜ [LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE] +"\u01DC" => "u" + +# ȕ [LATIN SMALL LETTER U WITH DOUBLE GRAVE] +"\u0215" => "u" + +# ȗ [LATIN SMALL LETTER U WITH INVERTED BREVE] +"\u0217" => "u" + +# ʉ [LATIN SMALL LETTER U BAR] +"\u0289" => "u" + +# ᵤ [LATIN SUBSCRIPT SMALL LETTER U] +"\u1D64" => "u" + +# ᶙ [LATIN SMALL LETTER U WITH RETROFLEX HOOK] +"\u1D99" => "u" + +# ṳ [LATIN SMALL LETTER U WITH DIAERESIS BELOW] +"\u1E73" => "u" + +# ṵ [LATIN SMALL LETTER U WITH TILDE BELOW] +"\u1E75" => "u" + +# ṷ [LATIN SMALL LETTER U WITH CIRCUMFLEX BELOW] +"\u1E77" => "u" + +# ṹ [LATIN SMALL LETTER U WITH TILDE AND ACUTE] +"\u1E79" => "u" + +# ṻ [LATIN SMALL LETTER U WITH MACRON AND DIAERESIS] +"\u1E7B" => "u" + +# ụ [LATIN SMALL LETTER U WITH DOT BELOW] +"\u1EE5" => "u" + +# ủ [LATIN SMALL LETTER U WITH HOOK ABOVE] +"\u1EE7" => "u" + +# ứ [LATIN SMALL LETTER U WITH HORN AND ACUTE] +"\u1EE9" => "u" + +# ừ [LATIN SMALL LETTER U WITH HORN AND GRAVE] +"\u1EEB" => "u" + +# ử [LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE] +"\u1EED" => "u" + +# ữ [LATIN SMALL LETTER U WITH HORN AND TILDE] +"\u1EEF" => "u" + +# ự [LATIN SMALL LETTER U WITH HORN AND DOT BELOW] +"\u1EF1" => "u" + +# ⓤ [CIRCLED LATIN SMALL LETTER U] +"\u24E4" => "u" + +# u [FULLWIDTH LATIN SMALL LETTER U] +"\uFF55" => "u" + +# ⒰ [PARENTHESIZED LATIN SMALL LETTER U] +"\u24B0" => "(u)" + +# ᵫ [LATIN SMALL LETTER UE] +"\u1D6B" => "ue" + +# Ʋ [LATIN CAPITAL LETTER V WITH HOOK] +"\u01B2" => "V" + +# Ʌ [LATIN CAPITAL LETTER TURNED V] +"\u0245" => "V" + +# ᴠ [LATIN LETTER SMALL CAPITAL V] +"\u1D20" => "V" + +# Ṽ [LATIN CAPITAL LETTER V WITH TILDE] +"\u1E7C" => "V" + +# Ṿ [LATIN CAPITAL LETTER V WITH DOT BELOW] +"\u1E7E" => "V" + +# Ỽ [LATIN CAPITAL LETTER MIDDLE-WELSH V] +"\u1EFC" => "V" + +# Ⓥ [CIRCLED LATIN CAPITAL LETTER V] +"\u24CB" => "V" + +# Ꝟ [LATIN CAPITAL LETTER V WITH DIAGONAL STROKE] +"\uA75E" => "V" + +# Ꝩ [LATIN CAPITAL LETTER VEND] +"\uA768" => "V" + +# V [FULLWIDTH LATIN CAPITAL LETTER V] +"\uFF36" => "V" + +# ʋ [LATIN SMALL LETTER V WITH HOOK] +"\u028B" => "v" + +# ʌ [LATIN SMALL LETTER TURNED V] +"\u028C" => "v" + +# ᵥ [LATIN SUBSCRIPT SMALL LETTER V] +"\u1D65" => "v" + +# ᶌ [LATIN SMALL LETTER V WITH PALATAL HOOK] +"\u1D8C" => "v" + +# ṽ [LATIN SMALL LETTER V WITH TILDE] +"\u1E7D" => "v" + +# ṿ [LATIN SMALL LETTER V WITH DOT BELOW] +"\u1E7F" => "v" + +# ⓥ [CIRCLED LATIN SMALL LETTER V] +"\u24E5" => "v" + +# ⱱ [LATIN SMALL LETTER V WITH RIGHT HOOK] +"\u2C71" => "v" + +# ⱴ [LATIN SMALL LETTER V WITH CURL] +"\u2C74" => "v" + +# ꝟ [LATIN SMALL LETTER V WITH DIAGONAL STROKE] +"\uA75F" => "v" + +# v [FULLWIDTH LATIN SMALL LETTER V] +"\uFF56" => "v" + +# Ꝡ [LATIN CAPITAL LETTER VY] +"\uA760" => "VY" + +# ⒱ [PARENTHESIZED LATIN SMALL LETTER V] +"\u24B1" => "(v)" + +# ꝡ [LATIN SMALL LETTER VY] +"\uA761" => "vy" + +# Ŵ [LATIN CAPITAL LETTER W WITH CIRCUMFLEX] +"\u0174" => "W" + +# Ƿ http://en.wikipedia.org/wiki/Wynn [LATIN CAPITAL LETTER WYNN] +"\u01F7" => "W" + +# ᴡ [LATIN LETTER SMALL CAPITAL W] +"\u1D21" => "W" + +# Ẁ [LATIN CAPITAL LETTER W WITH GRAVE] +"\u1E80" => "W" + +# Ẃ [LATIN CAPITAL LETTER W WITH ACUTE] +"\u1E82" => "W" + +# Ẅ [LATIN CAPITAL LETTER W WITH DIAERESIS] +"\u1E84" => "W" + +# Ẇ [LATIN CAPITAL LETTER W WITH DOT ABOVE] +"\u1E86" => "W" + +# Ẉ [LATIN CAPITAL LETTER W WITH DOT BELOW] +"\u1E88" => "W" + +# Ⓦ [CIRCLED LATIN CAPITAL LETTER W] +"\u24CC" => "W" + +# Ⱳ [LATIN CAPITAL LETTER W WITH HOOK] +"\u2C72" => "W" + +# W [FULLWIDTH LATIN CAPITAL LETTER W] +"\uFF37" => "W" + +# ŵ [LATIN SMALL LETTER W WITH CIRCUMFLEX] +"\u0175" => "w" + +# ƿ http://en.wikipedia.org/wiki/Wynn [LATIN LETTER WYNN] +"\u01BF" => "w" + +# ʍ [LATIN SMALL LETTER TURNED W] +"\u028D" => "w" + +# ẁ [LATIN SMALL LETTER W WITH GRAVE] +"\u1E81" => "w" + +# ẃ [LATIN SMALL LETTER W WITH ACUTE] +"\u1E83" => "w" + +# ẅ [LATIN SMALL LETTER W WITH DIAERESIS] +"\u1E85" => "w" + +# ẇ [LATIN SMALL LETTER W WITH DOT ABOVE] +"\u1E87" => "w" + +# ẉ [LATIN SMALL LETTER W WITH DOT BELOW] +"\u1E89" => "w" + +# ẘ [LATIN SMALL LETTER W WITH RING ABOVE] +"\u1E98" => "w" + +# ⓦ [CIRCLED LATIN SMALL LETTER W] +"\u24E6" => "w" + +# ⱳ [LATIN SMALL LETTER W WITH HOOK] +"\u2C73" => "w" + +# w [FULLWIDTH LATIN SMALL LETTER W] +"\uFF57" => "w" + +# ⒲ [PARENTHESIZED LATIN SMALL LETTER W] +"\u24B2" => "(w)" + +# Ẋ [LATIN CAPITAL LETTER X WITH DOT ABOVE] +"\u1E8A" => "X" + +# Ẍ [LATIN CAPITAL LETTER X WITH DIAERESIS] +"\u1E8C" => "X" + +# Ⓧ [CIRCLED LATIN CAPITAL LETTER X] +"\u24CD" => "X" + +# X [FULLWIDTH LATIN CAPITAL LETTER X] +"\uFF38" => "X" + +# ᶍ [LATIN SMALL LETTER X WITH PALATAL HOOK] +"\u1D8D" => "x" + +# ẋ [LATIN SMALL LETTER X WITH DOT ABOVE] +"\u1E8B" => "x" + +# ẍ [LATIN SMALL LETTER X WITH DIAERESIS] +"\u1E8D" => "x" + +# ₓ [LATIN SUBSCRIPT SMALL LETTER X] +"\u2093" => "x" + +# ⓧ [CIRCLED LATIN SMALL LETTER X] +"\u24E7" => "x" + +# x [FULLWIDTH LATIN SMALL LETTER X] +"\uFF58" => "x" + +# ⒳ [PARENTHESIZED LATIN SMALL LETTER X] +"\u24B3" => "(x)" + +# Ý [LATIN CAPITAL LETTER Y WITH ACUTE] +"\u00DD" => "Y" + +# Ŷ [LATIN CAPITAL LETTER Y WITH CIRCUMFLEX] +"\u0176" => "Y" + +# Ÿ [LATIN CAPITAL LETTER Y WITH DIAERESIS] +"\u0178" => "Y" + +# Ƴ [LATIN CAPITAL LETTER Y WITH HOOK] +"\u01B3" => "Y" + +# Ȳ [LATIN CAPITAL LETTER Y WITH MACRON] +"\u0232" => "Y" + +# Ɏ [LATIN CAPITAL LETTER Y WITH STROKE] +"\u024E" => "Y" + +# ʏ [LATIN LETTER SMALL CAPITAL Y] +"\u028F" => "Y" + +# Ẏ [LATIN CAPITAL LETTER Y WITH DOT ABOVE] +"\u1E8E" => "Y" + +# Ỳ [LATIN CAPITAL LETTER Y WITH GRAVE] +"\u1EF2" => "Y" + +# Ỵ [LATIN CAPITAL LETTER Y WITH DOT BELOW] +"\u1EF4" => "Y" + +# Ỷ [LATIN CAPITAL LETTER Y WITH HOOK ABOVE] +"\u1EF6" => "Y" + +# Ỹ [LATIN CAPITAL LETTER Y WITH TILDE] +"\u1EF8" => "Y" + +# Ỿ [LATIN CAPITAL LETTER Y WITH LOOP] +"\u1EFE" => "Y" + +# Ⓨ [CIRCLED LATIN CAPITAL LETTER Y] +"\u24CE" => "Y" + +# Y [FULLWIDTH LATIN CAPITAL LETTER Y] +"\uFF39" => "Y" + +# ý [LATIN SMALL LETTER Y WITH ACUTE] +"\u00FD" => "y" + +# ÿ [LATIN SMALL LETTER Y WITH DIAERESIS] +"\u00FF" => "y" + +# ŷ [LATIN SMALL LETTER Y WITH CIRCUMFLEX] +"\u0177" => "y" + +# ƴ [LATIN SMALL LETTER Y WITH HOOK] +"\u01B4" => "y" + +# ȳ [LATIN SMALL LETTER Y WITH MACRON] +"\u0233" => "y" + +# ɏ [LATIN SMALL LETTER Y WITH STROKE] +"\u024F" => "y" + +# ʎ [LATIN SMALL LETTER TURNED Y] +"\u028E" => "y" + +# ẏ [LATIN SMALL LETTER Y WITH DOT ABOVE] +"\u1E8F" => "y" + +# ẙ [LATIN SMALL LETTER Y WITH RING ABOVE] +"\u1E99" => "y" + +# ỳ [LATIN SMALL LETTER Y WITH GRAVE] +"\u1EF3" => "y" + +# ỵ [LATIN SMALL LETTER Y WITH DOT BELOW] +"\u1EF5" => "y" + +# ỷ [LATIN SMALL LETTER Y WITH HOOK ABOVE] +"\u1EF7" => "y" + +# ỹ [LATIN SMALL LETTER Y WITH TILDE] +"\u1EF9" => "y" + +# ỿ [LATIN SMALL LETTER Y WITH LOOP] +"\u1EFF" => "y" + +# ⓨ [CIRCLED LATIN SMALL LETTER Y] +"\u24E8" => "y" + +# y [FULLWIDTH LATIN SMALL LETTER Y] +"\uFF59" => "y" + +# ⒴ [PARENTHESIZED LATIN SMALL LETTER Y] +"\u24B4" => "(y)" + +# Ź [LATIN CAPITAL LETTER Z WITH ACUTE] +"\u0179" => "Z" + +# Ż [LATIN CAPITAL LETTER Z WITH DOT ABOVE] +"\u017B" => "Z" + +# Ž [LATIN CAPITAL LETTER Z WITH CARON] +"\u017D" => "Z" + +# Ƶ [LATIN CAPITAL LETTER Z WITH STROKE] +"\u01B5" => "Z" + +# Ȝ http://en.wikipedia.org/wiki/Yogh [LATIN CAPITAL LETTER YOGH] +"\u021C" => "Z" + +# Ȥ [LATIN CAPITAL LETTER Z WITH HOOK] +"\u0224" => "Z" + +# ᴢ [LATIN LETTER SMALL CAPITAL Z] +"\u1D22" => "Z" + +# Ẑ [LATIN CAPITAL LETTER Z WITH CIRCUMFLEX] +"\u1E90" => "Z" + +# Ẓ [LATIN CAPITAL LETTER Z WITH DOT BELOW] +"\u1E92" => "Z" + +# Ẕ [LATIN CAPITAL LETTER Z WITH LINE BELOW] +"\u1E94" => "Z" + +# Ⓩ [CIRCLED LATIN CAPITAL LETTER Z] +"\u24CF" => "Z" + +# Ⱬ [LATIN CAPITAL LETTER Z WITH DESCENDER] +"\u2C6B" => "Z" + +# Ꝣ [LATIN CAPITAL LETTER VISIGOTHIC Z] +"\uA762" => "Z" + +# Z [FULLWIDTH LATIN CAPITAL LETTER Z] +"\uFF3A" => "Z" + +# ź [LATIN SMALL LETTER Z WITH ACUTE] +"\u017A" => "z" + +# ż [LATIN SMALL LETTER Z WITH DOT ABOVE] +"\u017C" => "z" + +# ž [LATIN SMALL LETTER Z WITH CARON] +"\u017E" => "z" + +# ƶ [LATIN SMALL LETTER Z WITH STROKE] +"\u01B6" => "z" + +# ȝ http://en.wikipedia.org/wiki/Yogh [LATIN SMALL LETTER YOGH] +"\u021D" => "z" + +# ȥ [LATIN SMALL LETTER Z WITH HOOK] +"\u0225" => "z" + +# ɀ [LATIN SMALL LETTER Z WITH SWASH TAIL] +"\u0240" => "z" + +# ʐ [LATIN SMALL LETTER Z WITH RETROFLEX HOOK] +"\u0290" => "z" + +# ʑ [LATIN SMALL LETTER Z WITH CURL] +"\u0291" => "z" + +# ᵶ [LATIN SMALL LETTER Z WITH MIDDLE TILDE] +"\u1D76" => "z" + +# ᶎ [LATIN SMALL LETTER Z WITH PALATAL HOOK] +"\u1D8E" => "z" + +# ẑ [LATIN SMALL LETTER Z WITH CIRCUMFLEX] +"\u1E91" => "z" + +# ẓ [LATIN SMALL LETTER Z WITH DOT BELOW] +"\u1E93" => "z" + +# ẕ [LATIN SMALL LETTER Z WITH LINE BELOW] +"\u1E95" => "z" + +# ⓩ [CIRCLED LATIN SMALL LETTER Z] +"\u24E9" => "z" + +# ⱬ [LATIN SMALL LETTER Z WITH DESCENDER] +"\u2C6C" => "z" + +# ꝣ [LATIN SMALL LETTER VISIGOTHIC Z] +"\uA763" => "z" + +# z [FULLWIDTH LATIN SMALL LETTER Z] +"\uFF5A" => "z" + +# ⒵ [PARENTHESIZED LATIN SMALL LETTER Z] +"\u24B5" => "(z)" + +# ⁰ [SUPERSCRIPT ZERO] +"\u2070" => "0" + +# ₀ [SUBSCRIPT ZERO] +"\u2080" => "0" + +# ⓪ [CIRCLED DIGIT ZERO] +"\u24EA" => "0" + +# ⓿ [NEGATIVE CIRCLED DIGIT ZERO] +"\u24FF" => "0" + +# 0 [FULLWIDTH DIGIT ZERO] +"\uFF10" => "0" + +# ¹ [SUPERSCRIPT ONE] +"\u00B9" => "1" + +# ₁ [SUBSCRIPT ONE] +"\u2081" => "1" + +# ① [CIRCLED DIGIT ONE] +"\u2460" => "1" + +# ⓵ [DOUBLE CIRCLED DIGIT ONE] +"\u24F5" => "1" + +# ❶ [DINGBAT NEGATIVE CIRCLED DIGIT ONE] +"\u2776" => "1" + +# ➀ [DINGBAT CIRCLED SANS-SERIF DIGIT ONE] +"\u2780" => "1" + +# ➊ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE] +"\u278A" => "1" + +# 1 [FULLWIDTH DIGIT ONE] +"\uFF11" => "1" + +# ⒈ [DIGIT ONE FULL STOP] +"\u2488" => "1." + +# ⑴ [PARENTHESIZED DIGIT ONE] +"\u2474" => "(1)" + +# ² [SUPERSCRIPT TWO] +"\u00B2" => "2" + +# ₂ [SUBSCRIPT TWO] +"\u2082" => "2" + +# ② [CIRCLED DIGIT TWO] +"\u2461" => "2" + +# ⓶ [DOUBLE CIRCLED DIGIT TWO] +"\u24F6" => "2" + +# ❷ [DINGBAT NEGATIVE CIRCLED DIGIT TWO] +"\u2777" => "2" + +# ➁ [DINGBAT CIRCLED SANS-SERIF DIGIT TWO] +"\u2781" => "2" + +# ➋ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT TWO] +"\u278B" => "2" + +# 2 [FULLWIDTH DIGIT TWO] +"\uFF12" => "2" + +# ⒉ [DIGIT TWO FULL STOP] +"\u2489" => "2." + +# ⑵ [PARENTHESIZED DIGIT TWO] +"\u2475" => "(2)" + +# ³ [SUPERSCRIPT THREE] +"\u00B3" => "3" + +# ₃ [SUBSCRIPT THREE] +"\u2083" => "3" + +# ③ [CIRCLED DIGIT THREE] +"\u2462" => "3" + +# ⓷ [DOUBLE CIRCLED DIGIT THREE] +"\u24F7" => "3" + +# ❸ [DINGBAT NEGATIVE CIRCLED DIGIT THREE] +"\u2778" => "3" + +# ➂ [DINGBAT CIRCLED SANS-SERIF DIGIT THREE] +"\u2782" => "3" + +# ➌ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT THREE] +"\u278C" => "3" + +# 3 [FULLWIDTH DIGIT THREE] +"\uFF13" => "3" + +# ⒊ [DIGIT THREE FULL STOP] +"\u248A" => "3." + +# ⑶ [PARENTHESIZED DIGIT THREE] +"\u2476" => "(3)" + +# ⁴ [SUPERSCRIPT FOUR] +"\u2074" => "4" + +# ₄ [SUBSCRIPT FOUR] +"\u2084" => "4" + +# ④ [CIRCLED DIGIT FOUR] +"\u2463" => "4" + +# ⓸ [DOUBLE CIRCLED DIGIT FOUR] +"\u24F8" => "4" + +# ❹ [DINGBAT NEGATIVE CIRCLED DIGIT FOUR] +"\u2779" => "4" + +# ➃ [DINGBAT CIRCLED SANS-SERIF DIGIT FOUR] +"\u2783" => "4" + +# ➍ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FOUR] +"\u278D" => "4" + +# 4 [FULLWIDTH DIGIT FOUR] +"\uFF14" => "4" + +# ⒋ [DIGIT FOUR FULL STOP] +"\u248B" => "4." + +# ⑷ [PARENTHESIZED DIGIT FOUR] +"\u2477" => "(4)" + +# ⁵ [SUPERSCRIPT FIVE] +"\u2075" => "5" + +# ₅ [SUBSCRIPT FIVE] +"\u2085" => "5" + +# ⑤ [CIRCLED DIGIT FIVE] +"\u2464" => "5" + +# ⓹ [DOUBLE CIRCLED DIGIT FIVE] +"\u24F9" => "5" + +# ❺ [DINGBAT NEGATIVE CIRCLED DIGIT FIVE] +"\u277A" => "5" + +# ➄ [DINGBAT CIRCLED SANS-SERIF DIGIT FIVE] +"\u2784" => "5" + +# ➎ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FIVE] +"\u278E" => "5" + +# 5 [FULLWIDTH DIGIT FIVE] +"\uFF15" => "5" + +# ⒌ [DIGIT FIVE FULL STOP] +"\u248C" => "5." + +# ⑸ [PARENTHESIZED DIGIT FIVE] +"\u2478" => "(5)" + +# ⁶ [SUPERSCRIPT SIX] +"\u2076" => "6" + +# ₆ [SUBSCRIPT SIX] +"\u2086" => "6" + +# ⑥ [CIRCLED DIGIT SIX] +"\u2465" => "6" + +# ⓺ [DOUBLE CIRCLED DIGIT SIX] +"\u24FA" => "6" + +# ❻ [DINGBAT NEGATIVE CIRCLED DIGIT SIX] +"\u277B" => "6" + +# ➅ [DINGBAT CIRCLED SANS-SERIF DIGIT SIX] +"\u2785" => "6" + +# ➏ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SIX] +"\u278F" => "6" + +# 6 [FULLWIDTH DIGIT SIX] +"\uFF16" => "6" + +# ⒍ [DIGIT SIX FULL STOP] +"\u248D" => "6." + +# ⑹ [PARENTHESIZED DIGIT SIX] +"\u2479" => "(6)" + +# ⁷ [SUPERSCRIPT SEVEN] +"\u2077" => "7" + +# ₇ [SUBSCRIPT SEVEN] +"\u2087" => "7" + +# ⑦ [CIRCLED DIGIT SEVEN] +"\u2466" => "7" + +# ⓻ [DOUBLE CIRCLED DIGIT SEVEN] +"\u24FB" => "7" + +# ❼ [DINGBAT NEGATIVE CIRCLED DIGIT SEVEN] +"\u277C" => "7" + +# ➆ [DINGBAT CIRCLED SANS-SERIF DIGIT SEVEN] +"\u2786" => "7" + +# ➐ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SEVEN] +"\u2790" => "7" + +# 7 [FULLWIDTH DIGIT SEVEN] +"\uFF17" => "7" + +# ⒎ [DIGIT SEVEN FULL STOP] +"\u248E" => "7." + +# ⑺ [PARENTHESIZED DIGIT SEVEN] +"\u247A" => "(7)" + +# ⁸ [SUPERSCRIPT EIGHT] +"\u2078" => "8" + +# ₈ [SUBSCRIPT EIGHT] +"\u2088" => "8" + +# ⑧ [CIRCLED DIGIT EIGHT] +"\u2467" => "8" + +# ⓼ [DOUBLE CIRCLED DIGIT EIGHT] +"\u24FC" => "8" + +# ❽ [DINGBAT NEGATIVE CIRCLED DIGIT EIGHT] +"\u277D" => "8" + +# ➇ [DINGBAT CIRCLED SANS-SERIF DIGIT EIGHT] +"\u2787" => "8" + +# ➑ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT EIGHT] +"\u2791" => "8" + +# 8 [FULLWIDTH DIGIT EIGHT] +"\uFF18" => "8" + +# ⒏ [DIGIT EIGHT FULL STOP] +"\u248F" => "8." + +# ⑻ [PARENTHESIZED DIGIT EIGHT] +"\u247B" => "(8)" + +# ⁹ [SUPERSCRIPT NINE] +"\u2079" => "9" + +# ₉ [SUBSCRIPT NINE] +"\u2089" => "9" + +# ⑨ [CIRCLED DIGIT NINE] +"\u2468" => "9" + +# ⓽ [DOUBLE CIRCLED DIGIT NINE] +"\u24FD" => "9" + +# ❾ [DINGBAT NEGATIVE CIRCLED DIGIT NINE] +"\u277E" => "9" + +# ➈ [DINGBAT CIRCLED SANS-SERIF DIGIT NINE] +"\u2788" => "9" + +# ➒ [DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT NINE] +"\u2792" => "9" + +# 9 [FULLWIDTH DIGIT NINE] +"\uFF19" => "9" + +# ⒐ [DIGIT NINE FULL STOP] +"\u2490" => "9." + +# ⑼ [PARENTHESIZED DIGIT NINE] +"\u247C" => "(9)" + +# ⑩ [CIRCLED NUMBER TEN] +"\u2469" => "10" + +# ⓾ [DOUBLE CIRCLED NUMBER TEN] +"\u24FE" => "10" + +# ❿ [DINGBAT NEGATIVE CIRCLED NUMBER TEN] +"\u277F" => "10" + +# ➉ [DINGBAT CIRCLED SANS-SERIF NUMBER TEN] +"\u2789" => "10" + +# ➓ [DINGBAT NEGATIVE CIRCLED SANS-SERIF NUMBER TEN] +"\u2793" => "10" + +# ⒑ [NUMBER TEN FULL STOP] +"\u2491" => "10." + +# ⑽ [PARENTHESIZED NUMBER TEN] +"\u247D" => "(10)" + +# ⑪ [CIRCLED NUMBER ELEVEN] +"\u246A" => "11" + +# ⓫ [NEGATIVE CIRCLED NUMBER ELEVEN] +"\u24EB" => "11" + +# ⒒ [NUMBER ELEVEN FULL STOP] +"\u2492" => "11." + +# ⑾ [PARENTHESIZED NUMBER ELEVEN] +"\u247E" => "(11)" + +# ⑫ [CIRCLED NUMBER TWELVE] +"\u246B" => "12" + +# ⓬ [NEGATIVE CIRCLED NUMBER TWELVE] +"\u24EC" => "12" + +# ⒓ [NUMBER TWELVE FULL STOP] +"\u2493" => "12." + +# ⑿ [PARENTHESIZED NUMBER TWELVE] +"\u247F" => "(12)" + +# ⑬ [CIRCLED NUMBER THIRTEEN] +"\u246C" => "13" + +# ⓭ [NEGATIVE CIRCLED NUMBER THIRTEEN] +"\u24ED" => "13" + +# ⒔ [NUMBER THIRTEEN FULL STOP] +"\u2494" => "13." + +# ⒀ [PARENTHESIZED NUMBER THIRTEEN] +"\u2480" => "(13)" + +# ⑭ [CIRCLED NUMBER FOURTEEN] +"\u246D" => "14" + +# ⓮ [NEGATIVE CIRCLED NUMBER FOURTEEN] +"\u24EE" => "14" + +# ⒕ [NUMBER FOURTEEN FULL STOP] +"\u2495" => "14." + +# ⒁ [PARENTHESIZED NUMBER FOURTEEN] +"\u2481" => "(14)" + +# ⑮ [CIRCLED NUMBER FIFTEEN] +"\u246E" => "15" + +# ⓯ [NEGATIVE CIRCLED NUMBER FIFTEEN] +"\u24EF" => "15" + +# ⒖ [NUMBER FIFTEEN FULL STOP] +"\u2496" => "15." + +# ⒂ [PARENTHESIZED NUMBER FIFTEEN] +"\u2482" => "(15)" + +# ⑯ [CIRCLED NUMBER SIXTEEN] +"\u246F" => "16" + +# ⓰ [NEGATIVE CIRCLED NUMBER SIXTEEN] +"\u24F0" => "16" + +# ⒗ [NUMBER SIXTEEN FULL STOP] +"\u2497" => "16." + +# ⒃ [PARENTHESIZED NUMBER SIXTEEN] +"\u2483" => "(16)" + +# ⑰ [CIRCLED NUMBER SEVENTEEN] +"\u2470" => "17" + +# ⓱ [NEGATIVE CIRCLED NUMBER SEVENTEEN] +"\u24F1" => "17" + +# ⒘ [NUMBER SEVENTEEN FULL STOP] +"\u2498" => "17." + +# ⒄ [PARENTHESIZED NUMBER SEVENTEEN] +"\u2484" => "(17)" + +# ⑱ [CIRCLED NUMBER EIGHTEEN] +"\u2471" => "18" + +# ⓲ [NEGATIVE CIRCLED NUMBER EIGHTEEN] +"\u24F2" => "18" + +# ⒙ [NUMBER EIGHTEEN FULL STOP] +"\u2499" => "18." + +# ⒅ [PARENTHESIZED NUMBER EIGHTEEN] +"\u2485" => "(18)" + +# ⑲ [CIRCLED NUMBER NINETEEN] +"\u2472" => "19" + +# ⓳ [NEGATIVE CIRCLED NUMBER NINETEEN] +"\u24F3" => "19" + +# ⒚ [NUMBER NINETEEN FULL STOP] +"\u249A" => "19." + +# ⒆ [PARENTHESIZED NUMBER NINETEEN] +"\u2486" => "(19)" + +# ⑳ [CIRCLED NUMBER TWENTY] +"\u2473" => "20" + +# ⓴ [NEGATIVE CIRCLED NUMBER TWENTY] +"\u24F4" => "20" + +# ⒛ [NUMBER TWENTY FULL STOP] +"\u249B" => "20." + +# ⒇ [PARENTHESIZED NUMBER TWENTY] +"\u2487" => "(20)" + +# « [LEFT-POINTING DOUBLE ANGLE QUOTATION MARK] +"\u00AB" => "\"" + +# » [RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK] +"\u00BB" => "\"" + +# “ [LEFT DOUBLE QUOTATION MARK] +"\u201C" => "\"" + +# ” [RIGHT DOUBLE QUOTATION MARK] +"\u201D" => "\"" + +# „ [DOUBLE LOW-9 QUOTATION MARK] +"\u201E" => "\"" + +# ″ [DOUBLE PRIME] +"\u2033" => "\"" + +# ‶ [REVERSED DOUBLE PRIME] +"\u2036" => "\"" + +# ❝ [HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT] +"\u275D" => "\"" + +# ❞ [HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT] +"\u275E" => "\"" + +# ❮ [HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT] +"\u276E" => "\"" + +# ❯ [HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT] +"\u276F" => "\"" + +# " [FULLWIDTH QUOTATION MARK] +"\uFF02" => "\"" + +# ‘ [LEFT SINGLE QUOTATION MARK] +"\u2018" => "\'" + +# ’ [RIGHT SINGLE QUOTATION MARK] +"\u2019" => "\'" + +# ‚ [SINGLE LOW-9 QUOTATION MARK] +"\u201A" => "\'" + +# ‛ [SINGLE HIGH-REVERSED-9 QUOTATION MARK] +"\u201B" => "\'" + +# ′ [PRIME] +"\u2032" => "\'" + +# ‵ [REVERSED PRIME] +"\u2035" => "\'" + +# ‹ [SINGLE LEFT-POINTING ANGLE QUOTATION MARK] +"\u2039" => "\'" + +# › [SINGLE RIGHT-POINTING ANGLE QUOTATION MARK] +"\u203A" => "\'" + +# ❛ [HEAVY SINGLE TURNED COMMA QUOTATION MARK ORNAMENT] +"\u275B" => "\'" + +# ❜ [HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT] +"\u275C" => "\'" + +# ' [FULLWIDTH APOSTROPHE] +"\uFF07" => "\'" + +# ‐ [HYPHEN] +"\u2010" => "-" + +# ‑ [NON-BREAKING HYPHEN] +"\u2011" => "-" + +# ‒ [FIGURE DASH] +"\u2012" => "-" + +# – [EN DASH] +"\u2013" => "-" + +# — [EM DASH] +"\u2014" => "-" + +# ⁻ [SUPERSCRIPT MINUS] +"\u207B" => "-" + +# ₋ [SUBSCRIPT MINUS] +"\u208B" => "-" + +# - [FULLWIDTH HYPHEN-MINUS] +"\uFF0D" => "-" + +# ⁅ [LEFT SQUARE BRACKET WITH QUILL] +"\u2045" => "[" + +# ❲ [LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT] +"\u2772" => "[" + +# [ [FULLWIDTH LEFT SQUARE BRACKET] +"\uFF3B" => "[" + +# ⁆ [RIGHT SQUARE BRACKET WITH QUILL] +"\u2046" => "]" + +# ❳ [LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT] +"\u2773" => "]" + +# ] [FULLWIDTH RIGHT SQUARE BRACKET] +"\uFF3D" => "]" + +# ⁽ [SUPERSCRIPT LEFT PARENTHESIS] +"\u207D" => "(" + +# ₍ [SUBSCRIPT LEFT PARENTHESIS] +"\u208D" => "(" + +# ❨ [MEDIUM LEFT PARENTHESIS ORNAMENT] +"\u2768" => "(" + +# ❪ [MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT] +"\u276A" => "(" + +# ( [FULLWIDTH LEFT PARENTHESIS] +"\uFF08" => "(" + +# ⸨ [LEFT DOUBLE PARENTHESIS] +"\u2E28" => "((" + +# ⁾ [SUPERSCRIPT RIGHT PARENTHESIS] +"\u207E" => ")" + +# ₎ [SUBSCRIPT RIGHT PARENTHESIS] +"\u208E" => ")" + +# ❩ [MEDIUM RIGHT PARENTHESIS ORNAMENT] +"\u2769" => ")" + +# ❫ [MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT] +"\u276B" => ")" + +# ) [FULLWIDTH RIGHT PARENTHESIS] +"\uFF09" => ")" + +# ⸩ [RIGHT DOUBLE PARENTHESIS] +"\u2E29" => "))" + +# ❬ [MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT] +"\u276C" => "<" + +# ❰ [HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT] +"\u2770" => "<" + +# < [FULLWIDTH LESS-THAN SIGN] +"\uFF1C" => "<" + +# ❭ [MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT] +"\u276D" => ">" + +# ❱ [HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT] +"\u2771" => ">" + +# > [FULLWIDTH GREATER-THAN SIGN] +"\uFF1E" => ">" + +# ❴ [MEDIUM LEFT CURLY BRACKET ORNAMENT] +"\u2774" => "{" + +# { [FULLWIDTH LEFT CURLY BRACKET] +"\uFF5B" => "{" + +# ❵ [MEDIUM RIGHT CURLY BRACKET ORNAMENT] +"\u2775" => "}" + +# } [FULLWIDTH RIGHT CURLY BRACKET] +"\uFF5D" => "}" + +# ⁺ [SUPERSCRIPT PLUS SIGN] +"\u207A" => "+" + +# ₊ [SUBSCRIPT PLUS SIGN] +"\u208A" => "+" + +# + [FULLWIDTH PLUS SIGN] +"\uFF0B" => "+" + +# ⁼ [SUPERSCRIPT EQUALS SIGN] +"\u207C" => "=" + +# ₌ [SUBSCRIPT EQUALS SIGN] +"\u208C" => "=" + +# = [FULLWIDTH EQUALS SIGN] +"\uFF1D" => "=" + +# ! [FULLWIDTH EXCLAMATION MARK] +"\uFF01" => "!" + +# ‼ [DOUBLE EXCLAMATION MARK] +"\u203C" => "!!" + +# ⁉ [EXCLAMATION QUESTION MARK] +"\u2049" => "!?" + +# # [FULLWIDTH NUMBER SIGN] +"\uFF03" => "#" + +# $ [FULLWIDTH DOLLAR SIGN] +"\uFF04" => "$" + +# ⁒ [COMMERCIAL MINUS SIGN] +"\u2052" => "%" + +# % [FULLWIDTH PERCENT SIGN] +"\uFF05" => "%" + +# & [FULLWIDTH AMPERSAND] +"\uFF06" => "&" + +# ⁎ [LOW ASTERISK] +"\u204E" => "*" + +# * [FULLWIDTH ASTERISK] +"\uFF0A" => "*" + +# , [FULLWIDTH COMMA] +"\uFF0C" => "," + +# . [FULLWIDTH FULL STOP] +"\uFF0E" => "." + +# ⁄ [FRACTION SLASH] +"\u2044" => "/" + +# / [FULLWIDTH SOLIDUS] +"\uFF0F" => "/" + +# : [FULLWIDTH COLON] +"\uFF1A" => ":" + +# ⁏ [REVERSED SEMICOLON] +"\u204F" => ";" + +# ; [FULLWIDTH SEMICOLON] +"\uFF1B" => ";" + +# ? [FULLWIDTH QUESTION MARK] +"\uFF1F" => "?" + +# ⁇ [DOUBLE QUESTION MARK] +"\u2047" => "??" + +# ⁈ [QUESTION EXCLAMATION MARK] +"\u2048" => "?!" + +# @ [FULLWIDTH COMMERCIAL AT] +"\uFF20" => "@" + +# \ [FULLWIDTH REVERSE SOLIDUS] +"\uFF3C" => "\\" + +# ‸ [CARET] +"\u2038" => "^" + +# ^ [FULLWIDTH CIRCUMFLEX ACCENT] +"\uFF3E" => "^" + +# _ [FULLWIDTH LOW LINE] +"\uFF3F" => "_" + +# ⁓ [SWUNG DASH] +"\u2053" => "~" + +# ~ [FULLWIDTH TILDE] +"\uFF5E" => "~" + +################################################################ +# Below is the Perl script used to generate the above mappings # +# from ASCIIFoldingFilter.java: # +################################################################ +# +# #!/usr/bin/perl +# +# use warnings; +# use strict; +# +# my @source_chars = (); +# my @source_char_descriptions = (); +# my $target = ''; +# +# while (<>) { +# if (/case\s+'(\\u[A-F0-9]+)':\s*\/\/\s*(.*)/i) { +# push @source_chars, $1; +# push @source_char_descriptions, $2; +# next; +# } +# if (/output\[[^\]]+\]\s*=\s*'(\\'|\\\\|.)'/) { +# $target .= $1; +# next; +# } +# if (/break;/) { +# $target = "\\\"" if ($target eq '"'); +# for my $source_char_num (0..$#source_chars) { +# print "# $source_char_descriptions[$source_char_num]\n"; +# print "\"$source_chars[$source_char_num]\" => \"$target\"\n\n"; +# } +# @source_chars = (); +# @source_char_descriptions = (); +# $target = ''; +# } +# } diff --git a/solr/exampleSolr/conf/mapping-ISOLatin1Accent.txt b/solr/exampleSolr/conf/mapping-ISOLatin1Accent.txt index ede774258..c4410432f 100644 --- a/solr/exampleSolr/conf/mapping-ISOLatin1Accent.txt +++ b/solr/exampleSolr/conf/mapping-ISOLatin1Accent.txt @@ -1,246 +1,246 @@ -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Syntax: -# "source" => "target" -# "source".length() > 0 (source cannot be empty.) -# "target".length() >= 0 (target can be empty.) - -# example: -# "À" => "A" -# "\u00C0" => "A" -# "\u00C0" => "\u0041" -# "ß" => "ss" -# "\t" => " " -# "\n" => "" - -# À => A -"\u00C0" => "A" - -# Á => A -"\u00C1" => "A" - -#  => A -"\u00C2" => "A" - -# à => A -"\u00C3" => "A" - -# Ä => A -"\u00C4" => "A" - -# Å => A -"\u00C5" => "A" - -# Æ => AE -"\u00C6" => "AE" - -# Ç => C -"\u00C7" => "C" - -# È => E -"\u00C8" => "E" - -# É => E -"\u00C9" => "E" - -# Ê => E -"\u00CA" => "E" - -# Ë => E -"\u00CB" => "E" - -# Ì => I -"\u00CC" => "I" - -# Í => I -"\u00CD" => "I" - -# Î => I -"\u00CE" => "I" - -# Ï => I -"\u00CF" => "I" - -# IJ => IJ -"\u0132" => "IJ" - -# Ð => D -"\u00D0" => "D" - -# Ñ => N -"\u00D1" => "N" - -# Ò => O -"\u00D2" => "O" - -# Ó => O -"\u00D3" => "O" - -# Ô => O -"\u00D4" => "O" - -# Õ => O -"\u00D5" => "O" - -# Ö => O -"\u00D6" => "O" - -# Ø => O -"\u00D8" => "O" - -# Œ => OE -"\u0152" => "OE" - -# Þ -"\u00DE" => "TH" - -# Ù => U -"\u00D9" => "U" - -# Ú => U -"\u00DA" => "U" - -# Û => U -"\u00DB" => "U" - -# Ü => U -"\u00DC" => "U" - -# Ý => Y -"\u00DD" => "Y" - -# Ÿ => Y -"\u0178" => "Y" - -# à => a -"\u00E0" => "a" - -# á => a -"\u00E1" => "a" - -# â => a -"\u00E2" => "a" - -# ã => a -"\u00E3" => "a" - -# ä => a -"\u00E4" => "a" - -# å => a -"\u00E5" => "a" - -# æ => ae -"\u00E6" => "ae" - -# ç => c -"\u00E7" => "c" - -# è => e -"\u00E8" => "e" - -# é => e -"\u00E9" => "e" - -# ê => e -"\u00EA" => "e" - -# ë => e -"\u00EB" => "e" - -# ì => i -"\u00EC" => "i" - -# í => i -"\u00ED" => "i" - -# î => i -"\u00EE" => "i" - -# ï => i -"\u00EF" => "i" - -# ij => ij -"\u0133" => "ij" - -# ð => d -"\u00F0" => "d" - -# ñ => n -"\u00F1" => "n" - -# ò => o -"\u00F2" => "o" - -# ó => o -"\u00F3" => "o" - -# ô => o -"\u00F4" => "o" - -# õ => o -"\u00F5" => "o" - -# ö => o -"\u00F6" => "o" - -# ø => o -"\u00F8" => "o" - -# œ => oe -"\u0153" => "oe" - -# ß => ss -"\u00DF" => "ss" - -# þ => th -"\u00FE" => "th" - -# ù => u -"\u00F9" => "u" - -# ú => u -"\u00FA" => "u" - -# û => u -"\u00FB" => "u" - -# ü => u -"\u00FC" => "u" - -# ý => y -"\u00FD" => "y" - -# ÿ => y -"\u00FF" => "y" - -# ff => ff -"\uFB00" => "ff" - -# fi => fi -"\uFB01" => "fi" - -# fl => fl -"\uFB02" => "fl" - -# ffi => ffi -"\uFB03" => "ffi" - -# ffl => ffl -"\uFB04" => "ffl" - -# ſt => ft -"\uFB05" => "ft" - -# st => st -"\uFB06" => "st" +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Syntax: +# "source" => "target" +# "source".length() > 0 (source cannot be empty.) +# "target".length() >= 0 (target can be empty.) + +# example: +# "À" => "A" +# "\u00C0" => "A" +# "\u00C0" => "\u0041" +# "ß" => "ss" +# "\t" => " " +# "\n" => "" + +# À => A +"\u00C0" => "A" + +# Á => A +"\u00C1" => "A" + +#  => A +"\u00C2" => "A" + +# à => A +"\u00C3" => "A" + +# Ä => A +"\u00C4" => "A" + +# Å => A +"\u00C5" => "A" + +# Æ => AE +"\u00C6" => "AE" + +# Ç => C +"\u00C7" => "C" + +# È => E +"\u00C8" => "E" + +# É => E +"\u00C9" => "E" + +# Ê => E +"\u00CA" => "E" + +# Ë => E +"\u00CB" => "E" + +# Ì => I +"\u00CC" => "I" + +# Í => I +"\u00CD" => "I" + +# Î => I +"\u00CE" => "I" + +# Ï => I +"\u00CF" => "I" + +# IJ => IJ +"\u0132" => "IJ" + +# Ð => D +"\u00D0" => "D" + +# Ñ => N +"\u00D1" => "N" + +# Ò => O +"\u00D2" => "O" + +# Ó => O +"\u00D3" => "O" + +# Ô => O +"\u00D4" => "O" + +# Õ => O +"\u00D5" => "O" + +# Ö => O +"\u00D6" => "O" + +# Ø => O +"\u00D8" => "O" + +# Œ => OE +"\u0152" => "OE" + +# Þ +"\u00DE" => "TH" + +# Ù => U +"\u00D9" => "U" + +# Ú => U +"\u00DA" => "U" + +# Û => U +"\u00DB" => "U" + +# Ü => U +"\u00DC" => "U" + +# Ý => Y +"\u00DD" => "Y" + +# Ÿ => Y +"\u0178" => "Y" + +# à => a +"\u00E0" => "a" + +# á => a +"\u00E1" => "a" + +# â => a +"\u00E2" => "a" + +# ã => a +"\u00E3" => "a" + +# ä => a +"\u00E4" => "a" + +# å => a +"\u00E5" => "a" + +# æ => ae +"\u00E6" => "ae" + +# ç => c +"\u00E7" => "c" + +# è => e +"\u00E8" => "e" + +# é => e +"\u00E9" => "e" + +# ê => e +"\u00EA" => "e" + +# ë => e +"\u00EB" => "e" + +# ì => i +"\u00EC" => "i" + +# í => i +"\u00ED" => "i" + +# î => i +"\u00EE" => "i" + +# ï => i +"\u00EF" => "i" + +# ij => ij +"\u0133" => "ij" + +# ð => d +"\u00F0" => "d" + +# ñ => n +"\u00F1" => "n" + +# ò => o +"\u00F2" => "o" + +# ó => o +"\u00F3" => "o" + +# ô => o +"\u00F4" => "o" + +# õ => o +"\u00F5" => "o" + +# ö => o +"\u00F6" => "o" + +# ø => o +"\u00F8" => "o" + +# œ => oe +"\u0153" => "oe" + +# ß => ss +"\u00DF" => "ss" + +# þ => th +"\u00FE" => "th" + +# ù => u +"\u00F9" => "u" + +# ú => u +"\u00FA" => "u" + +# û => u +"\u00FB" => "u" + +# ü => u +"\u00FC" => "u" + +# ý => y +"\u00FD" => "y" + +# ÿ => y +"\u00FF" => "y" + +# ff => ff +"\uFB00" => "ff" + +# fi => fi +"\uFB01" => "fi" + +# fl => fl +"\uFB02" => "fl" + +# ffi => ffi +"\uFB03" => "ffi" + +# ffl => ffl +"\uFB04" => "ffl" + +# ſt => ft +"\uFB05" => "ft" + +# st => st +"\uFB06" => "st" diff --git a/solr/exampleSolr/conf/protwords.txt b/solr/exampleSolr/conf/protwords.txt index 1dfc0abec..5a32e5032 100644 --- a/solr/exampleSolr/conf/protwords.txt +++ b/solr/exampleSolr/conf/protwords.txt @@ -1,21 +1,21 @@ -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#----------------------------------------------------------------------- -# Use a protected word file to protect against the stemmer reducing two -# unrelated words to the same base word. - -# Some non-words that normally won't be encountered, -# just to test that they won't be stemmed. -dontstems -zwhacky - +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +# Use a protected word file to protect against the stemmer reducing two +# unrelated words to the same base word. + +# Some non-words that normally won't be encountered, +# just to test that they won't be stemmed. +dontstems +zwhacky + diff --git a/solr/exampleSolr/conf/schema.xml b/solr/exampleSolr/conf/schema.xml index 49a2aff5a..7a220a86b 100644 --- a/solr/exampleSolr/conf/schema.xml +++ b/solr/exampleSolr/conf/schema.xml @@ -1,545 +1,602 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DocId - - - ALLTEXT - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DocId + + + ALLTEXT + + + + + + + + + + + + + + + + + + + + + diff --git a/solr/exampleSolr/conf/solrconfig.xml b/solr/exampleSolr/conf/solrconfig.xml index 8a1c14665..a3bf11307 100644 --- a/solr/exampleSolr/conf/solrconfig.xml +++ b/solr/exampleSolr/conf/solrconfig.xml @@ -1,1033 +1,1508 @@ - - - - - - ${solr.abortOnConfigurationError:true} - - - - - - - - - - - - - - - - - - - - - - false - - 10 - - - - - 32 - - 10000 - 1000 - 10000 - - - - - - - - - - - - - native - - - - - - - false - 32 - 10 - - - - - - - - false - - - true - - - - - - - - 1 - - 0 - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - 1024 - - - - - - - - - - - - - - - - true - - - - - - - - 20 - - - 200 - - - - - - - - - - - - - solr rocks010 - static firstSearcher warming query from solrconfig.xml - - - - - false - - - 2 - - - - - - - - - - - - - - - - - - - - - - - explicit - - - - - - - - - - - - - dismax - explicit - 0.01 - - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 - - - text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9 - - - popularity^0.5 recip(price,1,1000,1000)^0.3 - - - id,name,price,score - - - 2<-1 5<-2 6<90% - - 100 - *:* - - text features name - - 0 - - name - regex - - - - - - - dismax - explicit - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 - 2<-1 5<-2 6<90% - - incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2 - - - - inStock:true - - - - cat - manu_exact - price:[* TO 500] - price:[500 TO *] - - - - - - - - - - textSpell - - - default - name - ./spellchecker - - - - - - - - - - - - false - - false - - 1 - - - spellcheck - - - - - - - - true - - - tvComponent - - - - - - - - - default - - org.carrot2.clustering.lingo.LingoClusteringAlgorithm - - 20 - - - stc - org.carrot2.clustering.stc.STCClusteringAlgorithm - - - - - true - default - true - - name - id - - features - - true - - - - false - - - clusteringComponent - - - - - - - - text - true - ignored_ - - - true - links - ignored_ - - - - - - - - - - true - - - termsComponent - - - - - - - - string - elevate.xml - - - - - - explicit - - - elevator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - standard - solrpingquery - all - - - - - - - explicit - true - - - - - - - - - 100 - - - - - - - - 70 - - 0.5 - - [-\w ,/\n\"']{20,200} - - - - - - - ]]> - ]]> - - - - - - - - - - - - - 5 - - - - - - - - - - solr - - - - - + + + + + + + + + ${solr.abortOnConfigurationError:true} + + + LUCENE_31 + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + 10 + + 32 + + + + 10000 + 1000 + 10000 + + + + + + + + + native + + + + + + + + + false + 32 + 10 + + + false + + + true + + + + + 1 + + 0 + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1024 + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 20 + + + 200 + + + + + + + + + + + + static firstSearcher warming in solrconfig.xml + + + + + + false + + + 2 + + + + + + + + + + + + + + + + + + + + + + + explicit + 10 + + + + + + + + + + + + + + explicit + + + velocity + + browse + layout + Solritas + + edismax + *:* + 10 + *,score + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + + text,features,name,sku,id,manu,cat + 3 + + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + + + on + cat + manu_exact + ipod + GB + 1 + cat,inStock + price + 0 + 600 + 50 + after + manufacturedate_dt + NOW/YEAR-10YEARS + NOW + +1YEAR + before + after + + + + on + text features name + 0 + name + + + spellcheck + + + + + + + + + + + + + + + + + + + + + + + text + true + ignored_ + + + true + links + ignored_ + + + + + + + + + + + + + + + + + + + + + search + solrpingquery + all + + + + + + + explicit + true + + + + + + + + + + + + textSpell + + + + + + default + name + spellchecker + + + + + + + + + + + + + + + + false + false + 1 + + + spellcheck + + + + + + + + + + true + + + tvComponent + + + + + + + + + default + + org.carrot2.clustering.lingo.LingoClusteringAlgorithm + + 20 + + + ENGLISH + + + stc + org.carrot2.clustering.stc.STCClusteringAlgorithm + + + + + + + true + default + true + + name + id + + features + + true + + + + false + + edismax + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + + *:* + 10 + *,score + + + clustering + + + + + + + + + + true + + + terms + + + + + + + + string + elevate.xml + + + + + + explicit + + + elevator + + + + + + + + + + + 100 + + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + ,, + ,, + ,, + ,, + ,]]> + ]]> + + + + + + + + + + + + + + + + + + 5 + + + + + + + + + + + + + *:* + + + + + + diff --git a/solr/exampleSolr/conf/spellings.txt b/solr/exampleSolr/conf/spellings.txt index d7ede6f56..765190ae5 100644 --- a/solr/exampleSolr/conf/spellings.txt +++ b/solr/exampleSolr/conf/spellings.txt @@ -1,2 +1,2 @@ -pizza -history \ No newline at end of file +pizza +history diff --git a/solr/exampleSolr/conf/stopwords.txt b/solr/exampleSolr/conf/stopwords.txt index b5824da32..22f277fe0 100644 --- a/solr/exampleSolr/conf/stopwords.txt +++ b/solr/exampleSolr/conf/stopwords.txt @@ -1,58 +1,58 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#----------------------------------------------------------------------- -# a couple of test stopwords to test that the words are really being -# configured from this file: -stopworda -stopwordb - -#Standard english stop words taken from Lucene's StopAnalyzer -a -an -and -are -as -at -be -but -by -for -if -in -into -is -it -no -not -of -on -or -s -such -t -that -the -their -then -there -these -they -this -to -was -will -with - +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +# a couple of test stopwords to test that the words are really being +# configured from this file: +stopworda +stopwordb + +#Standard english stop words taken from Lucene's StopAnalyzer +a +an +and +are +as +at +be +but +by +for +if +in +into +is +it +no +not +of +on +or +s +such +t +that +the +their +then +there +these +they +this +to +was +will +with + diff --git a/solr/exampleSolr/conf/synonyms.txt b/solr/exampleSolr/conf/synonyms.txt index b0e31cb7e..f00294b0c 100644 --- a/solr/exampleSolr/conf/synonyms.txt +++ b/solr/exampleSolr/conf/synonyms.txt @@ -1,31 +1,29 @@ -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#----------------------------------------------------------------------- -#some test synonym mappings unlikely to appear in real input text -aaa => aaaa -bbb => bbbb1 bbbb2 -ccc => cccc1,cccc2 -a\=>a => b\=>b -a\,a => b\,b -fooaaa,baraaa,bazaaa - -# Some synonym groups specific to this example -GB,gib,gigabyte,gigabytes -MB,mib,megabyte,megabytes -Television, Televisions, TV, TVs -#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming -#after us won't split it into two words. - -# Synonym mappings can be used for spelling correction too -pixima => pixma - +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +#some test synonym mappings unlikely to appear in real input text +aaafoo => aaabar +bbbfoo => bbbfoo bbbbar +cccfoo => cccbar cccbaz +fooaaa,baraaa,bazaaa + +# Some synonym groups specific to this example +GB,gib,gigabyte,gigabytes +MB,mib,megabyte,megabytes +Television, Televisions, TV, TVs +#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming +#after us won't split it into two words. + +# Synonym mappings can be used for spelling correction too +pixima => pixma + diff --git a/solr/exampleSolr/conf/xslt/example.xsl b/solr/exampleSolr/conf/xslt/example.xsl index 6832a1d4c..c17f9ea78 100644 --- a/solr/exampleSolr/conf/xslt/example.xsl +++ b/solr/exampleSolr/conf/xslt/example.xsl @@ -1,132 +1,132 @@ - - - - - - - - - - - - - - - <xsl:value-of select="$title"/> - - - -

-
- This has been formatted by the sample "example.xsl" transform - - use your own XSLT to get a nicer page -
- - - -
- - - -
- - - - -
-
-
- - - - - - - - - - - - - - javascript:toggle("");? -
- - exp - - - - - -
- - -
- - - - - - - -
    - -
  • -
    -
- - -
- - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + <xsl:value-of select="$title"/> + + + +

+
+ This has been formatted by the sample "example.xsl" transform - + use your own XSLT to get a nicer page +
+ + + +
+ + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + javascript:toggle("");? +
+ + exp + + + + + +
+ + +
+ + + + + + + +
    + +
  • +
    +
+ + +
+ + + + + + + + + + + + + + + + + + + + +
diff --git a/solr/exampleSolr/conf/xslt/example_atom.xsl b/solr/exampleSolr/conf/xslt/example_atom.xsl index e1c7d5a2a..da4d0822b 100644 --- a/solr/exampleSolr/conf/xslt/example_atom.xsl +++ b/solr/exampleSolr/conf/xslt/example_atom.xsl @@ -1,67 +1,67 @@ - - - - - - - - - - - - - - Example Solr Atom 1.0 Feed - - This has been formatted by the sample "example_atom.xsl" transform - - use your own XSLT to get a nicer Atom feed. - - - Apache Solr - solr-user@lucene.apache.org - - - - - - tag:localhost,2007:example - - - - - - - - - <xsl:value-of select="str[@name='name']"/> - - tag:localhost,2007: - - - - - - + + + + + + + + + + + + + + Example Solr Atom 1.0 Feed + + This has been formatted by the sample "example_atom.xsl" transform - + use your own XSLT to get a nicer Atom feed. + + + Apache Solr + solr-user@lucene.apache.org + + + + + + tag:localhost,2007:example + + + + + + + + + <xsl:value-of select="str[@name='name']"/> + + tag:localhost,2007: + + + + + + diff --git a/solr/exampleSolr/conf/xslt/example_rss.xsl b/solr/exampleSolr/conf/xslt/example_rss.xsl index 3e09e654d..26c814bc3 100644 --- a/solr/exampleSolr/conf/xslt/example_rss.xsl +++ b/solr/exampleSolr/conf/xslt/example_rss.xsl @@ -1,66 +1,66 @@ - - - - - - - - - - - - - Example Solr RSS 2.0 Feed - http://localhost:8983/solr - - This has been formatted by the sample "example_rss.xsl" transform - - use your own XSLT to get a nicer RSS feed. - - en-us - http://localhost:8983/solr - - - - - - - - - - - <xsl:value-of select="str[@name='name']"/> - - http://localhost:8983/solr/select?q=id: - - - - - - - http://localhost:8983/solr/select?q=id: - - - - + + + + + + + + + + + + + Example Solr RSS 2.0 Feed + http://localhost:8983/solr + + This has been formatted by the sample "example_rss.xsl" transform - + use your own XSLT to get a nicer RSS feed. + + en-us + http://localhost:8983/solr + + + + + + + + + + + <xsl:value-of select="str[@name='name']"/> + + http://localhost:8983/solr/select?q=id: + + + + + + + http://localhost:8983/solr/select?q=id: + + + + diff --git a/solr/exampleSolr/conf/xslt/luke.xsl b/solr/exampleSolr/conf/xslt/luke.xsl index 6e9a064d7..04d341d5f 100644 --- a/solr/exampleSolr/conf/xslt/luke.xsl +++ b/solr/exampleSolr/conf/xslt/luke.xsl @@ -1,337 +1,337 @@ - - - - - - - - - Solr Luke Request Handler Response - - - - - - - - - <xsl:value-of select="$title"/> - - - - - -

- -

-
- -
- -

Index Statistics

- -
- -

Field Statistics

- - - -

Document statistics

- - - - -
- - - - - -
- -
- - -
- -
- -
-
-
- - - - - - - - - - - - - - - - - - - - - -
-

- -

- -
- -
-
-
- - -
- - 50 - 800 - 160 - blue - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- background-color: ; width: px; height: px; -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
  • - -
  • -
    -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + Solr Luke Request Handler Response + + + + + + + + + <xsl:value-of select="$title"/> + + + + + +

+ +

+
+ +

Index Statistics

+ +
+ +

Field Statistics

+ + + +

Document statistics

+ + + + + + + + + + +
+ +
+ + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+

+ +

+ +
+ +
+
+
+ + +
+ + 50 + 800 + 160 + blue + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ background-color: ; width: px; height: px; +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
  • + +
  • +
    +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + + + + + + + + + + + + + + + + + diff --git a/solr/exampleSolr/solr.xml b/solr/exampleSolr/solr.xml new file mode 100644 index 000000000..6f0d0fd3c --- /dev/null +++ b/solr/exampleSolr/solr.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/webapp/config/web.xml b/webapp/config/web.xml index 4c495732e..d82026d64 100644 --- a/webapp/config/web.xml +++ b/webapp/config/web.xml @@ -143,18 +143,20 @@ edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneSetup - - - - - edu.cornell.mannlib.vitro.webapp.auth.identifier.UserToIndIdentifierFactorySetup - - - + + + + edu.cornell.mannlib.vitro.webapp.auth.policy.setup.EditorEditingPolicySetup @@ -890,7 +892,13 @@ SearchController edu.cornell.mannlib.vitro.webapp.search.controller.PagedSearchController + + SearchController /search @@ -913,6 +921,12 @@ AutocompleteController edu.cornell.mannlib.vitro.webapp.search.controller.AutocompleteController + AutocompleteController /autocomplete @@ -962,6 +976,12 @@ JSON Service edu.cornell.mannlib.vitro.webapp.controller.JSONServlet + JSON Service /dataservice diff --git a/webapp/lib/apache-solr-core-1.4.1.jar b/webapp/lib/apache-solr-core-1.4.1.jar deleted file mode 100644 index 2a5d49ed7..000000000 Binary files a/webapp/lib/apache-solr-core-1.4.1.jar and /dev/null differ diff --git a/webapp/lib/apache-solr-core-3.1.0.jar b/webapp/lib/apache-solr-core-3.1.0.jar new file mode 100644 index 000000000..00a842e4b Binary files /dev/null and b/webapp/lib/apache-solr-core-3.1.0.jar differ diff --git a/webapp/lib/apache-solr-solrj-1.4.1.jar b/webapp/lib/apache-solr-solrj-1.4.1.jar deleted file mode 100644 index 130ec5347..000000000 Binary files a/webapp/lib/apache-solr-solrj-1.4.1.jar and /dev/null differ diff --git a/webapp/lib/apache-solr-solrj-3.1.0.jar b/webapp/lib/apache-solr-solrj-3.1.0.jar new file mode 100644 index 000000000..058d27350 Binary files /dev/null and b/webapp/lib/apache-solr-solrj-3.1.0.jar differ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/HasRoleLevel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/HasRoleLevel.java deleted file mode 100644 index 29d3759b5..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/HasRoleLevel.java +++ /dev/null @@ -1,25 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.identifier; - -import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel; - -/** - * The current user has this RoleLevel. - */ -public class HasRoleLevel implements Identifier { - private final RoleLevel roleLevel; - - public HasRoleLevel(RoleLevel roleLevel) { - this.roleLevel = roleLevel; - } - - public RoleLevel getRoleLevel() { - return roleLevel; - } - - @Override - public String toString() { - return "HasRoleLevel[" + roleLevel + "]"; - } -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/SelfEditing2RoleIdentifierFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/SelfEditing2RoleIdentifierFactory.java deleted file mode 100644 index c521821b8..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/SelfEditing2RoleIdentifierFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.identifier; - -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpSession; - -import edu.cornell.mannlib.vitro.webapp.auth.policy.RoleBasedPolicy.AuthRole; -import edu.cornell.mannlib.vitro.webapp.beans.User; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; - -/** - * Checks to see if the Individual associated with a SelfEditingIdentifier - * has Admin, Curator or Editor rights. This ignores black listing. - * - * This should be added to the IdentifierFactory list after the - * SelfEditingIdentiferFactory. - * - * SelfEditing2RoleIdentifierSetup can be used in web.xml to add this class - * to the IdentifierFactory list of a servlet context. - * - * @author bdc34 - * - */ -public class SelfEditing2RoleIdentifierFactory implements - IdentifierBundleFactory { - - @Override - public IdentifierBundle getIdentifierBundle(ServletRequest request, - HttpSession session, ServletContext context) { - IdentifierBundle whoToAuth = RequestIdentifiers.getIdBundleForRequest(request); - WebappDaoFactory wdf = (WebappDaoFactory)context.getAttribute("webappDaoFactory"); - if( wdf == null ) - return whoToAuth; - SelfEditingIdentifierFactory.SelfEditing selfEditing = - SelfEditingIdentifierFactory.getSelfEditingIdentifier(whoToAuth); - if( selfEditing != null ){ - User user = wdf.getUserDao().getUserByURI(selfEditing.getIndividual().getURI()); - if( user != null){ - String role = user.getRoleURI(); - if("role/:50".equals(role)){ - whoToAuth.add( AuthRole.DBA ); - } - if("role/:4".equals(role)){ - whoToAuth.add( AuthRole.CURATOR); - } - if("role/:3".equals(role)){ - whoToAuth.add( AuthRole.EDITOR); - } - if("role/:2".equals(role)){ - whoToAuth.add( AuthRole.USER ); - } - } - } - return whoToAuth; - } -} \ No newline at end of file diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/SelfEditingIdentifierFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/SelfEditingIdentifierFactory.java index 5ba828ffd..5807e9ce7 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/SelfEditingIdentifierFactory.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/SelfEditingIdentifierFactory.java @@ -16,7 +16,6 @@ import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; @@ -31,7 +30,6 @@ import com.hp.hpl.jena.rdf.model.Resource; import edu.cornell.mannlib.vedit.beans.LoginStatusBean; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration; -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; @@ -44,6 +42,7 @@ public class SelfEditingIdentifierFactory implements IdentifierBundleFactory { private static final int MAXIMUM_USERNAME_LENGTH = 100; + @Override public IdentifierBundle getIdentifierBundle(ServletRequest request, HttpSession session, ServletContext context) { if (!(request instanceof HttpServletRequest)) { @@ -202,7 +201,8 @@ public class SelfEditingIdentifierFactory implements IdentifierBundleFactory { log.debug("checking directlry " + realPath + " for blacklisting sparql query files"); File[] files = blacklistDir.listFiles(new FileFilter(){ - public boolean accept(File pathname) { + @Override + public boolean accept(File pathname) { return pathname.getName().endsWith(".sparql"); }} ); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/UserToIndIdentifierFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/UserToIndIdentifierFactory.java deleted file mode 100644 index 8aa3e84e0..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/UserToIndIdentifierFactory.java +++ /dev/null @@ -1,96 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.identifier; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpSession; - -import edu.cornell.mannlib.vedit.beans.LoginStatusBean; -import edu.cornell.mannlib.vitro.webapp.beans.Individual; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; - -/** - * Check to see if the User is logged in, find Individuals that the User mayEditAs, - * and and those Individuals as identifiers. - * - * @author bdc34 - * - */ -public class UserToIndIdentifierFactory implements IdentifierBundleFactory { - - public IdentifierBundle getIdentifierBundle( - ServletRequest request, - HttpSession session, - ServletContext context) { - // is the request logged in as a User? - LoginStatusBean loginBean = LoginStatusBean.getBean(session); - if (loginBean.isLoggedIn()) { - String userURI = loginBean.getUserURI(); - - WebappDaoFactory wdf = (WebappDaoFactory)context.getAttribute("webappDaoFactory"); - - // get Individuals that the User mayEditAs - List mayEditAsUris = - wdf.getUserDao().getIndividualsUserMayEditAs(userURI); - - // make self editing Identifiers for those Individuals - IdentifierBundle idb = new ArrayIdentifierBundle(); - idb.add( new UserIdentifier(userURI,mayEditAsUris) ); - - //Also make a self-editing identifier. - //There is not need for SelfEditingIdentifierFactory because SelfEditing - //identifiers are created here. - for( String personUri : mayEditAsUris){ - if( personUri != null ){ - Individual person = wdf.getIndividualDao().getIndividualByURI(personUri); - if( person != null ){ - idb.add( new SelfEditingIdentifierFactory.SelfEditing(person,null) ); - } - } - } - return idb; - } - - return null; - } - - public static List getIndividualsForUser(IdentifierBundle ids) { - if( ids == null ) - return Collections.emptyList(); - - //find the user id - List uris = new ArrayList(); - for( Identifier id : ids ){ - if( id instanceof UserIdentifier){ - uris.addAll( ((UserIdentifier)id).getMayEditAsURIs() ); - } - } - return uris; - } - - public class UserIdentifier implements Identifier { - private final String userURI; - private final List mayEditAsURIs; - public UserIdentifier(String userURI, List mayEditAsURIs) { - super(); - this.userURI = userURI; - this.mayEditAsURIs = Collections.unmodifiableList(mayEditAsURIs); - } - public String getUserURI() { - return userURI; - } - public List getMayEditAsURIs() { - return mayEditAsURIs; - } - @Override - public String toString() { - return "UserIdentifier: " + userURI; - } - - } -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/UserToIndIdentifierFactorySetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/UserToIndIdentifierFactorySetup.java deleted file mode 100644 index 7ee015260..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/UserToIndIdentifierFactorySetup.java +++ /dev/null @@ -1,40 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.identifier; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import edu.cornell.mannlib.vitro.webapp.servlet.setup.AbortStartup; - -/** - * Setups context so that Identifiers for Individuals associated with Users are - * added to requests. - * - * This only adds identifiers. A self-editing policy is also needed. - * - * @author bdc34 - * - */ -public class UserToIndIdentifierFactorySetup implements ServletContextListener{ - private static final Log log = LogFactory.getLog(UserToIndIdentifierFactorySetup.class.getName()); - - @Override - public void contextInitialized(ServletContextEvent sce) { - - if (AbortStartup.isStartupAborted(sce.getServletContext())) { - return; - } - - ActiveIdentifierBundleFactories.addFactory(sce, new UserToIndIdentifierFactory()); - log.info("Set up Identifier Factory UserToIndIdentifierFactory."); - } - - @Override - public void contextDestroyed(ServletContextEvent arg0) { - // Nothing to do. - } -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/AbstractCommonIdentifier.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/AbstractCommonIdentifier.java new file mode 100644 index 000000000..969131c20 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/AbstractCommonIdentifier.java @@ -0,0 +1,27 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.auth.identifier.common; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; + +/** + * A base class for the Identifiers created by the + * CommonIdentifierBundleFactory. + */ +public abstract class AbstractCommonIdentifier { + protected static Collection getIdentifiersForClass( + IdentifierBundle ids, Class clazz) { + Set set = new HashSet(); + for (Identifier id : ids) { + if (clazz.isAssignableFrom(id.getClass())) { + set.add(clazz.cast(id)); + } + } + return set; + } +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/CommonIdentifierBundleFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/CommonIdentifierBundleFactory.java similarity index 55% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/CommonIdentifierBundleFactory.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/CommonIdentifierBundleFactory.java index 7652e6f13..5b05f5862 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/CommonIdentifierBundleFactory.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/CommonIdentifierBundleFactory.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.auth.identifier; +package edu.cornell.mannlib.vitro.webapp.auth.identifier.common; import java.util.ArrayList; import java.util.Collection; @@ -16,6 +16,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vedit.beans.LoginStatusBean; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.ArrayIdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundleFactory; import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration; @@ -29,26 +33,46 @@ public class CommonIdentifierBundleFactory implements IdentifierBundleFactory { private static final Log log = LogFactory .getLog(CommonIdentifierBundleFactory.class); + private final ServletContext context; + + public CommonIdentifierBundleFactory(ServletContext context) { + this.context = context; + } + @Override public IdentifierBundle getIdentifierBundle(ServletRequest request, - HttpSession session, ServletContext context) { + HttpSession session, ServletContext unusedContext) { // If this is not an HttpServletRequest, we might as well fail now. HttpServletRequest req = (HttpServletRequest) request; ArrayIdentifierBundle bundle = new ArrayIdentifierBundle(); - bundle.addAll(determineRoleLevelIdentifiers(req)); - bundle.addAll(determineAssociatedIndividualIdentifiers(req)); + bundle.addAll(createUserIdentifiers(req)); + bundle.addAll(createRoleLevelIdentifiers(req)); + bundle.addAll(createBlacklistOrAssociatedIndividualIdentifiers(req)); return bundle; } + /** + * If the user is logged in, create an identifier that shows his URI. + */ + private Collection createUserIdentifiers( + HttpServletRequest req) { + LoginStatusBean bean = LoginStatusBean.getBean(req); + if (bean.isLoggedIn()) { + return Collections.singleton(new IsUser(bean.getUserURI())); + } else { + return Collections.emptySet(); + } + } + /** * Create an identifier that shows the role level of the current user, or * PUBLIC if the user is not logged in. */ - private Collection determineRoleLevelIdentifiers( + private Collection createRoleLevelIdentifiers( HttpServletRequest req) { RoleLevel roleLevel = RoleLevel.getRoleFromLoginStatus(req); return Collections.singleton(new HasRoleLevel(roleLevel)); @@ -56,37 +80,48 @@ public class CommonIdentifierBundleFactory implements IdentifierBundleFactory { /** * Find all of the individuals that are associated with the current user, - * and create an Identifier for each one. + * and create either an IsBlacklisted or HasAssociatedIndividual for each + * one. */ - private Collection determineAssociatedIndividualIdentifiers( + private Collection createBlacklistOrAssociatedIndividualIdentifiers( HttpServletRequest req) { Collection ids = new ArrayList(); + for (Individual ind : getAssociatedIndividuals(req)) { + // If they are blacklisted, this factory will return an identifier + Identifier id = IsBlacklisted.getInstance(ind, context); + if (id != null) { + ids.add(id); + } else { + ids.add(new HasAssociatedIndividual(ind.getURI())); + } + } + + return ids; + } + + private Collection getAssociatedIndividuals( + HttpServletRequest req) { + Collection individuals = new ArrayList(); + LoginStatusBean bean = LoginStatusBean.getBean(req); String username = bean.getUsername(); if (!bean.isLoggedIn()) { - log.debug("No SelfEditing: not logged in."); - return ids; + log.debug("No Associated Individuals: not logged in."); + return individuals; } if (StringUtils.isEmpty(username)) { - log.debug("No SelfEditing: username is empty."); - return ids; + log.debug("No Associated Individuals: username is empty."); + return individuals; } - HttpSession session = req.getSession(false); - if (session == null) { - log.debug("No SelfEditing: session is null."); - return ids; - } - - ServletContext context = session.getServletContext(); WebappDaoFactory wdf = (WebappDaoFactory) context .getAttribute("webappDaoFactory"); if (wdf == null) { log.error("Could not get a WebappDaoFactory from the ServletContext"); - return ids; + return individuals; } IndividualDao indDao = wdf.getIndividualDao(); @@ -96,22 +131,18 @@ public class CommonIdentifierBundleFactory implements IdentifierBundleFactory { if (uri == null) { log.debug("Could not find an Individual with a netId of " + username); - return ids; + return individuals; } Individual ind = indDao.getIndividualByURI(uri); if (ind == null) { log.warn("Found a URI for the netId " + username + " but could not build Individual"); - return ids; + return individuals; } - log.debug("Found an Individual for netId " + username + " URI: " + uri); - // Use the factory method to fill in the Blacklisting reason, if there - // is one. - ids.add(HasAssociatedIndividual.getInstance(ind, context)); - - return ids; + individuals.add(ind); + return individuals; } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/HasAssociatedIndividual.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/HasAssociatedIndividual.java new file mode 100644 index 000000000..1004f057e --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/HasAssociatedIndividual.java @@ -0,0 +1,48 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.auth.identifier.common; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; + +/** + * The current user is associated with this Individual. + * + * This includes a thick factory method that will look through a directory of + * files to determine whether the associated individual is blacklisted. + */ +public class HasAssociatedIndividual extends AbstractCommonIdentifier implements + Identifier { + + public static Collection getIdentifiers( + IdentifierBundle ids) { + return getIdentifiersForClass(ids, HasAssociatedIndividual.class); + } + + public static Collection getIndividualUris(IdentifierBundle ids) { + Set set = new HashSet(); + for (HasAssociatedIndividual id : getIdentifiers(ids)) { + set.add(id.getAssociatedIndividualUri()); + } + return set; + } + + private final String associatedIndividualUri; + + public HasAssociatedIndividual(String associatedIndividualUri) { + this.associatedIndividualUri = associatedIndividualUri; + } + + public String getAssociatedIndividualUri() { + return associatedIndividualUri; + } + + @Override + public String toString() { + return "HasAssociatedIndividual['" + associatedIndividualUri + "']"; + } +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/HasRoleLevel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/HasRoleLevel.java new file mode 100644 index 000000000..535ef5815 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/HasRoleLevel.java @@ -0,0 +1,52 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.auth.identifier.common; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel; + +/** + * The current user has this RoleLevel. + */ +public class HasRoleLevel extends AbstractCommonIdentifier implements Identifier { + public static Collection getIdentifiers(IdentifierBundle ids) { + return getIdentifiersForClass(ids, HasRoleLevel.class); + } + + public static Collection getRoleLevelUris(IdentifierBundle ids) { + Set set = new HashSet(); + for (HasRoleLevel id : getIdentifiers(ids)) { + set.add(id.getRoleLevel().getURI()); + } + return set; + } + + public static RoleLevel getUsersRoleLevel(IdentifierBundle whoToAuth) { + Collection roleIds = getIdentifiers(whoToAuth); + if (roleIds.isEmpty()) { + return RoleLevel.PUBLIC; + } else { + return roleIds.iterator().next().getRoleLevel(); + } + } + + private final RoleLevel roleLevel; + + public HasRoleLevel(RoleLevel roleLevel) { + this.roleLevel = roleLevel; + } + + public RoleLevel getRoleLevel() { + return roleLevel; + } + + @Override + public String toString() { + return "HasRoleLevel[" + roleLevel + "]"; + } +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/HasAssociatedIndividual.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsBlacklisted.java similarity index 76% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/HasAssociatedIndividual.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsBlacklisted.java index b012d02f0..bb8dc65a8 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/HasAssociatedIndividual.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsBlacklisted.java @@ -1,11 +1,14 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.auth.identifier; +package edu.cornell.mannlib.vitro.webapp.auth.identifier.common; import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.IOException; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; import javax.servlet.ServletContext; @@ -22,17 +25,16 @@ import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.RDFNode; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; import edu.cornell.mannlib.vitro.webapp.beans.Individual; /** - * The current user is associated with this Individual. - * - * This includes a thick factory method that will look through a directory of - * files to determine whether the associated individual is blacklisted. + * The current user is blacklisted for this reason. */ -public class HasAssociatedIndividual implements Identifier { - private static final Log log = LogFactory - .getLog(HasAssociatedIndividual.class); +public class IsBlacklisted extends AbstractCommonIdentifier implements + Identifier { + private static final Log log = LogFactory.getLog(IsBlacklisted.class); private final static String BLACKLIST_SPARQL_DIR = "/admin/selfEditBlacklist"; private static final String NOT_BLACKLISTED = null; @@ -41,7 +43,11 @@ public class HasAssociatedIndividual implements Identifier { // static methods // ---------------------------------------------------------------------- - public static HasAssociatedIndividual getInstance(Individual individual, + /** + * If this individual is blacklisted, return an appropriate Identifier. + * Otherwise, return null. + */ + public static IsBlacklisted getInstance(Individual individual, ServletContext context) { if (individual == null) { throw new NullPointerException("individual may not be null."); @@ -51,8 +57,13 @@ public class HasAssociatedIndividual implements Identifier { } String reasonForBlacklisting = checkForBlacklisted(individual, context); - return new HasAssociatedIndividual(individual.getURI(), + IsBlacklisted id = new IsBlacklisted(individual.getURI(), reasonForBlacklisting); + if (id.isBlacklisted()) { + return id; + } else { + return null; + } } /** @@ -172,6 +183,20 @@ public class HasAssociatedIndividual implements Identifier { return NOT_BLACKLISTED; } + public static Collection getIdentifiers(IdentifierBundle ids) { + return getIdentifiersForClass(ids, IsBlacklisted.class); + } + + public static Collection getBlacklistReasons(IdentifierBundle ids) { + Set set = new HashSet(); + for (IsBlacklisted id : getIdentifiers(ids)) { + if (id.isBlacklisted()) { + set.add(id.getReasonForBlacklisting()); + } + } + return set; + } + // ---------------------------------------------------------------------- // the Identifier // ---------------------------------------------------------------------- @@ -179,7 +204,7 @@ public class HasAssociatedIndividual implements Identifier { private final String associatedIndividualUri; private final String reasonForBlacklisting; - public HasAssociatedIndividual(String associatedIndividualUri, + public IsBlacklisted(String associatedIndividualUri, String reasonForBlacklisting) { this.associatedIndividualUri = associatedIndividualUri; this.reasonForBlacklisting = reasonForBlacklisting; @@ -193,9 +218,13 @@ public class HasAssociatedIndividual implements Identifier { return reasonForBlacklisting != NOT_BLACKLISTED; } + public String getReasonForBlacklisting() { + return reasonForBlacklisting; + } + @Override public String toString() { - return "HasAssociatedIndividual['" + associatedIndividualUri - + "', blacklist='" + reasonForBlacklisting + "']"; + return "IsBlacklisted['" + reasonForBlacklisting + "']"; } + } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsUser.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsUser.java new file mode 100644 index 000000000..635069a80 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/identifier/common/IsUser.java @@ -0,0 +1,42 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.auth.identifier.common; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; + +/** + * The current user has this URI. + */ +public class IsUser extends AbstractCommonIdentifier implements Identifier { + public static Collection getIdentifiers(IdentifierBundle ids) { + return getIdentifiersForClass(ids, IsUser.class); + } + + public static Collection getUserUris(IdentifierBundle ids) { + Set set = new HashSet(); + for (IsUser id : getIdentifiers(ids)) { + set.add(id.getUri()); + } + return set; + } + + private final String uri; + + public IsUser(String uri) { + this.uri = uri; + } + + public String getUri() { + return uri; + } + + @Override + public String toString() { + return "IsUser[" + uri + "]"; + } +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/BaseSelfEditingPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/BaseSelfEditingPolicy.java index 3c96fc9ee..70319776f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/BaseSelfEditingPolicy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/BaseSelfEditingPolicy.java @@ -2,14 +2,8 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy; -import java.util.ArrayList; -import java.util.List; - import javax.servlet.ServletContext; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory.SelfEditing; import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; @@ -37,21 +31,6 @@ public abstract class BaseSelfEditingPolicy { uri, roleLevel); } - protected List getUrisOfSelfEditor(IdentifierBundle ids) { - List uris = new ArrayList(); - if (ids != null) { - for (Identifier id : ids) { - if (id instanceof SelfEditing) { - SelfEditing selfEditId = (SelfEditing) id; - if (selfEditId.getBlacklisted() == null) { - uris.add(selfEditId.getValue()); - } - } - } - } - return uris; - } - protected PolicyDecision cantModifyResource(String uri) { return inconclusiveDecision("No access to admin resources; cannot modify " + uri); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/DisplayRestrictedDataByRoleLevelPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/DisplayRestrictedDataByRoleLevelPolicy.java index 383fecaba..d251e643b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/DisplayRestrictedDataByRoleLevelPolicy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/DisplayRestrictedDataByRoleLevelPolicy.java @@ -7,9 +7,8 @@ import javax.servlet.ServletContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasRoleLevel; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasRoleLevel; import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; @@ -51,7 +50,7 @@ public class DisplayRestrictedDataByRoleLevelPolicy implements PolicyIface { return defaultDecision("whatToAuth was null"); } - RoleLevel userRole = getUsersRoleLevel(whoToAuth); + RoleLevel userRole = HasRoleLevel.getUsersRoleLevel(whoToAuth); PolicyDecision result; if (whatToAuth instanceof DisplayDataProperty) { @@ -164,17 +163,4 @@ public class DisplayRestrictedDataByRoleLevelPolicy implements PolicyIface { .canDisplayPredicate(uri, userRole); } - /** - * The user is nobody unless they have a HasRoleLevel identifier. - */ - private RoleLevel getUsersRoleLevel(IdentifierBundle whoToAuth) { - RoleLevel userRole = RoleLevel.PUBLIC; - for (Identifier id : whoToAuth) { - if (id instanceof HasRoleLevel) { - userRole = ((HasRoleLevel) id).getRoleLevel(); - } - } - return userRole; - } - } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/DisplayRestrictedDataToSelfPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/DisplayRestrictedDataToSelfPolicy.java index 8911a2fa8..7247f779d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/DisplayRestrictedDataToSelfPolicy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/DisplayRestrictedDataToSelfPolicy.java @@ -2,19 +2,16 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; import javax.servlet.ServletContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasAssociatedIndividual; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasRoleLevel; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasRoleLevel; import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; @@ -24,9 +21,9 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.display.DisplayData import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.display.DisplayObjectProperty; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.display.DisplayObjectPropertyStatement; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; +import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel; import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement; -import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel; /** * Permit display of various data if it relates to the user's associated @@ -60,12 +57,13 @@ public class DisplayRestrictedDataToSelfPolicy implements PolicyIface { return defaultDecision("whatToAuth was null"); } - RoleLevel userRole = getUsersRoleLevel(whoToAuth); + RoleLevel userRole = HasRoleLevel.getUsersRoleLevel(whoToAuth); if (userRole != RoleLevel.SELF) { return defaultDecision("not a self-editor"); } - Collection associated = getAssociatedIndividualUris(whoToAuth); + Collection associated = HasAssociatedIndividual + .getIndividualUris(whoToAuth); if (associated.isEmpty()) { return defaultDecision("not self-editing for anyone"); } @@ -177,35 +175,4 @@ public class DisplayRestrictedDataToSelfPolicy implements PolicyIface { return false; } - /** - * The user is nobody unless they have a HasRoleLevel identifier. - */ - private RoleLevel getUsersRoleLevel(IdentifierBundle whoToAuth) { - RoleLevel userRole = RoleLevel.PUBLIC; - for (Identifier id : whoToAuth) { - if (id instanceof HasRoleLevel) { - userRole = ((HasRoleLevel) id).getRoleLevel(); - } - } - return userRole; - } - - /** - * Find out who the user has self-editing rights for. We only include the - * ones that are not blacklisted. - */ - private Collection getAssociatedIndividualUris( - IdentifierBundle whoToAuth) { - List list = new ArrayList(); - for (Identifier id : whoToAuth) { - if (id instanceof HasAssociatedIndividual) { - HasAssociatedIndividual haiId = (HasAssociatedIndividual) id; - if (!haiId.isBlacklisted()) { - list.add(haiId.getAssociatedIndividualUri()); - } - } - } - return list; - } - } \ No newline at end of file diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/JenaNetidPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/JenaNetidPolicy.java deleted file mode 100644 index d5da219e6..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/JenaNetidPolicy.java +++ /dev/null @@ -1,428 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.policy; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.hp.hpl.jena.query.Query; -import com.hp.hpl.jena.query.QueryExecution; -import com.hp.hpl.jena.query.QueryExecutionFactory; -import com.hp.hpl.jena.query.QueryFactory; -import com.hp.hpl.jena.query.QuerySolutionMap; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.thoughtworks.xstream.XStream; -import com.thoughtworks.xstream.io.xml.DomDriver; - -import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory.NetId; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.DefaultInconclusivePolicy; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddDataPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddObjectPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropDataPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropObjectPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.resource.AddResource; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.resource.DropResource; -import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; - -/** - * This policy looks for a netid in the IdentifierBundle and will use that netid - * as a anchor in SPARQL queries. These queries are intended to specify the relations - * that allow authorization. - * - * We could use things other than SPARQL. Other possibilities: - * Some java driven code that worked with the the jena Model - * Fresnel Selector Language (FSL) - * SWRL? - * - * example of how to set up the xml: - * - * - - Example Policy - PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> -PREFIX vivoa: <http://vivo.library.cornell.edu/abox#> -PREFIX vivo: <http://vivo.library.cornell.edu/ns/0.1#> -PREFIX vitro: <http://lowe.mannlib.cornell.edu/ns/vitro/0.1/vitro.owl#> - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropDataPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropObjectPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddObjectPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddDataPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - - - - * @author bdc34 - * - */ -public class JenaNetidPolicy extends DefaultInconclusivePolicy implements PolicyIface { - - - protected transient Model model = ModelFactory.createDefaultModel(); - private transient HashMap queryStrToQuery = new HashMap(); - - /** human readable name for this policy */ - protected String name="Unnamed Policy"; - - /** prefixes for SPARQL queries. */ - protected String prefixes = DEFAULT_PREFIXES; - - /** Specifies the type of Authorization returned when the SPARQL query succeeds. This allows us to - * create a JenaNetidPolicy that returns UNAUTHORIZED when the some set of conditions are meet. */ - protected Authorization authForSuccessfulQuery = Authorization.AUTHORIZED; - - /** The SPARQL queries. They should all be of the type ASK and - * they should all have the variable ?netid */ - protected HashMap> actionToQueryStr = new HashMap>(); - - /* *************************** Constructors ******************************* */ - - /** - * See JenaNetidPolicy.setupDefault() for the sparql queries that will - * be used by the default JenaNetidPolicy. - */ - public JenaNetidPolicy(Model model){ - if( model == null ){ - this.model = ModelFactory.createDefaultModel(); - }else{ - this.model = model; - } - setupDefault(); - } - - /** - * Loads sparql statements for policy from a JSON text file. - * - * @param model - * @param sparqlStmts - */ - public JenaNetidPolicy(Model model, InputStream policySpec){ - this(model, policySpec, Authorization.AUTHORIZED); - } - - /* - * Load xml policy files with this.getClass().getResourceAsStream() - * Notice that / is the path seperator and strings that lack - * a leading slash are relative to the package of the this.getClass(). - */ - public JenaNetidPolicy(Model model, String resource){ - this(model, JenaNetidPolicy.class.getResourceAsStream(resource)); - } - - public JenaNetidPolicy(Model model, InputStream policySpec, Authorization authForSuccessfulQuery){ - this.authForSuccessfulQuery = authForSuccessfulQuery; - XStream x = new XStream(new DomDriver()); - //XStream x = new XStream(); - JenaNetidPolicy jnip =(JenaNetidPolicy) x.fromXML( policySpec ); - this.actionToQueryStr = jnip.actionToQueryStr; - this.prefixes = jnip.prefixes; - this.name = jnip.name; - this.model = model; - } - - /* *********************** Methods ************************************ */ - @Override - public PolicyDecision isAuthorized(IdentifierBundle whoToAuth, - RequestedAction whatToAuth) { - BasicPolicyDecision pd = new BasicPolicyDecision(Authorization.INCONCLUSIVE,"not yet set"); - if( whoToAuth == null ) - return pd.setMessage("whoToAuth was null"); - if(whatToAuth == null) - return pd.setMessage("whatToAuth was null"); - - String netid = getNetid(whoToAuth); - if (netid == null) - return pd.setMessage("Unable to get netid from IdBundle"); - - if (whatToAuth instanceof AddResource) { - return visit(whoToAuth, (AddResource) whatToAuth); - } else if (whatToAuth instanceof DropResource) { - return visit(whoToAuth, (DropResource) whatToAuth); - } else if (whatToAuth instanceof AddObjectPropStmt) { - return visit(whoToAuth, (AddObjectPropStmt) whatToAuth); - } else if (whatToAuth instanceof DropObjectPropStmt) { - return visit(whoToAuth, (DropObjectPropStmt) whatToAuth); - } else if (whatToAuth instanceof AddDataPropStmt) { - return visit(whoToAuth, (AddDataPropStmt) whatToAuth); - } else if (whatToAuth instanceof DropDataPropStmt) { - return visit(whoToAuth, (DropDataPropStmt) whatToAuth); - } else { - return UNAUTH; - } - } - - /* ************************* visit methods ************************** */ - private PolicyDecision visit(IdentifierBundle ids, AddResource action) { - log.debug("doing AddResource"); - - List queryStrs = actionToQueryStr.get(action.getClass().getName()); - if( queryStrs == null || queryStrs.size() ==0 ) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE, - "no queryies found for action" + action.getClass().getName()); - - QuerySolutionMap parameters = new QuerySolutionMap(); - parameters.add("netid", model.createLiteral( getNetid(ids) )); - parameters.add("subject",model.createResource( action.getSubjectUri() )); - - return doQueries(queryStrs,parameters,action); - } - - private PolicyDecision visit(IdentifierBundle ids, DropResource action) { - log.debug("doing DropResource"); - - List queryStrs = actionToQueryStr.get(action.getClass().getName()); - if( queryStrs == null || queryStrs.size() ==0 ) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE, - "no queryies found for action" + action.getClass().getName()); - - QuerySolutionMap parameters = new QuerySolutionMap(); - parameters.add("netid", model.createLiteral( getNetid(ids) )); - parameters.add("subject",model.createResource( action.getSubjectUri() )); - - return doQueries(queryStrs,parameters,action); - } - - private PolicyDecision visit(IdentifierBundle ids, AddObjectPropStmt action) { - log.debug("doing AddObjectPropStmt in visit()"); - - List queryStrs = actionToQueryStr.get(action.getClass().getName()); - if( queryStrs == null || queryStrs.size() ==0 ) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE, - "no queryies found for action" + action.getClass().getName()); - - QuerySolutionMap parameters = new QuerySolutionMap(); - parameters.add("netid", model.createLiteral( getNetid(ids) )); - parameters.add("subject",model.createResource( action.getUriOfSubject() )) ; - parameters.add("object", model.createResource( action.getUriOfObject() )) ; - parameters.add("predicate", model.createResource( action.getUriOfPredicate() )) ; - - return doQueries(queryStrs,parameters,action); - } - - private PolicyDecision visit(IdentifierBundle ids, DropObjectPropStmt action) { - log.debug("doing DropObjectPropStmt"); - - List queryStrs = actionToQueryStr.get(action.getClass().getName()); - if( queryStrs == null || queryStrs.size() ==0 ) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE, - "no queryies found for action" + action.getClass().getName()); - - QuerySolutionMap parameters = new QuerySolutionMap(); - parameters.add("netid", model.createLiteral( getNetid(ids) )); - parameters.add("subject",model.createResource( action.getUriOfSubject() )) ; - parameters.add("object", model.createResource( action.getUriOfObject() )) ; - parameters.add("predicate", model.createResource( action.getUriOfPredicate() )) ; - - return doQueries(queryStrs,parameters,action); - } - - private PolicyDecision visit(IdentifierBundle ids, AddDataPropStmt action) { - log.debug("doing AddDataPropStmt"); - - List queryStrs = actionToQueryStr.get(action.getClass().getName()); - if( queryStrs == null || queryStrs.size() ==0 ) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE, - "no queryies found for action" + action.getClass().getName()); - - QuerySolutionMap parameters = new QuerySolutionMap(); - parameters.add("netid", model.createLiteral( getNetid(ids) )); - parameters.add("subject",model.createResource( action.getSubjectUri() )) ; - parameters.add("predicate", model.createResource( action.getPredicateUri() )) ; - parameters.add("literalValue", model.createLiteral(action.getData() )); - return doQueries(queryStrs,parameters,action); - } - - private PolicyDecision visit(IdentifierBundle ids, DropDataPropStmt action) { - log.debug("doing DropDataPropStmt"); - - List queryStrs = actionToQueryStr.get(action.getClass().getName()); - if( queryStrs == null || queryStrs.size() ==0 ) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE, - "no queries found for action" + action.getClass().getName()); - - QuerySolutionMap parameters = new QuerySolutionMap(); - parameters.add("netid", model.createLiteral( getNetid(ids) )); - parameters.add("subject",model.createResource( action.getSubjectUri() )) ; - parameters.add("predicate", model.createResource( action.getPredicateUri() )) ; - parameters.add("literalValue", model.createLiteral(action.data() )); // caution: will always do untyped things - return doQueries(queryStrs,parameters,action); - } - - - /* ******************************** utilities ****************************** */ - private PolicyDecision doQueries(ListqueryStrs, QuerySolutionMap parameters, RequestedAction action){ - SparqlPolicyDecision pd = new SparqlPolicyDecision(Authorization.INCONCLUSIVE,""); - for(String quStr : queryStrs){ - - Query query = getQueryForQueryStr(quStr); - pd.setQuery(query); - QueryExecution qexec = QueryExecutionFactory.create(query, model, parameters); - pd.setQexec(qexec); - - boolean pathFound = qexec.execAsk(); - if( pathFound ){ - pd.setAuthorized(authForSuccessfulQuery); - pd.setMessage(action.getClass().getName() + " permited by " + quStr); - if( log.isDebugEnabled()){ - log.debug(action.getClass().getName() + " permited by " + quStr); - log.debug(query); - } - break; - } else { - if( log.isDebugEnabled()){ - log.debug(action.getClass().getName() + " no results for " + query); - log.debug(query); - } - } - } - return pd; - } - - private Query getQueryForQueryStr(String queryStr){ - Query q = queryStrToQuery.get(queryStr); - if( q == null ){ - q = QueryFactory.create(prefixes + queryStr); - queryStrToQuery.put(queryStr, q); - } - return q; - } - - private String getNetid(IdentifierBundle whoToAuth) { - String netidStr = null; - for(Identifier id : whoToAuth){ - if (id instanceof NetId) { - NetId netid = (NetId) id; - netidStr = netid.getValue(); - break; - } - } - if( log.isDebugEnabled() ) - log.debug("netid was " + (netidStr!=null?netidStr:"null") ); - return netidStr; - } - - /** - * An inner class used to setup everything that's needed for - * a JenaNetidPolicy. This setups the JenaNetidPolicy and a - * SelfEditingIdentifierFactory. - * - * @author bdc34 - * - */ - public static class ContextSetup implements ServletContextListener { - @Override - public void contextInitialized(ServletContextEvent sce) { - try{ - log.trace("Setting up JenaNetidPolicy"); - - Model model = (Model) sce.getServletContext().getAttribute("jenaOntModel"); - if( model == null ){ - log.error("could not get jenaOntModel from JenaBaseDao, JenaNetidPolicy will not work"); - } - - ServletPolicyList.addPolicy(sce.getServletContext(), new JenaNetidPolicy(model)); - - ActiveIdentifierBundleFactories.addFactory(sce, new SelfEditingIdentifierFactory()); - }catch(Exception e){ - log.error("could not create AuthorizationFactory: " + e); - e.printStackTrace(); - } - } - @Override - public void contextDestroyed(ServletContextEvent sce) { /*nothing*/ } - - } - - private void setupDefault(){ - // --- AddObjectPropStmt --- - // may have 4 parameters: netid, object, predicate, and subject. - ArrayList queries = new ArrayList(); - queries.add( "ASK WHERE { ?subject vitro:netid ?netid }"); - queries.add( "ASK WHERE { ?object vitro:netid ?netid }"); - actionToQueryStr.put( AddObjectPropStmt.class.getName(), queries); - // --- DropObjectPropStmt --- - queries = new ArrayList(); - queries.add( "ASK WHERE { ?subject vitro:netid ?netid }"); - queries.add( "ASK WHERE { ?object vitro:netid ?netid }"); - actionToQueryStr.put( DropObjectPropStmt.class.getName(), queries); - - // --- DropDataPropStmt --- - queries = new ArrayList(); - queries.add( "ASK WHERE { ?subject vitro:netid ?netid }"); - queries.add( "ASK WHERE { ?object vitro:netid ?netid }"); - actionToQueryStr.put( DropDataPropStmt.class.getName(), queries); - // --- AddDataPropStmt --- - queries = new ArrayList(); - queries.add( "ASK WHERE { ?subject vitro:netid ?netid }"); - queries.add( "ASK WHERE { ?object vitro:netid ?netid }"); - actionToQueryStr.put( AddDataPropStmt.class.getName(), queries); - - // --- DropResource --- - queries = new ArrayList(); - queries.add( "ASK WHERE { ?subject vitro:netid ?netid }"); - queries.add( "ASK WHERE { ?object vitro:netid ?netid }"); - actionToQueryStr.put( DropObjectPropStmt.class.getName(), queries); - // --- AddResource --- - queries = new ArrayList(); - queries.add( "ASK WHERE { ?subject vitro:netid ?netid }"); - queries.add( "ASK WHERE { ?object vitro:netid ?netid }"); - actionToQueryStr.put( DropObjectPropStmt.class.getName(), queries); - } - - public final static String netIdPropUri = VitroVocabulary.vitroURI+ "netid"; - private static final Log log = LogFactory.getLog(JenaNetidPolicy.class.getName()); - public final static String DEFAULT_PREFIXES = - "PREFIX rdf: \n"+ - "PREFIX rdfs: \n"+ - "PREFIX vivoa: \n"+ - "PREFIX vivo: \n"+ - "PREFIX vitro: <"+ VitroVocabulary.vitroURI+">\n"; - - private final PolicyDecision UNAUTH = new BasicPolicyDecision( - Authorization.UNAUTHORIZED, - "JenaNetidPolicy doesn't authorize admin or onto editing actions"); - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy.java index 5c2023598..c50e3223f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy.java @@ -2,11 +2,13 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy; +import java.util.ArrayList; import java.util.List; import javax.servlet.ServletContext; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; @@ -35,7 +37,8 @@ public class SelfEditingPolicy extends BaseSelfEditingPolicy implements return inconclusiveDecision("whatToAuth was null"); } - List userUris = getUrisOfSelfEditor(whoToAuth); + List userUris = new ArrayList( + HasAssociatedIndividual.getIndividualUris(whoToAuth)); if (userUris.isEmpty()) { return inconclusiveDecision("Not self-editing."); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicy.java deleted file mode 100644 index 6184f671a..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicy.java +++ /dev/null @@ -1,264 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.policy; - -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.hp.hpl.jena.query.Query; -import com.hp.hpl.jena.query.QueryExecution; -import com.hp.hpl.jena.query.QueryExecutionFactory; -import com.hp.hpl.jena.query.QueryFactory; -import com.hp.hpl.jena.query.QuerySolutionMap; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.thoughtworks.xstream.XStream; -import com.thoughtworks.xstream.io.xml.DomDriver; - -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.DefaultInconclusivePolicy; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin.UploadFile; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddDataPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddObjectPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropDataPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropObjectPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.EditDataPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.EditObjPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.resource.AddResource; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.resource.DropResource; - -/** - * This policy maps strings in the IdentifierBundle to a QuerySolutioinMap in order - * to bind identifiers with unbound variables in SPARQL queries. - * These queries are intended to specify the relations that allow authorization. - * If the query return no rows will be interpreted as unauthorized and a - * query returning one or more rows will be interpreted as authorized. - * - * @author bdc34 - * - */ -public class SparqlPolicy extends DefaultInconclusivePolicy implements PolicyIface{ - protected Model model = ModelFactory.createDefaultModel(); - private HashMap queryStrToQuery = new HashMap(); - - /** human readable name for this policy */ - protected String name="Unnamed Policy"; - - /** prefixes for SPARQL queries. */ - protected String prefixes = ""; - - /** The SPARQL queries. They should all be of the type ASK */ - protected HashMap> actionToQueryStr = new HashMap>(); - - /** Function to transform identifiers into a QuerySolutionMap */ - private Ids2QueryBindings binder; - - private String resource = null; - - /** - * Load XML policy files with this.getClass().getResourceAsStream() - * Notice that / is the path separator and strings that lack - * a leading slash are relative to the package of the this.getClass(). - */ - public SparqlPolicy(Model model, Ids2QueryBindings binder, String resource){ - if( model == null ) - throw new IllegalArgumentException("model must not be null."); - if( binder == null ) - throw new IllegalArgumentException("binder must not be null."); - if( resource == null ) - throw new IllegalArgumentException("resource must not be null."); - - this.model = model; - this.binder = binder; - this.resource = resource; - loadPolicy(); - } - - public void loadPolicy(){ - InputStream policySpec = SparqlPolicy.class.getResourceAsStream(resource); - XStream x = new XStream(new DomDriver()); - SparqlPolicy jnip =(SparqlPolicy) x.fromXML( policySpec ); - this.actionToQueryStr = jnip.actionToQueryStr; - this.prefixes = jnip.prefixes; - this.name = jnip.name; - try{ - policySpec.close(); - }catch(Throwable th){/*ignore it?*/} - } - - /* *********************** Methods ************************************ */ - @Override - public PolicyDecision isAuthorized(IdentifierBundle whoToAuth, - RequestedAction whatToAuth) { - if( whoToAuth == null ) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE,"whoToAuth was null"); - if(whatToAuth == null) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE,"whatToAuth was null"); - List queryStrs = actionToQueryStr.get(whatToAuth.getClass().getName()); - if( queryStrs == null || queryStrs.size() ==0 ) - return new BasicPolicyDecision(Authorization.INCONCLUSIVE, - "no queryies found for action" + whatToAuth.getClass().getName()); - - if (whatToAuth instanceof AddObjectPropStmt) { - return visit(whoToAuth, (AddObjectPropStmt) whatToAuth); - } else if (whatToAuth instanceof DropResource) { - return visit(whoToAuth, (DropResource) whatToAuth); - } else if (whatToAuth instanceof DropDataPropStmt) { - return visit(whoToAuth, (DropDataPropStmt) whatToAuth); - } else if (whatToAuth instanceof DropObjectPropStmt) { - return visit(whoToAuth, (DropObjectPropStmt) whatToAuth); - } else if (whatToAuth instanceof AddResource) { - return visit(whoToAuth, (AddResource) whatToAuth); - } else if (whatToAuth instanceof AddDataPropStmt) { - return visit(whoToAuth, (AddDataPropStmt) whatToAuth); - } else if (whatToAuth instanceof UploadFile) { - return visit(whoToAuth, (UploadFile) whatToAuth); - } else if (whatToAuth instanceof EditDataPropStmt) { - return visit(whoToAuth, (EditDataPropStmt) whatToAuth); - } else if (whatToAuth instanceof EditObjPropStmt) { - return visit(whoToAuth, (EditObjPropStmt) whatToAuth); - } else { - return UNAUTH; - } - } - - private PolicyDecision doQueries(ListqueryStrs, IdentifierBundle ids, RequestedAction action){ - SparqlPolicyDecision pd = new SparqlPolicyDecision(Authorization.INCONCLUSIVE,""); - List bindings = binder.makeScopeBinding(ids, action); - for( QuerySolutionMap scope: bindings ){ - for(String quStr : queryStrs){ - Query query = getQueryForQueryStr(quStr); - pd.setQuery(query); - QueryExecution qexec = QueryExecutionFactory.create(query, model, scope); - pd.setQexec(qexec); - boolean pathFound = qexec.execAsk(); - if( pathFound ){ - pd.setAuthorized(Authorization.AUTHORIZED); - pd.setMessage(action.getClass().getName() + " permited by " + quStr); - if( log.isDebugEnabled()){ - log.debug(action.getClass().getName() + " permited by " + quStr); - log.debug(query); - } - return pd; - } else { - if( log.isDebugEnabled()){ - log.debug(action.getClass().getName() + " no results for " + query); - log.debug(query); - } - } - } - } - return pd; - } - - private Query getQueryForQueryStr(String queryStr){ - //memoize queries - Query q = queryStrToQuery.get(queryStr); - if( q == null ){ - q = QueryFactory.create(prefixes + queryStr); - queryStrToQuery.put(queryStr, q); - } - return q; - } - - /* ***************** Visit methods ********************** */ - private final String pkg = "edu.cornell.mannlib.vitro.webapp.auth.requestedAction."; - - private PolicyDecision visit(IdentifierBundle ids, AddObjectPropStmt action) { - return doQueries(actionToQueryStr.get(pkg +"AddObjectPropStmt"),ids,action); - } - - private PolicyDecision visit(IdentifierBundle ids, DropResource action) { - return doQueries(actionToQueryStr.get(pkg +"DropResource"),ids,action); - } - - private PolicyDecision visit(IdentifierBundle ids, DropDataPropStmt action) { - return doQueries(actionToQueryStr.get(pkg +"DropDataPropStmt"),ids,action); - } - - private PolicyDecision visit(IdentifierBundle ids, DropObjectPropStmt action) { - return doQueries(actionToQueryStr.get(pkg +"DropObjectPropStmt"),ids,action); - } - - private PolicyDecision visit(IdentifierBundle ids, AddResource action) { - return doQueries(actionToQueryStr.get(pkg +"AddResource"),ids,action); - } - - private PolicyDecision visit(IdentifierBundle ids, AddDataPropStmt action) { - return doQueries(actionToQueryStr.get(pkg +"AddDataPropStmt"),ids,action); - } - - private PolicyDecision visit(IdentifierBundle ids, UploadFile action) { - return doQueries(actionToQueryStr.get(pkg +"UploadFile"),ids,action); - } - - private PolicyDecision visit(IdentifierBundle ids, EditDataPropStmt action) { - return doQueries(actionToQueryStr.get(pkg +"EditDataPropStmt"),ids,action); - } - - private PolicyDecision visit(IdentifierBundle ids, EditObjPropStmt action) { - return doQueries(actionToQueryStr.get(pkg +"EditObjPropStmt"),ids,action); - } - - private static final Log log = LogFactory.getLog(SparqlPolicy.class.getName()); - - private final PolicyDecision UNAUTH = new BasicPolicyDecision( - Authorization.UNAUTHORIZED, - name + " SparqlPolicy doesn't authorize admin or onto editing actions"); - -/* - * example of how to set up the xml: - * - * - - - Example Policy - PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> -PREFIX vivoa: <http://vivo.library.cornell.edu/abox#> -PREFIX vivo: <http://vivo.library.cornell.edu/ns/0.1#> -PREFIX vitro: <http://lowe.mannlib.cornell.edu/ns/vitro/0.1/vitro.owl#> - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropDataPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropObjectPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddObjectPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddDataPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - - - - */ -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicyDecision.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicyDecision.java deleted file mode 100644 index 05abf69b2..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicyDecision.java +++ /dev/null @@ -1,61 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.policy; - -import com.hp.hpl.jena.query.Query; -import com.hp.hpl.jena.query.QueryExecution; - -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; - -/** - * Extends the BasicPolicyDecision with additional debugging information about the - * sparql queries that were run to create the decision. - * - * @author bdc34 - * - */ -public class SparqlPolicyDecision extends BasicPolicyDecision { - Query query = null; - QueryExecution qexec = null; - - public SparqlPolicyDecision(Authorization authorized, String message) { - super(authorized, message); - } - - public QueryExecution getQexec() { - return qexec; - } - - public void setQexec(QueryExecution qexec) { - this.qexec = qexec; - } - - public Query getQuery() { - return query; - } - - public void setQuery(Query query) { - this.query = query; - } - - @Override - public String getDebuggingInfo() { - String msg = ""; - if( super.getDebuggingInfo() != null && super.getDebuggingInfo().length() > 0) - msg = super.getDebuggingInfo() + '\n'; - - if( query != null ) - msg= msg + "query: \n" + query.toString() + '\n'; - else - msg = msg + " query was null \n"; - - if( qexec != null ) - msg = msg + "query exec: \n" + qexec.toString(); - else - msg = msg + " query exec was null \n"; - - return msg; - } - - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/UseRestrictedPagesByRoleLevelPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/UseRestrictedPagesByRoleLevelPolicy.java index 09ca36896..e7cb90667 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/UseRestrictedPagesByRoleLevelPolicy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/UseRestrictedPagesByRoleLevelPolicy.java @@ -5,9 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasRoleLevel; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasRoleLevel; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface; @@ -27,6 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvance import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseBasicAjaxControllers; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousAdminPages; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousCuratorPages; +import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousEditorPages; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousPages; import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel; @@ -48,7 +48,7 @@ public class UseRestrictedPagesByRoleLevelPolicy implements PolicyIface { return defaultDecision("whatToAuth was null"); } - RoleLevel userRole = getUsersRoleLevel(whoToAuth); + RoleLevel userRole = HasRoleLevel.getUsersRoleLevel(whoToAuth); PolicyDecision result; if (whatToAuth instanceof UseAdvancedDataToolsPages) { @@ -93,6 +93,9 @@ public class UseRestrictedPagesByRoleLevelPolicy implements PolicyIface { } else if (whatToAuth instanceof SeeIndividualEditingPanel) { result = isAuthorized(whatToAuth, RoleLevel.EDITOR, userRole); + } else if (whatToAuth instanceof UseMiscellaneousEditorPages) { + result = isAuthorized(whatToAuth, RoleLevel.EDITOR, userRole); + } else if (whatToAuth instanceof UseBasicAjaxControllers) { result = isAuthorized(whatToAuth, RoleLevel.SELF, userRole); @@ -137,16 +140,4 @@ public class UseRestrictedPagesByRoleLevelPolicy implements PolicyIface { return new BasicPolicyDecision(Authorization.INCONCLUSIVE, message); } - /** - * The user is nobody unless they have a HasRoleLevel identifier. - */ - private RoleLevel getUsersRoleLevel(IdentifierBundle whoToAuth) { - RoleLevel userRole = RoleLevel.PUBLIC; - for (Identifier id : whoToAuth) { - if (id instanceof HasRoleLevel) { - userRole = ((HasRoleLevel) id).getRoleLevel(); - } - } - return userRole; - } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/CommonPolicyFamilySetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/CommonPolicyFamilySetup.java index 94f0623f3..2fca2f1ee 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/CommonPolicyFamilySetup.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/CommonPolicyFamilySetup.java @@ -10,7 +10,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.CommonIdentifierBundleFactory; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.CommonIdentifierBundleFactory; import edu.cornell.mannlib.vitro.webapp.auth.policy.DisplayRestrictedDataByRoleLevelPolicy; import edu.cornell.mannlib.vitro.webapp.auth.policy.DisplayRestrictedDataToSelfPolicy; import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList; @@ -41,7 +41,7 @@ public class CommonPolicyFamilySetup implements ServletContextListener { new UseRestrictedPagesByRoleLevelPolicy()); // This factory creates Identifiers for all of the above policies. - CommonIdentifierBundleFactory factory = new CommonIdentifierBundleFactory(); + CommonIdentifierBundleFactory factory = new CommonIdentifierBundleFactory(ctx); ActiveIdentifierBundleFactories.addFactory(sce, factory); } catch (Exception e) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/JenaNetidPolicySetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/JenaNetidPolicySetup.java deleted file mode 100644 index 29810e6de..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/JenaNetidPolicySetup.java +++ /dev/null @@ -1,55 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.policy.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.hp.hpl.jena.ontology.OntModel; - -import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory; -import edu.cornell.mannlib.vitro.webapp.auth.policy.JenaNetidPolicy; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList; - -/** - * Class used to setup a JenaNetidPolicy using the default. - * This setups the JenaNetidPolicy and a SelfEditingIdentifierFactory. - * - * See JenaNetidPolicy.setupDefault() for the sparql queries that will - * be used by the default JenaNetidPolicy. - * - * @author bdc34 - * - */ -public class JenaNetidPolicySetup implements ServletContextListener { - - private static final Log log = LogFactory.getLog(JenaNetidPolicySetup.class.getName()); - - @Override - public void contextInitialized(ServletContextEvent sce) { - try{ - log.debug("Setting up JenaNetidPolicy"); - - JenaNetidPolicy jnip = new JenaNetidPolicy((OntModel) sce.getServletContext().getAttribute("jenaOntModel")); - ServletPolicyList.addPolicy(sce.getServletContext(), jnip); - - SelfEditingIdentifierFactory niif =new SelfEditingIdentifierFactory(); - ActiveIdentifierBundleFactories.addFactory(sce, niif); - - }catch(Exception e){ - log.error("could not create AuthorizationFactory: " + e); - e.printStackTrace(); - } - } - - @Override - public void contextDestroyed(ServletContextEvent sce) { - /*nothing*/ - } - -} - diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditing2RoleIdentifierSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditing2RoleIdentifierSetup.java deleted file mode 100644 index 001aa5608..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditing2RoleIdentifierSetup.java +++ /dev/null @@ -1,49 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.policy.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditing2RoleIdentifierFactory; - -/** - * Add the SelfEditing2RoleIdentifier factory to the IdentifierFactory list - * in the servlet context. - * - * This should be added to the IdentifierFactory list after the - * SelfEditingIdentiferFactory. - * - * This only sets up a IdentifierFactoy that maps SelfEditing identifiers to - * roles associated with the Individual that represents the self editor. This - * does not set up a policy or the SelfEditingIdentifierFactory. - * - * @author bdc34 - * - */ -public class SelfEditing2RoleIdentifierSetup implements ServletContextListener{ - - private static final Log log = LogFactory.getLog(SelfEditing2RoleIdentifierSetup.class.getName()); - - @Override - public void contextDestroyed(ServletContextEvent sce) { - //do nothing - } - - @Override - public void contextInitialized(ServletContextEvent sce) { - try{ - log.debug("Setting up SelfEditing2RoleIdentifier"); - ActiveIdentifierBundleFactories.addFactory(sce, new SelfEditing2RoleIdentifierFactory()); - log.debug( "SelfEditing2RoleIdentifier has been setup. " ); - }catch(Exception e){ - log.error("could not run SelfEditing2RoleIdentifier: " + e); - e.printStackTrace(); - } - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/AbstractRelationshipPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/AbstractRelationshipPolicy.java index 0fb8e1928..c238d246c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/AbstractRelationshipPolicy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/AbstractRelationshipPolicy.java @@ -19,9 +19,6 @@ import com.hp.hpl.jena.rdf.model.SimpleSelector; import com.hp.hpl.jena.rdf.model.StmtIterator; import com.hp.hpl.jena.shared.Lock; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasAssociatedIndividual; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; import edu.cornell.mannlib.vitro.webapp.auth.policy.BasicPolicyDecision; import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; @@ -47,24 +44,6 @@ public abstract class AbstractRelationshipPolicy implements PolicyIface { this.model = model; } - /** - * Check to see whether we are self-editing, and for which Individuals. - */ - protected List getUrisOfSelfEditor(IdentifierBundle ids) { - List uris = new ArrayList(); - if (ids != null) { - for (Identifier id : ids) { - if (id instanceof HasAssociatedIndividual) { - HasAssociatedIndividual selfEditId = (HasAssociatedIndividual) id; - if (!selfEditId.isBlacklisted()) { - uris.add(selfEditId.getAssociatedIndividualUri()); - } - } - } - } - return uris; - } - protected boolean canModifyResource(String uri) { return PropertyRestrictionPolicyHelper.getBean(ctx).canModifyResource( uri, RoleLevel.SELF); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/SelfEditorRelationshipPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/SelfEditorRelationshipPolicy.java index ba0d984e1..19b29ab20 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/SelfEditorRelationshipPolicy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/SelfEditorRelationshipPolicy.java @@ -2,6 +2,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy.specialrelationships; +import java.util.ArrayList; import java.util.List; import javax.servlet.ServletContext; @@ -14,6 +15,7 @@ import org.apache.commons.logging.LogFactory; import com.hp.hpl.jena.ontology.OntModel; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface; @@ -128,7 +130,8 @@ public class SelfEditorRelationshipPolicy extends AbstractRelationshipPolicy private PolicyDecision isAuthorized(IdentifierBundle ids, DistilledAction action) { - List userUris = getUrisOfSelfEditor(ids); + List userUris = new ArrayList( + HasAssociatedIndividual.getIndividualUris(ids)); if (userUris.isEmpty()) { return inconclusiveDecision("Not self-editing."); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/Actions.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/Actions.java index b8bedc6b2..ecbf1638a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/Actions.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/Actions.java @@ -31,12 +31,12 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAct public class Actions { private static final Log log = LogFactory.getLog(Actions.class); - public static final Actions EMPTY = new Actions(); + public static final Actions AUTHORIZED = new Actions(); public static final Actions UNAUTHORIZED = new Actions( new UnauthorizedAction()); public static Actions notNull(Actions actions) { - return (actions == null) ? EMPTY : actions; + return (actions == null) ? AUTHORIZED : actions; } private final List> clauseList; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/usepages/UseMiscellaneousEditorPages.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/usepages/UseMiscellaneousEditorPages.java new file mode 100644 index 000000000..6b03bc755 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/usepages/UseMiscellaneousEditorPages.java @@ -0,0 +1,11 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages; + +import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; + +/** Should we allow the user to use the odd-lots pages that were designed for Editors, Curators or DBAs? */ +public class UseMiscellaneousEditorPages extends RequestedAction implements + UsePagesRequestedAction { + // no fields +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/UserAccount.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/UserAccount.java index 79a7542e7..27de0ffc1 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/UserAccount.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/beans/UserAccount.java @@ -11,6 +11,10 @@ import java.util.Set; * Information about the account of a user. URI, email, password, etc. */ public class UserAccount { + + public final static int MIN_PASSWORD_LENGTH = 6; + public final static int MAX_PASSWORD_LENGTH = 12; + public enum Status { ACTIVE, INACTIVE; @@ -30,36 +34,20 @@ public class UserAccount { } - /** Should never be null. */ - private String uri = ""; + private String uri = ""; // Never null. + private String emailAddress = ""; // Never null. + private String firstName = ""; // Never null. + private String lastName = ""; // Never null. - /** Should never be null. */ - private String emailAddress = ""; - - /** Should never be null. */ - private String firstName = ""; - - /** Should never be null. */ - private String lastName = ""; - - - /** Should never be null. */ - private String md5Password = ""; - - /** Should never be null. */ - private String oldPassword = ""; - - /** Should never be negative. */ - private long passwordLinkExpires = 0L; - + private String md5Password = ""; // Never null. + private String oldPassword = ""; // Never null. + private long passwordLinkExpires = 0L; // Never negative. private boolean passwordChangeRequired = false; - /** Should never be negative. */ - private int loginCount = 0; - - /** Might be null. */ - private Status status = Status.INACTIVE; + private int loginCount = 0; // Never negative. + private Status status = Status.INACTIVE; // Might be null. + private String externalAuthId = ""; // Never null. /** This may be empty, but should never be null. */ private Set permissionSetUris = Collections.emptySet(); @@ -128,7 +116,8 @@ public class UserAccount { } public void setPasswordChangeRequired(Boolean passwordChangeRequired) { - this.passwordChangeRequired = nonNull(passwordChangeRequired, Boolean.FALSE); + this.passwordChangeRequired = nonNull(passwordChangeRequired, + Boolean.FALSE); } public int getLoginCount() { @@ -151,6 +140,14 @@ public class UserAccount { this.status = Status.fromString(statusString); } + public String getExternalAuthId() { + return externalAuthId; + } + + public void setExternalAuthId(String externalAuthId) { + this.externalAuthId = nonNull(externalAuthId, ""); + } + public Set getPermissionSetUris() { return new HashSet(permissionSetUris); } @@ -161,19 +158,21 @@ public class UserAccount { } this.permissionSetUris = new HashSet(permissionSetUris); } - + private T nonNull(T value, T defaultValue) { return (value == null) ? defaultValue : value; } @Override public String toString() { - return "UserAccount[uri=" + uri + ", emailAddress=" + emailAddress - + ", firstName=" + firstName + ", lastName=" + lastName - + ", md5password=" + md5Password + ", passwordChangeExpires=" - + passwordLinkExpires + ", loginCount=" + loginCount - + ", status=" + status + ", permissionSetUris=" - + permissionSetUris + "]"; + return "UserAccount[uri=" + uri + (", emailAddress=" + emailAddress) + + (", firstName=" + firstName) + (", lastName=" + lastName) + + (", md5password=" + md5Password) + + (", oldPassword=" + oldPassword) + + (", passwordLinkExpires=" + passwordLinkExpires) + + (", passwordChangeRequired=" + passwordChangeRequired) + + (", loginCount=" + loginCount) + (", status=" + status) + + (", externalAuthId=" + externalAuthId) + + (", permissionSetUris=" + permissionSetUris) + "]"; } - } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/CuwalRedirector.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/CuwalRedirector.java deleted file mode 100644 index 21facde83..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/CuwalRedirector.java +++ /dev/null @@ -1,34 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.controller; - -import java.io.IOException; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class CuwalRedirector extends HttpServlet { - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - //forward to /edit/login.jsp to work around CUWebAuth bug - RequestDispatcher rd = getServletContext().getRequestDispatcher("/edit/login.jsp"); - rd.forward(req, resp); - return; - } - - @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - //forward to /edit/login.jsp to work around CUWebAuth bug - RequestDispatcher rd = getServletContext().getRequestDispatcher("/edit/login.jsp"); - rd.forward(req, resp); - return; - } - - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityURLController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityURLController.java index 8b67cb98b..1f874b601 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityURLController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityURLController.java @@ -29,6 +29,7 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.vocabulary.RDF; import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc; +import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames; import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexFactory; import edu.cornell.mannlib.vitro.webapp.web.ContentType; @@ -74,13 +75,13 @@ public void doGet (HttpServletRequest req, HttpServletResponse res) throws IOExc String classUri = (String) getServletContext().getAttribute("classuri"); BooleanQuery query = new BooleanQuery(); query.add( - new TermQuery( new Term(Entity2LuceneDoc.term.RDFTYPE, classUri)), + new TermQuery( new Term(VitroLuceneTermNames.RDFTYPE, classUri)), BooleanClause.Occur.MUST ); IndexSearcher index = LuceneIndexFactory.getIndexSearcher(getServletContext()); TopDocs docs = index.search(query, null, ENTITY_LIST_CONTROLLER_MAX_RESULTS, - new Sort(Entity2LuceneDoc.term.NAMELOWERCASE)); + new Sort(VitroLuceneTermNames.NAME_LOWERCASE)); if( docs == null ){ log.error("Search of lucene index returned null"); @@ -97,7 +98,7 @@ public void doGet (HttpServletRequest req, HttpServletResponse res) throws IOExc if (hit != null) { Document doc = index.doc(hit.doc); if (doc != null) { - String uri = doc.getField(Entity2LuceneDoc.term.URI).stringValue(); + String uri = doc.getField(VitroLuceneTermNames.URI).stringValue(); resource = ResourceFactory.createResource(uri); node = (RDFNode) ResourceFactory.createResource(classUri); model.add(resource, RDF.type, node); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/FedoraDatastreamController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/FedoraDatastreamController.java index fec08ca55..db59e7174 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/FedoraDatastreamController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/FedoraDatastreamController.java @@ -231,7 +231,7 @@ public class FedoraDatastreamController extends VitroHttpServlet implements Cons } //check if fedora is on line - OntModel sessionOntModel = (OntModel)req.getSession().getAttribute("jenaOntModel"); + OntModel sessionOntModel = (OntModel)rawRequest.getSession().getAttribute("jenaOntModel"); synchronized (FedoraDatastreamController.class) { if( fedoraUrl == null ){ setup( sessionOntModel, getServletContext() ); @@ -280,7 +280,7 @@ public class FedoraDatastreamController extends VitroHttpServlet implements Cons "enough information to complete your request.(Missing fileRes)"); //check if file individual has a fedora:PID for a data stream - VitroRequest vreq = new VitroRequest(req); + VitroRequest vreq = new VitroRequest(rawRequest); IndividualDao iwDao = vreq.getWebappDaoFactory().getIndividualDao(); Individual fileEntity = iwDao.getIndividualByURI(fileUri); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONReconcileServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONReconcileServlet.java index 276e0af4e..5f9827518 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONReconcileServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONReconcileServlet.java @@ -377,7 +377,7 @@ public class JSONReconcileServlet extends VitroHttpServlet { String stemParam = (String) request.getParameter("stem"); boolean stem = "true".equals(stemParam); - String termName = stem ? VitroLuceneTermNames.NAME : VitroLuceneTermNames.NAMEUNSTEMMED; + String termName = stem ? VitroLuceneTermNames.AC_NAME_STEMMED : VitroLuceneTermNames.AC_NAME_UNSTEMMED; BooleanQuery boolQuery = new BooleanQuery(); @@ -415,7 +415,7 @@ public class JSONReconcileServlet extends VitroHttpServlet { private Query makeUntokenizedNameQuery(String querystr) { querystr = querystr.toLowerCase(); - String termName = VitroLuceneTermNames.NAMELOWERCASE; + String termName = VitroLuceneTermNames.NAME_LOWERCASE; BooleanQuery query = new BooleanQuery(); log.debug("Adding wildcard query on unanalyzed name"); query.add( diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java index 72c3ade99..af6d82d5f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/JSONServlet.java @@ -40,8 +40,8 @@ import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator; import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/SolrJsonServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/SolrJsonServlet.java new file mode 100644 index 000000000..e342e291f --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/SolrJsonServlet.java @@ -0,0 +1,566 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.controller; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import com.hp.hpl.jena.ontology.OntModel; +import com.hp.hpl.jena.rdf.model.Literal; + +import edu.cornell.mannlib.vitro.webapp.beans.DataProperty; +import edu.cornell.mannlib.vitro.webapp.beans.Individual; +import edu.cornell.mannlib.vitro.webapp.beans.VClass; +import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; +import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; +import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; +import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; +import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator; +import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch; +import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel; + +/** + * This servlet is for servicing requests for JSON objects/data. + * It could be generalized to get other types of data ex. XML, HTML etc + * @author bdc34 + * + */ + +// RY Rename to JsonServlet once the transition to Solr is complete. +public class SolrJsonServlet extends VitroHttpServlet { + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + super.doPost(req, resp); + } + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + super.doGet(req, resp); + VitroRequest vreq = new VitroRequest(req); + + try{ + if(vreq.getParameter("getEntitiesByVClass") != null ){ + if( vreq.getParameter("resultKey") == null) { + getEntitiesByVClass(req, resp); + return; + } else { + getEntitiesByVClassContinuation( req, resp); + return; + } + }else if( vreq.getParameter("getN3EditOptionList") != null ){ + doN3EditOptionList(req,resp); + return; + }else if( vreq.getParameter("getLuceneIndividualsByVClass") != null ){ + getLuceneIndividualsByVClass(req,resp); + return; + }else if( vreq.getParameter("getVClassesForVClassGroup") != null ){ + getVClassesForVClassGroup(req,resp); + return; + } + }catch(Exception ex){ + log.warn(ex,ex); + } + } + + private void getVClassesForVClassGroup(HttpServletRequest req, HttpServletResponse resp) throws IOException, JSONException { + JSONObject map = new JSONObject(); + VitroRequest vreq = new VitroRequest(req); + String vcgUri = vreq.getParameter("classgroupUri"); + if( vcgUri == null ){ + log.debug("no URI passed for classgroupUri"); + resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return; + } + + VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext()); + VClassGroup vcg = vcgc.getGroup(vcgUri); + if( vcg == null ){ + log.debug("Could not find vclassgroup: " + vcgUri); + resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return; + } + + ArrayList classes = new ArrayList(vcg.size()); + for( VClass vc : vcg){ + JSONObject vcObj = new JSONObject(); + vcObj.put("name", vc.getName()); + vcObj.put("URI", vc.getURI()); + vcObj.put("entityCount", vc.getEntityCount()); + classes.add(vcObj); + } + map.put("classes", classes); + map.put("classGroupName", vcg.getPublicName()); + map.put("classGroupUri", vcg.getURI()); + + resp.setCharacterEncoding("UTF-8"); + resp.setContentType("application/json;charset=UTF-8"); + Writer writer = resp.getWriter(); + writer.write(map.toString()); + } + + private void getLuceneIndividualsByVClass( HttpServletRequest req, HttpServletResponse resp ){ + String errorMessage = null; + JSONObject rObj = null; + try{ + VitroRequest vreq = new VitroRequest(req); + VClass vclass=null; + + + String vitroClassIdStr = vreq.getParameter("vclassId"); + if ( vitroClassIdStr != null && !vitroClassIdStr.isEmpty()){ + vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vitroClassIdStr); + if (vclass == null) { + log.debug("Couldn't retrieve vclass "); + throw new Exception (errorMessage = "Class " + vitroClassIdStr + " not found"); + } + }else{ + log.debug("parameter vclassId URI parameter expected "); + throw new Exception("parameter vclassId URI parameter expected "); + } + rObj = getLuceneIndividualsByVClass(vclass.getURI(),req, getServletContext()); + }catch(Exception ex){ + errorMessage = ex.toString(); + log.error(ex,ex); + } + + if( rObj == null ) + rObj = new JSONObject(); + + try{ + resp.setCharacterEncoding("UTF-8"); + resp.setContentType("application/json;charset=UTF-8"); + + if( errorMessage != null ){ + rObj.put("errorMessage", errorMessage); + resp.setStatus(500 /*HttpURLConnection.HTTP_SERVER_ERROR*/); + }else{ + rObj.put("errorMessage", ""); + } + Writer writer = resp.getWriter(); + writer.write(rObj.toString()); + }catch(JSONException jse){ + log.error(jse,jse); + } catch (IOException e) { + log.error(e,e); + } + + } + + public static JSONObject getLuceneIndividualsByVClass(String vclassURI, HttpServletRequest req, ServletContext context) throws Exception { + + VitroRequest vreq = new VitroRequest(req); + VClass vclass=null; + JSONObject rObj = new JSONObject(); + + DataProperty fNameDp = (new DataProperty()); + fNameDp.setURI("http://xmlns.com/foaf/0.1/firstName"); + DataProperty lNameDp = (new DataProperty()); + lNameDp.setURI("http://xmlns.com/foaf/0.1/lastName"); + DataProperty monikerDp = (new DataProperty()); + monikerDp.setURI( VitroVocabulary.MONIKER); + //this property is vivo specific + DataProperty preferredTitleDp = (new DataProperty()); + preferredTitleDp.setURI("http://vivoweb.org/ontology/core#preferredTitle"); + + + if( log.isDebugEnabled() ){ + Enumeration e = vreq.getParameterNames(); + while(e.hasMoreElements()){ + String name = (String)e.nextElement(); + log.debug("parameter: " + name); + for( String value : vreq.getParameterValues(name) ){ + log.debug("value for " + name + ": '" + value + "'"); + } + } + } + + //need an unfiltered dao to get firstnames and lastnames + WebappDaoFactory fullWdf = vreq.getFullWebappDaoFactory(); + + + String vitroClassIdStr = vreq.getParameter("vclassId"); + if ( vitroClassIdStr != null && !vitroClassIdStr.isEmpty()){ + vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vitroClassIdStr); + if (vclass == null) { + log.debug("Couldn't retrieve vclass "); + throw new Exception ("Class " + vitroClassIdStr + " not found"); + } + }else{ + log.debug("parameter vclassId URI parameter expected "); + throw new Exception("parameter vclassId URI parameter expected "); + } + + rObj.put("vclass", + new JSONObject().put("URI",vclass.getURI()) + .put("name",vclass.getName())); + + if (vclass != null) { + String alpha = IndividualListController.getAlphaParameter(vreq); + int page = IndividualListController.getPageParameter(vreq); + Map map = IndividualListController.getResultsForVClass( + vclass.getURI(), + page, + alpha, + vreq.getWebappDaoFactory().getIndividualDao(), + context); + + rObj.put("totalCount", map.get("totalCount")); + rObj.put("alpha", map.get("alpha")); + + List inds = (List)map.get("entities"); + List indsTm = new ArrayList(); + JSONArray jInds = new JSONArray(); + for(Individual ind : inds ){ + JSONObject jo = new JSONObject(); + jo.put("URI", ind.getURI()); + jo.put("label",ind.getRdfsLabel()); + jo.put("name",ind.getName()); + jo.put("thumbUrl", ind.getThumbUrl()); + jo.put("imageUrl", ind.getImageUrl()); + jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq.getWebappDaoFactory())); + + String moniker = getDataPropertyValue(ind, monikerDp, fullWdf); + jo.put("moniker", moniker); + jo.put("vclassName", getVClassName(ind,moniker,fullWdf)); + + jo.put("preferredTitle", getDataPropertyValue(ind, preferredTitleDp, fullWdf)); + jo.put("firstName", getDataPropertyValue(ind, fNameDp, fullWdf)); + jo.put("lastName", getDataPropertyValue(ind, lNameDp, fullWdf)); + + jInds.put(jo); + } + rObj.put("individuals", jInds); + + JSONArray wpages = new JSONArray(); + List pages = (List)map.get("pages"); + for( PageRecord pr: pages ){ + JSONObject p = new JSONObject(); + p.put("text", pr.text); + p.put("param", pr.param); + p.put("index", pr.index); + wpages.put( p ); + } + rObj.put("pages",wpages); + + JSONArray jletters = new JSONArray(); + List letters = Controllers.getLetters(); + for( String s : letters){ + JSONObject jo = new JSONObject(); + jo.put("text", s); + jo.put("param", "alpha=" + URLEncoder.encode(s, "UTF-8")); + jletters.put( jo ); + } + rObj.put("letters", jletters); + } + + return rObj; + } + + + private static String getVClassName(Individual ind, String moniker, + WebappDaoFactory fullWdf) { + /* so the moniker frequently has a vclass name in it. Try to return + * the vclass name that is the same as the moniker so that the templates + * can detect this. */ + if( (moniker == null || moniker.isEmpty()) ){ + if( ind.getVClass() != null && ind.getVClass().getName() != null ) + return ind.getVClass().getName(); + else + return ""; + } + + List vcList = ind.getVClasses(); + for( VClass vc : vcList){ + if( vc != null && moniker.equals( vc.getName() )) + return moniker; + } + + // if we get here, then we didn't find a moniker that matched a vclass, + // so just return any vclass.name + if( ind.getVClass() != null && ind.getVClass().getName() != null ) + return ind.getVClass().getName(); + else + return ""; + } + + static String getDataPropertyValue(Individual ind, DataProperty dp, WebappDaoFactory wdf){ + List values = wdf.getDataPropertyStatementDao() + .getDataPropertyValuesForIndividualByProperty(ind, dp); + if( values == null || values.isEmpty() ) + return ""; + else{ + if( values.get(0) != null ) + return values.get(0).getLexicalForm(); + else + return ""; + } + + } + + /** + * Gets an option list for a given EditConfiguration and Field. + * Requires following HTTP query parameters: + * editKey + * field + */ + private void doN3EditOptionList(HttpServletRequest req, HttpServletResponse resp) throws IOException { + log.debug("in doN3EditOptionList()"); + String field = req.getParameter("field"); + if( field == null ){ + log.debug("could not find query parameter 'field' for doN3EditOptionList"); + throw new IllegalArgumentException(" getN3EditOptionList requires parameter 'field'"); + } + + HttpSession sess = req.getSession(false); + EditConfiguration editConfig = EditConfiguration.getConfigFromSession(sess, req); + if( editConfig == null ) { + log.debug("could not find query parameter 'editKey' for doN3EditOptionList"); + throw new IllegalArgumentException(" getN3EditOptionList requires parameter 'editKey'"); + } + + if( log.isDebugEnabled() ) + log.debug(" attempting to get option list for field '" + field + "'"); + + // set ProhibitedFromSearch object so picklist doesn't show + // individuals from classes that should be hidden from list views + OntModel displayOntModel = + (OntModel) getServletConfig().getServletContext() + .getAttribute("displayOntModel"); + if (displayOntModel != null) { + ProhibitedFromSearch pfs = new ProhibitedFromSearch( + DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel); + editConfig.setProhibitedFromSearch(pfs); + } + + Map options = SelectListGenerator.getOptions(editConfig, field, (new VitroRequest(req)).getFullWebappDaoFactory()); + resp.setContentType("application/json"); + ServletOutputStream out = resp.getOutputStream(); + + out.println("["); + for(String key : options.keySet()){ + JSONArray jsonObj = new JSONArray(); + jsonObj.put( options.get(key)); + jsonObj.put( key); + out.println(" " + jsonObj.toString() + ","); + } + out.println("]"); + } + + private void getEntitiesByVClassContinuation(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + log.debug("in getEntitiesByVClassContinuation()"); + VitroRequest vreq = new VitroRequest(req); + String resKey = vreq.getParameter("resultKey"); + if( resKey == null ) + throw new ServletException("Could not get resultKey"); + HttpSession session = vreq.getSession(); + if( session == null ) + throw new ServletException("there is no session to get the pervious results from"); + List entsInVClass = (List) session.getAttribute(resKey); + if( entsInVClass == null ) + throw new ServletException("Could not find List for resultKey " + resKey); + + List entsToReturn = new ArrayList(REPLY_SIZE); + boolean more = false; + int count = 0; + int size = REPLY_SIZE; + /* we have a large number of items to send back so we need to stash the list in the session scope */ + if( entsInVClass.size() > REPLY_SIZE){ + more = true; + ListIterator entsFromVclass = entsInVClass.listIterator(); + while ( entsFromVclass.hasNext() && count <= REPLY_SIZE ){ + entsToReturn.add( entsFromVclass.next()); + entsFromVclass.remove(); + count++; + } + if( log.isDebugEnabled() ) log.debug("getEntitiesByVClassContinuation(): Creating reply with continue token," + + " sending in this reply: " + count +", remaing to send: " + entsInVClass.size() ); + } else { + //send out reply with no continuation + entsToReturn = entsInVClass; + count = entsToReturn.size(); + session.removeAttribute(resKey); + if( log.isDebugEnabled()) log.debug("getEntitiesByVClassContinuation(): sending " + count + " Ind without continue token"); + } + + //put all the entities on the JSON array + JSONArray ja = individualsToJson( entsToReturn ); + + //put the responseGroup number on the end of the JSON array + if( more ){ + try{ + JSONObject obj = new JSONObject(); + obj.put("resultGroup", "true"); + obj.put("size", count); + + StringBuffer nextUrlStr = req.getRequestURL(); + nextUrlStr.append("?") + .append("getEntitiesByVClass").append( "=1&" ) + .append("resultKey=").append( resKey ); + obj.put("nextUrl", nextUrlStr.toString()); + + ja.put(obj); + }catch(JSONException je ){ + throw new ServletException(je.getMessage()); + } + } + resp.setContentType("application/json"); + ServletOutputStream out = resp.getOutputStream(); + out.print( ja.toString() ); + log.debug("done with getEntitiesByVClassContinuation()"); + } + + + + /** + * Gets a list of entities that are members of the indicated vClass. + * + * If the list is large then we will pass some token indicating that there is more + * to come. The results are sent back in 250 entity blocks. To get all of the + * entities for a VClass just keep requesting lists until there are not more + * continue tokens. + * + * If there are more entities the last item on the returned array will be an object + * with no id property. It will look like this: + * + * {"resultGroup":0, + * "resultKey":"2WEK2306", + * "nextUrl":"http://caruso.mannlib.cornell.edu:8080/vitro/dataservice?getEntitiesByVClass=1&resultKey=2WEK2306&resultGroup=1&vclassId=null", + * "entsInVClass":1752, + * "nextResultGroup":1, + * "standardReplySize":256} + * + */ + private void getEntitiesByVClass(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException{ + log.debug("in getEntitiesByVClass()"); + VitroRequest vreq = new VitroRequest(req); + String vclassURI = vreq.getParameter("vclassURI"); + WebappDaoFactory daos = (new VitroRequest(req)).getFullWebappDaoFactory(); + resp.setCharacterEncoding("UTF-8"); + + // ServletOutputStream doesn't support UTF-8 + PrintWriter out = resp.getWriter(); + resp.getWriter(); + + if( vclassURI == null ){ + log.debug("getEntitiesByVClass(): no value for 'vclassURI' found in the HTTP request"); + out.print( (new JSONArray()).toString() ); return; + } + + VClass vclass = daos.getVClassDao().getVClassByURI( vclassURI ); + if( vclass == null ){ + log.debug("getEntitiesByVClass(): could not find vclass for uri '"+ vclassURI + "'"); + out.print( (new JSONArray()).toString() ); return; + } + + List entsInVClass = daos.getIndividualDao().getIndividualsByVClass( vclass ); + if( entsInVClass == null ){ + log.debug("getEntitiesByVClass(): null List retruned by getIndividualsByVClass() for "+vclassURI); + out.print( (new JSONArray().toString() )); return ; + } + int numberOfEntsInVClass = entsInVClass.size(); + + List entsToReturn = new ArrayList( REPLY_SIZE ); + String requestHash = null; + int count = 0; + boolean more = false; + /* we have a large number of items to send back so we need to stash the list in the session scope */ + if( entsInVClass.size() > REPLY_SIZE){ + more = true; + HttpSession session = vreq.getSession(true); + requestHash = Integer.toString((vclassURI + System.currentTimeMillis()).hashCode()); + session.setAttribute(requestHash, entsInVClass ); + + ListIterator entsFromVclass = entsInVClass.listIterator(); + while ( entsFromVclass.hasNext() && count < REPLY_SIZE ){ + entsToReturn.add( entsFromVclass.next()); + entsFromVclass.remove(); + count++; + } + if( log.isDebugEnabled() ){ log.debug("getEntitiesByVClass(): Creating reply with continue token, found " + numberOfEntsInVClass + " Individuals"); } + }else{ + if( log.isDebugEnabled() ) log.debug("getEntitiesByVClass(): sending " + numberOfEntsInVClass +" Individuals without continue token"); + entsToReturn = entsInVClass; + count = entsToReturn.size(); + } + + + //put all the entities on the JSON array + JSONArray ja = individualsToJson( entsToReturn ); + + //put the responseGroup number on the end of the JSON array + if( more ){ + try{ + JSONObject obj = new JSONObject(); + obj.put("resultGroup", "true"); + obj.put("size", count); + obj.put("total", numberOfEntsInVClass); + + StringBuffer nextUrlStr = req.getRequestURL(); + nextUrlStr.append("?") + .append("getEntitiesByVClass").append( "=1&" ) + .append("resultKey=").append( requestHash ); + obj.put("nextUrl", nextUrlStr.toString()); + + ja.put(obj); + }catch(JSONException je ){ + throw new ServletException("unable to create continuation as JSON: " + je.getMessage()); + } + } + + resp.setContentType("application/json"); + out.print( ja.toString() ); + + log.debug("done with getEntitiesByVClass()"); + + } + + private JSONArray individualsToJson(List individuals) throws ServletException { + JSONArray ja = new JSONArray(); + Iterator it = individuals.iterator(); + try{ + while(it.hasNext()){ + Individual ent = (Individual) it.next(); + JSONObject entJ = new JSONObject(); + entJ.put("name", ent.getName()); + entJ.put("URI", ent.getURI()); + ja.put( entJ ); + } + }catch(JSONException ex){ + throw new ServletException("could not convert list of Individuals into JSON: " + ex); + } + + return ja; + } + + private static final int REPLY_SIZE = 256; + + private static final Log log = LogFactory.getLog(JSONServlet.class.getName()); +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/VitroHttpServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/VitroHttpServlet.java index 1aa9f51d8..5f7858b16 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/VitroHttpServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/VitroHttpServlet.java @@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vedit.beans.LoginStatusBean; import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; +import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage; import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector; @@ -98,7 +99,19 @@ public class VitroHttpServlet extends HttpServlet { * Don't display a page that the user isn't authorized to see. * * @param actions - * the RequestedActions that need to be authorized. + * the RequestedActions that must be authorized. + */ + protected boolean isAuthorizedToDisplayPage(HttpServletRequest request, + HttpServletResponse response, RequestedAction... actions) { + return isAuthorizedToDisplayPage(request, response, + new Actions(Arrays.asList(actions))); + } + + /** + * Don't display a page that the user isn't authorized to see. + * + * @param actions + * the combination of RequestedActions that must be authorized. */ protected boolean isAuthorizedToDisplayPage(HttpServletRequest request, HttpServletResponse response, Actions actions) { @@ -112,7 +125,7 @@ public class VitroHttpServlet extends HttpServlet { + "' is authorized for actions: " + actions); return true; } - + log.debug("Servlet '" + this.getClass().getSimpleName() + "' is not authorized for actions: " + actions); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/ajax/VitroAjaxController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/ajax/VitroAjaxController.java index 2975b6bc3..4e85d7e35 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/ajax/VitroAjaxController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/ajax/VitroAjaxController.java @@ -67,7 +67,7 @@ public abstract class VitroAjaxController extends HttpServlet { */ @SuppressWarnings("unused") protected Actions requiredActions(VitroRequest vreq) { - return Actions.EMPTY; + return Actions.AUTHORIZED; } /** diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/AdminLoginController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/AdminLoginController.java index 5f1a6b780..c44d73f25 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/AdminLoginController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/AdminLoginController.java @@ -7,7 +7,11 @@ import static edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSour import java.util.HashMap; import java.util.Map; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; +import edu.cornell.mannlib.vitro.webapp.beans.User; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; @@ -23,9 +27,13 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem * URL can come here, but they need to pass Internal Authentication to proceed. */ public class AdminLoginController extends FreemarkerHttpServlet { + private static final Log log = LogFactory + .getLog(AdminLoginController.class); + public static final String PARAMETER_USERNAME = "username"; public static final String PARAMETER_PASSWORD = "password"; public static final String PARAMETER_NEW_PASSWORD = "newPassword"; + public static final String PARAMETER_CONFIRM_PASSWORD = "confirmPassword"; public static final String URL_THIS = "/admin/login"; public static final String URL_HOME_PAGE = "/"; @@ -36,10 +44,13 @@ public class AdminLoginController extends FreemarkerHttpServlet { private static final String MESSAGE_NO_PASSWORD = "errorNoPassword"; private static final String MESSAGE_LOGIN_FAILED = "errorLoginFailed"; private static final String MESSAGE_NEW_PASSWORD_REQUIRED = "newPasswordRequired"; + private static final String MESSAGE_NEW_PASSWORD_WRONG_LENGTH = "errorNewPasswordWrongLength"; + private static final String MESSAGE_NEW_PASSWORDS_DONT_MATCH = "errorNewPasswordsDontMatch"; + private static final String MESSAGE_NEW_PASSWORD_MATCHES_OLD = "errorNewPasswordMatchesOld"; @Override protected Actions requiredActions(VitroRequest vreq) { - return Actions.EMPTY; // No requirements to use this page. + return Actions.AUTHORIZED; // No requirements to use this page. } @Override @@ -56,6 +67,7 @@ public class AdminLoginController extends FreemarkerHttpServlet { private final String username; private final String password; private final String newPassword; + private final String confirmPassword; public Core(VitroRequest vreq) { this.auth = Authenticator.getInstance(vreq); @@ -64,20 +76,40 @@ public class AdminLoginController extends FreemarkerHttpServlet { this.password = nonNull(vreq.getParameter(PARAMETER_PASSWORD)); this.newPassword = nonNull(vreq .getParameter(PARAMETER_NEW_PASSWORD)); + this.confirmPassword = nonNull(vreq + .getParameter(PARAMETER_CONFIRM_PASSWORD)); + + log.debug("Parameters: username='" + username + "', password='" + + password + "', newPassword='" + newPassword + + "', confirmPassword='" + confirmPassword + "'"); } public ResponseValues process() { if (username.isEmpty() && password.isEmpty()) { - return showInitialForm(); + return showForm(); } if (username.isEmpty()) { - return showFormWithMessage(MESSAGE_NO_USERNAME); + return showForm(MESSAGE_NO_USERNAME); } if (password.isEmpty()) { - return showFormWithMessage(MESSAGE_NO_PASSWORD); + return showForm(MESSAGE_NO_PASSWORD); } - if (newPasswordRequired() && newPassword.isEmpty()) { - return showFormWithMessage(MESSAGE_NEW_PASSWORD_REQUIRED); + if (newPasswordRequired()) { + if (newPassword.isEmpty()) { + return showForm(MESSAGE_NEW_PASSWORD_REQUIRED); + } + if (!isPasswordValidLength(newPassword)) { + return showForm(MESSAGE_NEW_PASSWORD_REQUIRED, + MESSAGE_NEW_PASSWORD_WRONG_LENGTH); + } + if (newPassword.equals(password)) { + return showForm(MESSAGE_NEW_PASSWORD_REQUIRED, + MESSAGE_NEW_PASSWORD_MATCHES_OLD); + } + if (!newPassword.equals(confirmPassword)) { + return showForm(MESSAGE_NEW_PASSWORD_REQUIRED, + MESSAGE_NEW_PASSWORDS_DONT_MATCH); + } } boolean loggedIn = tryToLogin(); @@ -85,7 +117,7 @@ public class AdminLoginController extends FreemarkerHttpServlet { return goToHomePage(); } - return showFormWithMessage(MESSAGE_LOGIN_FAILED); + return showForm(MESSAGE_LOGIN_FAILED); } private boolean newPasswordRequired() { @@ -93,11 +125,16 @@ public class AdminLoginController extends FreemarkerHttpServlet { && auth.isPasswordChangeRequired(username); } + private boolean isPasswordValidLength(String pw) { + return (pw.length() >= User.MIN_PASSWORD_LENGTH) + && (pw.length() <= User.MAX_PASSWORD_LENGTH); + } + private boolean tryToLogin() { if (auth.isCurrentPassword(username, password)) { auth.recordLoginAgainstUserAccount(username, INTERNAL); - if (auth.isPasswordChangeRequired(username)) { + if (!newPassword.isEmpty()) { auth.recordNewPassword(username, newPassword); } @@ -107,18 +144,20 @@ public class AdminLoginController extends FreemarkerHttpServlet { } } - private ResponseValues showInitialForm() { - Map body = new HashMap(); - body.put("controllerUrl", UrlBuilder.getUrl(URL_THIS)); - body.put("username", ""); - return new TemplateResponseValues(TEMPLATE_NAME, body); - } - - private ResponseValues showFormWithMessage(String messageCode) { + private ResponseValues showForm(String... codes) { Map body = new HashMap(); body.put("controllerUrl", UrlBuilder.getUrl(URL_THIS)); body.put("username", username); - body.put(messageCode, Boolean.TRUE); + body.put("password", password); + body.put("newPassword", newPassword); + body.put("confirmPassword", confirmPassword); + + for (String code : codes) { + body.put(code, Boolean.TRUE); + } + + log.debug("showing form with values: " + body); + return new TemplateResponseValues(TEMPLATE_NAME, body); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/Authenticator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/Authenticator.java index 15df5bb25..a212fbe1a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/Authenticator.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/Authenticator.java @@ -2,10 +2,14 @@ package edu.cornell.mannlib.vitro.webapp.controller.authenticate; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.util.List; import javax.servlet.http.HttpServletRequest; +import org.apache.commons.codec.binary.Hex; + import edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource; import edu.cornell.mannlib.vitro.webapp.beans.User; @@ -115,4 +119,25 @@ public abstract class Authenticator { */ public abstract void recordUserIsLoggedOut(); + // ---------------------------------------------------------------------- + // Public utility methods. + // ---------------------------------------------------------------------- + + /** + * Apply MD5 to this string, and encode as a string of hex digits. Just + * right for storing passwords in the database, or hashing the password + * link. + */ + public static String applyMd5Encoding(String raw) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] digest = md.digest(raw.getBytes()); + char[] hexChars = Hex.encodeHex(digest); + return new String(hexChars).toUpperCase(); + } catch (NoSuchAlgorithmException e) { + // This can't happen with a normal Java runtime. + throw new RuntimeException(e); + } + } + } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/BasicAuthenticator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/BasicAuthenticator.java index ebbd5a09c..a24f5bf45 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/BasicAuthenticator.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/authenticate/BasicAuthenticator.java @@ -66,8 +66,7 @@ public class BasicAuthenticator extends Authenticator { return false; } - String md5NewPassword = Authenticate - .applyMd5Encoding(clearTextPassword); + String md5NewPassword = applyMd5Encoding(clearTextPassword); return md5NewPassword.equals(user.getMd5password()); } @@ -90,7 +89,7 @@ public class BasicAuthenticator extends Authenticator { return; } user.setOldPassword(user.getMd5password()); - user.setMd5password(Authenticate.applyMd5Encoding(newClearTextPassword)); + user.setMd5password(applyMd5Encoding(newClearTextPassword)); getUserDao().updateUser(user); } @@ -226,7 +225,7 @@ public class BasicAuthenticator extends Authenticator { if (iDao == null) { return Collections.emptyList(); } - + String selfEditorUri = SelfEditingConfiguration.getBean(request) .getIndividualUriFromUsername(iDao, username); if (selfEditorUri == null) { @@ -313,15 +312,15 @@ public class BasicAuthenticator extends Authenticator { if (wadf == null) { return null; } - + IndividualDao individualDao = wadf.getIndividualDao(); if (individualDao == null) { log.error("getIndividualDao: no IndividualDao"); } - + return individualDao; } - + /** * Get a reference to the WebappDaoFactory, or null. */ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/ApplicationBeanRetryController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/ApplicationBeanRetryController.java index 36ed0ce55..2ef05fee1 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/ApplicationBeanRetryController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/ApplicationBeanRetryController.java @@ -43,7 +43,7 @@ public class ApplicationBeanRetryController extends BaseEditController { try { super.doGet(request,response); } catch (Exception e) { - log.error("PortalRetryController encountered exception calling super.doGet()"); + log.error(e,e); } //create an EditProcessObject for this and put it in the session @@ -88,7 +88,7 @@ public class ApplicationBeanRetryController extends BaseEditController { RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP); request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp"); - request.setAttribute("formJsp","/templates/edit/specific/portal_retry.jsp"); + request.setAttribute("formJsp","/templates/edit/specific/applicationBean_retry.jsp"); request.setAttribute("scripts","/templates/edit/formBasic.js"); request.setAttribute("title","Site Information Editing Form"); request.setAttribute("_action",action); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java index 34913c4c2..f91d3be49 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java @@ -493,22 +493,6 @@ public class Authenticate extends VitroHttpServlet { // Public utility methods. // ---------------------------------------------------------------------- - /** - * Encode this password for storage in the database. Apply an MD5 encoding, - * and store the result as a string of hex digits. - */ - public static String applyMd5Encoding(String password) { - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - byte[] digest = md.digest(password.getBytes()); - char[] hexChars = Hex.encodeHex(digest); - return new String(hexChars).toUpperCase(); - } catch (NoSuchAlgorithmException e) { - // This can't happen with a normal Java runtime. - throw new RuntimeException(e); - } - } - /** * The servlet context should contain a map from User URIs to * {@link HttpSession}s. Get a reference to it, creating it if necessary. diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/N3MultiPartUpload.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/N3MultiPartUpload.java index f7ed0e0e9..338bb3bea 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/N3MultiPartUpload.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/N3MultiPartUpload.java @@ -38,11 +38,11 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.dao.UserDao; import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; import edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.FileUploadServletRequest; import edu.cornell.mannlib.vitro.webapp.utils.MailUtil; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/PrimitiveRdfEdit.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/PrimitiveRdfEdit.java index 0ff5ebdd9..2e8e8cd27 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/PrimitiveRdfEdit.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/PrimitiveRdfEdit.java @@ -26,7 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController; import edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena; import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils; public class PrimitiveRdfEdit extends VitroAjaxController { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/UserRetryController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/UserRetryController.java index 63eacb371..221270593 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/UserRetryController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/UserRetryController.java @@ -33,6 +33,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUser import edu.cornell.mannlib.vitro.webapp.beans.User; import edu.cornell.mannlib.vitro.webapp.controller.Controllers; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator; import edu.cornell.mannlib.vitro.webapp.dao.UserDao; public class UserRetryController extends BaseEditController { @@ -355,7 +356,7 @@ public class UserRetryController extends BaseEditController { log.error("Can't encode a null password"); } - String encodedPassword = Authenticate.applyMd5Encoding(rawPassword); + String encodedPassword = Authenticator.applyMd5Encoding(rawPassword); log.trace(action + ": Raw password '" + rawPassword + "', encoded '" + encodedPassword + "'"); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerHttpServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerHttpServlet.java index 0118c1173..046a13268 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerHttpServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerHttpServlet.java @@ -121,7 +121,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet { */ @SuppressWarnings("unused") protected Actions requiredActions(VitroRequest vreq) { - return Actions.EMPTY; + return Actions.AUTHORIZED; } // Subclasses will override diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java index cb2445797..ec2d97ac1 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java @@ -48,8 +48,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.VClassDao; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; import edu.cornell.mannlib.vitro.webapp.filestorage.model.FileInfo; import edu.cornell.mannlib.vitro.webapp.reasoner.SimpleReasoner; import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapper; @@ -144,11 +142,8 @@ public class IndividualController extends FreemarkerHttpServlet { } private void cleanUpSession(VitroRequest vreq) { - // Session cleanup: any time we are at an entity page we shouldn't have an editing config or submission - HttpSession session = vreq.getSession(); - session.removeAttribute("editjson"); - EditConfiguration.clearAllConfigsInSession(session); - EditSubmission.clearAllEditSubmissionsInSession(session); + // We should not remove edit configurations from the session because the user + // may resubmit the forms via the back button and the system is setup to handle this. } private Map getVerbosePropertyValues(VitroRequest vreq) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualListController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualListController.java index c3c4b3874..531bb833e 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualListController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualListController.java @@ -188,7 +188,7 @@ public class IndividualListController extends FreemarkerHttpServlet { try{ docs = index.search(query, null, ENTITY_LIST_CONTROLLER_MAX_RESULTS, - new Sort(Entity2LuceneDoc.term.NAMELOWERCASE)); + new Sort(Entity2LuceneDoc.term.NAME_LOWERCASE)); }catch(Throwable th){ log.error("Could not run search. " + th.getMessage()); docs = null; @@ -258,7 +258,7 @@ public class IndividualListController extends FreemarkerHttpServlet { Query alphaQuery = null; if( alpha != null && !"".equals(alpha) && alpha.length() == 1){ alphaQuery = - new PrefixQuery(new Term(Entity2LuceneDoc.term.NAMELOWERCASE, alpha.toLowerCase())); + new PrefixQuery(new Term(Entity2LuceneDoc.term.NAME_LOWERCASE, alpha.toLowerCase())); query.add(alphaQuery,BooleanClause.Occur.MUST); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/N3EditFormController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/N3EditFormController.java index 8f1b2ce27..0e0c4506a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/N3EditFormController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/N3EditFormController.java @@ -11,8 +11,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; import freemarker.template.ObjectWrapper; import freemarker.template.TemplateModelException; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/SamplesController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/SamplesController.java index b45a82215..0c3f0caa2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/SamplesController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/SamplesController.java @@ -13,7 +13,6 @@ import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; /** * Freemarker controller and template samples. diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VClassDao.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VClassDao.java index 7c9ce1e02..e3f696491 100755 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VClassDao.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VClassDao.java @@ -2,11 +2,10 @@ package edu.cornell.mannlib.vitro.webapp.dao; -import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel; -import edu.cornell.mannlib.vitro.webapp.beans.VClass; -import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; - -import java.util.List; +import java.util.List; + +import edu.cornell.mannlib.vitro.webapp.beans.VClass; +import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; public interface VClassDao { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VitroVocabulary.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VitroVocabulary.java index 53fc1f43b..c35eccd51 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VitroVocabulary.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VitroVocabulary.java @@ -193,6 +193,7 @@ public class VitroVocabulary { public static final String USERACCOUNT_STATUS = VITRO_AUTH + "status"; public static final String USERACCOUNT_PASSWORD_LINK_EXPIRES = VITRO_AUTH + "passwordLinkExpires"; public static final String USERACCOUNT_PASSWORD_CHANGE_REQUIRED = VITRO_AUTH + "passwordChangeRequired"; + public static final String USERACCOUNT_EXTERNAL_AUTH_ID = VITRO_AUTH + "externalAuthId"; public static final String USERACCOUNT_HAS_PERMISSION_SET = VITRO_AUTH + "hasPermissionSet"; public static final String PERMISSIONSET = VITRO_AUTH + "PermissionSet"; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactory.java index d5127f86e..cbc9a5adc 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactory.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactory.java @@ -118,8 +118,6 @@ public interface WebappDaoFactory { public LinksDao getLinksDao(); public LinktypeDao getLinktypeDao(); - public FlagDao getFlagDao(); - // TODO This goes away when the UserAccounts stuff is fully implemented - jblake. public UserDao getUserDao(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/WebappDaoFactoryFiltering.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/WebappDaoFactoryFiltering.java index 15fe0a643..184c63479 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/WebappDaoFactoryFiltering.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/WebappDaoFactoryFiltering.java @@ -179,10 +179,6 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory { return innerWebappDaoFactory.getUserURI(); } - public FlagDao getFlagDao() { - return innerWebappDaoFactory.getFlagDao(); - } - public KeywordIndividualRelationDao getKeys2EntsDao() { return innerWebappDaoFactory.getKeys2EntsDao(); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ApplicationDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ApplicationDaoJena.java index 4d4a3c243..32ecf8487 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ApplicationDaoJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ApplicationDaoJena.java @@ -29,12 +29,12 @@ public class ApplicationDaoJena extends JenaBaseDao implements ApplicationDao { Integer portalCount = null; List externallyLinkedNamespaces = null; - ModelChangedListener modelChangedListener = null; + ModelChangedListener externalNamespaceChangeListener = null; public ApplicationDaoJena(WebappDaoFactoryJena wadf) { super(wadf); - modelChangedListener = new ExternalNamespacesChangeListener(); - getOntModelSelector().getDisplayModel().register(modelChangedListener); + externalNamespaceChangeListener = new ExternalNamespacesChangeListener(); + getOntModelSelector().getDisplayModel().register(externalNamespaceChangeListener); } private String getApplicationResourceURI() { @@ -117,18 +117,19 @@ public class ApplicationDaoJena extends JenaBaseDao implements ApplicationDao { } public void close() { - if (modelChangedListener != null) { - getOntModelSelector().getDisplayModel().unregister(modelChangedListener); + if (externalNamespaceChangeListener != null) { + getOntModelSelector().getDisplayModel().unregister(externalNamespaceChangeListener); } } private static final boolean CLEAR_CACHE = true; + @Override public synchronized List getExternallyLinkedNamespaces() { return getExternallyLinkedNamespaces(!CLEAR_CACHE); } - public synchronized List getExternallyLinkedNamespaces(boolean clearCache) { + private synchronized List getExternallyLinkedNamespaces(boolean clearCache) { if (clearCache || externallyLinkedNamespaces == null) { externallyLinkedNamespaces = new ArrayList(); OntModel ontModel = getOntModelSelector().getDisplayModel(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ExternalTripleStoreInterface.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ExternalTripleStoreInterface.java deleted file mode 100644 index 37ed8bf7b..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/ExternalTripleStoreInterface.java +++ /dev/null @@ -1,13 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.dao.jena; - -import com.hp.hpl.jena.rdf.model.Statement; - -public interface ExternalTripleStoreInterface { - - public abstract void addToExternalStore(Statement stmt) throws TripleStoreUnavailableException; - - public abstract void removeFromExternalStore(Statement stmt) throws TripleStoreUnavailableException; - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/FlagDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/FlagDaoJena.java deleted file mode 100644 index eed1d3c4f..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/FlagDaoJena.java +++ /dev/null @@ -1,36 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.dao.jena; - -import java.util.HashSet; -import java.util.List; - -import com.hp.hpl.jena.ontology.OntModel; - -import edu.cornell.mannlib.vitro.webapp.dao.FlagDao; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; - -public class FlagDaoJena extends JenaBaseDao implements FlagDao { - - public FlagDaoJena(WebappDaoFactoryJena wadf) { - super(wadf); - } - - public String convertNumericFlagToInsertString(int numeric, String column, - String table) { - // TODO Auto-generated method stub - return null; - } - - public String convertNumericFlagToInsertString(int numeric, - String flagColumns) { - // TODO Auto-generated method stub - return null; - } - - public String getFlagNames(String table, String field) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaBaseDaoCon.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaBaseDaoCon.java index dcf86672d..7d82223b3 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaBaseDaoCon.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaBaseDaoCon.java @@ -167,6 +167,7 @@ public class JenaBaseDaoCon { protected DatatypeProperty USERACCOUNT_STATUS = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_STATUS); protected DatatypeProperty USERACCOUNT_PASSWORD_LINK_EXPIRES = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_PASSWORD_LINK_EXPIRES); protected DatatypeProperty USERACCOUNT_PASSWORD_CHANGE_REQUIRED = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_PASSWORD_CHANGE_REQUIRED); + protected DatatypeProperty USERACCOUNT_EXTERNAL_AUTH_ID = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_EXTERNAL_AUTH_ID); protected ObjectProperty USERACCOUNT_HAS_PERMISSION_SET = _constModel.createObjectProperty(VitroVocabulary.USERACCOUNT_HAS_PERMISSION_SET); protected OntClass PERMISSIONSET = _constModel.createClass(VitroVocabulary.PERMISSIONSET); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaToExternalTripleStoreSynchronizer.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaToExternalTripleStoreSynchronizer.java deleted file mode 100644 index fa740e1c9..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaToExternalTripleStoreSynchronizer.java +++ /dev/null @@ -1,108 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.dao.jena; - -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -//import org.openrdf.repository.Repository; -//import org.openrdf.repository.RepositoryConnection; -//import org.openrdf.repository.RepositoryResult; -//import org.openrdf.repository.http.HTTPRepository; -//import org.openrdf.repository.sail.SailRepository; -//import org.openrdf.rio.RDFFormat; -//import org.openrdf.sail.memory.MemoryStore; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.rdf.listeners.StatementListener; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.Statement; -import com.hp.hpl.jena.rdf.model.StmtIterator; - -public class JenaToExternalTripleStoreSynchronizer extends StatementListener implements ServletContextListener { - - private ExternalTripleStoreInterface extStore; - - public JenaToExternalTripleStoreSynchronizer(ExternalTripleStoreInterface extStore, Model additionsQueue, Model retractionsQueue) { - this.extStore = extStore; - } - - private Model additionsQueue = ModelFactory.createDefaultModel(); - private Model retractionsQueue = ModelFactory.createDefaultModel(); - - // TODO: add a statement filter to filter out password props - - @Override - public void addedStatement(Statement stmt) { - if (!retractionsQueue.contains(stmt)) { - additionsQueue.add(stmt); - } else { - retractionsQueue.remove(stmt); - } -// try { - StmtIterator sit = retractionsQueue.listStatements(); - while (sit.hasNext()) { - Statement s = sit.nextStatement(); - - } -// } catch (TripleStoreUnavailableException e) { -// // log something? -// } - } - - @Override - public void removedStatement(Statement stmt) { - processUpdate(stmt, REMOVE); - } - - public void processUpdate(Statement stmt, boolean mode) { -// Repository myRepository = new HTTPRepository(sesameServer, repositoryID); -// myRepository.initialize(); -// RepositoryConnection myConn = myRepository.getConnection(); -// System.out.println(myConn.size()+" statements in remote Sesame"); -// -// Repository tempRepository = new SailRepository(new MemoryStore()); -// tempRepository.initialize(); -// tempRepository.getConnection().add(retractionsFile, null, RDFFormat.N3); -// System.out.println(tempRepository.getConnection().size()+" statements to retract"); -// RepositoryResult retractStmts = tempRepository.getConnection().getStatements(null, null, null, false); -// System.out.println("Retracting statements from repository..."); -// //myConn.remove(retractStmts); -// while (retractStmts.hasNext()) { -// Statement stmt = retractStmts.next(); -// myConn.remove(stmt.getSubject(), stmt.getPredicate(), null); -// } - } - - public static final boolean ADD = true; - public static final boolean REMOVE = false; - - public static final int SESAME_SERVER_URI = 0; - public static final int SESAME_REPOSITORY_NAME = 1; - - public List getSesameRepositories() { - List sesameRepositoryList = new ArrayList(); - String[] testRepository = new String[2]; - testRepository[SESAME_SERVER_URI] = "http://vivosesame.mannlib.cornell.edu:8080/openrdf-sesame"; - testRepository[SESAME_REPOSITORY_NAME] = "syncTest"; - sesameRepositoryList.add(testRepository); - return sesameRepositoryList; - } - - public void contextInitialized(ServletContextEvent sce) { - - OntModel jenaOntModel = (OntModel) sce.getServletContext().getAttribute(JenaBaseDao.JENA_ONT_MODEL_ATTRIBUTE_NAME); - jenaOntModel.getBaseModel().register(this); - } - - public void contextDestroyed(ServletContextEvent sce) { - - } - - - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJena.java index bc6aa5560..fd28ece40 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJena.java @@ -61,6 +61,8 @@ public class UserAccountsDaoJena extends JenaBaseDao implements UserAccountsDao USERACCOUNT_PASSWORD_CHANGE_REQUIRED)); u.setLoginCount(getPropertyIntValue(r, USERACCOUNT_LOGIN_COUNT)); u.setStatusFromString(getPropertyStringValue(r, USERACCOUNT_STATUS)); + u.setExternalAuthId(getPropertyStringValue(r, + USERACCOUNT_EXTERNAL_AUTH_ID)); u.setPermissionSetUris(getPropertyResourceURIValues(r, USERACCOUNT_HAS_PERMISSION_SET)); return u; @@ -105,6 +107,8 @@ public class UserAccountsDaoJena extends JenaBaseDao implements UserAccountsDao addPropertyStringValue(res, USERACCOUNT_STATUS, userAccount .getStatus().toString(), model); } + addPropertyStringValue(res, USERACCOUNT_EXTERNAL_AUTH_ID, + userAccount.getExternalAuthId(), model); updatePropertyResourceURIValues(res, USERACCOUNT_HAS_PERMISSION_SET, userAccount.getPermissionSetUris(), model); @@ -158,6 +162,8 @@ public class UserAccountsDaoJena extends JenaBaseDao implements UserAccountsDao updatePropertyStringValue(res, USERACCOUNT_STATUS, userAccount .getStatus().toString(), model); } + updatePropertyStringValue(res, USERACCOUNT_EXTERNAL_AUTH_ID, + userAccount.getExternalAuthId(), model); updatePropertyResourceURIValues(res, USERACCOUNT_HAS_PERMISSION_SET, userAccount.getPermissionSetUris(), model); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java index 5d524d6a9..032eef959 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java @@ -444,13 +444,6 @@ public class WebappDaoFactoryJena implements WebappDaoFactory { return entityWebappDao = new IndividualDaoJena(this); } - public FlagDao getFlagDao() { - if (flagDao != null) - return flagDao; - else - return flagDao = new FlagDaoJena(this); - } - public KeywordIndividualRelationDao getKeys2EntsDao() { if (keys2EntsDao != null) return keys2EntsDao; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/BaseEditElement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/BaseEditElement.java index 3d98df9d4..158bbb8c6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/BaseEditElement.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/BaseEditElement.java @@ -9,7 +9,7 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/DateTimeWithPrecision.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/DateTimeWithPrecision.java index ddce96da7..1a5816397 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/DateTimeWithPrecision.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/DateTimeWithPrecision.java @@ -25,9 +25,9 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; import freemarker.template.Configuration; /** diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/EditElement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/EditElement.java index 662c43954..ebc5b562d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/EditElement.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/elements/EditElement.java @@ -6,8 +6,8 @@ import java.util.Map; import com.hp.hpl.jena.rdf.model.Literal; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; import freemarker.template.Configuration; /** * All classes that implement this interface must have a public constructor that diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/listener/impl/IndividualDataPropertyStatementProcessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/listener/impl/IndividualDataPropertyStatementProcessor.java index 7736fd74b..763190bd5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/listener/impl/IndividualDataPropertyStatementProcessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/listener/impl/IndividualDataPropertyStatementProcessor.java @@ -19,7 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.BasicValidation; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.BasicValidation; public class IndividualDataPropertyStatementProcessor implements ChangeListener { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/N3Validator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/N3Validator.java deleted file mode 100644 index f135b3d87..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/N3Validator.java +++ /dev/null @@ -1,9 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; - -import java.util.Map; - -public interface N3Validator { - public Map validate(EditConfiguration editConfig, EditSubmission editSub); -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditConfiguration.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/EditConfiguration.java similarity index 96% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditConfiguration.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/EditConfiguration.java index 03c0df221..854126779 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditConfiguration.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/EditConfiguration.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; @@ -28,11 +28,15 @@ import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ResourceFactory; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.UserToIndIdentifierFactory; import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.EditSubmissionPreprocessor; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.N3Validator; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.SparqlEvaluate; import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch; /** @@ -256,22 +260,9 @@ public class EditConfiguration { throw new Error("EditConfiguration.addSystemValues() needs a session"); /* ********** Get URI of a logged in user ************** */ - IdentifierBundle ids = RequestIdentifiers.getIdBundleForRequest(request); - List userUris = - UserToIndIdentifierFactory.getIndividualsForUser(ids); - - if( userUris == null || userUris.size() == 0 ){ - log.debug("Cound not find user ur for edit request"); - log.error("Could not find a userUri for edit request, make " + - "sure that there is an IdentifierBundleFactory that " + - "produces userUri identifiers in the context."); - } else if( userUris.size() > 1 ){ - log.error("Found multiple userUris, using the first in list."); - log.debug("Found multiple user uris"); - }else { - log.debug("EditConfiguration.java - checking system value for User URI " + userUris.get(0)); - getUrisInScope().put("editingUser",userUris.get(0)); - } + String userUri = EditN3Utils.getEditorUri(request); + log.debug("EditConfiguration.java - checking system value for User URI " + userUri); + getUrisInScope().put("editingUser", userUri); } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/Field.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/Field.java similarity index 99% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/Field.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/Field.java index 56189ddda..1c3f357fa 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/Field.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/Field.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/ModelSelector.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/ModelSelector.java similarity index 82% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/ModelSelector.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/ModelSelector.java index 3d77a041d..bc8829059 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/ModelSelector.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/ModelSelector.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SelectListGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/SelectListGenerator.java similarity index 92% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SelectListGenerator.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/SelectListGenerator.java index 96e38ce97..bfcb198f6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SelectListGenerator.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/SelectListGenerator.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration; import java.util.ArrayList; import java.util.Collections; @@ -187,8 +187,8 @@ public class SelectListGenerator { for( Individual ind : individuals ){ String uri = ind.getURI(); if( uri != null ){ - optionsMap.put(uri,ind.getName().trim()); - ++optionsCount; + optionsMap.put(uri,ind.getName().trim()); + ++optionsCount; } } @@ -212,13 +212,13 @@ public class SelectListGenerator { // individuals asserted in subclasses boolean inferenceAvailable = false; if (wDaoFact instanceof WebappDaoFactoryJena) { - PelletListener pl = ((WebappDaoFactoryJena) wDaoFact) - .getPelletListener(); - if (pl != null && pl.isConsistent() - && !pl.isInErrorState() - && !pl.isReasoning()) { - inferenceAvailable = true; - } + PelletListener pl = ((WebappDaoFactoryJena) wDaoFact) + .getPelletListener(); + if (pl != null && pl.isConsistent() + && !pl.isInErrorState() + && !pl.isReasoning()) { + inferenceAvailable = true; + } } VClass vclass = wDaoFact.getVClassDao().getVClassByURI( vclassUri ); @@ -227,41 +227,41 @@ public class SelectListGenerator { optionsMap.put("", "Could not find class " + vclassUri); }else{ Map individualMap = new HashMap(); - + for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(vclass.getURI(),-1,-1)) { - if (ind.getURI() != null) { - individualMap.put(ind.getURI(), ind); - } + if (ind.getURI() != null) { + individualMap.put(ind.getURI(), ind); + } } if (!inferenceAvailable) { - for (String subclassURI : wDaoFact.getVClassDao().getAllSubClassURIs(vclass.getURI())) { - for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(subclassURI,-1,-1)) { - if (ind.getURI() != null) { - individualMap.put(ind.getURI(), ind); - } + for (String subclassURI : wDaoFact.getVClassDao().getAllSubClassURIs(vclass.getURI())) { + for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(subclassURI,-1,-1)) { + if (ind.getURI() != null) { + individualMap.put(ind.getURI(), ind); + } } - } + } } List individuals = new ArrayList(); individuals.addAll(individualMap.values()); Collections.sort(individuals); - + for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(vclass.getURI(),-1,-1)) { - if (ind.getURI() != null) { - individualMap.put(ind.getURI(), ind); - } + if (ind.getURI() != null) { + individualMap.put(ind.getURI(), ind); + } } if (!inferenceAvailable) { - for (String subclassURI : wDaoFact.getVClassDao().getAllSubClassURIs(vclass.getURI())) { - for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(subclassURI,-1,-1)) { - if (ind.getURI() != null) { - individualMap.put(ind.getURI(), ind); - } + for (String subclassURI : wDaoFact.getVClassDao().getAllSubClassURIs(vclass.getURI())) { + for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(subclassURI,-1,-1)) { + if (ind.getURI() != null) { + individualMap.put(ind.getURI(), ind); + } } - } + } } individuals.addAll(individualMap.values()); @@ -274,8 +274,8 @@ public class SelectListGenerator { for( Individual ind : individuals ) { String uri = ind.getURI(); if( uri != null ) { - optionsMap.put(uri,ind.getName().trim()); - ++optionsCount; + optionsMap.put(uri,ind.getName().trim()); + ++optionsCount; } } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StandardModelSelector.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/StandardModelSelector.java similarity index 94% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StandardModelSelector.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/StandardModelSelector.java index 1313a9667..5129d2b80 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StandardModelSelector.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/StandardModelSelector.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StandardWDFSelector.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/StandardWDFSelector.java similarity index 90% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StandardWDFSelector.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/StandardWDFSelector.java index df9dd6512..c5fcaaac5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StandardWDFSelector.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/StandardWDFSelector.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/WDFSelector.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/WDFSelector.java similarity index 83% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/WDFSelector.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/WDFSelector.java index 66a45ed4b..98c404064 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/WDFSelector.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/WDFSelector.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DefaultPropertyFormGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DefaultPropertyFormGenerator.java new file mode 100644 index 000000000..d32a41506 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DefaultPropertyFormGenerator.java @@ -0,0 +1,23 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; + +import javax.servlet.http.HttpSession; + +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; + +/** + * Generates the edit configuration for a default property form. + * + */ +public class DefaultPropertyFormGenerator implements EditConfigurationGenerator { + + @Override + public EditConfiguration getEditConfiguration(VitroRequest vreq, + HttpSession session) { + // TODO Generate a edit conf for the default object property form and return it. + return null; + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/EditConfigurationGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/EditConfigurationGenerator.java new file mode 100644 index 000000000..4289155ef --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/EditConfigurationGenerator.java @@ -0,0 +1,12 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; + +import javax.servlet.http.HttpSession; + +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; + +public interface EditConfigurationGenerator { + public EditConfiguration getEditConfiguration( VitroRequest vreq, HttpSession session ); +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BaseEditSubmissionPreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/BaseEditSubmissionPreprocessor.java similarity index 68% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BaseEditSubmissionPreprocessor.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/BaseEditSubmissionPreprocessor.java index 124c508c7..7ae4d246e 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BaseEditSubmissionPreprocessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/BaseEditSubmissionPreprocessor.java @@ -1,6 +1,9 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors; + +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; + public abstract class BaseEditSubmissionPreprocessor implements EditSubmissionPreprocessor { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/CreateLabelFromNameFields.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/CreateLabelFromNameFields.java similarity index 89% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/CreateLabelFromNameFields.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/CreateLabelFromNameFields.java index 643052ca6..a6ab3e67e 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/CreateLabelFromNameFields.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/CreateLabelFromNameFields.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors; import java.util.Map; @@ -11,6 +11,10 @@ import org.apache.commons.logging.LogFactory; import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.vocabulary.XSD; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; + public class CreateLabelFromNameFields extends BaseEditSubmissionPreprocessor { private static final Log log = LogFactory.getLog(CreateLabelFromNameFields.class.getName()); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/DefaultAddMissingIndividualFormModelPreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/DefaultAddMissingIndividualFormModelPreprocessor.java similarity index 93% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/DefaultAddMissingIndividualFormModelPreprocessor.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/DefaultAddMissingIndividualFormModelPreprocessor.java index 99c4bf57f..06fbcf9e4 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/DefaultAddMissingIndividualFormModelPreprocessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/DefaultAddMissingIndividualFormModelPreprocessor.java @@ -1,9 +1,12 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ResourceFactory; + + + import javax.servlet.http.HttpServletRequest; /** diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmissionPreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/EditSubmissionPreprocessor.java similarity index 53% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmissionPreprocessor.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/EditSubmissionPreprocessor.java index f50d42c31..8a14c01d8 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmissionPreprocessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/EditSubmissionPreprocessor.java @@ -1,6 +1,8 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors; + +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; public interface EditSubmissionPreprocessor { public void preprocess(EditSubmission editSubmission); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/FoafNameToRdfsLabelPreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/FoafNameToRdfsLabelPreprocessor.java similarity index 94% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/FoafNameToRdfsLabelPreprocessor.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/FoafNameToRdfsLabelPreprocessor.java index 512d4e80e..49e979740 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/FoafNameToRdfsLabelPreprocessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/FoafNameToRdfsLabelPreprocessor.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors; import javax.servlet.http.HttpServletRequest; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/ModelChangePreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ModelChangePreprocessor.java similarity index 79% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/ModelChangePreprocessor.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ModelChangePreprocessor.java index fbc668a1b..89e03c517 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/ModelChangePreprocessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ModelChangePreprocessor.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors; import com.hp.hpl.jena.rdf.model.Model; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BasicValidation.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/BasicValidation.java similarity index 97% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BasicValidation.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/BasicValidation.java index 596ad7f29..e2c30274b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BasicValidation.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/BasicValidation.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators; import java.util.ArrayList; import java.util.Arrays; @@ -24,6 +24,9 @@ import com.hp.hpl.jena.rdf.model.ModelFactory; import edu.cornell.mannlib.vitro.webapp.beans.Datatype; import edu.cornell.mannlib.vitro.webapp.dao.jena.DatatypeDaoJena; import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; /** * User: bdc34 diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/DateTimeIntervalValidation.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/DateTimeIntervalValidation.java similarity index 96% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/DateTimeIntervalValidation.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/DateTimeIntervalValidation.java index 1d0e06e06..3954a6356 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/DateTimeIntervalValidation.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/DateTimeIntervalValidation.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators; import java.util.Calendar; import java.util.HashMap; @@ -15,6 +15,8 @@ import com.hp.hpl.jena.rdf.model.Literal; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary.Precision; import edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; public class DateTimeIntervalValidation implements N3Validator { private static Log log = LogFactory.getLog(DateTimeIntervalValidation.class); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/N3Validator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/N3Validator.java new file mode 100644 index 000000000..255ffc828 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/N3Validator.java @@ -0,0 +1,12 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators; + +import java.util.Map; + +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; + +public interface N3Validator { + public Map validate(EditConfiguration editConfig, EditSubmission editSub); +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StartDateBeforeEndDate.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/StartDateBeforeEndDate.java similarity index 92% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StartDateBeforeEndDate.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/StartDateBeforeEndDate.java index 254e3b6c2..a6c4b0dc0 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StartDateBeforeEndDate.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/StartDateBeforeEndDate.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators; import java.util.Calendar; import java.util.HashMap; @@ -11,6 +11,9 @@ import org.apache.commons.logging.LogFactory; import com.hp.hpl.jena.rdf.model.Literal; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; + public class StartDateBeforeEndDate implements N3Validator { private String startFieldName; private String endFieldName; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StartYearBeforeEndYear.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/StartYearBeforeEndYear.java similarity index 89% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StartYearBeforeEndYear.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/StartYearBeforeEndYear.java index fa5c5226f..fb7eb2df1 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/StartYearBeforeEndYear.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/validators/StartYearBeforeEndYear.java @@ -1,12 +1,15 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators; import java.util.HashMap; import java.util.Map; import com.hp.hpl.jena.rdf.model.Literal; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; + public class StartYearBeforeEndYear implements N3Validator { private String startFieldName; private String endFieldName; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/EditRequestDispatch.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/EditRequestDispatchController.java similarity index 81% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/EditRequestDispatch.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/EditRequestDispatchController.java index 99d9a45a7..40598fc83 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/EditRequestDispatch.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/EditRequestDispatchController.java @@ -2,6 +2,9 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller; +import java.util.HashMap; +import java.util.Map; + import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; @@ -12,8 +15,9 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils; /** @@ -26,11 +30,11 @@ import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils; * form. Try adding the behavior logic to the code that generates the * EditConfiguration for the form. */ -public class EditRequestDispatch extends FreemarkerHttpServlet { +public class EditRequestDispatchController extends FreemarkerHttpServlet { private static final long serialVersionUID = 1L; - public static Log log = LogFactory.getLog(EditRequestDispatch.class); + public static Log log = LogFactory.getLog(EditRequestDispatchController.class); - final String DEFAULT_OBJ_FORM = "defaultObjPropForm.jsp"; + final String DEFAULT_OBJ_FORM = "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultPropertyFormGenerator"; final String DEFAULT_ERROR_FORM = "error.jsp"; final String DEFAULT_ADD_INDIVIDUAL = "defaultAddMissingIndividualForm.jsp"; @Override @@ -117,15 +121,12 @@ public class EditRequestDispatch extends FreemarkerHttpServlet { // Keep track of what form we are using so it can be returned to after a failed validation // I'd like to get this from the request but sometimes that doesn't work well, internal forwards etc. - String url = "/edit/editRequestDispatch.jsp"; - vreq.setAttribute("formUrl", url + "?" + vreq.getQueryString()); - - //this are only used by the old jsp forms - vreq.setAttribute("preForm", "/edit/formPrefix.jsp"); - vreq.setAttribute("postForm", "/edit/formSuffix.jsp"); + //TODO: this needs to be the same as the mapping in web.xml + vreq.setAttribute("formUrl", "/edit/editRequest?" + vreq.getQueryString()); if ("delete".equals(command)) { - // %><% + //TODO: delete command is used with the defualt delete form + //maybe it doesn't need to be in here? return null; } @@ -138,6 +139,7 @@ public class EditRequestDispatch extends FreemarkerHttpServlet { // so maybe this logic shouldn't be here? if ( isEditOfExistingStmt && (wdf.getObjectPropertyDao().skipEditForm(predicateUri)) ) { log.debug("redirecting to object for predicate " + predicateUri); + //TODO: implement this feature // %> // // @@ -146,19 +148,15 @@ public class EditRequestDispatch extends FreemarkerHttpServlet { // <% return null; } - - String form = DEFAULT_OBJ_FORM; + //use default object property form if nothing else works + String editConfGeneratorName = DEFAULT_OBJ_FORM; // *** handle the case where the form is specified as a request parameter *** if( predicateUri == null && ( formParam != null && !formParam.isEmpty()) ){ - //case where a form was passed as a http parameter - form = formParam; - vreq.setAttribute("form", form); - //followed by - return null; + //form parameter must be a fully qualified java class name of a EditConfigurationGenerator implementation. + editConfGeneratorName = formParam; } - // *** handle the case where the form is decided by the predicate parameter *** @@ -170,34 +168,48 @@ public class EditRequestDispatch extends FreemarkerHttpServlet { ObjectProperty objectProp = wdf.getObjectPropertyDao().getObjectPropertyByURI(predicateUri); if( objectProp != null ){ vreq.setAttribute("predicate", objectProp); + //custom entry form use to be a jsp but it should now be a fully qualified java class name of a + //EditConfigurationGenerator implementation. customForm = objectProp.getCustomEntryForm(); + if (customForm != null && customForm.length() > 0) { + //if there is a custom form on the predicate, use that + editConfGeneratorName = objectProp.getCustomEntryForm(); + } } // Forward to create new is part of the default object property form // it should be handled in that form's EditConfiguration, not here. // The code that sets up the EditConfiguration should decide on - // different configurations and templates to use based on isForwardToCreateNew. + // different configurations and templates to use based on isForwardToCreateNew. + //TODO: make sure that forward to create new works on the default object property form if( isFowardToCreateNew(vreq, objectProp, command)){ return handleForwardToCreateNew(vreq, command, objectProp, isEditOfExistingStmt); } - - //Offer create new and select from existing are ignored if there is a custom form - if (customForm != null && customForm.length() > 0) { - //if there is a custom form on the predicate, use that - form = objectProp.getCustomEntryForm(); - } else { - //if it is nothing special, then use the default object property form - form = DEFAULT_OBJ_FORM ; - } - vreq.setAttribute("form", form); + + vreq.setAttribute("form", editConfGeneratorName); - // Now here we can no longer forward to a JSP. - // Somehow we need to be able to specify some java code that generates the - // EditConfiguration and the do the freemarker template merge. - - return null; + /**** make the edit configuration ***/ + EditConfiguration editConfig = makeEditConfiguration( editConfGeneratorName, vreq, session); + + //what template? + String template = editConfig.getTemplate(); + + //what goes in the map for templates? + Map templateData = new HashMap(); + templateData.put("editConfiguration", editConfig); + + return new TemplateResponseValues(editConfig.getTemplate(), templateData); } + private EditConfiguration makeEditConfiguration( + String editConfGeneratorName, VitroRequest vreq, HttpSession session) { + + //TODO: instianciate generator obj + //TODO: call getEditConfiguration() + + return null; + } + /* Forward to create new is part of the default object property form it should be handled in that form's EditConfiguration, not here. diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfForm.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfForm.java deleted file mode 100644 index 104f616bd..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfForm.java +++ /dev/null @@ -1,528 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller; - -import java.io.IOException; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.shared.Lock; - -import edu.cornell.mannlib.vitro.webapp.beans.Individual; -import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; -import edu.cornell.mannlib.vitro.webapp.dao.InsertException; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; -import edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena; -import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelChangePreprocessor; - -/** - * This servlet will process EditConfigurations with query parameters - * to perform an edit. - * - * TODO: rename this class ProcessN3Edit - */ -public class ProcessRdfForm extends FreemarkerHttpServlet{ - - private Log log = LogFactory.getLog(ProcessRdfForm.class); - - //bdc34: this is likely to become a servlet instead of a jsp. - // You can get a reference to the servlet from the context. - // this will need to be converted from a jsp to something else - public static final String POST_EDIT_CLEANUP_JSP = "postEditCleanUp.jsp"; - - public void doPost(HttpServletRequest request, HttpServletResponse response) throws - ServletException, IOException{ - doGet(request, response); - } - - public void doGet(HttpServletRequest request, HttpServletResponse response) throws - ServletException, IOException{ - VitroRequest vreq = new VitroRequest(request); - - //get the EditConfiguration - EditConfiguration configuration = getEditConfiguration(request); - if(configuration == null){ - doEditConfigNotFound( vreq, response); - return; - } - - //get the EditSubmission - EditSubmission submission = new EditSubmission(vreq.getParameterMap(), configuration); - EditSubmission.putEditSubmissionInSession(request.getSession(), submission); - - boolean hasErrors = processValidationErrors(vreq, configuration, submission, response); - if( hasErrors) - return; //processValidationErrors() already forwarded to redisplay the form with validation messages - - // get the models to work with in case the write model and query model are not the defaults - OntModel queryModel = configuration.getQueryModelSelector().getModel(request, getServletContext()); - OntModel writeModel = configuration.getWriteModelSelector().getModel(request,getServletContext()); - - AdditionsAndRetractions changes; - if(configuration.isUpdate()){ - changes = editExistingResource(configuration, submission); - }else{ - changes = createNewResource(configuration, submission); - } - - changes = getMinimalChanges( changes ); - - if( configuration.isUseDependentResourceDelete() ) - changes = addDependentDeletes(changes, queryModel); - - preprocessModels(changes, configuration, vreq); - - applyChangesToWriteModel(changes, queryModel, writeModel, EditN3Utils.getEditorUri(vreq) ); - - //Here we are trying to get the entity to return to URL, - //Maybe this should be in POST_EDIT_CLEANUP? - if( configuration.getEntityToReturnTo() != null ){ - request.setAttribute("entityToReturnTo", substitueForURL( configuration, submission)); - } - - doPostEdit(vreq,response); - } - - /** - * Execute any modelChangePreprocessors in the editConfiguration; - * Move to EditN3Utils - */ - protected void preprocessModels(AdditionsAndRetractions changes, EditConfiguration editConfiguration, VitroRequest request){ - - List modelChangePreprocessors = editConfiguration.getModelChangePreprocessors(); - if ( modelChangePreprocessors != null ) { - for ( ModelChangePreprocessor pp : modelChangePreprocessors ) { - //these work by side effect - pp.preprocess( changes.getRetractions(), changes.getAdditions(), request ); - } - } - } - - //Move to EditN3Utils - protected AdditionsAndRetractions getMinimalChanges( AdditionsAndRetractions changes ){ - //make a model with all the assertions and a model with all the - //retractions, do a diff on those and then only add those to the jenaOntModel - Model allPossibleAssertions = changes.getAdditions(); - Model allPossibleRetractions = changes.getRetractions(); - - //find the minimal change set - Model assertions = allPossibleAssertions.difference( allPossibleRetractions ); - Model retractions = allPossibleRetractions.difference( allPossibleAssertions ); - return new AdditionsAndRetractions(assertions,retractions); - } - - protected AdditionsAndRetractions addDependentDeletes( AdditionsAndRetractions changes, Model queryModel){ - //Add retractions for dependent resource delete if that is configured and - //if there are any dependent resources. - Model depResRetractions = - DependentResourceDeleteJena - .getDependentResourceDeleteForChange(changes.getAdditions(),changes.getRetractions(),queryModel); - - changes.getRetractions().add(depResRetractions); - return changes; - } - - - protected void applyChangesToWriteModel(AdditionsAndRetractions changes, OntModel queryModel, OntModel writeModel, String editorUri) { - //side effect: modify the write model with the changes - Lock lock = null; - try{ - lock = writeModel.getLock(); - lock.enterCriticalSection(Lock.WRITE); - writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,true)); - writeModel.add( changes.getAdditions() ); - writeModel.remove( changes.getRetractions() ); - }catch(Throwable t){ - log.error("error adding edit change n3required model to in memory model \n"+ t.getMessage() ); - }finally{ - writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,false)); - lock.leaveCriticalSection(); - } - } - - private EditConfiguration getEditConfiguration(HttpServletRequest request) { - HttpSession session = request.getSession(); - EditConfiguration editConfiguration = EditConfiguration.getConfigFromSession(session, request); - return editConfiguration; - } - - @SuppressWarnings("static-access") - private AdditionsAndRetractions createNewResource(EditConfiguration editConfiguration , EditSubmission submission){ - List errorMessages = new ArrayList(); - - EditN3Generator n3Subber = editConfiguration.getN3Generator(); - - if(log.isDebugEnabled()){ - log.debug("creating a new relation " + editConfiguration.getPredicateUri()); - } - - //handle creation of a new object property and maybe a resource - List n3Required = editConfiguration.getN3Required(); - List n3Optional = editConfiguration.getN3Optional(); - - /* ********** URIs and Literals on Form/Parameters *********** */ - //sub in resource uris off form - n3Required = n3Subber.subInUris(submission.getUrisFromForm(), n3Required); - n3Optional = n3Subber.subInUris(submission.getUrisFromForm(), n3Optional); - if(log.isDebugEnabled()) { - Utilities.logRequiredOpt("substituted in URIs off from ",n3Required,n3Optional); - } - - //sub in literals from form - n3Required = n3Subber.subInLiterals(submission.getLiteralsFromForm(), n3Required); - n3Optional = n3Subber.subInLiterals(submission.getLiteralsFromForm(), n3Optional); - if(log.isDebugEnabled()) { - Utilities.logRequiredOpt("substituted in literals off from ",n3Required,n3Optional); - } - - /* ****************** URIs and Literals in Scope ************** */ - n3Required = n3Subber.subInUris( editConfiguration.getUrisInScope(), n3Required); - n3Optional = n3Subber.subInUris( editConfiguration.getUrisInScope(), n3Optional); - if(log.isDebugEnabled()) { - Utilities.logRequiredOpt("substituted in URIs from scope ",n3Required,n3Optional); - } - - n3Required = n3Subber.subInLiterals( editConfiguration.getLiteralsInScope(), n3Required); - n3Optional = n3Subber.subInLiterals( editConfiguration.getLiteralsInScope(), n3Optional); - if(log.isDebugEnabled()) { - Utilities.logRequiredOpt("substituted in Literals from scope ",n3Required,n3Optional); - } - - //deal with required N3 - List requiredNewModels = new ArrayList(); - for(String n3 : n3Required){ - try{ - Model model = ModelFactory.createDefaultModel(); - StringReader reader = new StringReader(n3); - model.read(reader, "", "N3"); - requiredNewModels.add(model); - } catch(Throwable t){ - errorMessages.add("error processing required n3 string \n" + t.getMessage() + '\n' + "n3: \n" + n3); - } - } - - if(!errorMessages.isEmpty()){ - String error = "problems processing required n3: \n"; - for(String errorMsg: errorMessages){ - error += errorMsg + '\n'; - } - if(log.isDebugEnabled()){ - log.debug(error); - } - } - List requiredAssertions = requiredNewModels; - - //deal with optional N3 - List optionalNewModels = new ArrayList(); - for(String n3 : n3Optional){ - try{ - Model model = ModelFactory.createDefaultModel(); - StringReader reader = new StringReader(n3); - model.read(reader, "", "N3"); - optionalNewModels.add(model); - }catch(Throwable t){ - //if an optional N3 block fails to parse it will be ignored - //this is what is meant by optional. - } - } - requiredAssertions.addAll( optionalNewModels ); - - return new AdditionsAndRetractions(requiredAssertions, Collections.emptyList()); - } - - @SuppressWarnings("static-access") - private AdditionsAndRetractions editExistingResource(EditConfiguration editConfiguration, EditSubmission submission) { - - Map> fieldAssertions = Utilities.fieldsToAssertionMap(editConfiguration.getFields()); - Map> fieldRetractions = Utilities.fieldsToRetractionMap(editConfiguration.getFields()); - EditN3Generator n3Subber = editConfiguration.getN3Generator(); - - /* ********** URIs and Literals on Form/Parameters *********** */ - fieldAssertions = n3Subber.substituteIntoValues(submission.getUrisFromForm(), submission.getLiteralsFromForm(), fieldAssertions); - if(log.isDebugEnabled()) { - Utilities.logAddRetract("substituted in literals from form",fieldAssertions,fieldRetractions); - } - - /* ****************** URIs and Literals in Scope ************** */ - fieldAssertions = n3Subber.substituteIntoValues(editConfiguration.getUrisInScope(), editConfiguration.getLiteralsInScope(), fieldAssertions ); - fieldRetractions = n3Subber.substituteIntoValues(editConfiguration.getUrisInScope(), editConfiguration.getLiteralsInScope(), fieldRetractions); - if(log.isDebugEnabled()) { - Utilities.logAddRetract("substituted in URIs and Literals from scope",fieldAssertions,fieldRetractions); - } - - //do edits ever need new resources? (YES) -/* Map varToNewResource = newToUriMap(editConfiguration.getNewResources(),wdf); - fieldAssertions = n3Subber.substituteIntoValues(varToNewResource, null, fieldAssertions); - if(log.isDebugEnabled()) { - Utilities.logAddRetract("substituted in URIs for new resources",fieldAssertions,fieldRetractions); - } - entToReturnTo = n3Subber.subInUris(varToNewResource,entToReturnTo); -*/ - //editing an existing statement - List requiredFieldAssertions = new ArrayList(); - List requiredFieldRetractions = new ArrayList(); - - List errorMessages = new ArrayList(); - - for(String fieldName : fieldAssertions.keySet()){ - List assertions = fieldAssertions.get(fieldName); - List retractions = fieldRetractions.get(fieldName); - - for(String n3: assertions){ - try{ - Model model = ModelFactory.createDefaultModel(); - StringReader reader = new StringReader(n3); - model.read(reader, "", "N3"); - }catch(Throwable t){ - String errMsg = "error processing N3 assertion string from field " + fieldName + "\n" + - t.getMessage() + '\n' + "n3: \n" + n3; - errorMessages.add(errMsg); - if(log.isDebugEnabled()){ - log.debug(errMsg); - } - } - } - - for(String n3 : retractions){ - try{ - Model model = ModelFactory.createDefaultModel(); - StringReader reader = new StringReader(n3); - model.read(reader, "", "N3"); - requiredFieldRetractions.add(model); - }catch(Throwable t){ - String errMsg = "error processing N3 retraction string from field " + fieldName + "\n"+ - t.getMessage() + '\n' + "n3: \n" + n3; - errorMessages.add(errMsg); - if(log.isDebugEnabled()){ - log.debug(errMsg); - } - } - } - } - - return new AdditionsAndRetractions(requiredFieldAssertions, requiredFieldRetractions); - } - - private void doEditConfigNotFound(VitroRequest request, HttpServletResponse response) { - HashMapmap = new HashMap(); - map.put("message", "No editing configuration found, cannot process edit."); - ResponseValues values = new TemplateResponseValues("message.ftl", map); - try { - doResponse(request,response,values); - } catch (TemplateProcessingException e) { - log.error("Could not process template for doEditConfigNotFound()",e); - } - } - - private boolean processValidationErrors(VitroRequest vreq, - EditConfiguration editConfiguration, EditSubmission submission, - HttpServletResponse response) throws ServletException, IOException { - - Map errors = submission.getValidationErrors(); - - if(errors != null && !errors.isEmpty()){ - String form = editConfiguration.getFormUrl(); - vreq.setAttribute("formUrl", form); - vreq.setAttribute("view", vreq.getParameter("view")); - - RequestDispatcher requestDispatcher = vreq.getRequestDispatcher(editConfiguration.getFormUrl()); - requestDispatcher.forward(vreq, response); - return true; - } - return false; - } - - private void doPostEdit(VitroRequest vreq, HttpServletResponse response) throws ServletException, IOException { - RequestDispatcher requestDispatcher = vreq.getRequestDispatcher(POST_EDIT_CLEANUP_JSP); - requestDispatcher.forward(vreq, response); - } - - //Move to EditN3Utils but keep make new uris here - public static class Utilities { - - private static Log log = LogFactory.getLog(ProcessRdfForm.class); - static Random random = new Random(); - - public static Map> fieldsToAssertionMap( Map fields){ - Map> out = new HashMap>(); - for( String fieldName : fields.keySet()){ - Field field = fields.get(fieldName); - - List copyOfN3 = new ArrayList(); - for( String str : field.getAssertions()){ - copyOfN3.add(str); - } - out.put( fieldName, copyOfN3 ); - } - return out; - } - - public static Map> fieldsToRetractionMap( Map fields){ - Map> out = new HashMap>(); - for( String fieldName : fields.keySet()){ - Field field = fields.get(fieldName); - - List copyOfN3 = new ArrayList(); - for( String str : field.getRetractions()){ - copyOfN3.add(str); - } - out.put( fieldName, copyOfN3 ); - } - return out; - } - - public static Map newToUriMap(Map newResources, WebappDaoFactory wdf){ - HashMap newVarsToUris = new HashMap(); - HashSet newUris = new HashSet(); - for( String key : newResources.keySet()){ - String prefix = newResources.get(key); - String uri = makeNewUri(prefix, wdf); - while( newUris.contains(uri) ){ - uri = makeNewUri(prefix,wdf); - } - newVarsToUris.put(key,uri); - newUris.add(uri); - } - return newVarsToUris; - } - - - public static String makeNewUri(String prefix, WebappDaoFactory wdf){ - if( prefix == null || prefix.length() == 0 ){ - String uri = null; - try{ - uri = wdf.getIndividualDao().getUnusedURI(null); - }catch(InsertException ex){ - log.error("could not create uri"); - } - return uri; - } - - String goodURI = null; - int attempts = 0; - while( goodURI == null && attempts < 30 ){ - Individual ind = new IndividualImpl(); - ind.setURI( prefix + random.nextInt() ); - try{ - goodURI = wdf.getIndividualDao().getUnusedURI(ind); - }catch(InsertException ex){ - log.debug("could not create uri"); - } - attempts++; - } - if( goodURI == null ) - log.error("could not create uri for prefix " + prefix); - return goodURI; - - } - - private static boolean logAddRetract(String msg, Map>add, Map>retract){ - log.debug(msg); - if( add != null ) log.debug( "assertions: " + add.toString() ); - if( retract != null ) log.debug( "retractions: " + retract.toString() ); - return true; - } - - private static boolean logRequiredOpt(String msg, Listrequired, Listoptional){ - log.debug(msg); - if( required != null ) log.debug( "required: " + required.toString() ); - if( optional != null ) log.debug( "optional: " + optional.toString() ); - return true; - } - - } - - /** - * This is intended to substitute vars from the EditConfiguration and - * EditSubmission into the URL to return to. - */ - protected String substitueForURL(EditConfiguration configuration, EditSubmission submission){ - - List entToReturnTo = new ArrayList(1); - entToReturnTo.add(configuration.getEntityToReturnTo()); - - EditN3Generator n3Subber = configuration.getN3Generator(); - // Substitute in URIs from the submission - entToReturnTo = n3Subber.subInUris(submission.getUrisFromForm(), entToReturnTo); - - // Substitute in URIs from the scope of the EditConfiguration - entToReturnTo = n3Subber.subInUris(configuration.getUrisInScope(), entToReturnTo); - - //The problem is that subInURI will add < and > around URIs for the N3 syntax. - //for the URL to return to, replace < and > from URI additions. - return entToReturnTo.get(0).trim().replaceAll("<","").replaceAll(">",""); - } - - /** - * This is a data structure to allow a method to return - * a pair of Model objects for additions and retractions. - * - * Move this to its own class - */ - protected class AdditionsAndRetractions { - Model additions; - Model retractions; - - public AdditionsAndRetractions(Listadds, Listretractions){ - Model allAdds = ModelFactory.createDefaultModel(); - Model allRetractions = ModelFactory.createDefaultModel(); - - for( Model model : adds ) { - allAdds.add( model ); - } - for( Model model : retractions ){ - allRetractions.add( model ); - } - - this.setAdditions(allAdds); - this.setRetractions(allRetractions); - } - - public AdditionsAndRetractions(Model add, Model retract){ - this.additions = add; - this.retractions = retract; - } - - public Model getAdditions() { - return additions; - } - public void setAdditions(Model additions) { - this.additions = additions; - } - public Model getRetractions() { - return retractions; - } - public void setRetractions(Model retractions) { - this.retractions = retractions; - } - } -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfFormController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfFormController.java new file mode 100644 index 000000000..14b1d10af --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfFormController.java @@ -0,0 +1,227 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.hp.hpl.jena.ontology.OntModel; + +import edu.cornell.mannlib.vitro.webapp.beans.Individual; +import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; +import edu.cornell.mannlib.vitro.webapp.dao.InsertException; +import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.AdditionsAndRetractions; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.ProcessRdfForm; + +/** + * This servlet will process EditConfigurations with query parameters + * to perform an edit. + * + * TODO: rename this class ProcessN3Edit + */ +public class ProcessRdfFormController extends FreemarkerHttpServlet{ + + private Log log = LogFactory.getLog(ProcessRdfFormController.class); + + + //bdc34: this is likely to become a servlet instead of a jsp. + // You can get a reference to the servlet from the context. + // this will need to be converted from a jsp to something else + public static final String POST_EDIT_CLEANUP_JSP = "postEditCleanUp.jsp"; + + public void doPost(HttpServletRequest request, HttpServletResponse response) throws + ServletException, IOException{ + doGet(request, response); + } + + public void doGet(HttpServletRequest request, HttpServletResponse response) throws + ServletException, IOException{ + VitroRequest vreq = new VitroRequest(request); + + //get the EditConfiguration + EditConfiguration configuration = getEditConfiguration(request); + if(configuration == null){ + doEditConfigNotFound( vreq, response); + return; + } + + //get the EditSubmission + EditSubmission submission = new EditSubmission(vreq.getParameterMap(), configuration); + EditSubmission.putEditSubmissionInSession(request.getSession(), submission); + + boolean hasErrors = doValidationErrors(vreq, configuration, submission, response); + if( hasErrors) + return; //processValidationErrors() already forwarded to redisplay the form with validation messages + + // get the models to work with in case the write model and query model are not the defaults + OntModel queryModel = configuration.getQueryModelSelector().getModel(request, getServletContext()); + OntModel writeModel = configuration.getWriteModelSelector().getModel(request,getServletContext()); + + AdditionsAndRetractions changes; + if(configuration.isUpdate()){ + changes = ProcessRdfForm.editExistingResource(configuration, submission); + }else{ + changes = ProcessRdfForm.createNewResource(configuration, submission); + } + + if( configuration.isUseDependentResourceDelete() ) + changes = ProcessRdfForm.addDependentDeletes(changes, queryModel); + + ProcessRdfForm.preprocessModels(changes, configuration, vreq); + + ProcessRdfForm.applyChangesToWriteModel(changes, queryModel, writeModel, EditN3Utils.getEditorUri(vreq) ); + + //Here we are trying to get the entity to return to URL, + //Maybe this should be in POST_EDIT_CLEANUP? + if( configuration.getEntityToReturnTo() != null ){ + request.setAttribute("entityToReturnTo", ProcessRdfForm.substitueForURL( configuration, submission)); + } + + doPostEdit(vreq,response); + } + private EditConfiguration getEditConfiguration(HttpServletRequest request) { + HttpSession session = request.getSession(); + EditConfiguration editConfiguration = EditConfiguration.getConfigFromSession(session, request); + return editConfiguration; + } + private void doEditConfigNotFound(VitroRequest request, HttpServletResponse response) { + HashMapmap = new HashMap(); + map.put("message", "No editing configuration found, cannot process edit."); + ResponseValues values = new TemplateResponseValues("message.ftl", map); + try { + doResponse(request,response,values); + } catch (TemplateProcessingException e) { + log.error("Could not process template for doEditConfigNotFound()",e); + } + } + + private boolean doValidationErrors(VitroRequest vreq, + EditConfiguration editConfiguration, EditSubmission submission, + HttpServletResponse response) throws ServletException, IOException { + + Map errors = submission.getValidationErrors(); + + if(errors != null && !errors.isEmpty()){ + String form = editConfiguration.getFormUrl(); + vreq.setAttribute("formUrl", form); + vreq.setAttribute("view", vreq.getParameter("view")); + + RequestDispatcher requestDispatcher = vreq.getRequestDispatcher(editConfiguration.getFormUrl()); + requestDispatcher.forward(vreq, response); + return true; + } + return false; + } + + private void doPostEdit(VitroRequest vreq, HttpServletResponse response) throws ServletException, IOException { + RequestDispatcher requestDispatcher = vreq.getRequestDispatcher(POST_EDIT_CLEANUP_JSP); + requestDispatcher.forward(vreq, response); + } + + //Move to EditN3Utils but keep make new uris here + public static class Utilities { + + private static Log log = LogFactory.getLog(ProcessRdfFormController.class); + static Random random = new Random(); + + public static Map> fieldsToAssertionMap( Map fields){ + Map> out = new HashMap>(); + for( String fieldName : fields.keySet()){ + Field field = fields.get(fieldName); + + List copyOfN3 = new ArrayList(); + for( String str : field.getAssertions()){ + copyOfN3.add(str); + } + out.put( fieldName, copyOfN3 ); + } + return out; + } + + public static Map> fieldsToRetractionMap( Map fields){ + Map> out = new HashMap>(); + for( String fieldName : fields.keySet()){ + Field field = fields.get(fieldName); + + List copyOfN3 = new ArrayList(); + for( String str : field.getRetractions()){ + copyOfN3.add(str); + } + out.put( fieldName, copyOfN3 ); + } + return out; + } + + public static Map newToUriMap(Map newResources, WebappDaoFactory wdf){ + HashMap newVarsToUris = new HashMap(); + HashSet newUris = new HashSet(); + for( String key : newResources.keySet()){ + String prefix = newResources.get(key); + String uri = makeNewUri(prefix, wdf); + while( newUris.contains(uri) ){ + uri = makeNewUri(prefix,wdf); + } + newVarsToUris.put(key,uri); + newUris.add(uri); + } + return newVarsToUris; + } + + + public static String makeNewUri(String prefix, WebappDaoFactory wdf){ + if( prefix == null || prefix.length() == 0 ){ + String uri = null; + try{ + uri = wdf.getIndividualDao().getUnusedURI(null); + }catch(InsertException ex){ + log.error("could not create uri"); + } + return uri; + } + + String goodURI = null; + int attempts = 0; + while( goodURI == null && attempts < 30 ){ + Individual ind = new IndividualImpl(); + ind.setURI( prefix + random.nextInt() ); + try{ + goodURI = wdf.getIndividualDao().getUnusedURI(ind); + }catch(InsertException ex){ + log.debug("could not create uri"); + } + attempts++; + } + if( goodURI == null ) + log.error("could not create uri for prefix " + prefix); + return goodURI; + + } + + + + } +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/AdditionsAndRetractions.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/AdditionsAndRetractions.java new file mode 100644 index 000000000..f60693a51 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/AdditionsAndRetractions.java @@ -0,0 +1,54 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit; + +import java.util.List; +import java.util.Map; + +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.rdf.model.ModelFactory; + +/** + * This is a data structure to allow a method to return + * a pair of Model objects for additions and retractions. + * + * Move this to its own class + */ +public class AdditionsAndRetractions { + Model additions; + Model retractions; + + public AdditionsAndRetractions(Listadds, Listretractions){ + Model allAdds = ModelFactory.createDefaultModel(); + Model allRetractions = ModelFactory.createDefaultModel(); + + for( Model model : adds ) { + allAdds.add( model ); + } + for( Model model : retractions ){ + allRetractions.add( model ); + } + + this.setAdditions(allAdds); + this.setRetractions(allRetractions); + } + + public AdditionsAndRetractions(Model add, Model retract){ + this.additions = add; + this.retractions = retract; + } + + public Model getAdditions() { + return additions; + } + public void setAdditions(Model additions) { + this.additions = additions; + } + public Model getRetractions() { + return retractions; + } + public void setRetractions(Model retractions) { + this.retractions = retractions; + } + +} \ No newline at end of file diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3Generator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditN3Generator.java similarity index 98% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3Generator.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditN3Generator.java index a040b72ff..b2bc6cfad 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3Generator.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditN3Generator.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit; import java.math.BigDecimal; import java.util.ArrayList; @@ -19,6 +19,8 @@ import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.vocabulary.XSD; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; + /** * Builds the N3 strings for the given EditConfiguration, model * and EditSubmission. Main responsibility is the proper substitution @@ -107,7 +109,7 @@ public class EditN3Generator { * references, Matcher.quoteReplacement() serves the purpose. * */ - protected String subInLiterals(String var, Literal literal, String target){ + public String subInLiterals(String var, Literal literal, String target){ String varRegex = "\\?" + var + "(?=\\.\\p{Space}|\\p{Space})"; if (target==null ) { log.error("subInLiterals was passed a null target"); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3Utils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditN3Utils.java similarity index 75% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3Utils.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditN3Utils.java index 64efba566..e8c4ca5b6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3Utils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditN3Utils.java @@ -1,6 +1,9 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit; + +import java.util.ArrayList; +import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -8,25 +11,22 @@ import org.apache.xerces.util.XMLChar; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory; -import edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasRoleLevel; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.IsUser; public class EditN3Utils { + /** Several places could give an editor URI. Return the first one. */ + public static String getEditorUri(HttpServletRequest request) { + IdentifierBundle ids = RequestIdentifiers.getIdBundleForRequest(request); - public static String getEditorUri(HttpServletRequest request){ - String editorUri = "Unknown N3 Editor"; - boolean selfEditing = VitroRequestPrep.isSelfEditing(request); - IdentifierBundle ids = - RequestIdentifiers.getIdBundleForRequest(request); - - if( selfEditing ) - editorUri = SelfEditingIdentifierFactory.getSelfEditingUri(ids); - else - editorUri = RoleIdentifier.getUri(ids); - - return editorUri; - } + List uris = new ArrayList(); + uris.addAll(IsUser.getUserUris(ids)); + uris.addAll(HasAssociatedIndividual.getIndividualUris(ids)); + uris.addAll(HasRoleLevel.getRoleLevelUris(ids)); + uris.add("Unknown N3 Editor"); + return uris.get(0); + } /** * Strips from a string any characters that are not valid in XML 1.0 diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmission.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditSubmission.java similarity index 97% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmission.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditSubmission.java index 095964fd8..61ed8e286 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmission.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/EditSubmission.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -29,6 +29,10 @@ import com.hp.hpl.jena.vocabulary.XSD; import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral; import edu.cornell.mannlib.vitro.webapp.edit.elements.EditElement; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.BasicValidation; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.N3Validator; public class EditSubmission { private String editKey; @@ -209,7 +213,7 @@ public class EditSubmission { validationErrors.putAll(this.basicValidation.validateFiles( fileItems ) ); } - protected Literal createLiteral(String value, String datatypeUri, String lang) { + public Literal createLiteral(String value, String datatypeUri, String lang) { if( datatypeUri != null ){ if( "http://www.w3.org/2001/XMLSchema:anyURI".equals(datatypeUri) ){ try { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/ProcessRdfForm.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/ProcessRdfForm.java new file mode 100644 index 000000000..e04c5fdc8 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/ProcessRdfForm.java @@ -0,0 +1,279 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit; + +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.hp.hpl.jena.ontology.OntModel; +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.rdf.model.ModelFactory; +import com.hp.hpl.jena.shared.Lock; + +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena; +import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller.ProcessRdfFormController.Utilities; + +public class ProcessRdfForm { + + private static Log log = LogFactory.getLog(ProcessRdfForm.class); + + /** + * Execute any modelChangePreprocessors in the editConfiguration; + * + */ + public static void preprocessModels(AdditionsAndRetractions changes, EditConfiguration editConfiguration, VitroRequest request){ + + List modelChangePreprocessors = editConfiguration.getModelChangePreprocessors(); + if ( modelChangePreprocessors != null ) { + for ( ModelChangePreprocessor pp : modelChangePreprocessors ) { + //these work by side effect + pp.preprocess( changes.getRetractions(), changes.getAdditions(), request ); + } + } + } + + protected static AdditionsAndRetractions getMinimalChanges( AdditionsAndRetractions changes ){ + //make a model with all the assertions and a model with all the + //retractions, do a diff on those and then only add those to the jenaOntModel + Model allPossibleAssertions = changes.getAdditions(); + Model allPossibleRetractions = changes.getRetractions(); + + //find the minimal change set + Model assertions = allPossibleAssertions.difference( allPossibleRetractions ); + Model retractions = allPossibleRetractions.difference( allPossibleAssertions ); + return new AdditionsAndRetractions(assertions,retractions); + } + + public static AdditionsAndRetractions addDependentDeletes( AdditionsAndRetractions changes, Model queryModel){ + //Add retractions for dependent resource delete if that is configured and + //if there are any dependent resources. + Model depResRetractions = + DependentResourceDeleteJena + .getDependentResourceDeleteForChange(changes.getAdditions(),changes.getRetractions(),queryModel); + + changes.getRetractions().add(depResRetractions); + return changes; + } + + + public static void applyChangesToWriteModel(AdditionsAndRetractions changes, OntModel queryModel, OntModel writeModel, String editorUri) { + //side effect: modify the write model with the changes + Lock lock = null; + try{ + lock = writeModel.getLock(); + lock.enterCriticalSection(Lock.WRITE); + writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,true)); + writeModel.add( changes.getAdditions() ); + writeModel.remove( changes.getRetractions() ); + }catch(Throwable t){ + log.error("error adding edit change n3required model to in memory model \n"+ t.getMessage() ); + }finally{ + writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,false)); + lock.leaveCriticalSection(); + } + } + + + @SuppressWarnings("static-access") + public static AdditionsAndRetractions createNewResource(EditConfiguration editConfiguration , EditSubmission submission){ + List errorMessages = new ArrayList(); + + EditN3Generator n3Subber = editConfiguration.getN3Generator(); + + if(log.isDebugEnabled()){ + log.debug("creating a new relation " + editConfiguration.getPredicateUri()); + } + + //handle creation of a new object property and maybe a resource + List n3Required = editConfiguration.getN3Required(); + List n3Optional = editConfiguration.getN3Optional(); + + /* ********** URIs and Literals on Form/Parameters *********** */ + //sub in resource uris off form + n3Required = n3Subber.subInUris(submission.getUrisFromForm(), n3Required); + n3Optional = n3Subber.subInUris(submission.getUrisFromForm(), n3Optional); + if(log.isDebugEnabled()) { + logRequiredOpt("substituted in URIs off from ",n3Required,n3Optional); + } + + //sub in literals from form + n3Required = n3Subber.subInLiterals(submission.getLiteralsFromForm(), n3Required); + n3Optional = n3Subber.subInLiterals(submission.getLiteralsFromForm(), n3Optional); + if(log.isDebugEnabled()) { + logRequiredOpt("substituted in literals off from ",n3Required,n3Optional); + } + + /* ****************** URIs and Literals in Scope ************** */ + n3Required = n3Subber.subInUris( editConfiguration.getUrisInScope(), n3Required); + n3Optional = n3Subber.subInUris( editConfiguration.getUrisInScope(), n3Optional); + if(log.isDebugEnabled()) { + logRequiredOpt("substituted in URIs from scope ",n3Required,n3Optional); + } + + n3Required = n3Subber.subInLiterals( editConfiguration.getLiteralsInScope(), n3Required); + n3Optional = n3Subber.subInLiterals( editConfiguration.getLiteralsInScope(), n3Optional); + if(log.isDebugEnabled()) { + logRequiredOpt("substituted in Literals from scope ",n3Required,n3Optional); + } + + //deal with required N3 + List requiredNewModels = new ArrayList(); + for(String n3 : n3Required){ + try{ + Model model = ModelFactory.createDefaultModel(); + StringReader reader = new StringReader(n3); + model.read(reader, "", "N3"); + requiredNewModels.add(model); + } catch(Throwable t){ + errorMessages.add("error processing required n3 string \n" + t.getMessage() + '\n' + "n3: \n" + n3); + } + } + + if(!errorMessages.isEmpty()){ + String error = "problems processing required n3: \n"; + for(String errorMsg: errorMessages){ + error += errorMsg + '\n'; + } + if(log.isDebugEnabled()){ + log.debug(error); + } + } + List requiredAssertions = requiredNewModels; + + //deal with optional N3 + List optionalNewModels = new ArrayList(); + for(String n3 : n3Optional){ + try{ + Model model = ModelFactory.createDefaultModel(); + StringReader reader = new StringReader(n3); + model.read(reader, "", "N3"); + optionalNewModels.add(model); + }catch(Throwable t){ + //if an optional N3 block fails to parse it will be ignored + //this is what is meant by optional. + } + } + requiredAssertions.addAll( optionalNewModels ); + + return getMinimalChanges(new AdditionsAndRetractions(requiredAssertions, Collections.emptyList())); + } + + @SuppressWarnings("static-access") + public static AdditionsAndRetractions editExistingResource(EditConfiguration editConfiguration, EditSubmission submission) { + + Map> fieldAssertions = Utilities.fieldsToAssertionMap(editConfiguration.getFields()); + Map> fieldRetractions = Utilities.fieldsToRetractionMap(editConfiguration.getFields()); + EditN3Generator n3Subber = editConfiguration.getN3Generator(); + + /* ********** URIs and Literals on Form/Parameters *********** */ + fieldAssertions = n3Subber.substituteIntoValues(submission.getUrisFromForm(), submission.getLiteralsFromForm(), fieldAssertions); + if(log.isDebugEnabled()) { + logAddRetract("substituted in literals from form",fieldAssertions,fieldRetractions); + } + + /* ****************** URIs and Literals in Scope ************** */ + fieldAssertions = n3Subber.substituteIntoValues(editConfiguration.getUrisInScope(), editConfiguration.getLiteralsInScope(), fieldAssertions ); + fieldRetractions = n3Subber.substituteIntoValues(editConfiguration.getUrisInScope(), editConfiguration.getLiteralsInScope(), fieldRetractions); + if(log.isDebugEnabled()) { + logAddRetract("substituted in URIs and Literals from scope",fieldAssertions,fieldRetractions); + } + + //do edits ever need new resources? (YES) +/* Map varToNewResource = newToUriMap(editConfiguration.getNewResources(),wdf); + fieldAssertions = n3Subber.substituteIntoValues(varToNewResource, null, fieldAssertions); + if(log.isDebugEnabled()) { + Utilities.logAddRetract("substituted in URIs for new resources",fieldAssertions,fieldRetractions); + } + entToReturnTo = n3Subber.subInUris(varToNewResource,entToReturnTo); +*/ + //editing an existing statement + List requiredFieldAssertions = new ArrayList(); + List requiredFieldRetractions = new ArrayList(); + + List errorMessages = new ArrayList(); + + for(String fieldName : fieldAssertions.keySet()){ + List assertions = fieldAssertions.get(fieldName); + List retractions = fieldRetractions.get(fieldName); + + for(String n3: assertions){ + try{ + Model model = ModelFactory.createDefaultModel(); + StringReader reader = new StringReader(n3); + model.read(reader, "", "N3"); + }catch(Throwable t){ + String errMsg = "error processing N3 assertion string from field " + fieldName + "\n" + + t.getMessage() + '\n' + "n3: \n" + n3; + errorMessages.add(errMsg); + if(log.isDebugEnabled()){ + log.debug(errMsg); + } + } + } + + for(String n3 : retractions){ + try{ + Model model = ModelFactory.createDefaultModel(); + StringReader reader = new StringReader(n3); + model.read(reader, "", "N3"); + requiredFieldRetractions.add(model); + }catch(Throwable t){ + String errMsg = "error processing N3 retraction string from field " + fieldName + "\n"+ + t.getMessage() + '\n' + "n3: \n" + n3; + errorMessages.add(errMsg); + if(log.isDebugEnabled()){ + log.debug(errMsg); + } + } + } + } + + return getMinimalChanges(new AdditionsAndRetractions(requiredFieldAssertions, requiredFieldRetractions)); + } + + + /** + * This is intended to substitute vars from the EditConfiguration and + * EditSubmission into the URL to return to. + */ + public static String substitueForURL(EditConfiguration configuration, EditSubmission submission){ + + List entToReturnTo = new ArrayList(1); + entToReturnTo.add(configuration.getEntityToReturnTo()); + + EditN3Generator n3Subber = configuration.getN3Generator(); + // Substitute in URIs from the submission + entToReturnTo = n3Subber.subInUris(submission.getUrisFromForm(), entToReturnTo); + + // Substitute in URIs from the scope of the EditConfiguration + entToReturnTo = n3Subber.subInUris(configuration.getUrisInScope(), entToReturnTo); + + //The problem is that subInURI will add < and > around URIs for the N3 syntax. + //for the URL to return to, replace < and > from URI additions. + return entToReturnTo.get(0).trim().replaceAll("<","").replaceAll(">",""); + } + + private static boolean logAddRetract(String msg, Map>add, Map>retract){ + log.debug(msg); + if( add != null ) log.debug( "assertions: " + add.toString() ); + if( retract != null ) log.debug( "retractions: " + retract.toString() ); + return true; + } + + private static boolean logRequiredOpt(String msg, Listrequired, Listoptional){ + log.debug(msg); + if( required != null ) log.debug( "required: " + required.toString() ); + if( optional != null ) log.debug( "optional: " + optional.toString() ); + return true; + } +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHash.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/RdfLiteralHash.java similarity index 99% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHash.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/RdfLiteralHash.java index 5109d39ba..e46aab8b2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHash.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/RdfLiteralHash.java @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit; import java.util.List; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SparqlEvaluate.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/SparqlEvaluate.java similarity index 94% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SparqlEvaluate.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/SparqlEvaluate.java index 3e03e0541..fde47f7db 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SparqlEvaluate.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/processEdit/SparqlEvaluate.java @@ -1,10 +1,13 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.edit.n3editing; +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit; import com.hp.hpl.jena.query.*; import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Resource; + +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -82,7 +85,7 @@ public class SparqlEvaluate { // return varToUris; // } - protected Map sparqlEvaluateForLiterals( EditConfiguration editConfig, Map varToSparql) { + public Map sparqlEvaluateForLiterals( EditConfiguration editConfig, Map varToSparql) { Map uriScope = editConfig.getUrisInScope(); Map literalScope = editConfig.getLiteralsInScope(); @@ -104,7 +107,7 @@ public class SparqlEvaluate { return varToLiterals; } - protected Map sparqlEvaluateForUris( EditConfiguration editConfig, MapvarToSparql) { + public Map sparqlEvaluateForUris( EditConfiguration editConfig, MapvarToSparql) { Map uriScope = editConfig.getUrisInScope(); Map literalScope = editConfig.getLiteralsInScope(); @@ -133,7 +136,7 @@ public class SparqlEvaluate { return varToUris; } -// protected Map sparqlEvaluateForAdditionalLiterals( EditConfiguration editConfig) { +// public Map sparqlEvaluateForAdditionalLiterals( EditConfiguration editConfig) { // Map varToSpqrql = editConfig.getSparqlForAdditionalLiteralsInScope(); // Map uriScope = editConfig.getUrisInScope(); // Map literalScope = editConfig.getLiteralsInScope(); @@ -156,7 +159,7 @@ public class SparqlEvaluate { // return varToLiterals; // } - protected String queryToUri(String querystr){ + public String queryToUri(String querystr){ String value = null; QueryExecution qe = null; try{ @@ -192,7 +195,7 @@ public class SparqlEvaluate { } - protected Literal queryToLiteral(String querystr){ + public Literal queryToLiteral(String querystr){ Literal value = null; QueryExecution qe = null; try{ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/VitroRequestPrep.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/VitroRequestPrep.java index feb08fe42..5142bf791 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/VitroRequestPrep.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/VitroRequestPrep.java @@ -14,20 +14,15 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.hp.hpl.jena.query.Dataset; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory.SelfEditing; import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList; import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean; -import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.filtering.WebappDaoFactoryFiltering; @@ -127,9 +122,6 @@ public class VitroRequestPrep implements Filter { log.debug("Found a WebappDaoFactory in the session and using it for this request"); } - RoleLevel role = RoleLevel.getRoleFromLoginStatus(req); - log.debug("setting role to "+role.getShorthand()); - VitroFilters filters = null; filters = getFiltersFromContextFilterFactory(req, wdf); @@ -194,25 +186,6 @@ public class VitroRequestPrep implements Filter { sc.setAttribute("FilterFactory", ff); } - /** - * Check to see whether any of the current identifiers is a SelfEditing - * identifier. - */ - public static boolean isSelfEditing(HttpServletRequest request) { - HttpSession session = request.getSession(false); - if (session == null) { - return false; - } - - IdentifierBundle idBundle = RequestIdentifiers.getIdBundleForRequest(request); - SelfEditing selfId = SelfEditingIdentifierFactory.getSelfEditingIdentifier(idBundle); - if (selfId == null) { - return false; - } - - return true; - } - @Override public void destroy() { // Nothing to do. diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java index b2f0390f8..7cf2cd947 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java @@ -102,9 +102,12 @@ public class SimpleReasoner extends StatementListener { if (stmt.getPredicate().equals(RDF.type)) { addedABoxTypeAssertion(stmt, inferenceModel); setMostSpecificTypes(stmt.getSubject(), inferenceModel); - } else { + } + /* uncomment this to enable subproperty/equivalent property inferencing. sjm222 5/13/2011 + else { addedABoxAssertion(stmt,inferenceModel); } + */ } catch (Exception e) { // don't stop the edit if there's an exception log.error("Exception while adding inferences: ", e); @@ -123,9 +126,12 @@ public class SimpleReasoner extends StatementListener { if (stmt.getPredicate().equals(RDF.type)) { removedABoxTypeAssertion(stmt, inferenceModel); setMostSpecificTypes(stmt.getSubject(), inferenceModel); - } else { + } + /* uncomment this to enable subproperty/equivalent property inferencing. sjm222 5/13/2011 + else { removedABoxAssertion(stmt, inferenceModel); } + */ } catch (Exception e) { // don't stop the edit if there's an exception log.error("Exception while retracting inferences: ", e); @@ -164,7 +170,9 @@ public class SimpleReasoner extends StatementListener { addedSubClass(subject,object,inferenceModel); addedSubClass(object,subject,inferenceModel); } - } else if (stmt.getPredicate().equals(RDFS.subPropertyOf) || stmt.getPredicate().equals(OWL.equivalentProperty)) { + } + /* uncomment this to enable sub property/equivalent property inferencing. sjm222 5/13/2011 + else if (stmt.getPredicate().equals(RDFS.subPropertyOf) || stmt.getPredicate().equals(OWL.equivalentProperty)) { OntProperty subject = tboxModel.getOntProperty((stmt.getSubject()).getURI()); OntProperty object = tboxModel.getOntProperty(((Resource)stmt.getObject()).getURI()); @@ -174,8 +182,10 @@ public class SimpleReasoner extends StatementListener { // equivalent property is the same as subProperty in both directions addedSubProperty(subject,object,inferenceModel); addedSubProperty(object,subject,inferenceModel); - } - } + } + } + */ + } catch (Exception e) { // don't stop the edit if there's an exception log.error("Exception while adding inference(s): ", e); @@ -210,7 +220,9 @@ public class SimpleReasoner extends StatementListener { removedSubClass(subject,object,inferenceModel); removedSubClass(object,subject,inferenceModel); } - } else if (stmt.getPredicate().equals(RDFS.subPropertyOf) || stmt.getPredicate().equals(OWL.equivalentProperty)) { + } + /* uncomment this to enable sub property / equivalent property inferencing. sjm222 5/13/2011. + else if (stmt.getPredicate().equals(RDFS.subPropertyOf) || stmt.getPredicate().equals(OWL.equivalentProperty)) { OntProperty subject = tboxModel.getOntProperty((stmt.getSubject()).getURI()); OntProperty object = tboxModel.getOntProperty(((Resource)stmt.getObject()).getURI()); @@ -222,6 +234,7 @@ public class SimpleReasoner extends StatementListener { removedSubProperty(object,subject); } } + */ } catch (Exception e) { // don't stop the edit if there's an exception log.error("Exception while removing inference(s): ", e); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroHighlighter.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroHighlighter.java index aaafb4714..061f40ffa 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroHighlighter.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroHighlighter.java @@ -14,7 +14,6 @@ import net.sf.jga.fn.UnaryFunctor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.solr.analysis.HTMLStripReader; import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.Individual; @@ -141,23 +140,27 @@ public abstract class VitroHighlighter extends UnaryFunctor { private final String stripHtml(String in){ /* make a string with html stripped out */ - Reader stripIn =new HTMLStripReader( new StringReader( in ) ); - StringWriter stripOut = new StringWriter(in.length()); - - char bytes[] = new char[5000]; - int bytesRead = 0; - try { - //this is a mess, there must be a better way to do this. - while ( true ){ - bytesRead = stripIn.read( bytes ); - if( bytesRead == -1 ) break; - stripOut.write(bytes, 0, bytesRead ); - } - } catch (IOException e1) { - log.error("LuceneHighlighter.getHighlightFragments()" + - " - unable to strip html" + e1); - } - return stripOut.toString(); + // ryounes 5/16/2011 Broken with upgrade to Solr 3.1: HTMLStripReader has been removed. + // According to change list, should use HTMLStripCharFilter, but it's not immediately clear how + // to migrate this code. Will enter Jira issue. +// Reader stripIn = new HTMLStripReader( new StringReader( in ) ); +// StringWriter stripOut = new StringWriter(in.length()); +// +// char bytes[] = new char[5000]; +// int bytesRead = 0; +// try { +// //this is a mess, there must be a better way to do this. +// while ( true ){ +// bytesRead = stripIn.read( bytes ); +// if( bytesRead == -1 ) break; +// stripOut.write(bytes, 0, bytesRead ); +// } +// } catch (IOException e1) { +// log.error("LuceneHighlighter.getHighlightFragments()" + +// " - unable to strip html" + e1); +// } +// return stripOut.toString(); + return in; } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java index f950ed5bc..2e83e231f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java @@ -30,8 +30,7 @@ import org.apache.lucene.search.TopDocs; import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.util.Version; import org.json.JSONArray; - -import com.hp.hpl.jena.sparql.lib.org.json.JSONObject; +import org.json.JSONObject; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseBasicAjaxControllers; @@ -118,7 +117,7 @@ public class AutocompleteController extends VitroAjaxController { try{ Document doc = searcherForRequest.doc(topDocs.scoreDocs[i].doc); String uri = doc.get(VitroLuceneTermNames.URI); - String name = doc.get(VitroLuceneTermNames.NAMERAW); + String name = doc.get(VitroLuceneTermNames.NAME_RAW); SearchResult result = new SearchResult(name, uri); results.add(result); } catch(Exception e){ @@ -208,7 +207,7 @@ public class AutocompleteController extends VitroAjaxController { String stemParam = (String) request.getParameter("stem"); boolean stem = "true".equals(stemParam); - String termName = stem ? VitroLuceneTermNames.NAME : VitroLuceneTermNames.NAMEUNSTEMMED; + String termName = stem ? VitroLuceneTermNames.AC_NAME_STEMMED : VitroLuceneTermNames.AC_NAME_UNSTEMMED; BooleanQuery boolQuery = new BooleanQuery(); @@ -245,7 +244,7 @@ public class AutocompleteController extends VitroAjaxController { private Query makeUntokenizedNameQuery(String querystr) { querystr = querystr.toLowerCase(); - String termName = VitroLuceneTermNames.NAMELOWERCASE; + String termName = VitroLuceneTermNames.NAME_LOWERCASE; BooleanQuery query = new BooleanQuery(); log.debug("Adding wildcard query on unanalyzed name"); query.add( diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java index 9f4931532..c6ae4d3cb 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java @@ -65,6 +65,7 @@ import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery; import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQueryFactory; import edu.cornell.mannlib.vitro.webapp.search.lucene.CustomSimilarity; import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc; +import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames; import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexFactory; import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneSetup; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.LinkTemplateModel; @@ -140,7 +141,7 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear //There may be other non-html formats in the future Format format = getFormat(vreq); boolean wasXmlRequested = Format.XML == format; - log.debug("xml was the requested format"); + log.debug("Requested format was " + (wasXmlRequested ? "xml" : "html")); boolean wasHtmlRequested = ! wasXmlRequested; try { @@ -228,7 +229,7 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear Document document = searcherForRequest.doc(scoreDoc.doc); Explanation explanation = searcherForRequest.explain(query, scoreDoc.doc); - log.debug("Document title: "+ document.get(Entity2LuceneDoc.VitroLuceneTermNames.NAME) + " score: " +scoreDoc.score); + log.debug("Document title: "+ document.get(Entity2LuceneDoc.VitroLuceneTermNames.AC_NAME_STEMMED) + " score: " +scoreDoc.score); log.debug("Scoring of the doc explained " + explanation.toString()); log.debug("Explanation's description "+ explanation.getDescription()); log.debug("ALLTEXT: " + document.get(Entity2LuceneDoc.VitroLuceneTermNames.ALLTEXT)); @@ -364,7 +365,7 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear body.put("title", qtxt + " - " + appBean.getApplicationName() + " Search Results"); - body.put("hitsLength",hitsLength); + body.put("hitCount",hitsLength); body.put("startIndex", startIndex); body.put("pagingLinks", getPagingLinks(startIndex, hitsPerPage, @@ -404,7 +405,7 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear Document doc; try { doc = searcher.doc(topDocs.scoreDocs[i].doc); - String name =doc.get(Entity2LuceneDoc.term.NAME); + String name =doc.get(Entity2LuceneDoc.term.AC_NAME_STEMMED); if( name != null && name.length() > 0) alphas.add( name.substring(0, 1)); } catch (CorruptIndexException e) { @@ -621,7 +622,7 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear BooleanQuery boolQuery = new BooleanQuery(); boolQuery.add( query, BooleanClause.Occur.MUST ); boolQuery.add( - new WildcardQuery(new Term(Entity2LuceneDoc.term.NAME, alpha+'*')), + new WildcardQuery(new Term(Entity2LuceneDoc.term.AC_NAME_STEMMED, alpha+'*')), BooleanClause.Occur.MUST); query = boolQuery; } @@ -682,7 +683,15 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear // qp.setStemmedToUnstemmed(map); MultiFieldQueryParser qp = new MultiFieldQueryParser(Version.LUCENE_29, new String[]{ - "name", "nameunstemmed", "type", "moniker", "ALLTEXT", "ALLTEXTUNSTEMMED", "nameraw" , "classLocalName", "classLocalNameLowerCase" }, analyzer); + VitroLuceneTermNames.AC_NAME_STEMMED, + VitroLuceneTermNames.AC_NAME_UNSTEMMED, + VitroLuceneTermNames.RDFTYPE, + VitroLuceneTermNames.MONIKER, + VitroLuceneTermNames.ALLTEXT, + VitroLuceneTermNames.ALLTEXTUNSTEMMED, + VitroLuceneTermNames.NAME_LOWERCASE, + VitroLuceneTermNames.CLASSLOCALNAME, + VitroLuceneTermNames.CLASSLOCALNAMELOWERCASE }, analyzer); // QueryParser qp = new QueryParser(Version.LUCENE_29, "name", analyzer); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrAutocompleteController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrAutocompleteController.java new file mode 100644 index 000000000..4a06424c7 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrAutocompleteController.java @@ -0,0 +1,287 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.search.controller; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.lucene.search.BooleanQuery; +import org.apache.solr.client.solrj.SolrQuery; +import org.apache.solr.client.solrj.SolrServer; +import org.apache.solr.client.solrj.response.QueryResponse; +import org.apache.solr.common.SolrDocument; +import org.apache.solr.common.SolrDocumentList; +import org.apache.solr.common.params.FacetParams; +import org.json.JSONArray; +import org.json.JSONObject; + +import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; +import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseBasicAjaxControllers; +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController; +import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames; +import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup; + +/** + * AutocompleteController generates autocomplete content + * through a Solr search. + */ + +// RY Rename to AutocompleteController once the transition to Solr is complete. +public class SolrAutocompleteController extends VitroAjaxController { + + private static final long serialVersionUID = 1L; + private static final Log log = LogFactory.getLog(SolrAutocompleteController.class); + + //private static final String TEMPLATE_DEFAULT = "autocompleteResults.ftl"; + + private static final String PARAM_QUERY = "term"; + private static final String PARAM_RDFTYPE = "type"; + + String NORESULT_MSG = ""; + private static final int DEFAULT_MAX_HIT_COUNT = 1000; + + public static final int MAX_QUERY_LENGTH = 500; + + @Override + protected Actions requiredActions(VitroRequest vreq) { + return new Actions(new UseBasicAjaxControllers()); + } + + @Override + protected void doRequest(VitroRequest vreq, HttpServletResponse response) + throws IOException, ServletException { + + try { + + String qtxt = vreq.getParameter(PARAM_QUERY); + + SolrQuery query = getQuery(qtxt, vreq); + if (query == null ) { + log.debug("query for '" + qtxt +"' is null."); + doNoQuery(response); + return; + } + log.debug("query for '" + qtxt +"' is " + query.toString()); + + SolrServer solr = SolrSetup.getSolrServer(getServletContext()); + QueryResponse queryResponse = solr.query(query); + + if ( queryResponse == null) { + log.error("Query response for a search was null"); + doNoSearchResults(response); + return; + } + + SolrDocumentList docs = queryResponse.getResults(); + + if ( docs == null) { + log.error("Docs for a search was null"); + doNoSearchResults(response); + return; + } + + long hitCount = docs.getNumFound(); + log.debug("Number of hits = " + hitCount); + if ( hitCount < 1 ) { + doNoSearchResults(response); + return; + } + + List results = new ArrayList(); + for (SolrDocument doc : docs) { + try{ + String uri = doc.get(VitroLuceneTermNames.URI).toString(); + // VitroLuceneTermNames.NAME_RAW is a multivalued field, so doc.get() returns a list + @SuppressWarnings("unchecked") + String name = ((List) doc.get(VitroLuceneTermNames.NAME_RAW)).get(0); + SearchResult result = new SearchResult(name, uri); + results.add(result); + } catch(Exception e){ + log.error("problem getting usable Individuals from search " + + "hits" + e.getMessage()); + } + } + + Collections.sort(results); + + // map.put("results", results); + // writeTemplate(TEMPLATE_DEFAULT, map, config, vreq, response); + + JSONArray jsonArray = new JSONArray(); + for (SearchResult result : results) { + jsonArray.put(result.toMap()); + } + response.getWriter().write(jsonArray.toString()); + + } catch (Throwable e) { + log.error(e, e); + doSearchError(response); + } + } + + private SolrQuery getQuery(String querystr, VitroRequest vreq) { + + if ( querystr == null) { + log.error("There was no parameter '"+ PARAM_QUERY + +"' in the request."); + return null; + } else if( querystr.length() > MAX_QUERY_LENGTH ) { + log.debug("The search was too long. The maximum " + + "query length is " + MAX_QUERY_LENGTH ); + return null; + } + + SolrQuery query = new SolrQuery(); + query = query.setStart(0); + query = query.setRows(DEFAULT_MAX_HIT_COUNT); + + query = setNameQuery(query, querystr, vreq); + + // Filter by type + String typeParam = (String) vreq.getParameter(PARAM_RDFTYPE); + if (typeParam != null) { + query = query.addFilterQuery(VitroLuceneTermNames.RDFTYPE + ":\"" + typeParam + "\""); + } + + // Set the fields to retrieve **** RY + // query = query.setFields( ... ); + + return query; + } + + private SolrQuery setNameQuery(SolrQuery query, String querystr, HttpServletRequest request) { + + String tokenizeParam = (String) request.getParameter("tokenize"); + boolean tokenize = "true".equals(tokenizeParam); + + // Note: Stemming is only relevant if we are tokenizing: an untokenized name + // query will not be stemmed. So we don't look at the stem parameter until we get to + // setTokenizedNameQuery(). + if (tokenize) { + return setTokenizedNameQuery(query, querystr, request); + } else { + return setUntokenizedNameQuery(query, querystr); + } + } + + private SolrQuery setTokenizedNameQuery(SolrQuery query, String querystr, HttpServletRequest request) { + + String stemParam = (String) request.getParameter("stem"); + boolean stem = "true".equals(stemParam); + String termName = stem ? VitroLuceneTermNames.AC_NAME_STEMMED : VitroLuceneTermNames.AC_NAME_UNSTEMMED ; + + BooleanQuery boolQuery = new BooleanQuery(); + +// // Use the query parser to analyze the search term the same way the indexed text was analyzed. +// // For example, text is lowercased, and function words are stripped out. +// QueryParser parser = getQueryParser(termName); +// +// // The wildcard query doesn't play well with stemming. Query term name:tales* doesn't match +// // "tales", which is indexed as "tale", while query term name:tales does. Obviously we need +// // the wildcard for name:tal*, so the only way to get them all to match is use a disjunction +// // of wildcard and non-wildcard queries. The query will look have only an implicit disjunction +// // operator: e.g., +(name:tales name:tales*) +// try { +// log.debug("Adding non-wildcard query for " + querystr); +// Query query = parser.parse(querystr); +// boolQuery.add(query, BooleanClause.Occur.SHOULD); +// +// // Prevent ParseException here when adding * after a space. +// // If there's a space at the end, we don't need the wildcard query. +// if (! querystr.endsWith(" ")) { +// log.debug("Adding wildcard query for " + querystr); +// Query wildcardQuery = parser.parse(querystr + "*"); +// boolQuery.add(wildcardQuery, BooleanClause.Occur.SHOULD); +// } +// +// log.debug("Name query is: " + boolQuery.toString()); +// } catch (ParseException e) { +// log.warn(e, e); +// } + + return query; + } + + private SolrQuery setUntokenizedNameQuery(SolrQuery query, String querystr) { + + // Using facet method described in http://solr.pl/en/2010/10/18/solr-and-autocomplete-part-1/ + // Consider using Solr Suggester in a future version. + return query.setFacet(true) + .addFacetField(VitroLuceneTermNames.NAME_LOWERCASE) + .setFacetMinCount(1) + .setFacetLimit(MAX_QUERY_LENGTH) + .setFacetPrefix(querystr)//.toLowerCase()) + //.setFacetSort(FacetParams.FACET_SORT_INDEX) // sort by alpha (but doesn't work) + .setQuery("*:*"); + + } + + private void doNoQuery(HttpServletResponse response) throws IOException { + // For now, we are not sending an error message back to the client because + // with the default autocomplete configuration it chokes. + doNoSearchResults(response); + } + + private void doSearchError(HttpServletResponse response) throws IOException { + // For now, we are not sending an error message back to the client because + // with the default autocomplete configuration it chokes. + doNoSearchResults(response); + } + + private void doNoSearchResults(HttpServletResponse response) throws IOException { + response.getWriter().write("[]"); + } + + public class SearchResult implements Comparable { + private String label; + private String uri; + + SearchResult(String label, String uri) { + this.label = label; + this.uri = uri; + } + + public String getLabel() { + return label; + } + + public String getJsonLabel() { + return JSONObject.quote(label); + } + + public String getUri() { + return uri; + } + + public String getJsonUri() { + return JSONObject.quote(uri); + } + + Map toMap() { + Map map = new HashMap(); + map.put("label", label); + map.put("uri", uri); + return map; + } + + public int compareTo(Object o) throws ClassCastException { + if ( !(o instanceof SearchResult) ) { + throw new ClassCastException("Error in SearchResult.compareTo(): expected SearchResult object."); + } + SearchResult sr = (SearchResult) o; + return label.compareToIgnoreCase(sr.getLabel()); + } + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java index 79135555b..f546cc796 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java @@ -15,7 +15,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -23,13 +22,9 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.queryParser.MultiFieldQueryParser; -import org.apache.lucene.queryParser.QueryParser; -import org.apache.lucene.util.Version; -import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServer; +import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; @@ -53,7 +48,7 @@ import edu.cornell.mannlib.vitro.webapp.search.SearchException; import edu.cornell.mannlib.vitro.webapp.search.beans.VitroHighlighter; import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery; import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQueryFactory; -import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc; +import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames; import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneSetup; import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.LinkTemplateModel; @@ -74,14 +69,18 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { private static final long serialVersionUID = 1L; private static final Log log = LogFactory.getLog(SolrPagedSearchController.class); - private static final String XML_REQUEST_PARAM = "xml"; private static final int DEFAULT_HITS_PER_PAGE = 25; - private static final int DEFAULT_MAX_SEARCH_SIZE = 1000; - private static final float QUERY_BOOST = 2.0F; - + private static final int DEFAULT_MAX_HIT_COUNT = 1000; + + private static final String PARAM_XML_REQUEST = "xml"; + private static final String PARAM_START_INDEX = "startIndex"; + private static final String PARAM_HITS_PER_PAGE = "hitsPerPage"; + private static final String PARAM_CLASSGROUP = "classgroup"; + private static final String PARAM_RDFTYPE = "type"; + private static final String PARAM_QUERY_TEXT = "querytext"; + protected static final Map> templateTable; - //private IndexSearcher searcher = null; protected enum Format { HTML, XML; } @@ -129,7 +128,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { //There may be other non-html formats in the future Format format = getFormat(vreq); boolean wasXmlRequested = Format.XML == format; - log.debug("xml was the requested format"); + log.debug("Requested format was " + (wasXmlRequested ? "xml" : "html")); boolean wasHtmlRequested = ! wasXmlRequested; try { @@ -151,7 +150,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { int startIndex = 0; try{ - startIndex = Integer.parseInt(vreq.getParameter("startIndex")); + startIndex = Integer.parseInt(vreq.getParameter(PARAM_START_INDEX)); }catch (Throwable e) { startIndex = 0; } @@ -159,34 +158,24 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { int hitsPerPage = DEFAULT_HITS_PER_PAGE; try{ - hitsPerPage = Integer.parseInt(vreq.getParameter("hitsPerPage")); + hitsPerPage = Integer.parseInt(vreq.getParameter(PARAM_HITS_PER_PAGE)); } catch (Throwable e) { hitsPerPage = DEFAULT_HITS_PER_PAGE; } log.debug("hitsPerPage is " + hitsPerPage); - int maxHitCount = DEFAULT_MAX_SEARCH_SIZE ; - if( startIndex >= DEFAULT_MAX_SEARCH_SIZE - hitsPerPage ) - maxHitCount = startIndex + DEFAULT_MAX_SEARCH_SIZE ; + int maxHitCount = DEFAULT_MAX_HIT_COUNT ; + if( startIndex >= DEFAULT_MAX_HIT_COUNT - hitsPerPage ) + maxHitCount = startIndex + DEFAULT_MAX_HIT_COUNT ; log.debug("maxHitSize is " + maxHitCount); String qtxt = vreq.getParameter(VitroQuery.QUERY_PARAMETER_NAME); - // RY *** Analyzer - //Analyzer analyzer = getAnalyzer(getServletContext()); - - log.debug("Query text: " + qtxt); + log.debug("Query text is \""+ qtxt + "\""); SolrQuery query = getQuery(qtxt, maxHitCount, vreq); - // We need Solr to send us the entire result set back, otherwise we may not get all the - // right refinement links. For example, if all individuals on pg 1 are Persons, and on - // pg 2 there are FacultyMembers, we need to show the FacultyMember refinement link on - // both pages. - //parameters.set("start", startIndex); - //parameters.set("rows", hitsPerPage); - // ** For xml requested, add version=2.2 for xml version // is that enough, or do we also have to add wt param? @@ -196,55 +185,6 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { try { response = solr.query(query); - - //log.debug("Query text is "+ qtxt + " Analyzer is "+ analyzer.toString()); - -// Query query = null; -// try { -// query = getQuery(vreq, portalFlag, analyzer, qtxt); -// log.debug("query for '" + qtxt +"' is " + query.toString()); -// } catch (ParseException e) { -// return doBadQuery(portal, qtxt,format); -// } - - //IndexSearcher searcherForRequest = LuceneIndexFactory.getIndexSearcher(getServletContext()); - - /* using the CustomSimilarity to override effects such as - * 1) rarity of a term doesn't affect the document score. - * 2) number of instances of a query term in the matched document doesn't affect the document score - * 3) field length doesn't affect the document score - * - * 3/29/2011 bk392 - */ -// CustomSimilarity customSimilarity = new CustomSimilarity(); -// searcherForRequest.setSimilarity(customSimilarity); -// -// TopDocs topDocs = null; -// try{ -// log.debug("Searching for query term in the Index with maxHitSize "+ maxHitSize); -// log.debug("Query is "+ query.toString()); -// -// //sets the query boost for the query. the lucene docs matching this query term -// //are multiplied by QUERY_BOOST to get their total score -// //query.setBoost(QUERY_BOOST); -// -// topDocs = searcherForRequest.search(query,null,maxHitSize); -// -// log.debug("Total hits for the query are "+ topDocs.totalHits); -// for(ScoreDoc scoreDoc : topDocs.scoreDocs){ -// -// Document document = searcherForRequest.doc(scoreDoc.doc); -// Explanation explanation = searcherForRequest.explain(query, scoreDoc.doc); -// -// log.debug("Document title: "+ document.get(Entity2LuceneDoc.VitroLuceneTermNames.NAME) + " score: " +scoreDoc.score); -// log.debug("Scoring of the doc explained " + explanation.toString()); -// log.debug("Explanation's description "+ explanation.getDescription()); -// log.debug("ALLTEXT: " + document.get(Entity2LuceneDoc.VitroLuceneTermNames.ALLTEXT)); -// log.debug("ALLTEXTUNSTEMMED: " + document.get(Entity2LuceneDoc.VitroLuceneTermNames.ALLTEXTUNSTEMMED)); -// -// -// } -// } catch (Throwable t) { log.error("in first pass at search: " + t); // this is a hack to deal with odd cases where search and index threads interact @@ -292,7 +232,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { for(int i = startIndex; i < lastHitToShow; i++){ try { SolrDocument doc = docs.get(i); - String uri = doc.get(Entity2LuceneDoc.term.URI).toString(); + String uri = doc.get(VitroLuceneTermNames.URI).toString(); log.debug("Retrieving individual with uri "+ uri); Individual ent = new IndividualImpl(); ent.setURI(uri); @@ -306,18 +246,18 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { } ParamMap pagingLinkParams = new ParamMap(); - pagingLinkParams.put("querytext", qtxt); - pagingLinkParams.put("hitsPerPage", String.valueOf(hitsPerPage)); + pagingLinkParams.put(PARAM_QUERY_TEXT, qtxt); + pagingLinkParams.put(PARAM_HITS_PER_PAGE, String.valueOf(hitsPerPage)); if( wasXmlRequested ){ - pagingLinkParams.put(XML_REQUEST_PARAM,"1"); + pagingLinkParams.put(PARAM_XML_REQUEST,"1"); } /* Compile the data for the templates */ Map body = new HashMap(); - String classGroupParam = vreq.getParameter("classgroup"); + String classGroupParam = vreq.getParameter(PARAM_CLASSGROUP); boolean classGroupFilterRequested = false; if (!StringUtils.isEmpty(classGroupParam)) { VClassGroup grp = grpDao.getGroupByURI(classGroupParam); @@ -326,11 +266,11 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { body.put("classGroupName", grp.getPublicName()); } - String typeParam = vreq.getParameter("type"); - boolean typeFiltereRequested = false; + String typeParam = vreq.getParameter(PARAM_RDFTYPE); + boolean typeFilterRequested = false; if (!StringUtils.isEmpty(typeParam)) { VClass type = vclassDao.getVClassByURI(typeParam); - typeFiltereRequested = true; + typeFilterRequested = true; if (type != null && type.getName() != null) body.put("typeName", type.getName()); } @@ -338,7 +278,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { /* Add classgroup and type refinement links to body */ if( wasHtmlRequested ){ // Search request includes no classgroup and no type, so add classgroup search refinement links. - if ( !classGroupFilterRequested && !typeFiltereRequested ) { + if ( !classGroupFilterRequested && !typeFilterRequested ) { List classgroups = getClassGroups(grpDao, docs); List classGroupLinks = new ArrayList(classgroups.size()); for (VClassGroup vcg : classgroups) { @@ -350,17 +290,17 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { // Search request is for a classgroup, so add rdf:type search refinement links // but try to filter out classes that are subclasses - } else if ( classGroupFilterRequested && !typeFiltereRequested ) { + } else if ( classGroupFilterRequested && !typeFilterRequested ) { List vClasses = getVClasses(vclassDao, docs); List vClassLinks = new ArrayList(vClasses.size()); for (VClass vc : vClasses) { vClassLinks.add(new VClassSearchLink(qtxt, vc)); } body.put("classLinks", vClassLinks); - pagingLinkParams.put("classgroup", classGroupParam); + pagingLinkParams.put(PARAM_CLASSGROUP, classGroupParam); } else { - pagingLinkParams.put("type", typeParam); + pagingLinkParams.put(PARAM_RDFTYPE, typeParam); } } @@ -374,7 +314,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { body.put("title", qtxt + " - " + appBean.getApplicationName() + " Search Results"); - body.put("hitsLength", hitCount); + body.put("hitCount", hitCount); body.put("startIndex", startIndex); body.put("pagingLinks", getPagingLinks(startIndex, hitsPerPage, @@ -413,7 +353,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { for(int i=0; i grpsFound ;i++){ try{ SolrDocument doc = docs.get(i); - Collection grps = doc.getFieldValues(Entity2LuceneDoc.term.CLASSGROUP_URI); + Collection grps = doc.getFieldValues(VitroLuceneTermNames.CLASSGROUP_URI); if (grps != null) { for (Object o : grps) { String groupUri = o.toString(); @@ -448,7 +388,6 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { return classgroups; } - private List getVClasses(VClassDao vclassDao, SolrDocumentList docs){ HashSet typesInHits = getVClassUrisForHits(docs); List classes = new ArrayList(typesInHits.size()); @@ -480,7 +419,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { HashSet typesInHits = new HashSet(); for (SolrDocument doc : docs) { try { - Collection types = doc.getFieldValues(Entity2LuceneDoc.term.RDFTYPE); + Collection types = doc.getFieldValues(VitroLuceneTermNames.RDFTYPE); if (types != null) { for (Object o : types) { String typeUri = o.toString(); @@ -494,129 +433,47 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { return typesInHits; } - private Analyzer getAnalyzer(ServletContext servletContext) throws SearchException { - Object obj = servletContext.getAttribute(LuceneSetup.ANALYZER); - if( obj == null || !(obj instanceof Analyzer) ) - throw new SearchException("Could not get analyzer"); - else - return (Analyzer)obj; - } - -// private Query getQuery(VitroRequest request, -// Analyzer analyzer, String querystr ) throws SearchException, ParseException { -// Query query = null; -// try{ -// //String querystr = request.getParameter(VitroQuery.QUERY_PARAMETER_NAME); -// if( querystr == null){ -// log.error("There was no Parameter '"+VitroQuery.QUERY_PARAMETER_NAME -// +"' in the request."); -// return null; -// }else if( querystr.length() > MAX_QUERY_LENGTH ){ -// log.debug("The search was too long. The maximum " + -// "query length is " + MAX_QUERY_LENGTH ); -// return null; -// } -// -// log.debug("Parsing query using QueryParser "); -// -// QueryParser parser = getQueryParser(analyzer); -// query = parser.parse(querystr); -// -// //check if this is classgroup filtered -// Object param = request.getParameter("classgroup"); -// if( param != null && !"".equals(param)){ -// -// log.debug("Firing classgroup query "); -// log.debug("request.getParameter(classgroup) is "+ param.toString()); -// -// BooleanQuery boolQuery = new BooleanQuery(); -// boolQuery.add( query, BooleanClause.Occur.MUST); -// boolQuery.add( new TermQuery( -// new Term(Entity2LuceneDoc.term.CLASSGROUP_URI, -// (String)param)), -// BooleanClause.Occur.MUST); -// query = boolQuery; -// } -// -// //check if this is rdf:type filtered -// param = request.getParameter("type"); -// if( param != null && !"".equals(param)){ -// log.debug("Firing type query "); -// log.debug("request.getParameter(type) is "+ param.toString()); -// -// BooleanQuery boolQuery = new BooleanQuery(); -// boolQuery.add( query, BooleanClause.Occur.MUST); -// boolQuery.add( new TermQuery( -// new Term(Entity2LuceneDoc.term.RDFTYPE, -// (String)param)), -// BooleanClause.Occur.MUST); -// query = boolQuery; -// } -// -// log.debug("Query: " + query); -// -// } catch (ParseException e) { -// throw new ParseException(e.getMessage()); -// } catch (Exception ex){ -// throw new SearchException(ex.getMessage()); -// } -// -// return query; -// } - private SolrQuery getQuery(String queryText, int maxHitCount, VitroRequest vreq) { SolrQuery query = new SolrQuery(queryText); // Solr requires these values, but we don't want them to be the real values for this page - // of results, else the refinement links won't work correctly: if only Persons are on pg 1, - // but there are FacultyMembers on pg 2, we still need to show the FacultyMember refinement - // link on pg 1, which won't happen if we have retrieved only one page of results from Solr. - query.setStart(0); - query.setRows(maxHitCount); - - // RY Add other stuff here - // classgroups, type params - - return query; - } - - @SuppressWarnings("static-access") - private QueryParser getQueryParser(Analyzer analyzer){ - //defaultSearchField indicates which field search against when there is no term - //indicated in the query string. - //The analyzer is needed so that we use the same analyzer on the search queries as - //was used on the text that was indexed. - //QueryParser qp = new QueryParser("NAME",analyzer); - //this sets the query parser to AND all of the query terms it finds. - //set up the map of stemmed field names -> unstemmed field names -// HashMap map = new HashMap(); -// map.put(Entity2LuceneDoc.term.ALLTEXT,Entity2LuceneDoc.term.ALLTEXTUNSTEMMED); -// qp.setStemmedToUnstemmed(map); - - MultiFieldQueryParser qp = new MultiFieldQueryParser(Version.LUCENE_29, new String[]{ - "name", "nameunstemmed", "type", "moniker", "ALLTEXT", "ALLTEXTUNSTEMMED", "nameraw" , "classLocalName", "classLocalNameLowerCase" }, analyzer); - - // QueryParser qp = new QueryParser(Version.LUCENE_29, "name", analyzer); - - //AND_OPERATOR returns documents even if the terms in the query lie in different fields. - //The only requirement is that they exist in a single document. - //qp.setDefaultOperator(QueryParser.AND_OPERATOR); + // of results, else the refinement links won't work correctly: each page of results needs to + // show refinement links generated for all results, not just for the results on the current page. + query.setStart(0) + .setRows(maxHitCount); - - return qp; + // Classgroup filtering + String classgroupParam = (String) vreq.getParameter(PARAM_CLASSGROUP); + if ( ! StringUtils.isBlank(classgroupParam) ) { + log.debug("Firing classgroup query "); + log.debug("request.getParameter(classgroup) is "+ classgroupParam); + query.addFilterQuery(VitroLuceneTermNames.CLASSGROUP_URI + ":\"" + classgroupParam + "\""); + } + + // rdf:type filtering + String typeParam = (String) vreq.getParameter(PARAM_RDFTYPE); + if ( ! StringUtils.isBlank(typeParam) ) { + log.debug("Firing type query "); + log.debug("request.getParameter(type) is "+ typeParam); + query.addFilterQuery(VitroLuceneTermNames.RDFTYPE + ":\"" + typeParam + "\""); + } + + //query.setQuery(queryText); + log.debug("Query = " + query.toString()); + return query; } private class VClassGroupSearchLink extends LinkTemplateModel { VClassGroupSearchLink(String querytext, VClassGroup classgroup) { - super(classgroup.getPublicName(), "/search", "querytext", querytext, "classgroup", classgroup.getURI()); + super(classgroup.getPublicName(), "/search", PARAM_QUERY_TEXT, querytext, PARAM_CLASSGROUP, classgroup.getURI()); } } private class VClassSearchLink extends LinkTemplateModel { VClassSearchLink(String querytext, VClass type) { - super(type.getName(), "/search", "querytext", querytext, "type", type.getURI()); + super(type.getName(), "/search", PARAM_QUERY_TEXT, querytext, PARAM_RDFTYPE, type.getURI()); } } @@ -630,7 +487,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { } for (int i = 0; i < hitCount; i += hitsPerPage) { - params.put("startIndex", String.valueOf(i)); + params.put(PARAM_START_INDEX, String.valueOf(i)); if ( i < maxHitCount - hitsPerPage) { int pageNumber = i/hitsPerPage + 1; if (i >= startIndex && i < (startIndex + hitsPerPage)) { @@ -647,14 +504,12 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { } private String getPreviousPageLink(int startIndex, int hitsPerPage, String baseUrl, ParamMap params) { - params.put("startIndex", String.valueOf(startIndex-hitsPerPage)); - //return new PagingLink("Previous", baseUrl, params); + params.put(PARAM_START_INDEX, String.valueOf(startIndex-hitsPerPage)); return UrlBuilder.getUrl(baseUrl, params); } private String getNextPageLink(int startIndex, int hitsPerPage, String baseUrl, ParamMap params) { - params.put("startIndex", String.valueOf(startIndex+hitsPerPage)); - //return new PagingLink("Next", baseUrl, params); + params.put(PARAM_START_INDEX, String.valueOf(startIndex+hitsPerPage)); return UrlBuilder.getUrl(baseUrl, params); } @@ -681,12 +536,12 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { return new ExceptionResponseValues(getTemplate(f,Result.ERROR), body, e); } - private TemplateResponseValues doBadQuery(ApplicationBean appBean, String query, Format f) { - Map body = new HashMap(); - body.put("title", "Search " + appBean.getApplicationName()); - body.put("query", query); - return new TemplateResponseValues(getTemplate(f,Result.BAD_QUERY), body); - } +// private TemplateResponseValues doBadQuery(ApplicationBean appBean, String query, Format f) { +// Map body = new HashMap(); +// body.put("title", "Search " + appBean.getApplicationName()); +// body.put("query", query); +// return new TemplateResponseValues(getTemplate(f,Result.BAD_QUERY), body); +// } private TemplateResponseValues doFailedSearch(String message, String querytext, Format f) { Map body = new HashMap(); @@ -747,32 +602,22 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { return rv; } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "unused" }) private HashSet getDataPropertyBlacklist(){ HashSetdpBlacklist = (HashSet) getServletContext().getAttribute(LuceneSetup.SEARCH_DATAPROPERTY_BLACKLIST); return dpBlacklist; } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "unused" }) private HashSet getObjectPropertyBlacklist(){ HashSetopBlacklist = (HashSet) getServletContext().getAttribute(LuceneSetup.SEARCH_OBJECTPROPERTY_BLACKLIST); return opBlacklist; } - - private final String defaultSearchField = "ALLTEXT"; public static final int MAX_QUERY_LENGTH = 500; - - /** - * Need to accept notification from indexer that the index has been changed. - */ -// public void close() { -// searcher = null; -// } - public VitroHighlighter getHighlighter(VitroQuery q) { throw new Error("PagedSearchController.getHighlighter() is unimplemented"); } @@ -781,13 +626,14 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet { throw new Error("PagedSearchController.getQueryFactory() is unimplemented"); } + @SuppressWarnings("rawtypes") public List search(VitroQuery query) throws SearchException { throw new Error("PagedSearchController.search() is unimplemented"); } protected boolean isRequestedFormatXml(HttpServletRequest req){ if( req != null ){ - String param = req.getParameter(XML_REQUEST_PARAM); + String param = req.getParameter(PARAM_XML_REQUEST); if( param != null && "1".equals(param)){ return true; }else{ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java index abc7cb07b..30831f197 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java @@ -45,14 +45,7 @@ public class Entity2LuceneDoc implements Obj2DocIface{ public static String CLASSGROUP_URI = "classgroup"; /** Modtime from db */ public static String MODTIME = "modTime"; - /** Name of entity, tab or vclass */ - public static String NAME = "name"; - /** rdfs:label unanalyzed */ - public static String NAMELOWERCASE = "nameunanalyzed" ; - /** Name of entity, unstemmed */ - public static String NAMEUNSTEMMED = "nameunstemmed"; - /** Unaltered name of individual, un-lowercased, un-stemmed, un-tokenized" */ - public static String NAMERAW = "nameraw"; + /** time of index in msec since epoc */ public static String INDEXEDTIME= "indexedTime"; /** timekey of entity in yyyymmddhhmm */ @@ -77,7 +70,24 @@ public class Entity2LuceneDoc implements Obj2DocIface{ /** class names in human readable form of an individual*/ public static final String CLASSLOCALNAMELOWERCASE = "classLocalNameLowerCase"; /** class names in human readable form of an individual*/ - public static final String CLASSLOCALNAME = "classLocalName"; + public static final String CLASSLOCALNAME = "classLocalName"; + + // Fields derived from rdfs:label + /** Raw rdfs:label: no lowercasing, no tokenizing, no stop words, no stemming. + * Used only in retrieval rather than search. **/ + public static String NAME_RAW = "nameRaw"; // was NAMERAW + + /** rdfs:label lowercased, no tokenizing, no stop words, no stemming **/ + public static String NAME_LOWERCASE = "nameLowercase"; // was NAMELOWERCASE + + /** rdfs:label lowercased, tokenized, stop words, no stemming. + * Used for autocomplete matching on proper names. **/ + public static String AC_NAME_UNSTEMMED = "acNameUnstemmed"; // was NAMEUNSTEMMED + + /** rdfs:label lowercased, tokenized, stop words, stemmed. + * Used for autocomplete matching where stemming is desired (e.g., book titles) **/ + public static String AC_NAME_STEMMED = "acNameStemmed"; // was NAME + } private static final Log log = LogFactory.getLog(Entity2LuceneDoc.class.getName()); @@ -189,7 +199,7 @@ public class Entity2LuceneDoc implements Obj2DocIface{ //java class doc.add( new Field(term.JCLASS, entClassName, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS)); - //Entity Name + // Individual label if( ent.getRdfsLabel() != null ) value=ent.getRdfsLabel(); else{ @@ -198,22 +208,24 @@ public class Entity2LuceneDoc implements Obj2DocIface{ log.debug("Using local name for individual with rdfs:label " + ent.getURI()); value = ent.getLocalName(); } - Field name = new Field(term.NAME, value, Field.Store.YES, Field.Index.ANALYZED); - doc.add( name ); - - Field nameUn = new Field(term.NAMEUNSTEMMED, value, Field.Store.NO, Field.Index.ANALYZED); - nameUn.setBoost(NAME_BOOST); - doc.add( nameUn ); - - // BK nameunanalyzed is used by IndividualListController - Field nameUnanalyzed = new Field(term.NAMELOWERCASE, value.toLowerCase(), Field.Store.YES, Field.Index.NOT_ANALYZED); - nameUnanalyzed.setBoost(NAME_BOOST); - doc.add( nameUnanalyzed ); - - Field nameRaw = new Field(term.NAMERAW, value, Field.Store.YES, Field.Index.NOT_ANALYZED); + + Field nameRaw = new Field(term.NAME_RAW, value, Field.Store.YES, Field.Index.NOT_ANALYZED); nameRaw.setBoost(NAME_BOOST); doc.add(nameRaw); + // RY Not sure if we need to store this. For Solr, see schema.xml field definition. + Field nameLowerCase = new Field(term.NAME_LOWERCASE, value.toLowerCase(), Field.Store.YES, Field.Index.NOT_ANALYZED); + nameLowerCase.setBoost(NAME_BOOST); + doc.add(nameLowerCase); + + Field nameUnstemmed = new Field(term.AC_NAME_UNSTEMMED, value, Field.Store.NO, Field.Index.ANALYZED); + nameUnstemmed.setBoost(NAME_BOOST); + doc.add(nameUnstemmed); + + Field nameStemmed = new Field(term.AC_NAME_STEMMED, value, Field.Store.NO, Field.Index.ANALYZED); + nameStemmed.setBoost(NAME_BOOST); + doc.add(nameStemmed); + //Moniker diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopAnalyzer.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopAnalyzer.java index 02b09a6b2..e6a32bed7 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopAnalyzer.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopAnalyzer.java @@ -81,8 +81,7 @@ public class HtmlLowerStopAnalyzer extends Analyzer { /** * Processes the input by first converting it to - * lower case, then by eliminating stop words, and - * finally by performing Porter stemming on it. + * lower case, then by eliminating stop words. * * @param reader the Reader that * provides access to the input text diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneSetup.java index 9a5376c93..149fa4914 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneSetup.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneSetup.java @@ -7,8 +7,8 @@ import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.Vi import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames.CLASSLOCALNAME; import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames.CLASSLOCALNAMELOWERCASE; import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames.MONIKER; -import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames.NAME; -import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames.NAMEUNSTEMMED; +import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames.AC_NAME_STEMMED; +import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames.AC_NAME_UNSTEMMED; import static edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames.RDFTYPE; import java.io.File; @@ -245,10 +245,9 @@ public class LuceneSetup implements javax.servlet.ServletContextListener { PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper( new StandardAnalyzer(Version.LUCENE_29)); analyzer.addAnalyzer(ALLTEXT, new HtmlLowerStopStemAnalyzer()); -// analyzer.addAnalyzer(NAME, new HtmlLowerStopStemAnalyzer()); analyzer.addAnalyzer(ALLTEXTUNSTEMMED, new HtmlLowerStopAnalyzer()); - analyzer.addAnalyzer(NAMEUNSTEMMED, new HtmlLowerStopAnalyzer()); - analyzer.addAnalyzer(NAME, new StandardAnalyzer(Version.LUCENE_29)); + analyzer.addAnalyzer(AC_NAME_UNSTEMMED, new HtmlLowerStopAnalyzer()); + analyzer.addAnalyzer(AC_NAME_STEMMED, new HtmlLowerStopStemAnalyzer()); analyzer.addAnalyzer(MONIKER, new StandardAnalyzer(Version.LUCENE_29)); analyzer.addAnalyzer(RDFTYPE, new StandardAnalyzer(Version.LUCENE_29)); analyzer.addAnalyzer(CLASSLOCALNAME, new HtmlLowerStopAnalyzer()); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/ErrorMessage.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/ErrorMessage.java index 786bbb262..092b9b2d2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/ErrorMessage.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/ErrorMessage.java @@ -2,8 +2,8 @@ package edu.cornell.mannlib.vitro.webapp.web.jsptags; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java index efd101ddf..ac110d4d6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java @@ -43,10 +43,10 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerConfigurationLoader; import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch; import freemarker.template.Configuration; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/Options.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/Options.java index 2f9d59993..848503cec 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/Options.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/Options.java @@ -2,18 +2,7 @@ package edu.cornell.mannlib.vitro.webapp.web.jsptags; -import edu.cornell.mannlib.vitro.webapp.beans.Individual; -import edu.cornell.mannlib.vitro.webapp.beans.VClass; -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import org.apache.commons.lang.StringEscapeUtils; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.TagSupport; -import java.util.List; /** * diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/Value.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/Value.java index 3bc9feaea..2c0ff8a23 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/Value.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/Value.java @@ -2,12 +2,6 @@ package edu.cornell.mannlib.vitro.webapp.web.jsptags; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; -import org.apache.commons.lang.StringEscapeUtils; - -import javax.servlet.http.HttpSession; -import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.TagSupport; /** diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyStatementTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyStatementTemplateModel.java index 1fde3c36b..49c8f3363 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyStatementTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyStatementTemplateModel.java @@ -19,7 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash; public class DataPropertyStatementTemplateModel extends PropertyStatementTemplateModel { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/widgets/SelectListWidget.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/widgets/SelectListWidget.java index 924e96afa..a2976656b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/widgets/SelectListWidget.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/widgets/SelectListWidget.java @@ -14,9 +14,8 @@ import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator; -import edu.cornell.mannlib.vitro.webapp.web.directives.WidgetDirective; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator; import freemarker.core.Environment; import freemarker.template.SimpleScalar; diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/JenaNetidPolicyTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/JenaNetidPolicyTest.java deleted file mode 100644 index 0f6827722..000000000 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/JenaNetidPolicyTest.java +++ /dev/null @@ -1,228 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.policy; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.InputStream; - -import org.apache.log4j.Level; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.ontology.OntModelSpec; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler; - -import edu.cornell.mannlib.vitro.testing.AbstractTestClass; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.ArrayIdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddDataPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddObjectPropStmt; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropDataPropStmt; -import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl; - -/** - * Simple test of JenaNetidPolicyTest that uses the ExamplePolicy.xml - * It expects that the model will have the resource - * will have - * the datatype property vitro:netid of "bdc34". - * - * @author bdc34 - * - */ - -public class JenaNetidPolicyTest extends AbstractTestClass { - static transient JenaNetidPolicy jniPolicy; - static transient JenaNetidPolicy unAuthPolicy; - static transient Model model; - static IdentifierBundle idb; - - static String onts[] ={ - "/testontologies/smallVivo-20070809.owl", - "/testontologies/vitro1.owl", - "/testontologies/vivo-users.owl" - }; - - - /* - * Loading files with this.getClass().getResourceAsStream() - * Notice that / is the path seperator and strings that lack - * a leading slash are relative to the package of the this.getClass(). - */ - @BeforeClass - public static void setUpForClass() throws Exception { - // Suppress warnings from creating default model. - setLoggerLevel(RDFDefaultErrorHandler.class, Level.OFF); - model = ModelFactory.createDefaultModel(); - - for( String ont : onts){ - InputStream in = JenaNetidPolicyTest.class.getResourceAsStream(ont); - model.read(in,null); - in.close(); - } - OntModel ontModel = ModelFactory.createOntologyModel(ONT_MODEL_SPEC,model); - ontModel.prepare(); - - InputStream in = JenaNetidPolicyTest.class.getResourceAsStream("resources/examplePolicy.xml"); - jniPolicy = new JenaNetidPolicy(model,in); - in.close(); - - in = JenaNetidPolicyTest.class.getResourceAsStream("resources/examplePolicy.xml"); - unAuthPolicy = new JenaNetidPolicy(model,in, Authorization.UNAUTHORIZED); - in.close(); - - idb = new ArrayIdentifierBundle(); - idb.add(new SelfEditingIdentifierFactory.NetId("bdc34")); - } - - @Test public void testOfSetupFromXml(){ - assertNotNull(model); - JenaNetidPolicy j = jniPolicy; - assertNotNull(j); - assertNotNull(j.model); - assertNotNull(j.prefixes); - assertNotNull( j.actionToQueryStr ); - assertNotNull(j.name); - assertEquals(j.name, "Example Policy"); - assertTrue(j.prefixes.length() > 0); - assertTrue( j.actionToQueryStr.size() > 0); - } - - @Test public void testAddDataProps(){ - RequestedAction act; PolicyDecision pd; - - act = new AddDataPropStmt( - "http://some.non.existing.resource", - "http://some.non.existing.dataproperty", - "bogus value", null, null); - pd = jniPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue( "authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.INCONCLUSIVE); - - pd = unAuthPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue( "authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.INCONCLUSIVE); - } - - @Test public void testAddDataProps2(){ - RequestedAction act; PolicyDecision pd; - - act = new AddDataPropStmt( - "http://vivo.library.cornell.edu/abox#entity11821", - "vitro:description", - "a description of some kind.", null, null); - pd = jniPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue("authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.AUTHORIZED); - - pd = unAuthPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue( "authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.UNAUTHORIZED); - } - - @Test public void testDropDataProps1(){ - RequestedAction act; PolicyDecision pd; - - DataPropertyStatementImpl dp = new DataPropertyStatementImpl(); - dp.setIndividualURI("http://vivo.library.cornell.edu/abox#entity11821"); - dp.setData("a description of some kind."); - dp.setDatapropURI("vitro:description"); - act = new DropDataPropStmt( dp ); - - pd = jniPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue("authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.AUTHORIZED); - - pd = unAuthPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue( "authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.UNAUTHORIZED); - } - - @Test public void testDropDataProps2(){ - RequestedAction act; PolicyDecision pd; - - DataPropertyStatementImpl dp = new DataPropertyStatementImpl(); - dp.setIndividualURI("http://mannlib.cornell.edu/non.existing.resource"); - dp.setData("a description of some kind."); - dp.setDatapropURI("vitro:description"); - act = new DropDataPropStmt( dp ); - - pd = jniPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue("authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.INCONCLUSIVE); - - pd = unAuthPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue( "authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.INCONCLUSIVE); - - } - - @Test public void testObjectProps(){ - RequestedAction act = new AddObjectPropStmt( - "http://vivo.library.cornell.edu/abox#entity11821", - "vitro:headOf", - "http://vivo.library.cornell.edu/abox#entity1"); - PolicyDecision pd = jniPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue("authorization was " + pd.getAuthorized(), - pd.getAuthorized() == Authorization.AUTHORIZED); - - pd = unAuthPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue( "authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.UNAUTHORIZED); - - act = new AddObjectPropStmt( - "http://vivo.library.cornell.edu/abox#entity123", - "vitro:headOf", - "http://vivo.library.cornell.edu/abox#entity1"); - pd = jniPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue("authorization was " + pd.getAuthorized(), - pd.getAuthorized() == Authorization.INCONCLUSIVE); - - pd = unAuthPolicy.isAuthorized(idb, act); - assertNotNull(pd); - assertTrue( "authorization was " + pd.getAuthorized() + - '\n' + pd.getDebuggingInfo(), - pd.getAuthorized() == Authorization.INCONCLUSIVE); - } - -// static String ONTOLOGY_ADDR = "http://caruso.mannlib.cornell.edu/xml/rdf/smallVivo-20070809.owl"; -// static String VITRO_ADDR = "http://ivy.mannlib.cornell.edu/ontologies/vitro/vitro1.owl"; -// static String USERS_ADDR = "http://ivy.mannlib.cornell.edu/ontologies/vivo/vivo-users.owl"; - //String ONTOLOGY_ADDR = "http://lowe.mannlib.cornell.edu/ontologies/fao/geopolitical_Ontology_v_0_2.owl"; - //String ONTOLOGY_ADDR = "http://lowe.mannlib.cornell.edu/ontologies/fao/languagecode.owl"; - //String ONTOLOGY_ADDR = "http://localhost/~bjl23/ontologies/VitroFacultyReporting.0.2.owl"; - - static OntModelSpec ONT_MODEL_SPEC = OntModelSpec.OWL_DL_MEM; // no additional entailment reasoning - //OntModelSpec ONT_MODEL_SPEC = OntModelSpec.OWL_MEM_MICRO_RULE_INF; // some additional OWL entailment reasoning - //OntModelSpec ONT_MODEL_SPEC = OntModelSpec.RDFS_MEM_RDFS_INF; - -} diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicyTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicyTest.java index 852d7d8d6..6f7e06852 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicyTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicyTest.java @@ -16,7 +16,7 @@ import stubs.javax.servlet.ServletContextStub; import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.webapp.auth.identifier.ArrayIdentifierBundle; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; @@ -69,14 +69,11 @@ public class SelfEditingPolicyTest extends AbstractTestClass { policy = new SelfEditingPolicy(ctx); - ids = new ArrayIdentifierBundle(); - ids.add(new SelfEditingIdentifierFactory.NetId("test223")); - IndividualImpl ind = new IndividualImpl(); ind.setURI(SELFEDITOR_URI); - ids.add(new SelfEditingIdentifierFactory.SelfEditing(ind, - SelfEditingIdentifierFactory.NOT_BLACKLISTED)); - + + ids = new ArrayIdentifierBundle(); + ids.add(new HasAssociatedIndividual(SELFEDITOR_URI)); } @Test @@ -323,19 +320,13 @@ public class SelfEditingPolicyTest extends AbstractTestClass { private void setUpTwoSEIs() { ids = new ArrayIdentifierBundle(); - ids.add(new SelfEditingIdentifierFactory.NetId("bozoUser")); - IndividualImpl ind1 = new IndividualImpl(); ind1.setURI(SAFE_NS + "bozoUri"); - ids.add(new SelfEditingIdentifierFactory.SelfEditing(ind1, - SelfEditingIdentifierFactory.NOT_BLACKLISTED)); - - ids.add(new SelfEditingIdentifierFactory.NetId("test223")); + ids.add(new HasAssociatedIndividual(ind1.getURI())); IndividualImpl ind2 = new IndividualImpl(); ind2.setURI(SELFEDITOR_URI); - ids.add(new SelfEditingIdentifierFactory.SelfEditing(ind2, - SelfEditingIdentifierFactory.NOT_BLACKLISTED)); + ids.add(new HasAssociatedIndividual(ind2.getURI())); } // ---------------------------------------------------------------------- diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/resources/examplePolicy.xml b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/resources/examplePolicy.xml deleted file mode 100644 index 506c124d4..000000000 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/resources/examplePolicy.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Example Policy - PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> -PREFIX vivoa: <http://vivo.library.cornell.edu/abox#> -PREFIX vivo: <http://vivo.library.cornell.edu/ns/0.1#> -PREFIX vitro: <http://lowe.mannlib.cornell.edu/ns/vitro/0.1/vitro.owl#> - - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropObjectPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddObjectPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - ASK WHERE { ?object vitro:netid ?netid } - - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddDataPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - - - - edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropDataPropStmt - - ASK WHERE { ?subject vitro:netid ?netid } - - - - - diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditingPolicySetupTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditingPolicySetupTest.java index 4b833c6b0..9b12d4598 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditingPolicySetupTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditingPolicySetupTest.java @@ -22,7 +22,7 @@ import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.webapp.auth.identifier.ArrayIdentifierBundle; import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; import edu.cornell.mannlib.vitro.webapp.auth.policy.SelfEditingPolicy; import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; @@ -88,7 +88,7 @@ public class SelfEditingPolicySetupTest extends AbstractTestClass { PropertyRestrictionPolicyHelper.setBean(ctx, PropertyRestrictionPolicyHelperStub .getInstance(new String[] { ADMIN_NS })); - + policy = new SelfEditingPolicy(ctx); Assert.assertNotNull(policy); @@ -96,8 +96,7 @@ public class SelfEditingPolicySetupTest extends AbstractTestClass { seIndividual.setURI(SELFEDITOR_URI); ids = new ArrayIdentifierBundle(); - ids.add(new SelfEditingIdentifierFactory.SelfEditing(seIndividual, - SelfEditingIdentifierFactory.NOT_BLACKLISTED)); + ids.add(new HasAssociatedIndividual(SELFEDITOR_URI)); // setLoggerLevel(SelfEditingPolicySetupTest.class, Level.DEBUG); } @@ -125,16 +124,8 @@ public class SelfEditingPolicySetupTest extends AbstractTestClass { @Test public void noSelfEditorIdentifier() { ids.clear(); - ids.add(new Identifier() { /* empty identifier */ }); - assertAddObjectPropStmt(SELFEDITOR_URI, SAFE_PREDICATE, SAFE_RESOURCE, - Authorization.INCONCLUSIVE); - } - - @Test - public void blacklistedSelfEditor() { - ids.clear(); - ids.add(new SelfEditingIdentifierFactory.SelfEditing(seIndividual, - "Don't like this guy.")); + ids.add(new Identifier() { /* empty identifier */ + }); assertAddObjectPropStmt(SELFEDITOR_URI, SAFE_PREDICATE, SAFE_RESOURCE, Authorization.INCONCLUSIVE); } diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/SelfEditorRelationshipPolicyTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/SelfEditorRelationshipPolicyTest.java index 368c25d3f..a107080d7 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/SelfEditorRelationshipPolicyTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/SelfEditorRelationshipPolicyTest.java @@ -28,8 +28,8 @@ import com.hp.hpl.jena.rdf.model.StmtIterator; import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.webapp.auth.identifier.ArrayIdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasAssociatedIndividual; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; +import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; @@ -420,7 +420,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass { // ---------------------------------------------------------------------- private HasAssociatedIndividual makeSelfEditingId(String uri) { - return new HasAssociatedIndividual(uri, null); + return new HasAssociatedIndividual(uri); } private void assertDecision(Authorization expected, PolicyDecision decision) { diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/authenticate/AuthenticatorStub.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/authenticate/AuthenticatorStub.java index 5488d91fb..4d5c1e09a 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/authenticate/AuthenticatorStub.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/authenticate/AuthenticatorStub.java @@ -13,7 +13,6 @@ import javax.servlet.http.HttpServletRequest; import edu.cornell.mannlib.vedit.beans.LoginStatusBean; import edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource; import edu.cornell.mannlib.vitro.webapp.beans.User; -import edu.cornell.mannlib.vitro.webapp.controller.edit.Authenticate; /** * A simple stub for unit tests that require an Authenticator. Call setup() to @@ -137,7 +136,7 @@ public class AuthenticatorStub extends Authenticator { if (!isExistingUser(username)) { return false; } - String md5Password = Authenticate.applyMd5Encoding(clearTextPassword); + String md5Password = applyMd5Encoding(clearTextPassword); User user = getUserByUsername(username); return md5Password.equals(user.getMd5password()); } diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/authenticate/ProgramLoginTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/authenticate/ProgramLoginTest.java index f9a6c5f6e..871ae5928 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/authenticate/ProgramLoginTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/authenticate/ProgramLoginTest.java @@ -16,7 +16,6 @@ import javax.servlet.ServletException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.log4j.Level; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -29,7 +28,6 @@ import stubs.javax.servlet.http.HttpSessionStub; import edu.cornell.mannlib.vedit.beans.LoginStatusBean; import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.webapp.beans.User; -import edu.cornell.mannlib.vitro.webapp.controller.edit.Authenticate; /** * Test the basic features of ProgramTest. @@ -93,7 +91,7 @@ public class ProgramLoginTest extends AbstractTestClass { user.setUsername(name); user.setURI(uri); user.setRoleURI(String.valueOf(50)); - user.setMd5password(Authenticate.applyMd5Encoding(password)); + user.setMd5password(Authenticator.applyMd5Encoding(password)); user.setLoginCount(loginCount); if (loginCount > 0) { user.setFirstTime(new Date(0)); diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/edit/AuthenticateTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/edit/AuthenticateTest.java index c3d94254d..1e5bc810f 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/edit/AuthenticateTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/controller/edit/AuthenticateTest.java @@ -29,6 +29,7 @@ import edu.cornell.mannlib.vedit.beans.LoginStatusBean; import edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource; import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.webapp.beans.User; +import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator; import edu.cornell.mannlib.vitro.webapp.controller.authenticate.AuthenticatorStub; import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean; import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean.State; @@ -133,7 +134,7 @@ public class AuthenticateTest extends AbstractTestClass { user.setUsername(userInfo.username); user.setURI(userInfo.uri); user.setRoleURI(String.valueOf(userInfo.securityLevel)); - user.setMd5password(Authenticate.applyMd5Encoding(userInfo.password)); + user.setMd5password(Authenticator.applyMd5Encoding(userInfo.password)); user.setLoginCount(userInfo.loginCount); if (userInfo.loginCount > 0) { user.setFirstTime(new Date(0)); diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/EntityDaoJenaTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/EntityDaoJenaTest.java deleted file mode 100644 index 99de41cf6..000000000 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/EntityDaoJenaTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.dao.jena; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.ontology.OntModelSpec; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler; - -import edu.cornell.mannlib.vitro.testing.AbstractTestClass; -import edu.cornell.mannlib.vitro.webapp.auth.policy.JenaNetidPolicyTest; -import edu.cornell.mannlib.vitro.webapp.dao.jena.IndividualDaoJena; -import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import org.apache.log4j.Level; -import org.junit.Before; -import org.junit.Test; - -import java.io.InputStream; -import java.util.Collection; - -public class EntityDaoJenaTest extends AbstractTestClass { - - OntModel dorkHobbyModel; - - @Before - public void setUp() throws Exception { - // Suppress error logging. - setLoggerLevel(RDFDefaultErrorHandler.class, Level.OFF); - - Model model = ModelFactory.createDefaultModel(); - InputStream in = JenaNetidPolicyTest.class.getResourceAsStream("resources/dorkyhobbies.owl"); - model.read(in,null); - dorkHobbyModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM,model); - } - - /** - * This is a class that had no tests, so Brian and I pulled one back. But it - * doesn't compile, and it appears to be intended to test a method that has - * not been implemented. So for now, we give it a pass. - */ - @Test - public void testGetEntitiesByProperties() { - // This is the class that had no tests, so we pulled one back. -// IndividualDaoJena edj = new IndividualDaoJena(); -// edj.setOntModel(dorkHobbyModel); -// String propURI="http://test.mannlib.cornell.edu#hasHobby", -// ignoreEntURI="http://test.mannlib.cornell.edu#bob", -// classURI=null; -// -// //bob hasHobby x -// Collection ents = -// edj.getIndividualsByObjectProperty(propURI, ignoreEntURI, classURI, true); -// assertNotNull(ents); - } - -} diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJenaTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJenaTest.java index e2214ae64..33399e2d9 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJenaTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJenaTest.java @@ -83,6 +83,7 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass { assertEquals("changeRequired", false, u.isPasswordChangeRequired()); assertEquals("loginCount", 5, u.getLoginCount()); assertEquals("status", Status.ACTIVE, u.getStatus()); + assertEquals("externalAuthId", "user1", u.getExternalAuthId()); assertEquals("permissionSetUris", Collections.singleton(URI_ROLE1), u.getPermissionSetUris()); } @@ -112,6 +113,7 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass { in.setPasswordChangeRequired(true); in.setLoginCount(42); in.setStatus(Status.INACTIVE); + in.setExternalAuthId("newUser"); in.setPermissionSetUris(buildSet(URI_ROLE1, URI_ROLE2)); String newUri = dao.insertUserAccount(in); @@ -127,6 +129,7 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass { assertEquals("changeRequired", true, u.isPasswordChangeRequired()); assertEquals("loginCount", 42, u.getLoginCount()); assertEquals("status", Status.INACTIVE, u.getStatus()); + assertEquals("externalAuthId", "newUser", u.getExternalAuthId()); assertEquals("permissionSetUris", buildSet(URI_ROLE1, URI_ROLE2), u.getPermissionSetUris()); } @@ -157,6 +160,7 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass { up.setPasswordChangeRequired(false); up.setLoginCount(43); up.setStatus(Status.ACTIVE); + up.setExternalAuthId("updatedUser1"); up.setPermissionSetUris(buildSet(URI_ROLE1, URI_ROLE3)); dao.updateUserAccount(up); @@ -172,6 +176,7 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass { assertEquals("changeRequired", false, u.isPasswordChangeRequired()); assertEquals("loginCount", 43, u.getLoginCount()); assertEquals("status", Status.ACTIVE, u.getStatus()); + assertEquals("externalAuthId", "updatedUser1", u.getExternalAuthId()); assertEquals("permissionSetUris", buildSet(URI_ROLE1, URI_ROLE3), u.getPermissionSetUris()); } @@ -257,6 +262,10 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass { assertCorrectPermissionSets(expected, dao.getAllPermissionSets()); } + // ---------------------------------------------------------------------- + // helper methods + // ---------------------------------------------------------------------- + private void assertCorrectPermissionSets(Set expected, Collection actual) { Set> expectedMaps = new HashSet>(); diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/resources/UserAccountsDaoJenaTest.n3 b/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/resources/UserAccountsDaoJenaTest.n3 index 23ccced76..56d26e55c 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/resources/UserAccountsDaoJenaTest.n3 +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/dao/jena/resources/UserAccountsDaoJenaTest.n3 @@ -17,6 +17,7 @@ mydomain:user01 auth:passwordChangeExpires 0 ; auth:loginCount 5 ; auth:status "ACTIVE" ; + auth:externalAuthId "user1"; auth:hasPermissionSet mydomain:role1 ; . diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/elements/DateTimeWithPrecisionTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/elements/DateTimeWithPrecisionTest.java index def105b0c..a09ea7f9b 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/elements/DateTimeWithPrecisionTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/elements/DateTimeWithPrecisionTest.java @@ -24,9 +24,9 @@ import com.hp.hpl.jena.datatypes.xsd.XSDDateTime; import com.hp.hpl.jena.rdf.model.Literal; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; @RunWith(value= Parameterized.class) diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BasicValidationTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BasicValidationTest.java index a524b438a..cd60ae8ec 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BasicValidationTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/BasicValidationTest.java @@ -10,6 +10,8 @@ import junit.framework.Assert; import org.junit.Test; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.BasicValidation; + public class BasicValidationTest { @Test diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3GeneratorTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3GeneratorTest.java index 4d2964153..adf85fe28 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3GeneratorTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3GeneratorTest.java @@ -14,6 +14,8 @@ import org.junit.Test; import com.hp.hpl.jena.rdf.model.Literal; import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator; public class EditN3GeneratorTest { diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3UtilsTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3UtilsTest.java index e824fdbd8..604babd38 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3UtilsTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditN3UtilsTest.java @@ -11,6 +11,8 @@ import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.vocabulary.RDFS; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils; + public class EditN3UtilsTest { diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmissionTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmissionTest.java index cdfd8d465..616f0cf4e 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmissionTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/EditSubmissionTest.java @@ -14,6 +14,8 @@ import stubs.javax.servlet.http.HttpServletRequestStub; import com.hp.hpl.jena.rdf.model.Literal; import edu.cornell.mannlib.vitro.testing.AbstractTestClass; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission; public class EditSubmissionTest extends AbstractTestClass { HttpServletRequestStub request; diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHashTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHashTest.java index 862a277be..180a6bfcc 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHashTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHashTest.java @@ -19,6 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash; public class RdfLiteralHashTest { diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SparqlEvaluateTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SparqlEvaluateTest.java index c558d53b9..e4ba6909e 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SparqlEvaluateTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/SparqlEvaluateTest.java @@ -9,6 +9,9 @@ import org.junit.Test; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.SparqlEvaluate; + public class SparqlEvaluateTest { SparqlEvaluate sEval; diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/filestorage/backend/FileStorageSetupTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/filestorage/backend/FileStorageSetupTest.java deleted file mode 100644 index 32f3aca27..000000000 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/filestorage/backend/FileStorageSetupTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.filestorage.backend; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.io.File; -import java.io.IOException; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; - -import org.apache.log4j.Level; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import stubs.edu.cornell.mannlib.vitro.webapp.config.ConfigurationPropertiesStub; -import stubs.javax.servlet.ServletContextStub; -import edu.cornell.mannlib.vitro.testing.AbstractTestClass; -import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties; - -/** - * Test the methods of {@link FileStorageSetup} - */ -public class FileStorageSetupTest extends AbstractTestClass { - // ---------------------------------------------------------------------- - // framework - // ---------------------------------------------------------------------- - - private static File tempDir; - private static File vivoHomeDir; - private static File fsBaseDir; - - private FileStorageSetup fss; - private ServletContextEvent sce; - private ServletContext sc; - - @Before - public void createFileStorageSetup() { - fss = new FileStorageSetup(); - } - - @Before - public void createContext() { - sc = new ServletContextStub(); - sce = new ServletContextEvent(sc); - } - - @Before - public void createBaseDirectory() throws IOException { - tempDir = createTempDirectory("FileStorageFactoryTest"); - vivoHomeDir = new File(tempDir, "fsBaseDirectory"); - vivoHomeDir.mkdir(); - fsBaseDir = new File(vivoHomeDir, FileStorageSetup.FILE_STORAGE_SUBDIRECTORY); - fsBaseDir.mkdir(); - } - - @After - public void cleanupBaseDirectory() { - purgeDirectoryRecursively(tempDir); - } - - // ---------------------------------------------------------------------- - // tests - // ---------------------------------------------------------------------- - - @Test - public void baseDirectoryNotSpecified() { - setLoggerLevel(FileStorageSetup.class, Level.OFF); - setConfigurationProperties(null, "http://vivo.myDomain.edu/individual/"); - fss.contextInitialized(sce); - assertNull("no base directory", - sc.getAttribute(FileStorageSetup.ATTRIBUTE_NAME)); - } - - @Test - public void baseDirectoryDoesntExist() { - setLoggerLevel(FileStorageSetup.class, Level.OFF); - setConfigurationProperties("/bogus/Directory", - "http://vivo.myDomain.edu/individual/"); - fss.contextInitialized(sce); - assertNull("no such directory", - sc.getAttribute(FileStorageSetup.ATTRIBUTE_NAME)); - } - - @Test - public void defaultNamespaceNotSpecified() { - setLoggerLevel(FileStorageSetup.class, Level.OFF); - setConfigurationProperties(vivoHomeDir.getPath(), null); - fss.contextInitialized(sce); - assertNull("no default namespace", - sc.getAttribute(FileStorageSetup.ATTRIBUTE_NAME)); - } - - // This no longer throws an exception - it should be a success. - @Test - public void defaultNamespaceIsBogus() { - setLoggerLevel(FileStorageSetup.class, Level.ERROR); - setConfigurationProperties(vivoHomeDir.getPath(), "namespace"); - fss.contextInitialized(sce); - - Object o = sc.getAttribute(FileStorageSetup.ATTRIBUTE_NAME); - FileStorage fs = (FileStorage) o; - - assertEquals("implementation class", FileStorageImpl.class, - fs.getClass()); - } - - @Test - public void success() { - setConfigurationProperties(vivoHomeDir.getPath(), - "http://vivo.myDomain.edu/individual/"); - fss.contextInitialized(sce); - - Object o = sc.getAttribute(FileStorageSetup.ATTRIBUTE_NAME); - FileStorage fs = (FileStorage) o; - - assertEquals("implementation class", FileStorageImpl.class, - fs.getClass()); - } - - // ---------------------------------------------------------------------- - // Helper methods - // ---------------------------------------------------------------------- - - private void setConfigurationProperties(String baseDir, - String defaultNamespace) { - ConfigurationPropertiesStub props = new ConfigurationPropertiesStub(); - - if (baseDir != null) { - props.setProperty(FileStorageSetup.PROPERTY_VITRO_HOME_DIR, - baseDir); - } - if (defaultNamespace != null) { - props.setProperty(FileStorageSetup.PROPERTY_DEFAULT_NAMESPACE, - defaultNamespace); - } - - setLoggerLevel(ConfigurationProperties.class, Level.WARN); - props.setBean(sc); - } - -} diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasonerTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasonerTest.java index fd7474f5a..5ee990ed2 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasonerTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasonerTest.java @@ -554,7 +554,7 @@ public class SimpleReasonerTest extends AbstractTestClass { /* * tests rdfs:subPropertyOf materialization for object properties. */ - @Test + // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011 public void addABoxAssertion1(){ // Create TBox, ABox and Inference models and register @@ -597,7 +597,7 @@ public class SimpleReasonerTest extends AbstractTestClass { * Test that when a statement is asserted, that it not * added to the inference graph. */ - @Test + // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011 public void addABoxAssertion2(){ // Create TBox, ABox and Inference models and register @@ -639,7 +639,7 @@ public class SimpleReasonerTest extends AbstractTestClass { /* * Test inference based on property equivalence */ - @Test + // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011 public void addABoxAssertion4(){ // Create TBox, ABox and Inference models and register @@ -694,7 +694,7 @@ public class SimpleReasonerTest extends AbstractTestClass { * property so no inference should be materialized. */ - @Test + // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011 public void addABoxAssertion5(){ // Create TBox, ABox and Inference models and register @@ -737,7 +737,7 @@ public class SimpleReasonerTest extends AbstractTestClass { /* * Test inference based on property equivalence */ - @Test + // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011 public void addABoxAssertion6() { // Create TBox, ABox and Inference models and register @@ -794,7 +794,7 @@ public class SimpleReasonerTest extends AbstractTestClass { * rdfs:subPropetyOf statement, this test serves * as a test of equivalentProperty assertions also. */ - @Test + // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011 public void addTBoxSubPropertyAssertion1(){ // Create TBox, ABox and Inference models and register @@ -850,7 +850,6 @@ public class SimpleReasonerTest extends AbstractTestClass { } - @Test /* * Test the removal of a subPropertyOf statement from * the TBox. The instance data that is the basis @@ -864,6 +863,7 @@ public class SimpleReasonerTest extends AbstractTestClass { * as a test of equivalentProperty assertions also. * */ + // @Test uncomment when sub/equiv property inferencing is enabled. sjm222 5/13/2011 public void removeTBoxSubPropertyAssertion1(){ // Create TBox, ABox and Inference models and register // the ABox reasoner listeners with the ABox and TBox @@ -955,11 +955,12 @@ public class SimpleReasonerTest extends AbstractTestClass { } - @Test + /* * Test computation of mostSpecificType annotations in response * to an added/removed ABox type assertion. */ + @Test public void mstTest1(){ // Create TBox, ABox and Inference models and register // the ABox reasoner listeners with the ABox and TBox @@ -1025,11 +1026,12 @@ public class SimpleReasonerTest extends AbstractTestClass { Assert.assertFalse(aBox.contains(ind_x, mostSpecificType, ResourceFactory.createTypedLiteral(classD.getURI(), XSDDatatype.XSDanyURI))); } - @Test + /* * Test computation of mostSpecificType annotations in response * to an added ABox type assertion. */ + @Test public void mstTest2(){ // Create TBox, ABox and Inference models and register // the ABox reasoner listeners with the ABox and TBox @@ -1074,11 +1076,11 @@ public class SimpleReasonerTest extends AbstractTestClass { Assert.assertTrue(aBox.contains(ind_x, mostSpecificType, ResourceFactory.createTypedLiteral(classC.getURI(), XSDDatatype.XSDanyURI))); } - @Test /* * Test computation of mostSpecificType annotations in response * to an added/removed TBox assertions. */ + @Test public void mstTest3(){ // Create TBox, ABox and Inference models and register // the ABox reasoner listeners with the ABox and TBox diff --git a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryStub.java b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryStub.java index 1b6364a69..9cf22d62f 100644 --- a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryStub.java +++ b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryStub.java @@ -214,12 +214,6 @@ public class WebappDaoFactoryStub implements WebappDaoFactory { "WebappDaoFactory.getLinktypeDao() not implemented."); } - @Override - public FlagDao getFlagDao() { - throw new RuntimeException( - "WebappDaoFactory.getFlagDao() not implemented."); - } - // TODO This goes away when the UserAccounts stuff is fully implemented -- jb @Override public UserDao getUserDao() { diff --git a/webapp/web/css/browseClassGroups.css b/webapp/web/css/browseClassGroups.css index a22d75396..43d59b4ee 100644 --- a/webapp/web/css/browseClassGroups.css +++ b/webapp/web/css/browseClassGroups.css @@ -78,7 +78,7 @@ ul#classes-in-classgroup { margin-bottom: 10px; } ul#classes-in-classgroup.vis { - width: 44%; + width: 55%; border-right: 1px solid #DDE5E4; } ul#classes-in-classgroup li { @@ -106,7 +106,7 @@ ul#classes-in-classgroup .count-individuals { /* VISUALIZATION ------> */ #visual-graph { float: left; - width: 308px; + width: 235px; } #visual-graph h5 { padding: 20px 0 12px 12px; diff --git a/webapp/web/css/individual/individual.css b/webapp/web/css/individual/individual.css index 1da43eca1..4e890b093 100644 --- a/webapp/web/css/individual/individual.css +++ b/webapp/web/css/individual/individual.css @@ -174,7 +174,6 @@ ul.individual-urls-people li { line-height: 1.3em; } ul#links-additional li, ul#links-primary li { - width: 145px; word-wrap: break-word; } #photo-wrapper { diff --git a/webapp/web/edit/dashboardPropsList.jsp b/webapp/web/edit/dashboardPropsList.jsp index 9a51eaf6a..beb449214 100644 --- a/webapp/web/edit/dashboardPropsList.jsp +++ b/webapp/web/edit/dashboardPropsList.jsp @@ -1,38 +1,22 @@ <%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Property" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.KeywordProperty" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Property" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="java.util.ArrayList" %> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> -<%@ page import="edu.cornell.mannlib.vedit.beans.LoginStatusBean" %> <%! public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.dashboardPropsList.jsp"); %> -<% -boolean showSelfEdits=false; -boolean showCuratorEdits=false; -if( VitroRequestPrep.isSelfEditing(request) ) { - showSelfEdits=true; - log.debug("self editing active"); -} else { - log.debug("self editing inactive"); -} -if (LoginStatusBean.getBean(request).isLoggedInAtLeast(LoginStatusBean.EDITOR)) { - showCuratorEdits=true; - log.debug("curator editing active"); -} else { - log.debug("curator editing inactive"); -}%> + <%-- just moving this into page scope for easy use --%> <% log.debug("Starting dashboardPropsList.jsp"); diff --git a/webapp/web/edit/editDatapropStmtRequestDispatch.jsp b/webapp/web/edit/editDatapropStmtRequestDispatch.jsp index d533602fd..aff82a9c5 100644 --- a/webapp/web/edit/editDatapropStmtRequestDispatch.jsp +++ b/webapp/web/edit/editDatapropStmtRequestDispatch.jsp @@ -6,8 +6,8 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> diff --git a/webapp/web/edit/editRequestDispatch.jsp b/webapp/web/edit/editRequestDispatch.jsp index 58d183b14..2af319f81 100644 --- a/webapp/web/edit/editRequestDispatch.jsp +++ b/webapp/web/edit/editRequestDispatch.jsp @@ -4,7 +4,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> diff --git a/webapp/web/edit/forms/addMissingWithMonikerAndLink.jsp b/webapp/web/edit/forms/addMissingWithMonikerAndLink.jsp index 70cd68e79..1e669fee5 100644 --- a/webapp/web/edit/forms/addMissingWithMonikerAndLink.jsp +++ b/webapp/web/edit/forms/addMissingWithMonikerAndLink.jsp @@ -7,7 +7,7 @@ <%@ page import="com.hp.hpl.jena.rdf.model.Literal" %> <%@ page import="com.hp.hpl.jena.rdf.model.Model" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <% diff --git a/webapp/web/edit/forms/admin/mayEditAs.jsp b/webapp/web/edit/forms/admin/mayEditAs.jsp index 65387307d..8563a83c7 100644 --- a/webapp/web/edit/forms/admin/mayEditAs.jsp +++ b/webapp/web/edit/forms/admin/mayEditAs.jsp @@ -6,9 +6,9 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelSelector" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.ModelSelector" %> <%@ page import="com.hp.hpl.jena.ontology.OntModel"%> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> diff --git a/webapp/web/edit/forms/autoCompleteDatapropForm.jsp b/webapp/web/edit/forms/autoCompleteDatapropForm.jsp index a37b87478..cc8d81917 100644 --- a/webapp/web/edit/forms/autoCompleteDatapropForm.jsp +++ b/webapp/web/edit/forms/autoCompleteDatapropForm.jsp @@ -5,7 +5,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> diff --git a/webapp/web/edit/forms/autoCompleteObjPropForm.jsp b/webapp/web/edit/forms/autoCompleteObjPropForm.jsp index 8b4eb9302..80480c14f 100644 --- a/webapp/web/edit/forms/autoCompleteObjPropForm.jsp +++ b/webapp/web/edit/forms/autoCompleteObjPropForm.jsp @@ -6,7 +6,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> diff --git a/webapp/web/edit/forms/datapropStmtDelete.jsp b/webapp/web/edit/forms/datapropStmtDelete.jsp index 1d655e9b4..091eb28c9 100644 --- a/webapp/web/edit/forms/datapropStmtDelete.jsp +++ b/webapp/web/edit/forms/datapropStmtDelete.jsp @@ -7,14 +7,14 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.StandardModelSelector"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.StandardModelSelector"%> <%@ page import="com.hp.hpl.jena.shared.Lock"%> <%@ page import="com.hp.hpl.jena.ontology.OntModel"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent"%> diff --git a/webapp/web/edit/forms/dateTimeIntervalForm.jsp b/webapp/web/edit/forms/dateTimeIntervalForm.jsp index 9e6e250b0..65d8fc805 100644 --- a/webapp/web/edit/forms/dateTimeIntervalForm.jsp +++ b/webapp/web/edit/forms/dateTimeIntervalForm.jsp @@ -10,15 +10,15 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.DateTimeIntervalValidation"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation"%> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> diff --git a/webapp/web/edit/forms/dateTimeValueForm.jsp b/webapp/web/edit/forms/dateTimeValueForm.jsp index 664f23060..b483e52c1 100644 --- a/webapp/web/edit/forms/dateTimeValueForm.jsp +++ b/webapp/web/edit/forms/dateTimeValueForm.jsp @@ -10,18 +10,18 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field"%> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.DateTimeIntervalValidation"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> diff --git a/webapp/web/edit/forms/defaultAddMissingIndividualForm.jsp b/webapp/web/edit/forms/defaultAddMissingIndividualForm.jsp index 28825ff8d..26ac4a2bb 100644 --- a/webapp/web/edit/forms/defaultAddMissingIndividualForm.jsp +++ b/webapp/web/edit/forms/defaultAddMissingIndividualForm.jsp @@ -7,9 +7,9 @@ <%@ page import="com.hp.hpl.jena.rdf.model.Literal" %> <%@ page import="com.hp.hpl.jena.rdf.model.Model" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelChangePreprocessor"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.DefaultAddMissingIndividualFormModelPreprocessor"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.DefaultAddMissingIndividualFormModelPreprocessor"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena"%> diff --git a/webapp/web/edit/forms/defaultDatapropForm.jsp b/webapp/web/edit/forms/defaultDatapropForm.jsp index 780f620ff..127cc8aa9 100644 --- a/webapp/web/edit/forms/defaultDatapropForm.jsp +++ b/webapp/web/edit/forms/defaultDatapropForm.jsp @@ -7,7 +7,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="java.util.HashMap"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%! private static HashMap defaultsForXSDtypes ; diff --git a/webapp/web/edit/forms/defaultLinkForm.jsp b/webapp/web/edit/forms/defaultLinkForm.jsp index 46ffba3b7..b00be7505 100644 --- a/webapp/web/edit/forms/defaultLinkForm.jsp +++ b/webapp/web/edit/forms/defaultLinkForm.jsp @@ -6,7 +6,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> diff --git a/webapp/web/edit/forms/defaultObjPropForm.jsp b/webapp/web/edit/forms/defaultObjPropForm.jsp index 50eaea23b..0307a3a39 100644 --- a/webapp/web/edit/forms/defaultObjPropForm.jsp +++ b/webapp/web/edit/forms/defaultObjPropForm.jsp @@ -6,7 +6,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="java.util.List" %> <%@ page import="org.apache.commons.logging.LogFactory" %> @@ -23,7 +23,7 @@ WebappDaoFactory wdf = vreq.getWebappDaoFactory(); %> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator"%> <%@page import="java.util.Map"%> <%@page import="com.hp.hpl.jena.ontology.OntModel"%> <%@page import="edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch"%> diff --git a/webapp/web/edit/forms/propDelete.jsp b/webapp/web/edit/forms/propDelete.jsp index fbf0f1527..525cb4c4a 100644 --- a/webapp/web/edit/forms/propDelete.jsp +++ b/webapp/web/edit/forms/propDelete.jsp @@ -5,7 +5,7 @@ <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory.SelfEditing"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%> diff --git a/webapp/web/edit/forms/rdfsLabelForm.jsp b/webapp/web/edit/forms/rdfsLabelForm.jsp index 410254a31..98de933c4 100644 --- a/webapp/web/edit/forms/rdfsLabelForm.jsp +++ b/webapp/web/edit/forms/rdfsLabelForm.jsp @@ -9,8 +9,8 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> diff --git a/webapp/web/edit/forms/test/dateTimePrecTest.jsp b/webapp/web/edit/forms/test/dateTimePrecTest.jsp index de926ec61..daa508c7e 100644 --- a/webapp/web/edit/forms/test/dateTimePrecTest.jsp +++ b/webapp/web/edit/forms/test/dateTimePrecTest.jsp @@ -13,7 +13,7 @@ This is a test file for the DateTimeWithPrecision EditElement. <%@ page import="java.util.HashMap"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> diff --git a/webapp/web/edit/login.jsp b/webapp/web/edit/login.jsp deleted file mode 100644 index e8c4954a1..000000000 --- a/webapp/web/edit/login.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> - - -
The experimental in-line editing is disabled for this system.
- - -
- - - diff --git a/webapp/web/edit/messages/datapropertyBackButtonProblems.jsp b/webapp/web/edit/messages/datapropertyBackButtonProblems.jsp index 6db24c055..f77fcc765 100644 --- a/webapp/web/edit/messages/datapropertyBackButtonProblems.jsp +++ b/webapp/web/edit/messages/datapropertyBackButtonProblems.jsp @@ -9,10 +9,10 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.EditLiteral" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="org.apache.commons.logging.Log" %> @@ -21,7 +21,7 @@ <%@ page import="java.util.*" %> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> diff --git a/webapp/web/edit/n3Delete.jsp b/webapp/web/edit/n3Delete.jsp index 7c413fd5d..c0b3bfc48 100644 --- a/webapp/web/edit/n3Delete.jsp +++ b/webapp/web/edit/n3Delete.jsp @@ -9,10 +9,10 @@ <%@ page import="com.hp.hpl.jena.shared.Lock" %> <%@ page import="com.thoughtworks.xstream.XStream" %> <%@ page import="com.thoughtworks.xstream.io.xml.DomDriver" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="java.io.StringReader" %> <%@ page import="java.util.*" %> @@ -33,7 +33,7 @@ <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep"%> <%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> diff --git a/webapp/web/edit/postEditCleanUp.jsp b/webapp/web/edit/postEditCleanUp.jsp index 2e90be807..fff890d5c 100644 --- a/webapp/web/edit/postEditCleanUp.jsp +++ b/webapp/web/edit/postEditCleanUp.jsp @@ -1,7 +1,7 @@ <%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="org.apache.commons.lang.StringUtils" %> <%@page import="org.apache.commons.logging.Log"%> diff --git a/webapp/web/edit/processDatapropRdfForm.jsp b/webapp/web/edit/processDatapropRdfForm.jsp index 837a7bc75..18ad0bd83 100644 --- a/webapp/web/edit/processDatapropRdfForm.jsp +++ b/webapp/web/edit/processDatapropRdfForm.jsp @@ -9,10 +9,10 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.EditLiteral" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="org.apache.commons.logging.Log" %> @@ -21,13 +21,13 @@ <%@ page import="java.util.*" %> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%> <%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%-- 2nd prototype of processing, adapted for data property editing diff --git a/webapp/web/edit/processRdfForm2.jsp b/webapp/web/edit/processRdfForm2.jsp index dde36eb75..0a8971448 100644 --- a/webapp/web/edit/processRdfForm2.jsp +++ b/webapp/web/edit/processRdfForm2.jsp @@ -9,10 +9,10 @@ <%@ page import="com.hp.hpl.jena.shared.Lock" %> <%@ page import="com.thoughtworks.xstream.XStream" %> <%@ page import="com.thoughtworks.xstream.io.xml.DomDriver" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %> <%@ page import="java.io.StringReader" %> <%@ page import="java.util.*" %> <%@ page import="java.util.Map" %> @@ -34,10 +34,10 @@ <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep"%> -<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelChangePreprocessor"%> +<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="java.net.URLDecoder" %> <%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena"%> diff --git a/webapp/web/edit/selfeditcheck.jsp b/webapp/web/edit/selfeditcheck.jsp index 1cf75b1af..98e703a86 100644 --- a/webapp/web/edit/selfeditcheck.jsp +++ b/webapp/web/edit/selfeditcheck.jsp @@ -1,7 +1,7 @@ <%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> -<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> diff --git a/webapp/web/jenaIngest/renameResource.jsp b/webapp/web/jenaIngest/renameResource.jsp index 0bff46301..e9496e2ac 100644 --- a/webapp/web/jenaIngest/renameResource.jsp +++ b/webapp/web/jenaIngest/renameResource.jsp @@ -26,7 +26,7 @@ to follow the established "n" + random integer naming convention.

-

Old Namespace�

-

New Namespace�

+

Old namespace:

+

New namespace:

\ No newline at end of file diff --git a/webapp/web/js/browseClassGroups.js b/webapp/web/js/browseClassGroups.js index 4fc2922b9..142860383 100644 --- a/webapp/web/js/browseClassGroups.js +++ b/webapp/web/js/browseClassGroups.js @@ -149,9 +149,9 @@ var graphClassGroups = { var height = values.length * 37; // Create the canvas - var r = Raphael("visual-graph", 300, height + 10); + var r = Raphael("visual-graph", 225, height + 10); - var chart = r.g.hbarchart(0, 16, 300, height, [values], {type:"soft", singleColor:"#999"}); + var chart = r.g.hbarchart(0, 16, 225, height, [values], {type:"soft", singleColor:"#999"}); // Was unable to append within -- was always hidden and couldn't get it to display // so using jQuery click to add links diff --git a/webapp/web/templates/edit/specific/portal_retry.jsp b/webapp/web/templates/edit/specific/applicationBean_retry.jsp similarity index 100% rename from webapp/web/templates/edit/specific/portal_retry.jsp rename to webapp/web/templates/edit/specific/applicationBean_retry.jsp diff --git a/webapp/web/templates/edit/specific/ents_edit.jsp b/webapp/web/templates/edit/specific/ents_edit.jsp index ce119b428..32b09295d 100644 --- a/webapp/web/templates/edit/specific/ents_edit.jsp +++ b/webapp/web/templates/edit/specific/ents_edit.jsp @@ -8,10 +8,11 @@ version="2.0"> */ %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="form" uri="http://vitro.mannlib.cornell.edu/edit/tags" %> -<%@ page import="edu.cornell.mannlib.vedit.beans.LoginStatusBean" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousEditorPages" %> <% - if (LoginStatusBean.getBean(request).isLoggedInAtLeast(LoginStatusBean.EDITOR)) { + if (PolicyHelper.isAuthorizedForActions(request, new UseMiscellaneousEditorPages())) { request.setAttribute("isEditor", Boolean.TRUE); } %> diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl index fa4a3239c..e6264302d 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl @@ -3,152 +3,13 @@ <#-- Template for displaying list of user accounts -->
-

Account |

- - -
-
- -
- -
- - - -
+ <#--current page: +
--> -
- - - - -
- - - - - - - - - - - - - - - - - <#list accounts as account> - - - - - - - - - - -
Account Management
Email Address
First name
Last Name
Status
Roles
Login Count
- - - - ${account.emailAddress} - - ${account.firstName}${account.lastName}${account.status} - <#list account.permissionSets as permissionSet> -
${permissionSet}
- -
${account.loginCount}
- -
- - - - -
- - <#--link on user's email address currently does nothing--> - - - current page: -
- - sort order: + <#--sort order: - <#assign directions = ["ASC", "DESC"]> + <#--<#assign directions = ["ASC", "DESC"]> <#list fields as field> - + --> + -
- show accounts per page - -
- - - \ No newline at end of file + + + +

Account |

+ + + + +
+ +
+ +
+ + + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + <#list accounts as account> + + + + + + + + + + +
Account Management
+
+
+ Email Address +
+
+
First name
Last Name
Status
Roles
Login Count
+ + + + ${account.emailAddress} + + ${account.firstName}${account.lastName}${account.status} + <#list account.permissionSets as permissionSet> +
${permissionSet}
+ +
${account.loginCount}
+ +<#--link on user's email address currently does nothing--> + +${scripts.add('')} \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/adminLogin.ftl b/webapp/web/templates/freemarker/body/adminLogin.ftl index af3898a30..1751efd3f 100644 --- a/webapp/web/templates/freemarker/body/adminLogin.ftl +++ b/webapp/web/templates/freemarker/body/adminLogin.ftl @@ -1,38 +1,67 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -<#-- Template for the Fake External Authentication page. --> +<#-- Template for login using internal vitro account (even when external auth is enabled). Accessible at /admin/login --> -
+

Internal Login

<#if errorNoUser??> -

No username supplied.

+ <#assign errorMessage = "No email supplied." /> <#if errorNoPassword??> -

No password supplied

+ <#assign errorMessage = "No password supplied." /> <#if errorLoginFailed??> -

Username or Password was incorrect.

+ <#assign errorMessage = "Email or Password was incorrect." /> - <#if newPasswordRequired??> -

This is your first time logging in. You must supply a new password.

+ <#if errorNewPasswordWrongLength??> + <#assign errorMessage = "Password must be between 6 and 12 characters." /> -

- Enter the username and password for your internal VIVO account. -

- -
-
Username:
-
Password:
+ <#if errorNewPasswordsDontMatch??> + <#assign errorMessage = "Passwords do not match." /> + + + <#if errorNewPasswordMatchesOld??> + <#assign errorMessage = "Your new password must be different from your existing password." /> + + + <#if errorMessage?has_content> + + + + <#if !newPasswordRequired??> +

Enter the email address and password for your internal Vitro account.

+ <#else> +

You must change your password to log in.

+ + <#if newPasswordRequired??> -
New Password:
+ + + +

Minimum of 6 characters in length.

+ + + + + + + <#else> + + + + + - +

-
+
\ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/search/search-xmlResults.ftl b/webapp/web/templates/freemarker/body/search/search-xmlResults.ftl index 9def574b8..b96094453 100644 --- a/webapp/web/templates/freemarker/body/search/search-xmlResults.ftl +++ b/webapp/web/templates/freemarker/body/search/search-xmlResults.ftl @@ -9,7 +9,7 @@ - + <#list individuals as individual> ${individual.uri?xml} diff --git a/webapp/web/templates/freemarker/body/termsOfUse.ftl b/webapp/web/templates/freemarker/body/termsOfUse.ftl index a0862c635..f9859d97e 100644 --- a/webapp/web/templates/freemarker/body/termsOfUse.ftl +++ b/webapp/web/templates/freemarker/body/termsOfUse.ftl @@ -6,20 +6,25 @@

Disclaimers

This ${termsOfUse.siteName} website contains material—text information, publication citations, links, and images—provided by ${termsOfUse.siteHost} and by various - third parties, both individuals and organizations, commercial and otherwise. The use of this material - is protected by copyright and unless the terms of use are clearly stated with respect to individual items, - users must seek permission from the copyright owner for all uses that are not allowed by fair use and - other provisions of the United States Copyright Act. Redistribution or commercial use is prohibited - without express written permission.

+ third parties, both individuals and organizations, commercial and otherwise. To the extent copyrightable, + the information presented on the VIVO website and available as Resource Description Framework (RDF) data + from VIVO at ${termsOfUse.siteHost} is intended for public use and is freely distributed under the terms of the + Creative Commons CC-BY 3.0 license which allows you + to copy, distribute, display and make derivatives of this information provided you give credit to + ${termsOfUse.siteHost}. Any non-copyrightable information is available to you under a + CC0 waiver. However, source documents, + images or web pages attached to or linked from VIVO may contain copyrighted information and should only be + used or distributed under terms included with each source or in accordance with the principles of fair use. +

Disclaimer of Liability

${termsOfUse.siteHost?cap_first} makes no warranty, expressed or implied, including the warranties of merchantability and fitness for a particular purpose, or assumes any legal liability or responsibility for the accuracy, completeness, currency or usefulness of any material displayed or distributed through the - ${termsOfUse.siteName} website or represents that its use would not infringe privately owned rights. + ${termsOfUse.siteName} website or represents that its use would not infringe privately owned rights. ${termsOfUse.siteHost?cap_first} disclaims all warranties with regard to the information provided. Any reliance upon such information is at your own risk. In no event will ${termsOfUse.siteHost} be liable to you for any damages or losses whatsoever resulting - from or caused by the ${termsOfUse.siteName} website or its contents.

+ from or caused by the ${siteName} website or its contents.

Disclaimer of Endorsement

Reference herein to any specific commercial product, process, or service by trade name, diff --git a/webapp/web/templates/freemarker/widgets/widget-login.ftl b/webapp/web/templates/freemarker/widgets/widget-login.ftl index 77b20394b..c76468ba9 100644 --- a/webapp/web/templates/freemarker/widgets/widget-login.ftl +++ b/webapp/web/templates/freemarker/widgets/widget-login.ftl @@ -20,7 +20,7 @@

Alert Icon -

In order to edit VIVO content, you'll need to enable JavaScript.

+

In order to edit content, you'll need to enable JavaScript.

@@ -38,7 +38,7 @@ -
+ <#if externalAuthUrl??>

${externalAuthName}

or

@@ -46,13 +46,13 @@

Log in using your ${siteName} account

- - + + - - + + -

+

<#-- NC: remember me won't be ready for r1.2 --> @@ -74,16 +74,16 @@
- - - + + +

Minimum of 6 characters in length.

- - + + -

or Cancel

+

or Cancel