Anoop's major update. Everything has changed location.
This commit is contained in:
parent
c4c899c895
commit
6251b6c670
438 changed files with 40585 additions and 0 deletions
134
loadtests/LoadTest.jmx
Normal file
134
loadtests/LoadTest.jmx
Normal file
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.testelement.TestPlan">
|
||||
<testelement class="org.apache.jmeter.config.Arguments" name="TestPlan.user_defined_variables">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.config.Arguments</property>
|
||||
<collection class="java.util.ArrayList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="Arguments.arguments"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Argument List</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
</testelement>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.control.gui.TestPlanGui</property>
|
||||
<collection class="java.util.LinkedList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="TestPlan.thread_groups"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.testelement.TestPlan</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestPlan.serialize_threadgroups">false</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Test Plan</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestPlan.functional_mode">false</property>
|
||||
</testelement>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.threads.ThreadGroup">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.threads.gui.ThreadGroupGui</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.LongProperty" name="ThreadGroup.start_time">1068560706000</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.threads.ThreadGroup</property>
|
||||
<testelement class="org.apache.jmeter.control.LoopController" name="ThreadGroup.main_controller">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.control.gui.LoopControlPanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="LoopController.loops">250</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.control.LoopController</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Loop Controller</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="LoopController.continue_forever">false</property>
|
||||
</testelement>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">/lex/action Thread Group</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.LongProperty" name="ThreadGroup.end_time">1068560706000</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="ThreadGroup.num_threads">1</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="ThreadGroup.scheduler">false</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="ThreadGroup.ramp_time">1</property>
|
||||
</testelement>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.config.ConfigTestElement">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.path"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.config.ConfigTestElement</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">HTTP Request Defaults</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.domain">haley.local</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.protocol">http</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<testelement class="org.apache.jmeter.config.Arguments" name="HTTPsampler.Arguments">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.config.Arguments</property>
|
||||
<collection class="java.util.ArrayList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="Arguments.arguments"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Argument List</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
</testelement>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.port">2020</property>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.protocol.http.sampler.HTTPSampler">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.path">/lex/action</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.encoded_path">/lex/action</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.method">GET</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPSampler.use_keepalive">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.protocol"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPSampler.image_parser">false</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPSampler.follow_redirects">true</property>
|
||||
<testelement class="org.apache.jmeter.config.Arguments" name="HTTPsampler.Arguments">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.config.Arguments</property>
|
||||
<collection class="java.util.LinkedList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="Arguments.arguments">
|
||||
<testelement class="org.apache.jmeter.protocol.http.util.HTTPArgument" name="">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="Argument.metadata">=</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="Argument.value">menu</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPArgument.use_equals">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="Argument.name">cmd</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPArgument.always_encode">false</property>
|
||||
</testelement>
|
||||
</collection>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Argument List</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
</testelement>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.port"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.mimetype"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.FILE_FIELD"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">cmd=menu</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.domain"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.FILE_NAME"/>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.reporters.ResultCollector">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.visualizers.ViewResultsFullVisualizer</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.reporters.ResultCollector</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">View Results Tree</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="filename"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="ResultCollector.error_logging">false</property>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.reporters.ResultCollector">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.visualizers.StatVisualizer</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.reporters.ResultCollector</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Aggregate Report</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="filename"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="ResultCollector.error_logging">false</property>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.timers.UniformRandomTimer">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.timers.gui.UniformRandomTimerGui</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.timers.UniformRandomTimer</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Uniform Random Timer</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="ConstantTimer.delay">2000</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="RandomTimer.range">1000</property>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.protocol.http.control.CookieManager">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.CookiePanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.protocol.http.control.CookieManager</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">HTTP Cookie Manager</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="CookieManager.clearEachIteration">false</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<collection class="java.util.ArrayList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="CookieManager.cookies"/>
|
||||
</testelement>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
124
loadtests/LoadTestRecorder.jmx
Normal file
124
loadtests/LoadTestRecorder.jmx
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.testelement.TestPlan">
|
||||
<testelement class="org.apache.jmeter.config.Arguments" name="TestPlan.user_defined_variables">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.config.Arguments</property>
|
||||
<collection class="java.util.ArrayList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="Arguments.arguments"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Argument List</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
</testelement>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.control.gui.TestPlanGui</property>
|
||||
<collection class="java.util.LinkedList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="TestPlan.thread_groups"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.testelement.TestPlan</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestPlan.serialize_threadgroups">false</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Test Plan</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestPlan.functional_mode">false</property>
|
||||
</testelement>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.threads.ThreadGroup">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.threads.gui.ThreadGroupGui</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.LongProperty" name="ThreadGroup.start_time">1068560706000</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.threads.ThreadGroup</property>
|
||||
<testelement class="org.apache.jmeter.control.LoopController" name="ThreadGroup.main_controller">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.control.gui.LoopControlPanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="LoopController.loops">250</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.control.LoopController</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Loop Controller</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="LoopController.continue_forever">false</property>
|
||||
</testelement>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">/lex/action Thread Group</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.LongProperty" name="ThreadGroup.end_time">1068560706000</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="ThreadGroup.num_threads">1</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="ThreadGroup.scheduler">false</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="ThreadGroup.ramp_time">1</property>
|
||||
</testelement>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.config.ConfigTestElement">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.path"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.config.ConfigTestElement</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">HTTP Request Defaults</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.domain">haley.local</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.protocol">http</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.port">2020</property>
|
||||
<testelement class="org.apache.jmeter.config.Arguments" name="HTTPsampler.Arguments">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.config.Arguments</property>
|
||||
<collection class="java.util.ArrayList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="Arguments.arguments"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Argument List</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
</testelement>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.protocol.http.sampler.HTTPSampler">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.path">/lex/action</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.encoded_path">/lex/action</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.method">GET</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPSampler.use_keepalive">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.protocol"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPSampler.image_parser">false</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPSampler.follow_redirects">true</property>
|
||||
<testelement class="org.apache.jmeter.config.Arguments" name="HTTPsampler.Arguments">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.config.Arguments</property>
|
||||
<collection class="java.util.LinkedList" propType="org.apache.jmeter.testelement.property.CollectionProperty" name="Arguments.arguments">
|
||||
<testelement class="org.apache.jmeter.protocol.http.util.HTTPArgument" name="">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="Argument.metadata">=</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="Argument.value">menu</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPArgument.use_equals">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="Argument.name">cmd</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="HTTPArgument.always_encode">false</property>
|
||||
</testelement>
|
||||
</collection>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Argument List</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
</testelement>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.port"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.mimetype"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.FILE_FIELD"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">cmd=menu</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.domain"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="HTTPSampler.FILE_NAME"/>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.reporters.ResultCollector">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.visualizers.ViewResultsFullVisualizer</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.reporters.ResultCollector</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">View Results Tree</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="filename"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="ResultCollector.error_logging">false</property>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.reporters.ResultCollector">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.visualizers.StatVisualizer</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.reporters.ResultCollector</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Aggregate Report</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="filename"/>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="ResultCollector.error_logging">false</property>
|
||||
</testelement>
|
||||
</node>
|
||||
<node>
|
||||
<testelement class="org.apache.jmeter.timers.UniformRandomTimer">
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.gui_class">org.apache.jmeter.timers.gui.UniformRandomTimerGui</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.test_class">org.apache.jmeter.timers.UniformRandomTimer</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="TestElement.name">Uniform Random Timer</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.BooleanProperty" name="TestElement.enabled">true</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="RandomTimer.range">1000</property>
|
||||
<property xml:space="preserve" propType="org.apache.jmeter.testelement.property.StringProperty" name="ConstantTimer.delay">2000</property>
|
||||
</testelement>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
4
src/java/dictionary-importer.properties.sample
Normal file
4
src/java/dictionary-importer.properties.sample
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Default localized resources for DictionaryImporter
|
||||
|
||||
dictionaryimporter.driverclassname=com.mysql.jdbc.Driver
|
||||
dictionaryimporter.url=jdbc:mysql://localhost:3306/lex?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&user=USERNAME&password=PASSWORD
|
46
src/java/hibernate.cfg.xml
Normal file
46
src/java/hibernate.cfg.xml
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
|
||||
|
||||
<hibernate-configuration>
|
||||
|
||||
<session-factory>
|
||||
|
||||
<property name="connection.datasource">java:comp/env/jdbc/lex-datasource</property>
|
||||
|
||||
<!-- <property name="connection.url">jdbc:mysql://localhost:3306/lex?useUnicode=true&characterEncoding=UTF-8</property>
|
||||
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
|
||||
<property name="connection.username">javauser</property>
|
||||
<property name="connection.password">javadude</property> -->
|
||||
|
||||
<property name="show_sql">false</property>
|
||||
<property name="use_outer_join">true</property>
|
||||
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
|
||||
<!-- <property name="max_fetch_depth">15</property>
|
||||
-->
|
||||
<!-- Mapping files -->
|
||||
<mapping resource="org/thdl/lex/component/LexComponent.hbm.xml"/>
|
||||
<!-- <mapping resource="org/thdl/lex/component/child/Author.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Dialect.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/EtymologyType.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Function.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/FunctionsGeneral.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/FunctionsSpecific.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Language.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/LiteraryForm.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/LiteraryGenre.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/LiteraryPeriod.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/LiterarySource.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/MajorDialectFamily.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/PhoneticsType.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/ProjectSubject.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Register.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/RelatedTermType.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Script.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/Source.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/SpecificDialect.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/SpellingType.hbm.xml"/>
|
||||
<mapping resource="org/thdl/lex/component/child/TransitionalDataLabel.hbm.xml"/> -->
|
||||
</session-factory>
|
||||
|
||||
</hibernate-configuration>
|
6
src/java/lex-codegen-cfg.xml
Normal file
6
src/java/lex-codegen-cfg.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<codegen>
|
||||
<meta attribute="scope-class" inherit="false">abstract public </meta>
|
||||
<generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"/>
|
||||
<!-- <generate package="org.thdl.lex.component.peer" suffix="Peer" renderer="net.sf.hibernate.tool.hbm2java.FinderRenderer"/> -->
|
||||
</codegen>
|
||||
|
17
src/java/log4j.properties
Normal file
17
src/java/log4j.properties
Normal file
|
@ -0,0 +1,17 @@
|
|||
### direct log messages to stdout ###
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
|
||||
### direct messages to file hibernate.log ###
|
||||
log4j.appender.file=org.apache.log4j.FileAppender
|
||||
log4j.appender.file.File=/dictionary-hibernate.log
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
|
||||
### direct messages to file lex.log ###
|
||||
log4j.appender.lex-out=org.apache.log4j.FileAppender
|
||||
log4j.appender.lex-out.File=/dictionary.log
|
||||
log4j.appender.lex-out.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.lex-out.layout.ConversionPattern=%d{ABattribute>
|
145
src/java/org/thdl/lex/AuthenticationFilter.java
Normal file
145
src/java/org/thdl/lex/AuthenticationFilter.java
Normal file
|
@ -0,0 +1,145 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 21, 2003
|
||||
*/
|
||||
public class AuthenticationFilter implements Filter {
|
||||
//attributes
|
||||
private String loginPage;
|
||||
|
||||
//accessors
|
||||
/**
|
||||
* Sets the loginPage attribute of the AuthenticationFilter object
|
||||
*
|
||||
* @param loginPage
|
||||
* The new loginPage value
|
||||
*/
|
||||
public void setLoginPage(String loginPage) {
|
||||
this.loginPage = loginPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the loginPage attribute of the AuthenticationFilter object
|
||||
*
|
||||
* @return The loginPage value
|
||||
*/
|
||||
public String getLoginPage() {
|
||||
return loginPage;
|
||||
}
|
||||
|
||||
//contract methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param config
|
||||
* Description of the Parameter
|
||||
* @exception ServletException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
setLoginPage(config.getInitParameter("loginPage"));
|
||||
if (null == getLoginPage()) {
|
||||
throw new ServletException(
|
||||
"The loginPage parameter must be specified");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of the Parameter
|
||||
* @param response
|
||||
* Description of the Parameter
|
||||
* @param chain
|
||||
* Description of the Parameter
|
||||
* @exception IOException
|
||||
* Description of the Exception
|
||||
* @exception ServletException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
if (request instanceof HttpServletRequest
|
||||
&& response instanceof HttpServletResponse) {
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
ThdlUser user = visit.getUser();
|
||||
if (null == user) {
|
||||
requireLogin(req, (HttpServletResponse) response, req
|
||||
.getSession(true));
|
||||
} else {
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
} else {
|
||||
throw new ServletException(
|
||||
"Filter only applicable to HTTP and HTTPS requests");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*/
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
//helper methods
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of the Parameter
|
||||
* @param response
|
||||
* Description of the Parameter
|
||||
* @param session
|
||||
* Description of the Parameter
|
||||
* @exception IOException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void requireLogin(HttpServletRequest request,
|
||||
HttpServletResponse response, HttpSession session)
|
||||
throws IOException {
|
||||
StringBuffer buffer = request.getRequestURL();
|
||||
String query = request.getQueryString();
|
||||
Enumeration params = request.getParameterNames();
|
||||
boolean paramsExist;
|
||||
if (params.hasMoreElements()) {
|
||||
paramsExist = true;
|
||||
buffer.append('?');
|
||||
while (params.hasMoreElements()) {
|
||||
String temp = (String) params.nextElement();
|
||||
buffer.append(temp + "=" + request.getParameter(temp));
|
||||
if (params.hasMoreElements()) {
|
||||
buffer.append("&");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
paramsExist = false;
|
||||
}
|
||||
|
||||
UserSessionManager.getInstance().setSessionLoginTarget(session,
|
||||
buffer.toString());
|
||||
UserSessionManager.doRedirect(request, response, loginPage);
|
||||
}
|
||||
}
|
||||
|
70
src/java/org/thdl/lex/CharEncFilter.java
Normal file
70
src/java/org/thdl/lex/CharEncFilter.java
Normal file
|
@ -0,0 +1,70 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 21, 2003
|
||||
*/
|
||||
public class CharEncFilter implements Filter {
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param config
|
||||
* Description of the Parameter
|
||||
* @exception ServletException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of the Parameter
|
||||
* @param response
|
||||
* Description of the Parameter
|
||||
* @param chain
|
||||
* Description of the Parameter
|
||||
* @exception IOException
|
||||
* Description of the Exception
|
||||
* @exception ServletException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
if (request instanceof HttpServletRequest
|
||||
&& response instanceof HttpServletResponse) {
|
||||
HttpServletResponse res = (HttpServletResponse) response;
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
res.setContentType("text/html; charset=UTF-8;");
|
||||
req.setCharacterEncoding("UTF-8");
|
||||
|
||||
chain.doFilter(request, response);
|
||||
} else {
|
||||
throw new ServletException(
|
||||
"Filter only applicable to HTTP and HTTPS requests");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*/
|
||||
public void destroy() {
|
||||
}
|
||||
//helper methods
|
||||
|
||||
}
|
||||
|
79
src/java/org/thdl/lex/ConvertDataToNewMapping.java
Normal file
79
src/java/org/thdl/lex/ConvertDataToNewMapping.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.Query;
|
||||
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created February 16, 2004
|
||||
*/
|
||||
public class ConvertDataToNewMapping {
|
||||
public static File file = null;
|
||||
|
||||
public static void convertLexComponents(String[] args) {
|
||||
try {
|
||||
|
||||
if (file.exists()) {
|
||||
System.out.println("Config File exists!");
|
||||
} else {
|
||||
System.out.println("Config File DOES NOT exist!");
|
||||
}
|
||||
|
||||
HibernateSessionDataTransfer.setConfig(file);
|
||||
HibernateSessionDataTransfer.setConfigResource(args[0]);
|
||||
|
||||
Iterator it;
|
||||
ILexComponent lc;
|
||||
|
||||
LexComponentRepository.beginTransaction();
|
||||
|
||||
String queryString = " FROM org.thdl.lex.component.LexComponent comp where metaId";
|
||||
Query query = LexComponentRepository.getSession().createQuery(
|
||||
queryString);
|
||||
it = query.iterate();
|
||||
while (it.hasNext()) {
|
||||
lc = (ILexComponent) it.next();
|
||||
|
||||
System.out.println("Saving: " + lc.toString());
|
||||
|
||||
try {
|
||||
LexComponentRepositoryDataTransfer.beginTransaction();
|
||||
LexComponentRepositoryDataTransfer.getSession().save(lc);
|
||||
LexComponentRepositoryDataTransfer.endTransaction(true);
|
||||
LexComponentRepositoryDataTransfer.getSession().evict(lc);
|
||||
LexComponentRepository.getSession().evict(lc);
|
||||
} catch (HibernateException he) {
|
||||
LexComponentRepositoryDataTransfer.endTransaction(false);
|
||||
throw he;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LexComponentRepository.endTransaction(false);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The main program for the ConvertDataToNewMapping class
|
||||
*
|
||||
* @param args
|
||||
* The command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
file = new java.io.File(args[0]);
|
||||
//ConvertDataToNewMapping.convertLexComponents();
|
||||
//ConvertDataToNewMapping.convertTerms();
|
||||
//ConvertDataToNewMapping.writeCredits();
|
||||
}
|
||||
}
|
||||
|
317
src/java/org/thdl/lex/DisplayHelper.java
Normal file
317
src/java/org/thdl/lex/DisplayHelper.java
Normal file
|
@ -0,0 +1,317 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.Translatable;
|
||||
import org.thdl.tib.text.TibetanHTML;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 14, 2003
|
||||
*/
|
||||
public class DisplayHelper {
|
||||
private Collection collection;
|
||||
|
||||
private ILexComponent component;
|
||||
|
||||
private ILexComponent note;
|
||||
|
||||
private Date date;
|
||||
|
||||
private final static DateFormat DATE_FORMAT = DateFormat
|
||||
.getDateInstance(DateFormat.LONG);
|
||||
|
||||
private boolean showNotes;
|
||||
|
||||
private boolean showMeta;
|
||||
|
||||
private boolean showEditOptions;
|
||||
|
||||
private boolean showTranslations;
|
||||
|
||||
private String wylie;
|
||||
|
||||
/**
|
||||
* Sets the wylie attribute of the DisplayHelper object
|
||||
*
|
||||
* @param wylie
|
||||
* The new wylie value
|
||||
*/
|
||||
public void setWylie(String wylie) {
|
||||
this.wylie = wylie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the wylie attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The wylie value
|
||||
*/
|
||||
public String getWylie() {
|
||||
return wylie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the date attribute of the DisplayHelper object
|
||||
*
|
||||
* @param date
|
||||
* The new date value
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the date attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The date value
|
||||
*/
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the note attribute of the DisplayHelper object
|
||||
*
|
||||
* @param note
|
||||
* The new note value
|
||||
*/
|
||||
public void setNote(ILexComponent note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the note attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The note value
|
||||
*/
|
||||
public ILexComponent getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the component attribute of the DisplayHelper object
|
||||
*
|
||||
* @param component
|
||||
* The new component value
|
||||
*/
|
||||
public void setComponent(ILexComponent component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the component attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The component value
|
||||
*/
|
||||
public ILexComponent getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the showEditOptions attribute of the DisplayHelper object
|
||||
*
|
||||
* @param showEditOptions
|
||||
* The new showEditOptions value
|
||||
*/
|
||||
public void setShowEditOptions(boolean showEditOptions) {
|
||||
this.showEditOptions = showEditOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the showEditOptions attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The showEditOptions value
|
||||
*/
|
||||
public boolean getShowEditOptions() {
|
||||
return showEditOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the showTranslations attribute of the DisplayHelper object
|
||||
*
|
||||
* @param showTranslations
|
||||
* The new showTranslations value
|
||||
*/
|
||||
public void setShowTranslations(boolean showTranslations) {
|
||||
this.showTranslations = showTranslations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the showTranslations attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The showTranslations value
|
||||
*/
|
||||
public boolean getShowTranslations() {
|
||||
return showTranslations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the showNotes attribute of the DisplayHelper object
|
||||
*
|
||||
* @param showNotes
|
||||
* The new showNotes value
|
||||
*/
|
||||
public void setShowNotes(boolean showNotes) {
|
||||
this.showNotes = showNotes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the showMeta attribute of the DisplayHelper object
|
||||
*
|
||||
* @param showMeta
|
||||
* The new showMeta value
|
||||
*/
|
||||
public void setShowMeta(boolean showMeta) {
|
||||
this.showMeta = showMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the showNotes attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The showNotes value
|
||||
*/
|
||||
public boolean getShowNotes() {
|
||||
return showNotes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the showMeta attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The showMeta value
|
||||
*/
|
||||
public boolean getShowMeta() {
|
||||
return showMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the collection attribute of the DisplayHelper object
|
||||
*
|
||||
* @param collection
|
||||
* The new collection value
|
||||
*/
|
||||
public void setCollection(Collection collection) {
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the collection attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The collection value
|
||||
*/
|
||||
public Collection getCollection() {
|
||||
return collection;
|
||||
}
|
||||
|
||||
//composite properties
|
||||
/**
|
||||
* Gets the collectionSize attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The collectionSize value
|
||||
*/
|
||||
public int getCollectionSize() {
|
||||
int size = 0;
|
||||
if (null != getCollection()) {
|
||||
size = getCollection().size();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the componentIsTranslation attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The componentIsTranslation value
|
||||
*/
|
||||
public boolean getComponentIsTranslation() {
|
||||
|
||||
boolean b = false;
|
||||
if (null != getComponent() && getComponent() instanceof Translatable) {
|
||||
Translatable t = (Translatable) getComponent();
|
||||
b = t.getTranslationOf() != null ? true : false;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tibetan attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The tibetan value
|
||||
*/
|
||||
public String getTibetan() {
|
||||
return TibetanHTML.getHTML(getWylie());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the formattedDate attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The formattedDate value
|
||||
*/
|
||||
public String getFormattedDate() {
|
||||
String date = null;
|
||||
if (null != getDate()) {
|
||||
date = DATE_FORMAT.format(getDate());
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
// helpers
|
||||
/**
|
||||
* Description of the Method
|
||||
*/
|
||||
public void clear() {
|
||||
setShowEditOptions(false);
|
||||
setShowMeta(false);
|
||||
setShowTranslations(false);
|
||||
setShowNotes(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param map
|
||||
* Description of the Parameter
|
||||
* @exception Exception
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void populate(Map map) throws Exception {
|
||||
clear();
|
||||
BeanUtils.populate(this, map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hashCode attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The hashCode value
|
||||
*/
|
||||
public int getHashCodeForComponent() {
|
||||
return getComponent().hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hashCodeForCollection attribute of the DisplayHelper object
|
||||
*
|
||||
* @return The hashCodeForCollection value
|
||||
*/
|
||||
public int getHashCodeForCollection() {
|
||||
return getCollection().hashCode();
|
||||
}
|
||||
|
||||
public String getIndexOfComponent() {
|
||||
int i = ((List) getCollection()).indexOf(getComponent()) + 1;
|
||||
return "" + i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the DisplayHelper object
|
||||
*/
|
||||
public DisplayHelper() {
|
||||
}
|
||||
}
|
||||
|
204
src/java/org/thdl/lex/Global.java
Normal file
204
src/java/org/thdl/lex/Global.java
Normal file
|
@ -0,0 +1,204 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.thdl.lex.component.ITerm;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 20, 2003
|
||||
*/
|
||||
public class Global {
|
||||
private static long refreshDelay;
|
||||
|
||||
private static int recentTermsCount;
|
||||
|
||||
private static long lastRefresh;
|
||||
|
||||
private int entryCount;
|
||||
|
||||
private List recentTerms;
|
||||
|
||||
/**
|
||||
* Gets the lastUpdateAsDate attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The lastUpdateAsDate value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public Date getLastUpdate() throws LexRepositoryException {
|
||||
Date date = null;
|
||||
if (null != getRecentTerms() && getRecentTerms().size() > 0) {
|
||||
ITerm term = (ITerm) getRecentTerms().get(0);
|
||||
date = term.getMeta().getModifiedOn();
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the recentTermsCount attribute of the Global object
|
||||
*
|
||||
* @param recentTermsCount
|
||||
* The new recentTermsCount value
|
||||
*/
|
||||
public void setRecentTermsCount(int recentTermsCount) {
|
||||
this.recentTermsCount = recentTermsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the refreshDelay attribute of the Global object
|
||||
*
|
||||
* @param refreshDelay
|
||||
* The new refreshDelay value
|
||||
*/
|
||||
public void setRefreshDelay(long refreshDelay) {
|
||||
this.refreshDelay = refreshDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the recentTermsCount attribute of the Global object
|
||||
*
|
||||
* @return The recentTermsCount value
|
||||
*/
|
||||
public int getRecentTermsCount() {
|
||||
return recentTermsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the refreshDelay attribute of the Global object
|
||||
*
|
||||
* @return The refreshDelay value
|
||||
*/
|
||||
public long getRefreshDelay() {
|
||||
return refreshDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entryCount attribute of the Global object
|
||||
*
|
||||
* @param entryCount
|
||||
* The new entryCount value
|
||||
*/
|
||||
public void setEntryCount(int entryCount) {
|
||||
this.entryCount = entryCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the lastRefresh attribute of the Global object
|
||||
*
|
||||
* @param lastRefresh
|
||||
* The new lastRefresh value
|
||||
*/
|
||||
public void setLastRefresh(long lastRefresh) {
|
||||
this.lastRefresh = lastRefresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the recentTerms attribute of the Global object
|
||||
*
|
||||
* @param recentTerms
|
||||
* The new recentTerms value
|
||||
*/
|
||||
public void setRecentTerms(List recentTerms) {
|
||||
this.recentTerms = recentTerms;
|
||||
setLastRefresh(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lastRefresh attribute of the Global object
|
||||
*
|
||||
* @return The lastRefresh value
|
||||
*/
|
||||
public long getLastRefresh() {
|
||||
return lastRefresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the recentTerms attribute of the Global object
|
||||
*
|
||||
* @return The recentTerms value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public List getRecentTerms() throws LexRepositoryException {
|
||||
if (null == recentTerms || requiresRefresh()) {
|
||||
refresh();
|
||||
}
|
||||
return recentTerms;
|
||||
}
|
||||
|
||||
//helpers
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public boolean requiresRefresh() {
|
||||
boolean requiresRefresh = false;
|
||||
long now = System.currentTimeMillis();
|
||||
long lastUpdate = LexComponentRepository.getLastUpdate();
|
||||
long sinceLastRefresh = now - getLastRefresh();
|
||||
|
||||
//LexLogger.debug( "Requires Refresh Logic: if " + sinceLastRefresh + "
|
||||
// > " + getRefreshDelay() + " && " + lastUpdate + " > " +
|
||||
// getLastRefresh() );
|
||||
if (sinceLastRefresh > getRefreshDelay()
|
||||
&& lastUpdate > getLastRefresh()) {
|
||||
requiresRefresh = true;
|
||||
LexLogger.debug("Refresh Required at: "
|
||||
+ System.currentTimeMillis());
|
||||
}
|
||||
return requiresRefresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*/
|
||||
public void refresh() {
|
||||
try {
|
||||
int limit = getRecentTermsCount();
|
||||
LexLogger.debug("GlobalRefresher is starting a refresh for the "
|
||||
+ limit + " most recent terms.");
|
||||
setRecentTerms(LexComponentRepository.getRecentTerms(limit));
|
||||
LexLogger.debug("GlobalRefresher is finished refreshing...");
|
||||
LexLogger.debug("Here's the new recent terms list: "
|
||||
+ getRecentTerms().toString());
|
||||
LexComponentRepository.cleanup();
|
||||
LexLogger.info("GlobalRefresher finished a refresh...");
|
||||
} catch (Exception e) {
|
||||
StringWriter writer = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(writer));
|
||||
String stackTrace = writer.getBuffer().toString();
|
||||
LexLogger.error("GlobalRefresher Thread caught an Exception: "
|
||||
+ stackTrace);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the Global object
|
||||
*/
|
||||
public Global() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the Global object
|
||||
*
|
||||
* @param refreshDelay
|
||||
* Description of the Parameter
|
||||
* @param recentItems
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public Global(int recentItems, long refreshDelay) {
|
||||
setRecentTermsCount(recentItems);
|
||||
setRefreshDelay(refreshDelay);
|
||||
}
|
||||
|
||||
}
|
||||
|
106
src/java/org/thdl/lex/GuestFilter.java
Normal file
106
src/java/org/thdl/lex/GuestFilter.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 9, 2003
|
||||
*/
|
||||
public class GuestFilter implements Filter {
|
||||
//attributes
|
||||
private String loginPage;
|
||||
|
||||
private UserSessionManager sessionMgr;
|
||||
|
||||
//accessors
|
||||
/**
|
||||
* Sets the loginPage attribute of the GuestFilter object
|
||||
*
|
||||
* @param loginPage
|
||||
* The new loginPage value
|
||||
*/
|
||||
public void setLoginPage(String loginPage) {
|
||||
this.loginPage = loginPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the loginPage attribute of the GuestFilter object
|
||||
*
|
||||
* @return The loginPage value
|
||||
*/
|
||||
public String getLoginPage() {
|
||||
return loginPage;
|
||||
}
|
||||
|
||||
//contract methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param config
|
||||
* Description of the Parameter
|
||||
* @exception ServletException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of the Parameter
|
||||
* @param response
|
||||
* Description of the Parameter
|
||||
* @param chain
|
||||
* Description of the Parameter
|
||||
* @exception IOException
|
||||
* Description of the Exception
|
||||
* @exception ServletException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
if (request instanceof HttpServletRequest
|
||||
&& response instanceof HttpServletResponse) {
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
ThdlUser user = visit.getUser();
|
||||
if (null == user) {
|
||||
try {
|
||||
user = new LexUser();
|
||||
} catch (Exception e) {
|
||||
throw new ServletException(e);
|
||||
}
|
||||
user.setRoles("guest");
|
||||
visit.setUser(user);
|
||||
visit.setDisplayMode("full");
|
||||
}
|
||||
chain.doFilter(request, response);
|
||||
} else {
|
||||
throw new ServletException(
|
||||
"Filter only applicable to HTTP and HTTPS requests");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*/
|
||||
public void destroy() {
|
||||
}
|
||||
//helper methods
|
||||
}
|
||||
|
68
src/java/org/thdl/lex/HibernateSession.java
Normal file
68
src/java/org/thdl/lex/HibernateSession.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.Session;
|
||||
import net.sf.hibernate.SessionFactory;
|
||||
import net.sf.hibernate.cfg.Configuration;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author Hibernate WIKI
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class HibernateSession {
|
||||
|
||||
private static SessionFactory sessionFactory;
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static ThreadLocal session = new ThreadLocal();
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Returned Value
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static Session currentSession() throws HibernateException {
|
||||
|
||||
Session s = (Session) session.get();
|
||||
if (s == null) {
|
||||
|
||||
// Don't get from JNDI, use a static SessionFactory
|
||||
if (sessionFactory == null) {
|
||||
|
||||
// Use default hibernate.cfg.xml
|
||||
sessionFactory = new Configuration().configure()
|
||||
.buildSessionFactory();
|
||||
|
||||
}
|
||||
|
||||
s = sessionFactory.openSession();
|
||||
session.set(s);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void closeSession() throws HibernateException {
|
||||
|
||||
Session s = (Session) session.get();
|
||||
session.set(null);
|
||||
if (s != null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
104
src/java/org/thdl/lex/HibernateSessionDataTransfer.java
Normal file
104
src/java/org/thdl/lex/HibernateSessionDataTransfer.java
Normal file
|
@ -0,0 +1,104 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.Session;
|
||||
import net.sf.hibernate.SessionFactory;
|
||||
import net.sf.hibernate.cfg.Configuration;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author Hibernate WIKI
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class HibernateSessionDataTransfer {
|
||||
|
||||
private static SessionFactory sessionFactory;
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static ThreadLocal session = new ThreadLocal();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public static File config;
|
||||
|
||||
public static String configResource;
|
||||
|
||||
public static void setConfigResource(String configResource) {
|
||||
HibernateSessionDataTransfer.configResource = configResource;
|
||||
}
|
||||
|
||||
public static String getConfigResource() {
|
||||
return configResource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the config attribute of the HibernateSessionDataTransfer object
|
||||
*
|
||||
* @param config
|
||||
* The new config value
|
||||
*/
|
||||
public static void setConfig(File config) {
|
||||
HibernateSessionDataTransfer.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the config attribute of the HibernateSessionDataTransfer object
|
||||
*
|
||||
* @return The config value
|
||||
*/
|
||||
public static File getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Returned Value
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static Session currentSession() throws HibernateException {
|
||||
|
||||
Session s = (Session) session.get();
|
||||
if (s == null) {
|
||||
|
||||
// Don't get from JNDI, use a static SessionFactory
|
||||
if (sessionFactory == null) {
|
||||
|
||||
// Use default hibernate.cfg.xml
|
||||
sessionFactory = new Configuration().configure(getConfig())
|
||||
.buildSessionFactory();
|
||||
|
||||
}
|
||||
|
||||
s = sessionFactory.openSession();
|
||||
session.set(s);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void closeSession() throws HibernateException {
|
||||
|
||||
Session s = (Session) session.get();
|
||||
session.set(null);
|
||||
if (s != null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
218
src/java/org/thdl/lex/HibernateTestServlet.java
Normal file
218
src/java/org/thdl/lex/HibernateTestServlet.java
Normal file
|
@ -0,0 +1,218 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.Query;
|
||||
import net.sf.hibernate.Session;
|
||||
import net.sf.hibernate.SessionFactory;
|
||||
import net.sf.hibernate.Transaction;
|
||||
import net.sf.hibernate.cfg.Configuration;
|
||||
|
||||
import org.thdl.lex.component.IPronunciation;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class HibernateTestServlet extends HttpServlet {
|
||||
|
||||
private SessionFactory sessionFactory;
|
||||
|
||||
private Session session;
|
||||
|
||||
private Transaction transaction;
|
||||
|
||||
/**
|
||||
* Sets the sessionFactory attribute of the HibernateTestServlet object
|
||||
*
|
||||
* @param sessionFactory
|
||||
* The new sessionFactory value
|
||||
* @since
|
||||
*/
|
||||
public void setSessionFactory(SessionFactory sessionFactory) {
|
||||
this.sessionFactory = sessionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the session attribute of the HibernateTestServlet object
|
||||
*
|
||||
* @param session
|
||||
* The new session value
|
||||
* @since
|
||||
*/
|
||||
public void setSession(Session session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the transaction attribute of the HibernateTestServlet object
|
||||
*
|
||||
* @param transaction
|
||||
* The new transaction value
|
||||
* @since
|
||||
*/
|
||||
public void setTransaction(Transaction transaction) {
|
||||
this.transaction = transaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sessionFactory attribute of the HibernateTestServlet object
|
||||
*
|
||||
* @return The sessionFactory value
|
||||
* @since
|
||||
*/
|
||||
public SessionFactory getSessionFactory() {
|
||||
return sessionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the session attribute of the HibernateTestServlet object
|
||||
*
|
||||
* @return The session value
|
||||
* @since
|
||||
*/
|
||||
public Session getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transaction attribute of the HibernateTestServlet object
|
||||
*
|
||||
* @return The transaction value
|
||||
* @since
|
||||
*/
|
||||
public Transaction getTransaction() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of Parameter
|
||||
* @param response
|
||||
* Description of Parameter
|
||||
* @exception ServletException
|
||||
* Description of Exception
|
||||
* @exception IOException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
try {
|
||||
initHibernate();
|
||||
|
||||
//response.setContentType( "text/html" );
|
||||
response.setContentType("text/html;charset=UTF-8;");
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<html><body>");
|
||||
beginTransaction();
|
||||
testQuery(out);
|
||||
endTransaction(false);
|
||||
LexLogger.logRequestState(request);
|
||||
LexLogger.logResponseState(response);
|
||||
out.println("</body></html>");
|
||||
|
||||
} catch (SQLException e) {
|
||||
try {
|
||||
getSession().close();
|
||||
throw new ServletException(e);
|
||||
} catch (HibernateException he) {
|
||||
throw new ServletException(he);
|
||||
}
|
||||
} catch (HibernateException e) {
|
||||
try {
|
||||
getSession().close();
|
||||
throw new ServletException(e);
|
||||
} catch (HibernateException he) {
|
||||
throw new ServletException(he);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Helper Methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private void initHibernate() throws HibernateException {
|
||||
|
||||
// Load Configuration and build SessionFactory
|
||||
setSessionFactory(new Configuration().configure().buildSessionFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private void beginTransaction() throws HibernateException {
|
||||
setSession(getSessionFactory().openSession());
|
||||
setTransaction(session.beginTransaction());
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param commit
|
||||
* Description of Parameter
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private void endTransaction(boolean commit) throws HibernateException {
|
||||
|
||||
if (commit) {
|
||||
getTransaction().commit();
|
||||
} else {
|
||||
// Don't commit the transaction, can be faster for read-only
|
||||
// operations
|
||||
getTransaction().rollback();
|
||||
}
|
||||
getSession().close();
|
||||
}
|
||||
|
||||
/**
|
||||
* A unit test for JUnit
|
||||
*
|
||||
* @param out
|
||||
* Description of Parameter
|
||||
* @exception SQLException
|
||||
* Description of Exception
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void testQuery(PrintWriter out) throws SQLException,
|
||||
HibernateException {
|
||||
String queryString = "FROM org.thdl.lex.component.Pronunciation";
|
||||
Query query = getSession().createQuery(queryString);
|
||||
for (Iterator it = query.iterate(); it.hasNext();) {
|
||||
String s = ((IPronunciation) it.next()).getPhonetics();
|
||||
out.println(s + "<br/>");
|
||||
LexLogger.debug("Diacritics Test: " + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
57
src/java/org/thdl/lex/HibernateTransaction.java
Normal file
57
src/java/org/thdl/lex/HibernateTransaction.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.Transaction;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author Hibernate WIKI
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class HibernateTransaction {
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static ThreadLocal transaction = new ThreadLocal();
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void beginTransaction() throws HibernateException {
|
||||
|
||||
Transaction t = (Transaction) transaction.get();
|
||||
if (t == null) {
|
||||
t = HibernateSession.currentSession().beginTransaction();
|
||||
transaction.set(t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param commit
|
||||
* Description of the Parameter
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void endTransaction(boolean commit) throws HibernateException {
|
||||
Transaction t = (Transaction) transaction.get();
|
||||
transaction.set(null);
|
||||
if (t != null) {
|
||||
if (commit) {
|
||||
t.commit();
|
||||
} else {
|
||||
t.rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
58
src/java/org/thdl/lex/HibernateTransactionDataTransfer.java
Normal file
58
src/java/org/thdl/lex/HibernateTransactionDataTransfer.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.Transaction;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author Hibernate WIKI
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class HibernateTransactionDataTransfer {
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static ThreadLocal transaction = new ThreadLocal();
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void beginTransaction() throws HibernateException {
|
||||
|
||||
Transaction t = (Transaction) transaction.get();
|
||||
if (t == null) {
|
||||
t = HibernateSessionDataTransfer.currentSession()
|
||||
.beginTransaction();
|
||||
transaction.set(t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param commit
|
||||
* Description of the Parameter
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void endTransaction(boolean commit) throws HibernateException {
|
||||
Transaction t = (Transaction) transaction.get();
|
||||
transaction.set(null);
|
||||
if (t != null) {
|
||||
if (commit) {
|
||||
t.commit();
|
||||
} else {
|
||||
t.rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
265
src/java/org/thdl/lex/LexActionServlet.java
Normal file
265
src/java/org/thdl/lex/LexActionServlet.java
Normal file
|
@ -0,0 +1,265 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.thdl.lex.commands.AbortCommand;
|
||||
import org.thdl.lex.commands.Command;
|
||||
import org.thdl.lex.commands.CommandException;
|
||||
import org.thdl.lex.commands.CommandToken;
|
||||
import org.thdl.lex.commands.DisplayCommand;
|
||||
import org.thdl.lex.commands.FindCommand;
|
||||
import org.thdl.lex.commands.GetInsertFormCommand;
|
||||
import org.thdl.lex.commands.GetRemoveFormCommand;
|
||||
import org.thdl.lex.commands.GetUpdateFormCommand;
|
||||
import org.thdl.lex.commands.InsertCommand;
|
||||
import org.thdl.lex.commands.NullCommand;
|
||||
import org.thdl.lex.commands.PreferencesCommand;
|
||||
import org.thdl.lex.commands.RemoveCommand;
|
||||
import org.thdl.lex.commands.UpdateCommand;
|
||||
import org.thdl.lex.component.LexComponent;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexActionServlet extends HttpServlet {
|
||||
//attributes
|
||||
private HashMap commands;
|
||||
|
||||
//accessors
|
||||
|
||||
/**
|
||||
* Sets the commands attribute of the LexActionServlet object
|
||||
*
|
||||
* @param commands
|
||||
* The new commands value
|
||||
* @since
|
||||
*/
|
||||
public void setCommands(HashMap commands) {
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the commands attribute of the LexActionServlet object
|
||||
*
|
||||
* @return The commands value
|
||||
* @since
|
||||
*/
|
||||
public HashMap getCommands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param config
|
||||
* Description of Parameter
|
||||
* @exception ServletException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
try {
|
||||
super.init(config);
|
||||
initCommands();
|
||||
|
||||
config.getServletContext().setAttribute("flatData",
|
||||
new LexFlatDataRepository());
|
||||
|
||||
/*
|
||||
* LexSourceRepository sources = LexSourceRepository.getInstance();
|
||||
* sources.setOaiServer(
|
||||
* config.getServletContext().getInitParameter( "oaiServer" ) );
|
||||
* sources.setOaiMetadataPrefix(
|
||||
* config.getServletContext().getInitParameter( "oaiMetadataPrefix" ) );
|
||||
* sources.setOaiHome( config.getServletContext().getInitParameter(
|
||||
* "oaiHome" ) ); sources.setOaiLocalCopy(
|
||||
* config.getServletContext().getInitParameter( "oaiLocalCopy" ) );
|
||||
* //int oaiDelay = Integer.parseInt(
|
||||
* config.getServletContext().getInitParameter( "oaiRefreshDelay" ) );
|
||||
* sources.setOaiRefreshDelay( 24 );
|
||||
* config.getServletContext().setAttribute( "sources", sources );
|
||||
*/
|
||||
String delay = config.getInitParameter("globalDataRefreshDelay");
|
||||
long refreshDelay = Long.parseLong(delay) * 1000;
|
||||
String recent = config.getInitParameter("recentItems");
|
||||
int recentItems = Integer.parseInt(recent);
|
||||
Global global = new Global(recentItems, refreshDelay);
|
||||
config.getServletContext().setAttribute(
|
||||
LexConstants.GLOBAL_CONTEXT_ATTR, global);
|
||||
LexLogger.debugComponent(global);
|
||||
System.setProperty("java.awt.headless", "true");
|
||||
} catch (Exception e) {
|
||||
throw new ServletException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of Parameter
|
||||
* @param res
|
||||
* Description of Parameter
|
||||
* @exception ServletException
|
||||
* Description of Exception
|
||||
* @exception IOException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void service(HttpServletRequest req, HttpServletResponse res)
|
||||
throws ServletException, IOException {
|
||||
/*
|
||||
* LexLogger.debug( "Checking Request state at start of
|
||||
* LexActionServlet.service()" ); LexLogger.logRequestState( req );
|
||||
* LexLogger.logSessionState( req );
|
||||
*/
|
||||
String next;
|
||||
try {
|
||||
String cmd = req.getParameter(LexConstants.COMMAND_REQ_PARAM);
|
||||
Command command = lookupCommand(cmd);
|
||||
LexComponent component = (LexComponent) req
|
||||
.getAttribute(LexConstants.COMPONENT_REQ_ATTR);
|
||||
next = command.execute(req, component);
|
||||
CommandToken.set(req);
|
||||
} catch (CommandException e) {
|
||||
req.setAttribute("javax.servlet.jsp.jspException", e);
|
||||
next = LexConstants.ERROR_PAGE;
|
||||
try {
|
||||
LexComponentRepository.cleanup();
|
||||
} catch (LexRepositoryException lre) {
|
||||
Exception ex = new Exception(
|
||||
"LexComponentRepository couldn't clean up after Exception because: "
|
||||
+ lre.getMessage(), e);
|
||||
req.setAttribute("javax.servlet.jsp.jspException", ex);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("javax.servlet.jsp.jspException", e);
|
||||
next = LexConstants.ERROR_PAGE;
|
||||
try {
|
||||
LexComponentRepository.cleanup();
|
||||
} catch (LexRepositoryException lre) {
|
||||
Exception ex = new Exception(
|
||||
"LexComponentRepository couldn't clean up after Exception because: "
|
||||
+ lre.getMessage(), e);
|
||||
req.setAttribute("javax.servlet.jsp.jspException", ex);
|
||||
}
|
||||
}
|
||||
RequestDispatcher rd;
|
||||
rd = getServletContext().getRequestDispatcher(
|
||||
LexConstants.JSP_DIR + next);
|
||||
rd.forward(req, res);
|
||||
LexLogger
|
||||
.debug("Checking Request state at end of LexActionServlet.service()");
|
||||
LexLogger.logRequestState(req);
|
||||
LexLogger
|
||||
.debug("Checking Session state at end of LexActionServlet.service()");
|
||||
LexLogger.logSessionState(req);
|
||||
LexLogger
|
||||
.debug("Checking Context state at end of LexActionServlet.service()");
|
||||
LexLogger.logContextState(getServletContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param cmdKey
|
||||
* Description of Parameter
|
||||
* @return Description of the Returned Value
|
||||
* @exception CommandException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private Command lookupCommand(String cmdKey) throws CommandException {
|
||||
if (cmdKey == null) {
|
||||
cmdKey = "menu";
|
||||
}
|
||||
if (getCommands().containsKey(cmdKey)) {
|
||||
return (Command) getCommands().get(cmdKey);
|
||||
} else {
|
||||
throw new CommandException("Invalid Command Identifier: '" + cmdKey
|
||||
+ "'");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @since
|
||||
*/
|
||||
private void initCommands() {
|
||||
HashMap commands = new HashMap();
|
||||
|
||||
commands.put("menu", new NullCommand("menu.jsp"));
|
||||
commands.put("search", new NullCommand("search.jsp"));
|
||||
commands.put("logout", new NullCommand("logout.jsp"));
|
||||
commands.put("getMetaPrefsForm", new NullCommand("metaPrefsForm.jsp"));
|
||||
commands.put("getMetaDefaultsForm", new NullCommand(
|
||||
"metaDefaultsForm.jsp"));
|
||||
|
||||
commands.put("find", new FindCommand("displayEntry.jsp"));
|
||||
|
||||
commands.put("getInsertForm", new GetInsertFormCommand(
|
||||
"displayForm.jsp?formMode=insert", Boolean.FALSE));
|
||||
commands.put("getInsertTermForm", new GetInsertFormCommand(
|
||||
"displayForm.jsp?formMode=insert", Boolean.TRUE));
|
||||
commands.put("getTranslationForm", new GetInsertFormCommand(
|
||||
"displayForm.jsp?formMode=insert", Boolean.FALSE));
|
||||
commands.put("getAnnotationForm", new GetInsertFormCommand(
|
||||
"displayForm.jsp?formMode=insert", Boolean.FALSE));
|
||||
|
||||
commands.put("getUpdateForm", new GetUpdateFormCommand(
|
||||
"displayForm.jsp?formMode=update", Boolean.FALSE));
|
||||
commands.put("getUpdateTermForm", new GetUpdateFormCommand(
|
||||
"displayForm.jsp?formMode=update", Boolean.TRUE));
|
||||
|
||||
/*
|
||||
* commands.put( "getAnnotationForm", new AnnotateCommand(
|
||||
* "displayForm.jsp?formMode=insert" ) ); commands.put( "addAnnotation",
|
||||
* new AddAnnotationCommand( "displayEntry.jsp", Boolean.TRUE ) );
|
||||
*/
|
||||
commands.put("insert", new InsertCommand("displayEntry.jsp",
|
||||
Boolean.FALSE));
|
||||
commands.put("insertTerm", new InsertCommand("displayEntry.jsp",
|
||||
Boolean.TRUE));
|
||||
|
||||
commands.put("update", new UpdateCommand("displayEntry.jsp",
|
||||
Boolean.FALSE));
|
||||
commands.put("updateTerm", new UpdateCommand("displayEntry.jsp",
|
||||
Boolean.TRUE));
|
||||
|
||||
commands.put("display", new DisplayCommand("displayEntry.jsp"));
|
||||
commands.put("displayFull", new DisplayCommand("displayEntry.jsp"));
|
||||
commands.put("editEntry", new DisplayCommand("displayEntry.jsp"));
|
||||
|
||||
commands.put("getRemoveForm", new GetRemoveFormCommand(
|
||||
"displayForm.jsp?formMode=remove", Boolean.FALSE));
|
||||
commands.put("getRemoveTermForm", new GetRemoveFormCommand(
|
||||
"displayForm.jsp?formMode=remove", Boolean.TRUE));
|
||||
commands.put("remove", new RemoveCommand("displayEntry.jsp",
|
||||
Boolean.FALSE));
|
||||
commands.put("removeTerm", new RemoveCommand("menu.jsp", Boolean.TRUE));
|
||||
|
||||
commands.put("setMetaPrefs", new PreferencesCommand("menu.jsp"));
|
||||
commands.put("setMetaDefaults", new PreferencesCommand("menu.jsp"));
|
||||
// commands.put( "refreshSources", new RefreshSourcesCommand( "test.jsp"
|
||||
// ) );
|
||||
|
||||
commands.put("abort", new AbortCommand("menu.jsp"));
|
||||
|
||||
setCommands(commands);
|
||||
}
|
||||
}
|
||||
|
238
src/java/org/thdl/lex/LexComponentFilter.java
Normal file
238
src/java/org/thdl/lex/LexComponentFilter.java
Normal file
|
@ -0,0 +1,238 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.thdl.lex.component.AnalyticalNote;
|
||||
import org.thdl.lex.component.Definition;
|
||||
import org.thdl.lex.component.EncyclopediaArticle;
|
||||
import org.thdl.lex.component.Etymology;
|
||||
import org.thdl.lex.component.GrammaticalFunction;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
import org.thdl.lex.component.Keyword;
|
||||
import org.thdl.lex.component.LexComponent;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.lex.component.ModelSentence;
|
||||
import org.thdl.lex.component.Passage;
|
||||
import org.thdl.lex.component.Pronunciation;
|
||||
import org.thdl.lex.component.RelatedTerm;
|
||||
import org.thdl.lex.component.SpeechRegister;
|
||||
import org.thdl.lex.component.Spelling;
|
||||
import org.thdl.lex.component.Subdefinition;
|
||||
import org.thdl.lex.component.Term;
|
||||
import org.thdl.lex.component.TransitionalData;
|
||||
import org.thdl.lex.component.TranslationEquivalent;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexComponentFilter implements Filter {
|
||||
//attributes
|
||||
private HashMap blanks;
|
||||
|
||||
private UserSessionManager sessionMgr;
|
||||
|
||||
//accessors
|
||||
/**
|
||||
* Sets the blanks attribute of the LexComponentFilter object
|
||||
*
|
||||
* @param blanks
|
||||
* The new blanks value
|
||||
* @since
|
||||
*/
|
||||
public void setBlanks(HashMap blanks) {
|
||||
this.blanks = blanks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sessionMgr attribute of the LexComponentFilter object
|
||||
*
|
||||
* @param sessionMgr
|
||||
* The new sessionMgr value
|
||||
* @since
|
||||
*/
|
||||
public void setSessionManager(UserSessionManager sessionMgr) {
|
||||
this.sessionMgr = sessionMgr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the blanks attribute of the LexComponentFilter object
|
||||
*
|
||||
* @return The blanks value
|
||||
* @since
|
||||
*/
|
||||
public HashMap getBlanks() {
|
||||
return blanks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sessionMgr attribute of the LexComponentFilter object
|
||||
*
|
||||
* @return The sessionMgr value
|
||||
* @since
|
||||
*/
|
||||
public UserSessionManager getSessionManager() {
|
||||
if (null == sessionMgr) {
|
||||
setSessionManager(UserSessionManager.getInstance());
|
||||
}
|
||||
return sessionMgr;
|
||||
}
|
||||
|
||||
//contract methods
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param config
|
||||
* Description of Parameter
|
||||
* @exception ServletException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
try {
|
||||
setBlanks(new HashMap());
|
||||
ITerm term = new Term();
|
||||
getBlanks().put(LexConstants.TERMLABEL_VALUE, term);
|
||||
getBlanks().put(LexConstants.PRONUNCIATIONLABEL_VALUE,
|
||||
new Pronunciation());
|
||||
getBlanks().put(LexConstants.ETYMOLOGYLABEL_VALUE, new Etymology());
|
||||
getBlanks().put(LexConstants.FUNCTIONLABEL_VALUE,
|
||||
new GrammaticalFunction());
|
||||
getBlanks().put(LexConstants.SPELLINGLABEL_VALUE, new Spelling());
|
||||
getBlanks().put(LexConstants.ENCYCLOPEDIA_ARTICLE_LABEL_VALUE,
|
||||
new EncyclopediaArticle());
|
||||
getBlanks().put(LexConstants.DEFINITIONLABEL_VALUE,
|
||||
new Definition());
|
||||
getBlanks().put(LexConstants.PASSAGELABEL_VALUE, new Passage());
|
||||
getBlanks().put(LexConstants.SUBDEFINITIONLABEL_VALUE,
|
||||
new Subdefinition());
|
||||
getBlanks().put(LexConstants.TRANSLATIONLABEL_VALUE,
|
||||
new TranslationEquivalent());
|
||||
getBlanks().put(LexConstants.KEYWORDLABEL_VALUE, new Keyword());
|
||||
getBlanks().put(LexConstants.RELATEDTERMLABEL_VALUE,
|
||||
new RelatedTerm());
|
||||
getBlanks().put(LexConstants.MODELSENTENCELABEL_VALUE,
|
||||
new ModelSentence());
|
||||
getBlanks().put(LexConstants.REGISTERLABEL_VALUE,
|
||||
new SpeechRegister());
|
||||
getBlanks().put("analyticalNote", new AnalyticalNote());
|
||||
getBlanks().put("transitionalData", new TransitionalData());
|
||||
// getBlanks().put( LexConstants.INPUTSESSIONLABEL_VALUE, new
|
||||
// Preferences() );
|
||||
}
|
||||
// catch (LexComponentException labe)
|
||||
catch (Exception labe) {
|
||||
throw new ServletException(labe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of Parameter
|
||||
* @param response
|
||||
* Description of Parameter
|
||||
* @param chain
|
||||
* Description of Parameter
|
||||
* @exception IOException
|
||||
* Description of Exception
|
||||
* @exception ServletException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
long start = System.currentTimeMillis();
|
||||
if (request instanceof HttpServletRequest
|
||||
&& response instanceof HttpServletResponse) {
|
||||
HttpServletResponse res = (HttpServletResponse) response;
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
res.setContentType("text/html; charset=UTF-8;");
|
||||
req.setCharacterEncoding("UTF-8");
|
||||
|
||||
if (null != req.getParameter(LexConstants.LABEL_REQ_PARAM)) {
|
||||
String labelValue = req
|
||||
.getParameter(LexConstants.LABEL_REQ_PARAM);
|
||||
try {
|
||||
if (getBlanks().get(labelValue) != null) {
|
||||
Class c = getBlanks().get(labelValue).getClass();
|
||||
LexComponent component = (LexComponent) c.newInstance();
|
||||
component.populate(req.getParameterMap());
|
||||
component.getMeta().populate(req.getParameterMap());
|
||||
req.setAttribute(LexConstants.COMPONENT_REQ_ATTR,
|
||||
component);
|
||||
} else {
|
||||
LexLogger
|
||||
.error("componentLabel was not in blank components");
|
||||
}
|
||||
} catch (InstantiationException ie) {
|
||||
throw new ServletException(ie);
|
||||
} catch (IllegalAccessException iae) {
|
||||
throw new ServletException(iae);
|
||||
} catch (LexComponentException lce) {
|
||||
throw new ServletException(lce);
|
||||
}
|
||||
} else {
|
||||
LexLogger
|
||||
.error("Required parameter, '"
|
||||
+ LexConstants.LABEL_REQ_PARAM
|
||||
+ "' was not specified.");
|
||||
}
|
||||
chain.doFilter(request, response);
|
||||
|
||||
HttpServletResponse resp = (HttpServletResponse) response;
|
||||
resp.setContentType("text/html; charset=UTF-8;");
|
||||
LexLogger.logResponseState(resp);
|
||||
try {
|
||||
LexComponentRepository.cleanup();
|
||||
} catch (LexRepositoryException lre) {
|
||||
throw new ServletException(lre);
|
||||
}
|
||||
/*
|
||||
* LexLogger.debug( "Checking Request state at end of
|
||||
* LexComponentFilter.doFilter()" ); LexLogger.logRequestState( req );
|
||||
* LexLogger.logSessionState( req );
|
||||
*/
|
||||
long dur = System.currentTimeMillis() - start;
|
||||
LexLogger.debug("Total Request took: " + dur / 1000
|
||||
+ " seconds.\n\n");
|
||||
} else {
|
||||
throw new ServletException(
|
||||
"Filter only applicable to HTTP and HTTPS requests");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @since
|
||||
*/
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
//helper methods
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Constructor for the LexComponentFilter object
|
||||
*
|
||||
* @since
|
||||
*/
|
||||
public LexComponentFilter() {
|
||||
}
|
||||
}
|
||||
|
853
src/java/org/thdl/lex/LexComponentRepository.java
Normal file
853
src/java/org/thdl/lex/LexComponentRepository.java
Normal file
|
@ -0,0 +1,853 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.Query;
|
||||
import net.sf.hibernate.Session;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexComponentRepository {
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String EXACT = "exact";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String STARTS_WITH = "startsWith";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String ANYWHERE = "anywhere";
|
||||
|
||||
private static long start;
|
||||
|
||||
private static long lastUpdate = now();
|
||||
|
||||
/**
|
||||
* Sets the lastUpdate attribute of the LexComponentRepository class
|
||||
*
|
||||
* @param last
|
||||
* The new lastUpdate value
|
||||
*/
|
||||
public static void setLastUpdate(long last) {
|
||||
lastUpdate = last;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lastUpdate attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The lastUpdate value
|
||||
*/
|
||||
public static long getLastUpdate() {
|
||||
return lastUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the start attribute of the LexComponentRepository object
|
||||
*
|
||||
* @param startTime
|
||||
* The new start value
|
||||
* @since
|
||||
*/
|
||||
private static void setStart(long startTime) {
|
||||
Logger logger = Logger.getLogger("org.thdl.lex");
|
||||
logger.debug("Query start time: " + new java.util.Date(startTime));
|
||||
start = startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start attribute of the LexComponentRepository object
|
||||
*
|
||||
* @return The start value
|
||||
* @since
|
||||
*/
|
||||
private static long getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the duration attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The duration value
|
||||
*/
|
||||
private static long getDuration() {
|
||||
long duration = now() - getStart();
|
||||
|
||||
Logger logger = Logger.getLogger("org.thdl.lex");
|
||||
logger.debug("Query finish: " + new java.util.Date(now()));
|
||||
logger.debug("Query duration in ms: " + duration);
|
||||
logger.info("Query duration: " + duration / 1000 + " seconds.");
|
||||
return duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the session attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The session value
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
protected static Session getSession() throws HibernateException {
|
||||
Session session = HibernateSession.currentSession();
|
||||
if (!session.isConnected()) {
|
||||
//session.reconnect();
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
protected static void beginTransaction() throws LexRepositoryException {
|
||||
try {
|
||||
HibernateTransaction.beginTransaction();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param commit
|
||||
* Description of Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
* @since
|
||||
*/
|
||||
protected static void endTransaction(boolean commit)
|
||||
throws LexRepositoryException {
|
||||
try {
|
||||
HibernateTransaction.endTransaction(commit);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Returned Value
|
||||
* @since
|
||||
*/
|
||||
private static long now() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param comp
|
||||
* Description of Parameter
|
||||
* @return Description of the Returned Value
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private static ITerm assertTerm(ILexComponent comp)
|
||||
throws LexRepositoryException {
|
||||
ITerm term = null;
|
||||
try {
|
||||
term = (ITerm) comp;
|
||||
} catch (Exception e) {
|
||||
throw new LexRepositoryException("Query Component was not a term.");
|
||||
}
|
||||
return term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the database for Terms that start with the string in the term
|
||||
* property of the queryComponent. Sets entry property the first hit
|
||||
* returned.
|
||||
*
|
||||
* @param lexQuery
|
||||
* Description of Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void findTermsByTerm(LexQuery lexQuery)
|
||||
throws LexRepositoryException {
|
||||
setStart(now());
|
||||
beginTransaction();
|
||||
ITerm term = assertTerm(lexQuery.getQueryComponent());
|
||||
if (null == term.getTerm()) {
|
||||
throw new LexRepositoryException("Query Component term was null.");
|
||||
}
|
||||
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
/*
|
||||
* String termForQuery = LexUtilities.hqlEscape( term.getTerm() );
|
||||
* LexLogger.debug( "Escaped term string: " + termForQuery );
|
||||
*/
|
||||
String termForQuery = term.getTerm();
|
||||
|
||||
if (lexQuery.getFindMode().equals(LexComponentRepository.STARTS_WITH)) {
|
||||
termForQuery = termForQuery + "%";
|
||||
} else if (lexQuery.getFindMode().equals(
|
||||
LexComponentRepository.ANYWHERE)) {
|
||||
termForQuery = "%" + termForQuery + "%";
|
||||
}
|
||||
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term.term like :term AND term.deleted=0 ORDER BY term";
|
||||
try {
|
||||
query = getSession().createQuery(queryString);
|
||||
query.setString("term", termForQuery);
|
||||
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
try {
|
||||
it = query.iterate();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
if (it.hasNext()) {
|
||||
term = (ITerm) it.next();
|
||||
lexQuery.setEntry(term);
|
||||
lexQuery.getResults().clear();
|
||||
lexQuery.getResults().put(term.getMetaId(), term.getTerm());
|
||||
} else {
|
||||
lexQuery.setEntry(null);
|
||||
lexQuery.getResults().clear();
|
||||
}
|
||||
while (it.hasNext()) {
|
||||
term = (ITerm) it.next();
|
||||
lexQuery.getResults().put(term.getMetaId(), term.getTerm());
|
||||
}
|
||||
endTransaction(false);
|
||||
lexQuery.setDuration(getDuration());
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static ITerm findTermByPk(Integer pk) throws LexRepositoryException {
|
||||
ITerm term = null;
|
||||
|
||||
beginTransaction();
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term.metaId = "
|
||||
+ pk.toString();
|
||||
try {
|
||||
Query query = getSession().createQuery(queryString);
|
||||
term = (ITerm) query.uniqueResult();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
endTransaction(false);
|
||||
return term;
|
||||
}
|
||||
|
||||
public static List getAllTerms() throws LexRepositoryException {
|
||||
List terms = null;
|
||||
|
||||
beginTransaction();
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm";
|
||||
try {
|
||||
Query query = getSession().createQuery(queryString);
|
||||
terms = query.list();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
endTransaction(false);
|
||||
return terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param lexQuery
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static Map findTermsByMeta(LexQuery lexQuery)
|
||||
throws LexRepositoryException {
|
||||
Logger logger = Logger.getLogger("org.thdl.lex");
|
||||
ITerm term = assertTerm(lexQuery.getQueryComponent());
|
||||
Map terms = new HashMap();
|
||||
ILexComponent comp = null;
|
||||
ITerm aTerm;
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
setStart(now());
|
||||
beginTransaction();
|
||||
if (null == term.getMeta()) {
|
||||
throw new LexRepositoryException(
|
||||
"Query Component term.meta was null.");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Tibetan Dictionary begin query!");
|
||||
}
|
||||
String queryString = "select term from org.thdl.lex.component.Term as term "
|
||||
//join term collections
|
||||
+ " join term.pronunciations as pron "
|
||||
+ " join term.etymologies as ety "
|
||||
+ " join term.spellings as sp "
|
||||
+ " join term.functions as func "
|
||||
+ " join term.encyclopediaArticles as ency "
|
||||
+ " join term.transitionalData as transData "
|
||||
+ " join term.definitions as def "
|
||||
+ " join term.glosses as glo "
|
||||
+ " join term.keywords as key "
|
||||
+ " join term.translationEquivalents as trans "
|
||||
+ " join term.relatedTerms as rel "
|
||||
+ " join term.passages as pass "
|
||||
+ " join term.registers as reg "
|
||||
//join def collections
|
||||
+ " join def.subdefinitions as sub "
|
||||
+ " join def.glosses as gloDef "
|
||||
+ " join def.keywords as keyDef "
|
||||
+ " join def.modelSentences as modDef "
|
||||
+ " join def.translationEquivalents as transDef "
|
||||
+ " join def.relatedTerms as relDef "
|
||||
+ " join def.passages as passDef "
|
||||
+ " join def.registers as regDef "
|
||||
//join subdef collections
|
||||
+ " join sub.glosses as gloSub "
|
||||
+ " join sub.keywords as keySub "
|
||||
+ " join sub.modelSentences as modSub "
|
||||
+ " join sub.translationEquivalents as transSub "
|
||||
+ " join sub.relatedTerms as relSub "
|
||||
+ " join sub.passages as passSub "
|
||||
+ " join sub.registers as regSub "
|
||||
// join translation collections
|
||||
/*
|
||||
* + " join ety.translations as etyTrans " + " join
|
||||
* term.definitions.translations as defTrans " + " join
|
||||
* term.modelSentences.translations as modTrans " + " join
|
||||
* term.passages.translations as passTrans " + " join
|
||||
* def.subdefinition.translations as subTrans " + " join
|
||||
* def.modelSentences.translations as modDefTrans " + " join
|
||||
* def.passages.translations as passDefTrans " + " join
|
||||
* sub.modelSentences.translations as modSubTrans " + " join
|
||||
* sub.passages.translations as passSubTrans "
|
||||
*/
|
||||
//restrict by projectSubject in createdByProjSub
|
||||
+ " where term.meta.createdByProjSub = :projSub"
|
||||
+ " or pron.meta.createdByProjSub = :projSub"
|
||||
+ " or ety.meta.createdByProjSub = :projSub"
|
||||
+ " or sp.meta.createdByProjSub = :projSub"
|
||||
+ " or func.meta.createdByProjSub = :projSub"
|
||||
+ " or ency.meta.createdByProjSub = :projSub"
|
||||
+ " or transData.meta.createdByProjSub = :projSub"
|
||||
+ " or def.meta.createdByProjSub = :projSub"
|
||||
+ " or glo.meta.createdByProjSub = :projSub"
|
||||
+ " or key.meta.createdByProjSub = :projSub"
|
||||
+ " or trans.meta.createdByProjSub = :projSub"
|
||||
+ " or rel.meta.createdByProjSub = :projSub"
|
||||
+ " or pass.meta.createdByProjSub = :projSub"
|
||||
+ " or reg.meta.createdByProjSub = :projSub"
|
||||
+ " or sub.meta.createdByProjSub = :projSub"
|
||||
+ " or gloDef.meta.createdByProjSub = :projSub"
|
||||
+ " or keyDef.meta.createdByProjSub = :projSub"
|
||||
+ " or modDef.meta.createdByProjSub = :projSub"
|
||||
+ " or transDef.meta.createdByProjSub = :projSub"
|
||||
+ " or relDef.meta.createdByProjSub = :projSub"
|
||||
+ " or passDef.meta.createdByProjSub = :projSub"
|
||||
+ " or regDef.meta.createdByProjSub = :projSub"
|
||||
+ " or gloSub.meta.createdByProjSub = :projSub"
|
||||
+ " or keySub.meta.createdByProjSub = :projSub"
|
||||
+ " or modSub.meta.createdByProjSub = :projSub"
|
||||
+ " or transSub.meta.createdByProjSub = :projSub"
|
||||
+ " or relSub.meta.createdByProjSub = :projSub"
|
||||
+ " or passSub.meta.createdByProjSub = :projSub"
|
||||
+ " or regSub.meta.createdByProjSub = :projSub"
|
||||
/*
|
||||
* + " or etyTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* defTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* subTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modDefTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passDefTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modSubTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passSubTrans.meta.createdByProjSub = :projSub"
|
||||
*/
|
||||
//restrict by projectSubject in modifiedByProjSub
|
||||
+ " or term.meta.modifiedByProjSub = :projSub"
|
||||
+ " or pron.meta.modifiedByProjSub = :projSub"
|
||||
+ " or ety.meta.modifiedByProjSub = :projSub"
|
||||
+ " or sp.meta.modifiedByProjSub = :projSub"
|
||||
+ " or func.meta.modifiedByProjSub = :projSub"
|
||||
+ " or ency.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transData.meta.modifiedByProjSub = :projSub"
|
||||
+ " or def.meta.modifiedByProjSub = :projSub"
|
||||
+ " or glo.meta.modifiedByProjSub = :projSub"
|
||||
+ " or key.meta.modifiedByProjSub = :projSub"
|
||||
+ " or trans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or rel.meta.modifiedByProjSub = :projSub"
|
||||
+ " or pass.meta.modifiedByProjSub = :projSub"
|
||||
+ " or reg.meta.modifiedByProjSub = :projSub"
|
||||
+ " or sub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or gloDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or keyDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or relDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or regDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or gloSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or keySub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or relSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or regSub.meta.modifiedByProjSub = :projSub"
|
||||
/*
|
||||
* + " or etyTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* defTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* subTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modDefTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passDefTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modSubTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passSubTrans.meta.modifiedByProjSub = :projSub";
|
||||
*/
|
||||
|
||||
+ "";
|
||||
try {
|
||||
query = getSession().createQuery(queryString);
|
||||
query.setMaxResults(100);
|
||||
query.setInteger("projSub", lexQuery.getQueryComponent().getMeta()
|
||||
.getCreatedByProjSub().intValue());
|
||||
logger.debug("About to list query");
|
||||
List list = query.list();
|
||||
logger.debug("results size: " + list.size());
|
||||
it = list.iterator();
|
||||
logger.debug("Starting to add terms to map");
|
||||
while (it.hasNext()) {
|
||||
aTerm = (ITerm) comp;
|
||||
logger.debug("successfully cast comp to an ITerm");
|
||||
|
||||
Integer id = aTerm.getMetaId();
|
||||
String tm = aTerm.getTerm();
|
||||
terms.put(id, tm);
|
||||
}
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
endTransaction(false);
|
||||
lexQuery.setDuration(getDuration());
|
||||
return terms;
|
||||
}
|
||||
|
||||
public static Map findTermsByMetaViaLc(LexQuery lexQuery)
|
||||
throws LexRepositoryException {
|
||||
Logger logger = Logger.getLogger("org.thdl.lex");
|
||||
ITerm term = assertTerm(lexQuery.getQueryComponent());
|
||||
Map terms = new HashMap();
|
||||
ILexComponent comp = null;
|
||||
ITerm aTerm;
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
setStart(now());
|
||||
beginTransaction();
|
||||
if (null == term.getMeta()) {
|
||||
throw new LexRepositoryException(
|
||||
"Query Component term.meta was null.");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Tibetan Dictionary begin query!");
|
||||
}
|
||||
String queryString = "from org.thdl.lex.component.LexComponent as comp where comp.meta.createdByProjSub=:projSub";
|
||||
|
||||
try {
|
||||
query = getSession().createQuery(queryString);
|
||||
//query.setMaxResults( 100 );
|
||||
query.setInteger("projSub", lexQuery.getQueryComponent().getMeta()
|
||||
.getCreatedByProjSub().intValue());
|
||||
logger.debug("About to list query");
|
||||
List list = query.list();
|
||||
logger.debug("results size: " + list.size());
|
||||
it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
logger.debug("Starting quest for a term parent");
|
||||
|
||||
comp = (ILexComponent) it.next();
|
||||
int safetyFirst = 0;
|
||||
parentSearch: while (!(comp instanceof ITerm) && comp != null) {
|
||||
logger.debug("comp class: " + comp.getClass().getName());
|
||||
comp = comp.getParent();
|
||||
if (comp instanceof ITerm) {
|
||||
try {
|
||||
aTerm = (ITerm) comp;
|
||||
terms.put(aTerm.getMetaId(), aTerm.getTerm());
|
||||
logger.debug("successfully cast comp to an ITerm");
|
||||
} catch (ClassCastException cce) {
|
||||
logger
|
||||
.debug("LCR caught ClassCastException Failed cast of "
|
||||
+ comp.toString() + " to ITerm");
|
||||
throw cce;
|
||||
}
|
||||
}
|
||||
|
||||
safetyFirst++;
|
||||
if (safetyFirst > 10) {
|
||||
logger
|
||||
.debug("could not find an ITerm parent for component: "
|
||||
+ comp);
|
||||
break parentSearch;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
endTransaction(false);
|
||||
lexQuery.setDuration(getDuration());
|
||||
return terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param term
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void loadTerm(ITerm term) throws LexRepositoryException {
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().load(term, term.getMetaId());
|
||||
endTransaction(false);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param lexQuery
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void loadTermByPk(LexQuery lexQuery)
|
||||
throws LexRepositoryException {
|
||||
beginTransaction();
|
||||
ITerm term = assertTerm(lexQuery.getQueryComponent());
|
||||
loadTerm(term);
|
||||
lexQuery.setEntry(term);
|
||||
if (!lexQuery.getResults().containsKey(term.getMetaId())) {
|
||||
lexQuery.getResults().put(term.getMetaId(), term.getTerm());
|
||||
}
|
||||
endTransaction(false);
|
||||
}
|
||||
|
||||
public static ITerm loadTermByTerm(String term)
|
||||
throws LexRepositoryException {
|
||||
ITerm returnTerm = null;
|
||||
beginTransaction();
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm as theTerm where theTerm.term = :term";
|
||||
try {
|
||||
Query query = getSession().createQuery(queryString);
|
||||
query.setString("term", term);
|
||||
returnTerm = (ITerm) query.uniqueResult();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
endTransaction(false);
|
||||
return returnTerm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void loadByPk(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().load(component, component.getMetaId());
|
||||
endTransaction(false);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void loadByPk(ILexComponent component, Integer pk)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().load(component, pk);
|
||||
endTransaction(false);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the recentTerms attribute of the LexComponentRepository class
|
||||
*
|
||||
* @param limit
|
||||
* Description of the Parameter
|
||||
* @return The recentTerms value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static List getRecentTerms(int limit) throws LexRepositoryException {
|
||||
Query query = null;
|
||||
List results = null;
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm ORDER BY modifiedOn DESC LIMIT "
|
||||
+ limit;
|
||||
try {
|
||||
beginTransaction();
|
||||
query = getSession().createQuery(queryString);
|
||||
results = query.list();
|
||||
endTransaction(false);
|
||||
getSession().clear();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void save(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().saveOrUpdate(component);
|
||||
endTransaction(true);
|
||||
setLastUpdate(now());
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void update(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().update(component);
|
||||
endTransaction(true);
|
||||
setLastUpdate(now());
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void remove(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().delete(component);
|
||||
endTransaction(true);
|
||||
setLastUpdate(now());
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void refresh(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().refresh(component);
|
||||
endTransaction(true);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void cleanup() throws LexRepositoryException {
|
||||
try {
|
||||
endTransaction(false);
|
||||
HibernateSession.closeSession();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* /join term collections + " join term.pronunciations as pron " + " join
|
||||
* term.etymologies as ety " + " join term.spellings as sp " + " join
|
||||
* term.functions as func " + " join term.encyclopediaArticles as ency " + "
|
||||
* join term.transitionalData as trans " + " join term.definitions as def " + "
|
||||
* join term.glosses as glo " + " join term.keywords as key " + " join
|
||||
* term.translationEquivalents as trans " + " join term.relatedTerms as rel " + "
|
||||
* join term.passages as pass " + " join term.registers as reg " join def
|
||||
* collections + " join def.subdefinitions as sub " + " join def.glosses as
|
||||
* gloDef " + " join def.keywords as keyDef " + " join def.modelSentences as
|
||||
* modDef " + " join def.translationEquivalents as transDef " + " join
|
||||
* def.relatedTerms as relDef " + " join def.passages as passDef " + " join
|
||||
* def.registers as regDef " join subdef collections + " join sub.glosses as
|
||||
* gloSub " + " join sub.keywords as keySub " + " join sub.modelSentences as
|
||||
* modSub " + " join sub.translationEquivalents as transSub " + " join
|
||||
* sub.relatedTerms as relSub " + " join sub.passages as passSub " + " join
|
||||
* sub.registers as regSub " join translation collections + " join
|
||||
* ety.translations as etyTrans " + " join term.definitions.translations as
|
||||
* defTrans " + " join term.modelSentences.translations as modTrans " + " join
|
||||
* term.passages.translations as passTrans " + " join
|
||||
* def.subdefinition.translations as subTrans " + " join
|
||||
* def.modelSentences.translations as modDefTrans " + " join
|
||||
* def.passages.translations as passDefTrans " + " join
|
||||
* sub.modelSentences.translations as modSubTrans " + " join
|
||||
* sub.passages.translations as passSubTrans " /restrict by projectSubject in
|
||||
* createdByProjSub + " where term.meta.createdByProjSub = :projSub" + " or
|
||||
* pron.meta.createdByProjSub = :projSub" + " or ety.meta.createdByProjSub =
|
||||
* :projSub" + " or sp.meta.createdByProjSub = :projSub" + " or
|
||||
* func.meta.createdByProjSub = :projSub" + " or ency.meta.createdByProjSub =
|
||||
* :projSub" + " or trans.meta.createdByProjSub = :projSub" + " or
|
||||
* def.meta.createdByProjSub = :projSub" + " or glo.meta.createdByProjSub =
|
||||
* :projSub" + " or key.meta.createdByProjSub = :projSub" + " or
|
||||
* trans.meta.createdByProjSub = :projSub" + " or rel.meta.createdByProjSub =
|
||||
* :projSub" + " or pass.meta.createdByProjSub = :projSub" + " or
|
||||
* reg.meta.createdByProjSub = :projSub" + " or subDef.meta.createdByProjSub =
|
||||
* :projSub" + " or gloDef.meta.createdByProjSub = :projSub" + " or
|
||||
* keyDef.meta.createdByProjSub = :projSub" + " or modDef.meta.createdByProjSub =
|
||||
* :projSub" + " or transDef.meta.createdByProjSub = :projSub" + " or
|
||||
* relDef.meta.createdByProjSub = :projSub" + " or passDef.meta.createdByProjSub =
|
||||
* :projSub" + " or regDef.meta.createdByProjSub = :projSub" + " or
|
||||
* gloSub.meta.createdByProjSub = :projSub" + " or keySub.meta.createdByProjSub =
|
||||
* :projSub" + " or modSub.meta.createdByProjSub = :projSub" + " or
|
||||
* transSub.meta.createdByProjSub = :projSub" + " or
|
||||
* relSub.meta.createdByProjSub = :projSub" + " or passSub.meta.createdByProjSub =
|
||||
* :projSub" + " or regSub.meta.createdByProjSub = :projSub" + " or
|
||||
* etyTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* defTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* subTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modDefTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passDefTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modSubTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passSubTrans.meta.createdByProjSub = :projSub" /restrict by projectSubject in
|
||||
* modifiedByProjSub + " or term.meta.modifiedByProjSub = :projSub" + " or
|
||||
* pron.meta.modifiedByProjSub = :projSub" + " or ety.meta.modifiedByProjSub =
|
||||
* :projSub" + " or sp.meta.modifiedByProjSub = :projSub" + " or
|
||||
* func.meta.modifiedByProjSub = :projSub" + " or ency.meta.modifiedByProjSub =
|
||||
* :projSub" + " or trans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* def.meta.modifiedByProjSub = :projSub" + " or glo.meta.modifiedByProjSub =
|
||||
* :projSub" + " or key.meta.modifiedByProjSub = :projSub" + " or
|
||||
* trans.meta.modifiedByProjSub = :projSub" + " or rel.meta.modifiedByProjSub =
|
||||
* :projSub" + " or pass.meta.modifiedByProjSub = :projSub" + " or
|
||||
* reg.meta.modifiedByProjSub = :projSub" + " or subDef.meta.modifiedByProjSub =
|
||||
* :projSub" + " or gloDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* keyDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* transDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* relDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* regDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* gloSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* keySub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* transSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* relSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* regSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* etyTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* defTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* subTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modDefTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passDefTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modSubTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passSubTrans.meta.modifiedByProjSub = :projSub";
|
||||
*/
|
||||
|
811
src/java/org/thdl/lex/LexComponentRepositoryDataTransfer.java
Normal file
811
src/java/org/thdl/lex/LexComponentRepositoryDataTransfer.java
Normal file
|
@ -0,0 +1,811 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.hibernate.HibernateException;
|
||||
import net.sf.hibernate.Query;
|
||||
import net.sf.hibernate.Session;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexComponentRepositoryDataTransfer {
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String EXACT = "exact";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String STARTS_WITH = "startsWith";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String ANYWHERE = "anywhere";
|
||||
|
||||
private static long start;
|
||||
|
||||
private static long lastUpdate = now();
|
||||
|
||||
/**
|
||||
* Sets the lastUpdate attribute of the LexComponentRepository class
|
||||
*
|
||||
* @param last
|
||||
* The new lastUpdate value
|
||||
*/
|
||||
public static void setLastUpdate(long last) {
|
||||
lastUpdate = last;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lastUpdate attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The lastUpdate value
|
||||
*/
|
||||
public static long getLastUpdate() {
|
||||
return lastUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the start attribute of the LexComponentRepository object
|
||||
*
|
||||
* @param startTime
|
||||
* The new start value
|
||||
* @since
|
||||
*/
|
||||
private static void setStart(long startTime) {
|
||||
Logger logger = Logger.getLogger("org.thdl.lex");
|
||||
logger.debug("Query start time: " + new java.util.Date(startTime));
|
||||
start = startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start attribute of the LexComponentRepository object
|
||||
*
|
||||
* @return The start value
|
||||
* @since
|
||||
*/
|
||||
private static long getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the duration attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The duration value
|
||||
*/
|
||||
private static long getDuration() {
|
||||
long duration = now() - getStart();
|
||||
|
||||
Logger logger = Logger.getLogger("org.thdl.lex");
|
||||
logger.debug("Query finish: " + new java.util.Date(now()));
|
||||
logger.debug("Query duration in ms: " + duration);
|
||||
logger.info("Query duration: " + duration / 1000 + " seconds.");
|
||||
return duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the session attribute of the LexComponentRepository class
|
||||
*
|
||||
* @return The session value
|
||||
* @exception HibernateException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
protected static Session getSession() throws HibernateException {
|
||||
Session session = HibernateSessionDataTransfer.currentSession();
|
||||
if (!session.isConnected()) {
|
||||
//session.reconnect();
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
protected static void beginTransaction() throws LexRepositoryException {
|
||||
try {
|
||||
HibernateTransactionDataTransfer.beginTransaction();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param commit
|
||||
* Description of Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
* @since
|
||||
*/
|
||||
protected static void endTransaction(boolean commit)
|
||||
throws LexRepositoryException {
|
||||
try {
|
||||
HibernateTransactionDataTransfer.endTransaction(commit);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Returned Value
|
||||
* @since
|
||||
*/
|
||||
private static long now() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param comp
|
||||
* Description of Parameter
|
||||
* @return Description of the Returned Value
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private static ITerm assertTerm(ILexComponent comp)
|
||||
throws LexRepositoryException {
|
||||
ITerm term = null;
|
||||
try {
|
||||
term = (ITerm) comp;
|
||||
} catch (Exception e) {
|
||||
throw new LexRepositoryException("Query Component was not a term.");
|
||||
}
|
||||
return term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the database for Terms that start with the string in the term
|
||||
* property of the queryComponent. Sets entry property the first hit
|
||||
* returned.
|
||||
*
|
||||
* @param lexQuery
|
||||
* Description of Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void findTermsByTerm(LexQuery lexQuery)
|
||||
throws LexRepositoryException {
|
||||
setStart(now());
|
||||
beginTransaction();
|
||||
ITerm term = assertTerm(lexQuery.getQueryComponent());
|
||||
if (null == term.getTerm()) {
|
||||
throw new LexRepositoryException("Query Component term was null.");
|
||||
}
|
||||
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
String termForQuery = LexUtilities.hqlEscape(term.getTerm());
|
||||
LexLogger.debug("Escaped term string: " + termForQuery);
|
||||
|
||||
if (lexQuery.getFindMode().equals(LexComponentRepository.STARTS_WITH)) {
|
||||
termForQuery = termForQuery + "%";
|
||||
} else if (lexQuery.getFindMode().equals(
|
||||
LexComponentRepository.ANYWHERE)) {
|
||||
termForQuery = "%" + termForQuery + "%";
|
||||
}
|
||||
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term like :term AND term.deleted=0 ORDER BY term";
|
||||
try {
|
||||
query = getSession().createQuery(queryString);
|
||||
query.setString("term", termForQuery);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
try {
|
||||
it = query.iterate();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
if (it.hasNext()) {
|
||||
term = (ITerm) it.next();
|
||||
lexQuery.setEntry(term);
|
||||
lexQuery.getResults().clear();
|
||||
lexQuery.getResults().put(term.getMetaId(), term.getTerm());
|
||||
} else {
|
||||
lexQuery.setEntry(null);
|
||||
lexQuery.getResults().clear();
|
||||
}
|
||||
while (it.hasNext()) {
|
||||
term = (ITerm) it.next();
|
||||
lexQuery.getResults().put(term.getMetaId(), term.getTerm());
|
||||
}
|
||||
endTransaction(false);
|
||||
lexQuery.setDuration(getDuration());
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static ITerm findTermByPk(Integer pk) throws LexRepositoryException {
|
||||
ITerm term = null;
|
||||
|
||||
beginTransaction();
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term.metaId = "
|
||||
+ pk.toString();
|
||||
try {
|
||||
Query query = getSession().createQuery(queryString);
|
||||
term = (ITerm) query.uniqueResult();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
endTransaction(false);
|
||||
return term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param lexQuery
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static Map findTermsByMeta(LexQuery lexQuery)
|
||||
throws LexRepositoryException {
|
||||
Logger logger = Logger.getLogger("org.thdl.lex");
|
||||
ITerm term = assertTerm(lexQuery.getQueryComponent());
|
||||
Map terms = new HashMap();
|
||||
ILexComponent comp = null;
|
||||
ITerm aTerm;
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
setStart(now());
|
||||
beginTransaction();
|
||||
if (null == term.getMeta()) {
|
||||
throw new LexRepositoryException(
|
||||
"Query Component term.meta was null.");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Tibetan Dictionary begin query!");
|
||||
}
|
||||
String queryString = "select term from org.thdl.lex.component.Term as term "
|
||||
//join term collections
|
||||
+ " join term.pronunciations as pron "
|
||||
+ " join term.etymologies as ety "
|
||||
+ " join term.spellings as sp "
|
||||
+ " join term.functions as func "
|
||||
+ " join term.encyclopediaArticles as ency "
|
||||
+ " join term.transitionalData as transData "
|
||||
+ " join term.definitions as def "
|
||||
+ " join term.glosses as glo "
|
||||
+ " join term.keywords as key "
|
||||
+ " join term.translationEquivalents as trans "
|
||||
+ " join term.relatedTerms as rel "
|
||||
+ " join term.passages as pass "
|
||||
+ " join term.registers as reg "
|
||||
//join def collections
|
||||
+ " join def.subdefinitions as sub "
|
||||
+ " join def.glosses as gloDef "
|
||||
+ " join def.keywords as keyDef "
|
||||
+ " join def.modelSentences as modDef "
|
||||
+ " join def.translationEquivalents as transDef "
|
||||
+ " join def.relatedTerms as relDef "
|
||||
+ " join def.passages as passDef "
|
||||
+ " join def.registers as regDef "
|
||||
//join subdef collections
|
||||
+ " join sub.glosses as gloSub "
|
||||
+ " join sub.keywords as keySub "
|
||||
+ " join sub.modelSentences as modSub "
|
||||
+ " join sub.translationEquivalents as transSub "
|
||||
+ " join sub.relatedTerms as relSub "
|
||||
+ " join sub.passages as passSub "
|
||||
+ " join sub.registers as regSub "
|
||||
// join translation collections
|
||||
/*
|
||||
* + " join ety.translations as etyTrans " + " join
|
||||
* term.definitions.translations as defTrans " + " join
|
||||
* term.modelSentences.translations as modTrans " + " join
|
||||
* term.passages.translations as passTrans " + " join
|
||||
* def.subdefinition.translations as subTrans " + " join
|
||||
* def.modelSentences.translations as modDefTrans " + " join
|
||||
* def.passages.translations as passDefTrans " + " join
|
||||
* sub.modelSentences.translations as modSubTrans " + " join
|
||||
* sub.passages.translations as passSubTrans "
|
||||
*/
|
||||
//restrict by projectSubject in createdByProjSub
|
||||
+ " where term.meta.createdByProjSub = :projSub"
|
||||
+ " or pron.meta.createdByProjSub = :projSub"
|
||||
+ " or ety.meta.createdByProjSub = :projSub"
|
||||
+ " or sp.meta.createdByProjSub = :projSub"
|
||||
+ " or func.meta.createdByProjSub = :projSub"
|
||||
+ " or ency.meta.createdByProjSub = :projSub"
|
||||
+ " or transData.meta.createdByProjSub = :projSub"
|
||||
+ " or def.meta.createdByProjSub = :projSub"
|
||||
+ " or glo.meta.createdByProjSub = :projSub"
|
||||
+ " or key.meta.createdByProjSub = :projSub"
|
||||
+ " or trans.meta.createdByProjSub = :projSub"
|
||||
+ " or rel.meta.createdByProjSub = :projSub"
|
||||
+ " or pass.meta.createdByProjSub = :projSub"
|
||||
+ " or reg.meta.createdByProjSub = :projSub"
|
||||
+ " or subDef.meta.createdByProjSub = :projSub"
|
||||
+ " or gloDef.meta.createdByProjSub = :projSub"
|
||||
+ " or keyDef.meta.createdByProjSub = :projSub"
|
||||
+ " or modDef.meta.createdByProjSub = :projSub"
|
||||
+ " or transDef.meta.createdByProjSub = :projSub"
|
||||
+ " or relDef.meta.createdByProjSub = :projSub"
|
||||
+ " or passDef.meta.createdByProjSub = :projSub"
|
||||
+ " or regDef.meta.createdByProjSub = :projSub"
|
||||
+ " or gloSub.meta.createdByProjSub = :projSub"
|
||||
+ " or keySub.meta.createdByProjSub = :projSub"
|
||||
+ " or modSub.meta.createdByProjSub = :projSub"
|
||||
+ " or transSub.meta.createdByProjSub = :projSub"
|
||||
+ " or relSub.meta.createdByProjSub = :projSub"
|
||||
+ " or passSub.meta.createdByProjSub = :projSub"
|
||||
+ " or regSub.meta.createdByProjSub = :projSub"
|
||||
+ " or etyTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or defTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or subTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modDefTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passDefTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or modSubTrans.meta.createdByProjSub = :projSub"
|
||||
+ " or passSubTrans.meta.createdByProjSub = :projSub"
|
||||
//restrict by projectSubject in modifiedByProjSub
|
||||
+ " or term.meta.modifiedByProjSub = :projSub"
|
||||
+ " or pron.meta.modifiedByProjSub = :projSub"
|
||||
+ " or ety.meta.modifiedByProjSub = :projSub"
|
||||
+ " or sp.meta.modifiedByProjSub = :projSub"
|
||||
+ " or func.meta.modifiedByProjSub = :projSub"
|
||||
+ " or ency.meta.modifiedByProjSub = :projSub"
|
||||
+ " or trans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or def.meta.modifiedByProjSub = :projSub"
|
||||
+ " or glo.meta.modifiedByProjSub = :projSub"
|
||||
+ " or key.meta.modifiedByProjSub = :projSub"
|
||||
+ " or trans.meta.modifiedByProjSub = :projSub"
|
||||
+ " or rel.meta.modifiedByProjSub = :projSub"
|
||||
+ " or pass.meta.modifiedByProjSub = :projSub"
|
||||
+ " or reg.meta.modifiedByProjSub = :projSub"
|
||||
+ " or subDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or gloDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or keyDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or relDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or regDef.meta.modifiedByProjSub = :projSub"
|
||||
+ " or gloSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or keySub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or modSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or transSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or relSub.meta.modifiedByProjSub = :projSub"
|
||||
+ " or passSub.meta.modifiedByProjSub = :projSub"
|
||||
/*
|
||||
* + " or regSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* etyTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* defTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* subTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modDefTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passDefTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modSubTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passSubTrans.meta.modifiedByProjSub = :projSub";
|
||||
*/
|
||||
|
||||
+ "";
|
||||
try {
|
||||
query = getSession().createQuery(queryString);
|
||||
//query.setMaxResults( 100 );
|
||||
query.setInteger("projSub", lexQuery.getQueryComponent().getMeta()
|
||||
.getCreatedByProjSub().intValue());
|
||||
logger.debug("About to list query");
|
||||
List list = query.list();
|
||||
logger.debug("results size: " + list.size());
|
||||
it = list.iterator();
|
||||
logger.debug("Starting to add terms to map");
|
||||
while (it.hasNext()) {
|
||||
aTerm = (ITerm) comp;
|
||||
logger.debug("successfully cast comp to an ITerm");
|
||||
terms.put(aTerm.getMetaId(), aTerm.getTerm());
|
||||
}
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
endTransaction(false);
|
||||
lexQuery.setDuration(getDuration());
|
||||
return terms;
|
||||
}
|
||||
|
||||
public static Map findTermsByMetaViaLc(LexQuery lexQuery)
|
||||
throws LexRepositoryException {
|
||||
Logger logger = Logger.getLogger("org.thdl.lex");
|
||||
ITerm term = assertTerm(lexQuery.getQueryComponent());
|
||||
Map terms = new HashMap();
|
||||
ILexComponent comp = null;
|
||||
ITerm aTerm;
|
||||
Query query = null;
|
||||
Iterator it = null;
|
||||
|
||||
setStart(now());
|
||||
beginTransaction();
|
||||
if (null == term.getMeta()) {
|
||||
throw new LexRepositoryException(
|
||||
"Query Component term.meta was null.");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Tibetan Dictionary begin query!");
|
||||
}
|
||||
String queryString = "from org.thdl.lex.component.LexComponent as comp where comp.meta.createdByProjSub=:projSub";
|
||||
|
||||
try {
|
||||
query = getSession().createQuery(queryString);
|
||||
//query.setMaxResults( 100 );
|
||||
query.setInteger("projSub", lexQuery.getQueryComponent().getMeta()
|
||||
.getCreatedByProjSub().intValue());
|
||||
logger.debug("About to list query");
|
||||
List list = query.list();
|
||||
logger.debug("results size: " + list.size());
|
||||
it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
logger.debug("Starting quest for a term parent");
|
||||
|
||||
comp = (ILexComponent) it.next();
|
||||
int safetyFirst = 0;
|
||||
while (!(comp instanceof ITerm) && comp != null) {
|
||||
logger.debug("comp class: " + comp.getClass().getName());
|
||||
comp = comp.getParent();
|
||||
if (comp instanceof ITerm) {
|
||||
try {
|
||||
aTerm = (ITerm) comp;
|
||||
terms.put(aTerm.getMetaId(), aTerm.getTerm());
|
||||
logger.debug("successfully cast comp to an ITerm");
|
||||
} catch (ClassCastException cce) {
|
||||
logger
|
||||
.debug("LCR caught ClassCastException Failed cast of "
|
||||
+ comp.toString() + " to ITerm");
|
||||
throw cce;
|
||||
}
|
||||
}
|
||||
|
||||
safetyFirst++;
|
||||
if (safetyFirst > 10) {
|
||||
logger
|
||||
.debug("could not find an ITerm parent for component: "
|
||||
+ comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
endTransaction(false);
|
||||
lexQuery.setDuration(getDuration());
|
||||
return terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param term
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void loadTerm(ITerm term) throws LexRepositoryException {
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().load(term, term.getMetaId());
|
||||
endTransaction(false);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param lexQuery
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void loadTermByPk(LexQuery lexQuery)
|
||||
throws LexRepositoryException {
|
||||
beginTransaction();
|
||||
ITerm term = assertTerm(lexQuery.getQueryComponent());
|
||||
loadTerm(term);
|
||||
lexQuery.setEntry(term);
|
||||
if (!lexQuery.getResults().containsKey(term.getMetaId())) {
|
||||
lexQuery.getResults().put(term.getMetaId(), term.getTerm());
|
||||
}
|
||||
endTransaction(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void loadByPk(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().load(component, component.getMetaId());
|
||||
endTransaction(false);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void loadByPk(ILexComponent component, Integer pk)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().load(component, pk);
|
||||
endTransaction(false);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the recentTerms attribute of the LexComponentRepository class
|
||||
*
|
||||
* @param limit
|
||||
* Description of the Parameter
|
||||
* @return The recentTerms value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static List getRecentTerms(int limit) throws LexRepositoryException {
|
||||
Query query = null;
|
||||
List results = null;
|
||||
String queryString = " FROM org.thdl.lex.component.ITerm ORDER BY modifiedOn DESC LIMIT "
|
||||
+ limit;
|
||||
try {
|
||||
beginTransaction();
|
||||
query = getSession().createQuery(queryString);
|
||||
results = query.list();
|
||||
endTransaction(false);
|
||||
getSession().clear();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void save(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().saveOrUpdate(component);
|
||||
endTransaction(true);
|
||||
setLastUpdate(now());
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void update(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().update(component);
|
||||
endTransaction(true);
|
||||
setLastUpdate(now());
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void remove(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().delete(component);
|
||||
endTransaction(true);
|
||||
setLastUpdate(now());
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static void refresh(ILexComponent component)
|
||||
throws LexRepositoryException {
|
||||
|
||||
try {
|
||||
beginTransaction();
|
||||
getSession().refresh(component);
|
||||
endTransaction(true);
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void cleanup() throws LexRepositoryException {
|
||||
try {
|
||||
endTransaction(false);
|
||||
HibernateSessionDataTransfer.closeSession();
|
||||
} catch (HibernateException he) {
|
||||
throw new LexRepositoryException(he);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* /join term collections + " join term.pronunciations as pron " + " join
|
||||
* term.etymologies as ety " + " join term.spellings as sp " + " join
|
||||
* term.functions as func " + " join term.encyclopediaArticles as ency " + "
|
||||
* join term.transitionalData as trans " + " join term.definitions as def " + "
|
||||
* join term.glosses as glo " + " join term.keywords as key " + " join
|
||||
* term.translationEquivalents as trans " + " join term.relatedTerms as rel " + "
|
||||
* join term.passages as pass " + " join term.registers as reg " join def
|
||||
* collections + " join def.subdefinitions as sub " + " join def.glosses as
|
||||
* gloDef " + " join def.keywords as keyDef " + " join def.modelSentences as
|
||||
* modDef " + " join def.translationEquivalents as transDef " + " join
|
||||
* def.relatedTerms as relDef " + " join def.passages as passDef " + " join
|
||||
* def.registers as regDef " join subdef collections + " join sub.glosses as
|
||||
* gloSub " + " join sub.keywords as keySub " + " join sub.modelSentences as
|
||||
* modSub " + " join sub.translationEquivalents as transSub " + " join
|
||||
* sub.relatedTerms as relSub " + " join sub.passages as passSub " + " join
|
||||
* sub.registers as regSub " join translation collections + " join
|
||||
* ety.translations as etyTrans " + " join term.definitions.translations as
|
||||
* defTrans " + " join term.modelSentences.translations as modTrans " + " join
|
||||
* term.passages.translations as passTrans " + " join
|
||||
* def.subdefinition.translations as subTrans " + " join
|
||||
* def.modelSentences.translations as modDefTrans " + " join
|
||||
* def.passages.translations as passDefTrans " + " join
|
||||
* sub.modelSentences.translations as modSubTrans " + " join
|
||||
* sub.passages.translations as passSubTrans " /restrict by projectSubject in
|
||||
* createdByProjSub + " where term.meta.createdByProjSub = :projSub" + " or
|
||||
* pron.meta.createdByProjSub = :projSub" + " or ety.meta.createdByProjSub =
|
||||
* :projSub" + " or sp.meta.createdByProjSub = :projSub" + " or
|
||||
* func.meta.createdByProjSub = :projSub" + " or ency.meta.createdByProjSub =
|
||||
* :projSub" + " or trans.meta.createdByProjSub = :projSub" + " or
|
||||
* def.meta.createdByProjSub = :projSub" + " or glo.meta.createdByProjSub =
|
||||
* :projSub" + " or key.meta.createdByProjSub = :projSub" + " or
|
||||
* trans.meta.createdByProjSub = :projSub" + " or rel.meta.createdByProjSub =
|
||||
* :projSub" + " or pass.meta.createdByProjSub = :projSub" + " or
|
||||
* reg.meta.createdByProjSub = :projSub" + " or subDef.meta.createdByProjSub =
|
||||
* :projSub" + " or gloDef.meta.createdByProjSub = :projSub" + " or
|
||||
* keyDef.meta.createdByProjSub = :projSub" + " or modDef.meta.createdByProjSub =
|
||||
* :projSub" + " or transDef.meta.createdByProjSub = :projSub" + " or
|
||||
* relDef.meta.createdByProjSub = :projSub" + " or passDef.meta.createdByProjSub =
|
||||
* :projSub" + " or regDef.meta.createdByProjSub = :projSub" + " or
|
||||
* gloSub.meta.createdByProjSub = :projSub" + " or keySub.meta.createdByProjSub =
|
||||
* :projSub" + " or modSub.meta.createdByProjSub = :projSub" + " or
|
||||
* transSub.meta.createdByProjSub = :projSub" + " or
|
||||
* relSub.meta.createdByProjSub = :projSub" + " or passSub.meta.createdByProjSub =
|
||||
* :projSub" + " or regSub.meta.createdByProjSub = :projSub" + " or
|
||||
* etyTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* defTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* subTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modDefTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passDefTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* modSubTrans.meta.createdByProjSub = :projSub" + " or
|
||||
* passSubTrans.meta.createdByProjSub = :projSub" /restrict by projectSubject in
|
||||
* modifiedByProjSub + " or term.meta.modifiedByProjSub = :projSub" + " or
|
||||
* pron.meta.modifiedByProjSub = :projSub" + " or ety.meta.modifiedByProjSub =
|
||||
* :projSub" + " or sp.meta.modifiedByProjSub = :projSub" + " or
|
||||
* func.meta.modifiedByProjSub = :projSub" + " or ency.meta.modifiedByProjSub =
|
||||
* :projSub" + " or trans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* def.meta.modifiedByProjSub = :projSub" + " or glo.meta.modifiedByProjSub =
|
||||
* :projSub" + " or key.meta.modifiedByProjSub = :projSub" + " or
|
||||
* trans.meta.modifiedByProjSub = :projSub" + " or rel.meta.modifiedByProjSub =
|
||||
* :projSub" + " or pass.meta.modifiedByProjSub = :projSub" + " or
|
||||
* reg.meta.modifiedByProjSub = :projSub" + " or subDef.meta.modifiedByProjSub =
|
||||
* :projSub" + " or gloDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* keyDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* transDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* relDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* regDef.meta.modifiedByProjSub = :projSub" + " or
|
||||
* gloSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* keySub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* transSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* relSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* regSub.meta.modifiedByProjSub = :projSub" + " or
|
||||
* etyTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* defTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* subTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modDefTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passDefTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* modSubTrans.meta.modifiedByProjSub = :projSub" + " or
|
||||
* passSubTrans.meta.modifiedByProjSub = :projSub";
|
||||
*/
|
||||
|
314
src/java/org/thdl/lex/LexConstants.java
Normal file
314
src/java/org/thdl/lex/LexConstants.java
Normal file
|
@ -0,0 +1,314 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import org.thdl.lex.component.AnalyticalNote;
|
||||
import org.thdl.lex.component.Definition;
|
||||
import org.thdl.lex.component.EncyclopediaArticle;
|
||||
import org.thdl.lex.component.Etymology;
|
||||
import org.thdl.lex.component.Gloss;
|
||||
import org.thdl.lex.component.GrammaticalFunction;
|
||||
import org.thdl.lex.component.Keyword;
|
||||
import org.thdl.lex.component.ModelSentence;
|
||||
import org.thdl.lex.component.Passage;
|
||||
import org.thdl.lex.component.Pronunciation;
|
||||
import org.thdl.lex.component.RelatedTerm;
|
||||
import org.thdl.lex.component.SpeechRegister;
|
||||
import org.thdl.lex.component.Spelling;
|
||||
import org.thdl.lex.component.Subdefinition;
|
||||
import org.thdl.lex.component.TransitionalData;
|
||||
import org.thdl.lex.component.TranslationEquivalent;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexConstants {
|
||||
/*
|
||||
* REQUEST PARAM/ATTR NAMES AND VALUES USED BY LexComponentFilter.java
|
||||
*/
|
||||
//form field req params
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String LABEL_REQ_PARAM = "comp";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String TERMLABEL_VALUE = "term";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String PRONUNCIATIONLABEL_VALUE = new Pronunciation()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String SPELLINGLABEL_VALUE = new Spelling().getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String ETYMOLOGYLABEL_VALUE = new Etymology()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String FUNCTIONLABEL_VALUE = new GrammaticalFunction()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String ENCYCLOPEDIA_ARTICLE_LABEL_VALUE = new EncyclopediaArticle()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String DEFINITIONLABEL_VALUE = new Definition()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String SUBDEFINITIONLABEL_VALUE = new Subdefinition()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String MODELSENTENCELABEL_VALUE = new ModelSentence()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String PASSAGELABEL_VALUE = new Passage().getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String TRANSLATIONLABEL_VALUE = new TranslationEquivalent()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String RELATEDTERMLABEL_VALUE = new RelatedTerm()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String REGISTERLABEL_VALUE = new SpeechRegister()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String KEYWORDLABEL_VALUE = new Keyword().getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String PREFERENCESLABEL_VALUE = "preferences";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String ANALYTICALNOTELABEL_VALUE = new AnalyticalNote()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String TRANSITIONALDATALABEL_VALUE = new TransitionalData()
|
||||
.getLabel();
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String GLOSSLABEL_VALUE = new Gloss().getLabel();
|
||||
|
||||
/*
|
||||
* REQUEST PARAM NAMES AND VALUES USED BY LexActionServlet.java
|
||||
*/
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String COMMAND_REQ_PARAM = "cmd";
|
||||
|
||||
/*
|
||||
* REQUEST PARAM NAMES AND VALUES USED BY LoginServlet.java
|
||||
*/
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String USERNAME_REQ_PARAM = "username";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String PASSWORD_REQ_PARAM = "password";
|
||||
|
||||
/*
|
||||
* -------------------------- REQUEST PARAM NAMES USED BY
|
||||
* LexComponent.scrapeRequest(req) METHODS --------------------------
|
||||
*/
|
||||
//Meta Data Request Params
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String NOTE_REQ_PARAM = "note";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String LANGUAGE_REQ_PARAM = "language";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String TRANSLATIONOF_REQ_PARAM = "translationOf";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String DIALECT_REQ_PARAM = "dialect";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String SOURCE_REQ_PARAM = "source";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String PROJSUB_REQ_PARAM = "projectSubject";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String SCRIPT_REQ_PARAM = "script";
|
||||
|
||||
//Term Data Request Params
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String TERM_REQ_PARAM = "term";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String TERMID_REQ_PARAM = "termId";
|
||||
|
||||
// public static final String SPELLINGNOTE_REQ_PARAM = "spellingNote";
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String PRECEDENCE_REQ_PARAM = "precedence";
|
||||
|
||||
//Definition Data Request Params
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String SUBDEFINITION_REQ_PARAM = "subdefinition";
|
||||
|
||||
//outgoing request attributes to jsp
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String COMPONENT_REQ_ATTR = "component";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String ORIGINALBEAN_REQ_ATTR = "original";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String MESSAGE_REQ_ATTR = "message";
|
||||
|
||||
//session attributes used by filters, servlet, commands and jsp
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String USER_SESS_ATTR = "user";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String PREFERENCES_SESS_ATTR = "preferences";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String LOGINTARGET_SESS_PARAM = "loginTarget";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String DISPLAYMODE_SESS_ATTR = "displayMode";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String QUERY_SESS_ATTR = "query";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String TERMENTRYBEAN_SESS_ATTR = "termEntry";
|
||||
|
||||
//used by Servlet
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String JSP_DIR = "/jsp/";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String WELCOME_PAGE = "action?cmd=menu";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String ERROR_PAGE = "error.jsp";
|
||||
|
||||
//used by Repository
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String DRIVER = "com.mysql.jdbc.Driver";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String DATASOURCE_NAME = "java:comp/env/jdbc/lex-datasource";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String HIBERNATE_SESSION_KEY = "hib";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String VISIT_SESSION_ATTR = "visit";
|
||||
|
||||
/**
|
||||
* Description of the Field
|
||||
*/
|
||||
public final static String GLOBAL_CONTEXT_ATTR = "global";
|
||||
|
||||
//public final static String URL = "jdbc:mysql://localhost/LexTorque";
|
||||
|
||||
}
|
||||
|
18
src/java/org/thdl/lex/LexConstantsSecure.java
Normal file
18
src/java/org/thdl/lex/LexConstantsSecure.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexConstantsSecure {
|
||||
final static String USER = "";
|
||||
|
||||
final static String PASSWORD = "";
|
||||
|
||||
final static String URL = "jdbc:mysql://localhost/Lex";
|
||||
|
||||
//public final static String URL = "jdbc:mysql://localhost/LexTorque";
|
||||
}
|
||||
|
686
src/java/org/thdl/lex/LexFlatDataRepository.java
Normal file
686
src/java/org/thdl/lex/LexFlatDataRepository.java
Normal file
|
@ -0,0 +1,686 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.thdl.users.ThdlUserRepository;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created December 15, 2003
|
||||
*/
|
||||
public class LexFlatDataRepository {
|
||||
//attributes
|
||||
int displayLanguage = 1;//this should default to the id for english from
|
||||
// Languages table
|
||||
|
||||
private static LexFlatDataRepository instance;
|
||||
|
||||
HashMap users;
|
||||
|
||||
HashMap userRoles;
|
||||
|
||||
HashMap projectSubjects;
|
||||
|
||||
HashMap sources;
|
||||
|
||||
HashMap languages;
|
||||
|
||||
HashMap scripts;
|
||||
|
||||
HashMap literarySources;
|
||||
|
||||
HashMap transitionalDataLabels;
|
||||
|
||||
HashMap dialects;//represents merge table
|
||||
|
||||
HashMap majorDialectFamilies;
|
||||
|
||||
HashMap specificDialects;
|
||||
|
||||
HashMap functionsGeneral;
|
||||
|
||||
HashMap functionsSpecific;
|
||||
|
||||
HashMap spellingTypes;
|
||||
|
||||
HashMap phoneticsTypes;
|
||||
|
||||
HashMap relatedTermTypes;
|
||||
|
||||
HashMap etymologyTypes;
|
||||
|
||||
HashMap registers;
|
||||
|
||||
HashMap commentTypes;
|
||||
|
||||
//accessors
|
||||
/**
|
||||
* Gets the instance attribute of the LexFlatDataRepository class
|
||||
*
|
||||
* @return The instance value
|
||||
*/
|
||||
public static LexFlatDataRepository getInstance() {
|
||||
if (null == instance) {
|
||||
instance = new LexFlatDataRepository();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the transitionalDataLabels attribute of the LexFlatDataRepository
|
||||
* object
|
||||
*/
|
||||
public void setTransitionalDataLabels() {
|
||||
String sql = "SELECT id, transitionalDataLabel FROM TransitionalDataLabels";
|
||||
setTransitionalDataLabels(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the transitionalDataLabels attribute of the LexFlatDataRepository
|
||||
* object
|
||||
*
|
||||
* @param transitionalDataLabels
|
||||
* The new transitionalDataLabels value
|
||||
*/
|
||||
public void setTransitionalDataLabels(HashMap transitionalDataLabels) {
|
||||
this.transitionalDataLabels = transitionalDataLabels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transitionalDataLabels attribute of the LexFlatDataRepository
|
||||
* object
|
||||
*
|
||||
* @return The transitionalDataLabels value
|
||||
*/
|
||||
public HashMap getTransitionalDataLabels() {
|
||||
return transitionalDataLabels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the literarySources attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param literarySources
|
||||
* The new literarySources value
|
||||
*/
|
||||
public void setLiterarySources(HashMap literarySources) {
|
||||
this.literarySources = literarySources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the literarySources attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setLiterarySources() {
|
||||
String sql = "SELECT id, sourceNormalizedTitle FROM LiterarySources";
|
||||
setLiterarySources(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the literarySources attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The literarySources value
|
||||
*/
|
||||
public HashMap getLiterarySources() {
|
||||
return literarySources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the users attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param users
|
||||
* The new users value
|
||||
*/
|
||||
public void setUsers(HashMap users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the users attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void setUsers() throws LexRepositoryException {
|
||||
try {
|
||||
ThdlUserRepository tr = ThdlUserRepository.getInstance();
|
||||
setUsers(tr.getUsernameMap());
|
||||
} catch (Exception e) {
|
||||
throw new LexRepositoryException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projectSubjects attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param projectSubjects
|
||||
* The new projectSubjects value
|
||||
*/
|
||||
public void setProjectSubjects(HashMap projectSubjects) {
|
||||
this.projectSubjects = projectSubjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projectSubjects attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setProjectSubjects() {
|
||||
String sql = "SELECT id, projectSubject FROM ProjectSubjects";
|
||||
setProjectSubjects(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sources attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param sources
|
||||
* The new sources value
|
||||
*/
|
||||
public void setSources(HashMap sources) {
|
||||
this.sources = sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sources attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setSources() {
|
||||
String sql = "SELECT id, sourceTitle FROM Sources";
|
||||
setSources(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the languages attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param languages
|
||||
* The new languages value
|
||||
*/
|
||||
public void setLanguages(HashMap languages) {
|
||||
this.languages = languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the languages attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setLanguages() {
|
||||
String sql = "SELECT id,Language FROM Languages";
|
||||
setLanguages(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the scripts attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param scripts
|
||||
* The new scripts value
|
||||
*/
|
||||
public void setScripts(HashMap scripts) {
|
||||
this.scripts = scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the scripts attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setScripts() {
|
||||
String sql = "SELECT id,script FROM Scripts";
|
||||
setScripts(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the users attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The users value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public HashMap getUsers() throws LexRepositoryException {
|
||||
if (null == users) {
|
||||
setUsers();
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projectSubjects attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The projectSubjects value
|
||||
*/
|
||||
public HashMap getProjectSubjects() {
|
||||
return projectSubjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sources attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The sources value
|
||||
*/
|
||||
public HashMap getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the languages attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The languages value
|
||||
*/
|
||||
public HashMap getLanguages() {
|
||||
return languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scripts attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The scripts value
|
||||
*/
|
||||
public HashMap getScripts() {
|
||||
return scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the etymologyTypes attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param etymologyTypes
|
||||
* The new etymologyTypes value
|
||||
*/
|
||||
public void setEtymologyTypes(HashMap etymologyTypes) {
|
||||
this.etymologyTypes = etymologyTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the etymologyTypes attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setEtymologyTypes() {
|
||||
String sql = "SELECT id, etymologyType FROM EtymologyTypes";
|
||||
setEtymologyTypes(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the etymologyTypes attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The etymologyTypes value
|
||||
*/
|
||||
public HashMap getEtymologyTypes() {
|
||||
return etymologyTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the spellingTypes attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setSpellingTypes() {
|
||||
String sql = "SELECT id, spellingType FROM SpellingTypes";
|
||||
setSpellingTypes(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the spellingTypes attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param spellingTypes
|
||||
* The new spellingTypes value
|
||||
*/
|
||||
public void setSpellingTypes(HashMap spellingTypes) {
|
||||
this.spellingTypes = spellingTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the spellingTypes attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The spellingTypes value
|
||||
*/
|
||||
public HashMap getSpellingTypes() {
|
||||
return spellingTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the phoneticsTypes attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setPhoneticsTypes() {
|
||||
String sql = "SELECT id, phoneticsType FROM PhoneticsTypes";
|
||||
setPhoneticsTypes(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the phoneticsTypes attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param phoneticsTypes
|
||||
* The new phoneticsTypes value
|
||||
*/
|
||||
public void setPhoneticsTypes(HashMap phoneticsTypes) {
|
||||
this.phoneticsTypes = phoneticsTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the phoneticsTypes attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The phoneticsTypes value
|
||||
*/
|
||||
public HashMap getPhoneticsTypes() {
|
||||
return phoneticsTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the relatedTermTypes attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setRelatedTermTypes() {
|
||||
String sql = "SELECT id, relatedTermType FROM RelatedTermTypes";
|
||||
setRelatedTermTypes(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the relatedTermTypes attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param relatedTermTypes
|
||||
* The new relatedTermTypes value
|
||||
*/
|
||||
public void setRelatedTermTypes(HashMap relatedTermTypes) {
|
||||
this.relatedTermTypes = relatedTermTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relatedTermTypes attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The relatedTermTypes value
|
||||
*/
|
||||
public HashMap getRelatedTermTypes() {
|
||||
return relatedTermTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the registers attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setRegisters() {
|
||||
String sql = "SELECT id, register FROM Registers";
|
||||
setRegisters(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the registers attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param registers
|
||||
* The new registers value
|
||||
*/
|
||||
public void setRegisters(HashMap registers) {
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the registers attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The registers value
|
||||
*/
|
||||
public HashMap getRegisters() {
|
||||
return registers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the functionsGeneral attribute of the LexFlatDataRepository object
|
||||
*/
|
||||
public void setFunctionsGeneral() {
|
||||
String sql = "SELECT id, functionGeneral FROM FunctionsGeneral";
|
||||
setFunctionsGeneral(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the functionsGeneral attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param functionsGeneral
|
||||
* The new functionsGeneral value
|
||||
*/
|
||||
public void setFunctionsGeneral(HashMap functionsGeneral) {
|
||||
this.functionsGeneral = functionsGeneral;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the functionsGeneral attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @return The functionsGeneral value
|
||||
*/
|
||||
public HashMap getFunctionsGeneral() {
|
||||
return functionsGeneral;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the majorDialectFamilies attribute of the LexFlatDataRepository
|
||||
* object
|
||||
*/
|
||||
public void setMajorDialectFamilies() {
|
||||
String sql = "SELECT id, majorDialectFamily FROM MajorDialectFamilies";
|
||||
setMajorDialectFamilies(createMap(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the majorDialectFamilies attribute of the LexFlatDataRepository
|
||||
* object
|
||||
*
|
||||
* @param majorDialectFamilies
|
||||
* The new majorDialectFamilies value
|
||||
*/
|
||||
public void setMajorDialectFamilies(HashMap majorDialectFamilies) {
|
||||
this.majorDialectFamilies = majorDialectFamilies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the majorDialectFamilies attribute of the LexFlatDataRepository
|
||||
* object
|
||||
*
|
||||
* @return The majorDialectFamilies value
|
||||
*/
|
||||
public HashMap getMajorDialectFamilies() {
|
||||
return majorDialectFamilies;
|
||||
}
|
||||
|
||||
// accessor methods for HashMap items
|
||||
|
||||
/**
|
||||
* Gets the user attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param userId
|
||||
* Description of the Parameter
|
||||
* @return The user value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String getUser(int userId) throws LexRepositoryException {
|
||||
return (String) getUsers().get(new Integer(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projectSubject attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param projSubId
|
||||
* Description of the Parameter
|
||||
* @return The projectSubject value
|
||||
*/
|
||||
public String getProjectSubject(int projSubId) {
|
||||
return (String) getProjectSubjects().get(new Integer(projSubId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param sourceId
|
||||
* Description of the Parameter
|
||||
* @return The source value
|
||||
*/
|
||||
public String getSource(int sourceId) {
|
||||
return (String) getSources().get(new Integer(sourceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the language attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param langId
|
||||
* Description of the Parameter
|
||||
* @return The language value
|
||||
*/
|
||||
public String getLanguage(int langId) {
|
||||
return (String) getLanguages().get(new Integer(langId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the script attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param scriptId
|
||||
* Description of the Parameter
|
||||
* @return The script value
|
||||
*/
|
||||
public String getScript(int scriptId) {
|
||||
return (String) getScripts().get(new Integer(scriptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the literarySource attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param litSourceId
|
||||
* Description of the Parameter
|
||||
* @return The literarySource value
|
||||
*/
|
||||
public String getLiterarySource(int litSourceId) {
|
||||
return (String) getLiterarySources().get(new Integer(litSourceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the etymologyType attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param etymType
|
||||
* Description of the Parameter
|
||||
* @return The etymologyType value
|
||||
*/
|
||||
public String getEtymologyType(int etymType) {
|
||||
return (String) getEtymologyTypes().get(new Integer(etymType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the spellingType attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param varType
|
||||
* Description of the Parameter
|
||||
* @return The spellingType value
|
||||
*/
|
||||
public String getSpellingType(int varType) {
|
||||
return (String) getSpellingTypes().get(new Integer(varType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the register attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param reg
|
||||
* Description of the Parameter
|
||||
* @return The register value
|
||||
*/
|
||||
public String getRegister(int reg) {
|
||||
return (String) getRegisters().get(new Integer(reg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the functionGeneral attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param funcGen
|
||||
* Description of the Parameter
|
||||
* @return The functionGeneral value
|
||||
*/
|
||||
public String getFunctionGeneral(int funcGen) {
|
||||
return (String) getFunctionsGeneral().get(new Integer(funcGen));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the majorDialectFamily attribute of the LexFlatDataRepository object
|
||||
*
|
||||
* @param dial
|
||||
* Description of the Parameter
|
||||
* @return The majorDialectFamily value
|
||||
*/
|
||||
public String getMajorDialectFamily(int dial) {
|
||||
return (String) getMajorDialectFamilies().get(new Integer(dial));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transitionalDataLabel attribute of the LexFlatDataRepository
|
||||
* object
|
||||
*
|
||||
* @param label
|
||||
* Description of the Parameter
|
||||
* @return The transitionalDataLabel value
|
||||
*/
|
||||
public String getTransitionalDataLabel(int label) {
|
||||
return (String) getTransitionalDataLabels().get(new Integer(label));
|
||||
}
|
||||
|
||||
//helpers
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param sql
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public HashMap createMap(String sql) {
|
||||
ResultSet rs = null;
|
||||
HashMap map = new HashMap();
|
||||
try {
|
||||
LexRepository lr = LexRepository.getInstance();
|
||||
Connection con = lr.getDataSource().getConnection();
|
||||
rs = con.createStatement().executeQuery(sql);
|
||||
if (null != rs) {
|
||||
int i = 0;
|
||||
Integer key = null;
|
||||
String value = "";
|
||||
while (rs.next()) {
|
||||
i = rs.getInt(1);
|
||||
key = new Integer(i);
|
||||
value = rs.getString(2);
|
||||
ResultSetMetaData rsmd = rs.getMetaData();
|
||||
int columnCount = rsmd.getColumnCount();
|
||||
for (int x = 3; x <= columnCount; x++) {
|
||||
value = value + " " + rs.getString(x);
|
||||
}
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
con.close();
|
||||
} catch (LexRepositoryException lre) {
|
||||
lre.printStackTrace();
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Constructor for the LexFlatDataRepository object
|
||||
*/
|
||||
public LexFlatDataRepository() {
|
||||
setProjectSubjects();
|
||||
setSources();
|
||||
setLanguages();
|
||||
setScripts();
|
||||
setLiterarySources();
|
||||
setEtymologyTypes();
|
||||
setSpellingTypes();
|
||||
setPhoneticsTypes();
|
||||
setRelatedTermTypes();
|
||||
setRegisters();
|
||||
setFunctionsGeneral();
|
||||
setMajorDialectFamilies();
|
||||
setTransitionalDataLabels();
|
||||
}
|
||||
|
||||
//main
|
||||
|
||||
/**
|
||||
* The main program for the LexFlatDataRepository class
|
||||
*
|
||||
* @param args
|
||||
* The command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
LexFlatDataRepository lfdr = new LexFlatDataRepository();
|
||||
//System.out.println( lfdr.getUser( 1 ) );
|
||||
System.out.println(lfdr.getProjectSubject(6));
|
||||
System.out.println(lfdr.getSource(1));
|
||||
System.out.println(lfdr.getLanguage(1));
|
||||
System.out.println(lfdr.getEtymologyType(1));
|
||||
}
|
||||
}
|
||||
|
223
src/java/org/thdl/lex/LexLogger.java
Normal file
223
src/java/org/thdl/lex/LexLogger.java
Normal file
|
@ -0,0 +1,223 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 9, 2003
|
||||
*/
|
||||
public class LexLogger {
|
||||
private final static Logger LOGGER = Logger.getLogger("org.thdl.lex");
|
||||
|
||||
private final static List EXCLUDED_PARAMS = Arrays.asList(new String[] {
|
||||
"org.apache.catalina.jsp_classpath",
|
||||
"javax.servlet.context.tempdir",
|
||||
"org.apache.catalina.WELCOME_FILES" });
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void logRequestState(HttpServletRequest req) {
|
||||
|
||||
Iterator it;
|
||||
LOGGER.debug("authType: " + req.getAuthType());
|
||||
LOGGER.debug("characterEncoding: " + req.getCharacterEncoding());
|
||||
LOGGER.debug("contentLength: " + req.getContentLength());
|
||||
LOGGER.debug("contentType: " + req.getContentType());
|
||||
LOGGER.debug("method: " + req.getMethod());
|
||||
LOGGER.debug("pathInfo: " + req.getPathInfo());
|
||||
LOGGER.debug("pathTranslated: " + req.getPathTranslated());
|
||||
LOGGER.debug("protocol: " + req.getProtocol());
|
||||
LOGGER.debug("queryString: " + req.getQueryString());
|
||||
LOGGER.debug("remoteAddr: " + req.getRemoteAddr());
|
||||
LOGGER.debug("remoteHost: " + req.getRemoteHost());
|
||||
LOGGER.debug("remoteUser: " + req.getRemoteUser());
|
||||
LOGGER.debug("requestedSessionId: " + req.getRequestedSessionId());
|
||||
LOGGER.debug("requestedSessionIdFromCookie: "
|
||||
+ req.isRequestedSessionIdFromCookie());
|
||||
LOGGER.debug("requestedSessionIdFromURL: "
|
||||
+ req.isRequestedSessionIdFromURL());
|
||||
LOGGER.debug("requestedSessionIdValid: "
|
||||
+ req.isRequestedSessionIdValid());
|
||||
LOGGER.debug("requestURI: " + req.getRequestURI());
|
||||
LOGGER.debug("scheme: " + req.getScheme());
|
||||
LOGGER.debug("serverName: " + req.getServerName());
|
||||
LOGGER.debug("serverPort: " + req.getServerPort());
|
||||
LOGGER.debug("contextPath: " + req.getContextPath());
|
||||
LOGGER.debug("servletPath: " + req.getServletPath());
|
||||
Enumeration enumeration = req.getParameterNames();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String parm = (String) enumeration.nextElement();
|
||||
LOGGER.debug("Request Parameter: " + parm + " = '"
|
||||
+ req.getParameter(parm) + "'");
|
||||
}
|
||||
enumeration = req.getAttributeNames();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String att = (String) enumeration.nextElement();
|
||||
LOGGER.debug("Request Attribute: " + att + " =: "
|
||||
+ req.getAttribute(att));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param resp
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void logResponseState(HttpServletResponse resp) {
|
||||
LOGGER.debug("RESPONSE STATE");
|
||||
LOGGER.debug("characterEncoding: " + resp.getCharacterEncoding());
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void logSessionState(HttpServletRequest req) {
|
||||
HttpSession ses = req.getSession(false);
|
||||
if (null == ses) {
|
||||
LOGGER.debug("Session was null");
|
||||
return;
|
||||
}
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
Enumeration enumeration = ses.getAttributeNames();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String att = (String) enumeration.nextElement();
|
||||
LOGGER.debug("Session Attribute: " + att + " =: "
|
||||
+ ses.getAttribute(att));
|
||||
}
|
||||
|
||||
if (null == visit) {
|
||||
LOGGER.debug("Visit was null");
|
||||
return;
|
||||
}
|
||||
debugComponent(visit);
|
||||
debugComponent(visit.getQuery());
|
||||
debugComponent(visit.getUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param context
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void logContextState(ServletContext context) {
|
||||
Enumeration enumeration = context.getAttributeNames();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String att = (String) enumeration.nextElement();
|
||||
if (!EXCLUDED_PARAMS.contains(att)) {
|
||||
LOGGER.debug("Context Attribute: " + att + " =: "
|
||||
+ context.getAttribute(att));
|
||||
}
|
||||
}
|
||||
debugComponent(context.getAttribute(LexConstants.GLOBAL_CONTEXT_ATTR));
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param msg
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void info(String msg) {
|
||||
LOGGER.info(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param msg
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void debug(String msg) {
|
||||
LOGGER.debug(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param msg
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void warn(String msg) {
|
||||
LOGGER.warn(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param msg
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void error(String msg) {
|
||||
LOGGER.error(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the debugComponent object
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void debugComponent(Object component) {
|
||||
if (null == component) {
|
||||
debug("debugComponent was just handed a null component");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
LOGGER.debug("Describing: " + component);
|
||||
String label = component instanceof ILexComponent ? ((ILexComponent) component)
|
||||
.getLabel()
|
||||
: component.toString();
|
||||
Iterator it = BeanUtils.describe(component).entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
LOGGER.debug(label + " property: " + entry.getKey() + " = '"
|
||||
+ entry.getValue() + "'");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
StringWriter writer = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(writer));
|
||||
String stackTrace = writer.getBuffer().toString();
|
||||
LOGGER.debug("LexLogger caught an Exception: " + stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param term
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void debugTerm(ITerm term) {
|
||||
debugComponent(term);
|
||||
}
|
||||
|
||||
}
|
||||
|
16
src/java/org/thdl/lex/LexQuery.hbm.xml
Normal file
16
src/java/org/thdl/lex/LexQuery.hbm.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC
|
||||
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
|
||||
|
||||
<hibernate-mapping>
|
||||
|
||||
<class name="org.thdl.lex.components.LexQuery" proxy="org.thdl.lex.components.ILexQuery" table="Queries" where="deleted=0">
|
||||
|
||||
<meta attribute="generated-class" inherit="false">org.thdl.lex.components.BaseLexQuery</meta>
|
||||
|
||||
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
221
src/java/org/thdl/lex/LexQuery.java
Normal file
221
src/java/org/thdl/lex/LexQuery.java
Normal file
|
@ -0,0 +1,221 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexQuery {
|
||||
private ILexComponent queryComponent;
|
||||
|
||||
private ILexComponent updateComponent;
|
||||
|
||||
private ITerm entry;
|
||||
|
||||
private Map results;
|
||||
|
||||
private String findMode;
|
||||
|
||||
private long duration;
|
||||
|
||||
/**
|
||||
* Sets the updateComponent attribute of the LexQuery object
|
||||
*
|
||||
* @param updateComponent
|
||||
* The new updateComponent value
|
||||
*/
|
||||
public void setUpdateComponent(ILexComponent updateComponent) {
|
||||
this.updateComponent = updateComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the duration attribute of the LexQuery object
|
||||
*
|
||||
* @param duration
|
||||
* The new duration value
|
||||
* @since
|
||||
*/
|
||||
public void setDuration(long duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the queryComponent attribute of the LexQuery object
|
||||
*
|
||||
* @param queryComponent
|
||||
* The new queryComponent value
|
||||
* @since
|
||||
*/
|
||||
public void setQueryComponent(ILexComponent queryComponent) {
|
||||
this.queryComponent = queryComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry attribute of the LexQuery object
|
||||
*
|
||||
* @param entry
|
||||
* The new entry value
|
||||
* @since
|
||||
*/
|
||||
public void setEntry(ITerm entry) {
|
||||
this.entry = entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the findMode attribute of the LexQuery object
|
||||
*
|
||||
* @param findMode
|
||||
* The new findMode value
|
||||
* @since
|
||||
*/
|
||||
public void setFindMode(String findMode) {
|
||||
this.findMode = findMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the results attribute of the LexQuery object
|
||||
*
|
||||
* @param results
|
||||
* The new results value
|
||||
* @since
|
||||
*/
|
||||
public void setResults(Map results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the updateComponent attribute of the LexQuery object
|
||||
*
|
||||
* @return The updateComponent value
|
||||
*/
|
||||
public ILexComponent getUpdateComponent() {
|
||||
return updateComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the duration attribute of the LexQuery object
|
||||
*
|
||||
* @return The duration value
|
||||
* @since
|
||||
*/
|
||||
public long getDuration() {
|
||||
return duration / 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the queryComponent attribute of the LexQuery object
|
||||
*
|
||||
* @return The queryComponent value
|
||||
* @since
|
||||
*/
|
||||
public ILexComponent getQueryComponent() {
|
||||
return queryComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry attribute of the LexQuery object
|
||||
*
|
||||
* @return The entry value
|
||||
* @since
|
||||
*/
|
||||
public ITerm getEntry() {
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the findMode attribute of the LexQuery object
|
||||
*
|
||||
* @return The findMode value
|
||||
* @since
|
||||
*/
|
||||
public String getFindMode() {
|
||||
return findMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the results attribute of the LexQuery object
|
||||
*
|
||||
* @return The results value
|
||||
* @since
|
||||
*/
|
||||
public Map getResults() {
|
||||
if (null == results) {
|
||||
setResults(new HashMap());
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param parameters
|
||||
* Description of Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void populate(Map parameters) throws LexRepositoryException {
|
||||
try {
|
||||
BeanUtils.populate(this, parameters);
|
||||
} catch (IllegalAccessException iae) {
|
||||
throw new LexRepositoryException(iae);
|
||||
} catch (java.lang.reflect.InvocationTargetException ite) {
|
||||
throw new LexRepositoryException(ite);
|
||||
}
|
||||
}
|
||||
|
||||
//constructors
|
||||
|
||||
/**
|
||||
* Constructor for the LexQuery object
|
||||
*
|
||||
* @param findMode
|
||||
* Description of the Parameter
|
||||
* @since
|
||||
*/
|
||||
public LexQuery(String findMode) {
|
||||
setFindMode(findMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexQuery object
|
||||
*/
|
||||
public LexQuery() {
|
||||
this(LexComponentRepository.STARTS_WITH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexQuery object
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public LexQuery(ILexComponent component) {
|
||||
this();
|
||||
setQueryComponent(component);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexQuery object
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @param findMode
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public LexQuery(ILexComponent component, String findMode) {
|
||||
this(findMode);
|
||||
setQueryComponent(component);
|
||||
}
|
||||
|
||||
}
|
||||
|
157
src/java/org/thdl/lex/LexRepository.java
Normal file
157
src/java/org/thdl/lex/LexRepository.java
Normal file
|
@ -0,0 +1,157 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created September 26, 2002
|
||||
*/
|
||||
public class LexRepository {
|
||||
//attributes
|
||||
private static LexRepository instance;
|
||||
|
||||
private DataSource dataSource;
|
||||
|
||||
/**
|
||||
* Sets the dataSource attribute of the LexRepository object
|
||||
*
|
||||
* @param dataSource
|
||||
* The new dataSource value
|
||||
*/
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dataSource attribute of the LexRepository object
|
||||
*
|
||||
* @return The dataSource value
|
||||
*/
|
||||
public DataSource getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
//accessors
|
||||
|
||||
/**
|
||||
* Gets the instance attribute of the LexRepository class
|
||||
*
|
||||
* @return The instance value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
* @since
|
||||
*/
|
||||
public static LexRepository getInstance() throws LexRepositoryException {
|
||||
if (instance == null) {
|
||||
instance = new LexRepository();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
|
||||
/**
|
||||
* doUpdate() performs an INSERT/UPDATE/DROP action
|
||||
*
|
||||
* @param sql
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
* @since
|
||||
*/
|
||||
public int doUpdate(String sql) throws LexRepositoryException {
|
||||
try {
|
||||
Connection con = getDataSource().getConnection();
|
||||
int i = con.createStatement().executeUpdate(sql);
|
||||
con.close();
|
||||
return i;
|
||||
} catch (SQLException sqle) {
|
||||
throw new LexRepositoryException(sqle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* doInsert() is a wrapper for doUpdate() that returns the auto_increment
|
||||
* primary key value of the newly inserted row
|
||||
*
|
||||
* @param sql
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
* @since
|
||||
*/
|
||||
public int doInsert(String sql) throws LexRepositoryException {
|
||||
if (null == sql) {
|
||||
throw new LexRepositoryException("SQL String was null");
|
||||
}
|
||||
if (sql.equals("")) {
|
||||
throw new LexRepositoryException("SQL String was empty");
|
||||
}
|
||||
try {
|
||||
ResultSet rs;
|
||||
int returnVal = 0;
|
||||
int i;
|
||||
i = doUpdate(sql);
|
||||
if (i > 0) {
|
||||
Connection con = getDataSource().getConnection();
|
||||
rs = con.createStatement().executeQuery(
|
||||
"SELECT LAST_INSERT_ID()");
|
||||
while (rs.next()) {
|
||||
returnVal = rs.getInt(1);
|
||||
}
|
||||
con.close();
|
||||
return returnVal;
|
||||
} else {
|
||||
returnVal = i;
|
||||
}
|
||||
throw new LexRepositoryException(
|
||||
"Insert affected 0 rows. Sql String was '" + sql + "'");
|
||||
} catch (SQLException sqle) {
|
||||
throw new LexRepositoryException(sqle);
|
||||
}
|
||||
}
|
||||
|
||||
//main
|
||||
/**
|
||||
* The main program for the LexRepository class. This method tests all other
|
||||
* methods in this class
|
||||
*
|
||||
* @param args
|
||||
* The command line arguments
|
||||
* @since
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Default Constructor for the LexRepository object
|
||||
*
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
* @since
|
||||
*/
|
||||
private LexRepository() throws LexRepositoryException {
|
||||
try {
|
||||
Context context = new InitialContext();
|
||||
DataSource source = (DataSource) context
|
||||
.lookup(LexConstants.DATASOURCE_NAME);
|
||||
setDataSource(source);
|
||||
} catch (NamingException ne) {
|
||||
throw new LexRepositoryException(ne);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
54
src/java/org/thdl/lex/LexRepositoryException.java
Normal file
54
src/java/org/thdl/lex/LexRepositoryException.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexRepositoryException extends Exception {
|
||||
/**
|
||||
* Constructor for the LexRepositoryException object
|
||||
*
|
||||
* @since
|
||||
*/
|
||||
public LexRepositoryException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexRepositoryException object
|
||||
*
|
||||
* @param msg
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public LexRepositoryException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexRepositoryException object
|
||||
*
|
||||
* @param e
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public LexRepositoryException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexRepositoryException object
|
||||
*
|
||||
* @param msg
|
||||
* Description of Parameter
|
||||
* @param e
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public LexRepositoryException(String msg, Exception e) {
|
||||
super(msg, e);
|
||||
}
|
||||
}
|
||||
|
299
src/java/org/thdl/lex/LexSourceRepository.java
Normal file
299
src/java/org/thdl/lex/LexSourceRepository.java
Normal file
|
@ -0,0 +1,299 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import org.thdl.users.ThdlUserRepository;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
import org.dlese.dpc.oai.harvester.*;
|
||||
import org.dlese.dpc.datamgr.*;
|
||||
import org.dlese.dpc.index.*;
|
||||
|
||||
import org.dlese.dpc.oai.harvester.structs.ScheduledHarvest;
|
||||
|
||||
import org.openarchives.oai.x20.oaiDc.DcDocument;
|
||||
import org.openarchives.oai.x20.oaiDc.OaiDcType;
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created December 15, 2003
|
||||
*/
|
||||
public class LexSourceRepository
|
||||
{
|
||||
//attributes
|
||||
private static LexSourceRepository instance;
|
||||
private ScheduledHarvestManager harvestManager;
|
||||
private ScheduledHarvest harvest;
|
||||
|
||||
private String oaiServer;
|
||||
private String oaiMetadataPrefix;
|
||||
private String oaiHome;
|
||||
private String oaiLocalCopy;
|
||||
private int oaiRefreshDelay;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the oaiServer attribute of the LexSourceRepository object
|
||||
*
|
||||
* @param oaiServer The new oaiServer value
|
||||
*/
|
||||
public void setOaiServer( String oaiServer )
|
||||
{
|
||||
this.oaiServer = oaiServer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the oaiMetadataPrefix attribute of the LexSourceRepository object
|
||||
*
|
||||
* @param oaiMetadataPrefix The new oaiMetadataPrefix value
|
||||
*/
|
||||
public void setOaiMetadataPrefix( String oaiMetadataPrefix )
|
||||
{
|
||||
this.oaiMetadataPrefix = oaiMetadataPrefix;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the oaiHome attribute of the LexSourceRepository object
|
||||
*
|
||||
* @param oaiHome The new oaiHome value
|
||||
*/
|
||||
public void setOaiHome( String oaiHome )
|
||||
{
|
||||
this.oaiHome = oaiHome;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the oaiLocalCopy attribute of the LexSourceRepository object
|
||||
*
|
||||
* @param oaiLocalCopy The new oaiLocalCopy value
|
||||
*/
|
||||
public void setOaiLocalCopy( String oaiLocalCopy )
|
||||
{
|
||||
this.oaiLocalCopy = oaiLocalCopy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the oaiRefreshDelay attribute of the LexSourceRepository object
|
||||
*
|
||||
* @param oaiRefreshDelay The new oaiRefreshDelay value
|
||||
*/
|
||||
public void setOaiRefreshDelay( int oaiRefreshDelay )
|
||||
{
|
||||
this.oaiRefreshDelay = oaiRefreshDelay;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the oaiServer attribute of the LexSourceRepository object
|
||||
*
|
||||
* @return The oaiServer value
|
||||
*/
|
||||
public String getOaiServer()
|
||||
{
|
||||
return oaiServer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the oaiMetadataPrefix attribute of the LexSourceRepository object
|
||||
*
|
||||
* @return The oaiMetadataPrefix value
|
||||
*/
|
||||
public String getOaiMetadataPrefix()
|
||||
{
|
||||
return oaiMetadataPrefix;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the oaiHome attribute of the LexSourceRepository object
|
||||
*
|
||||
* @return The oaiHome value
|
||||
*/
|
||||
public String getOaiHome()
|
||||
{
|
||||
return oaiHome;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the oaiLocalCopy attribute of the LexSourceRepository object
|
||||
*
|
||||
* @return The oaiLocalCopy value
|
||||
*/
|
||||
public String getOaiLocalCopy()
|
||||
{
|
||||
return oaiLocalCopy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the oaiRefreshDelay attribute of the LexSourceRepository object
|
||||
*
|
||||
* @return The oaiRefreshDelay value
|
||||
*/
|
||||
public int getOaiRefreshDelay()
|
||||
{
|
||||
return oaiRefreshDelay;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the harvest attribute of the LexSourceRepository object
|
||||
*
|
||||
* @param harvest The new harvest value
|
||||
*/
|
||||
public void setHarvest( ScheduledHarvest harvest )
|
||||
{
|
||||
this.harvest = harvest;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the harvest attribute of the LexSourceRepository object
|
||||
*
|
||||
* @return The harvest value
|
||||
*/
|
||||
public ScheduledHarvest getHarvest()
|
||||
{
|
||||
return harvest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the harvestManager attribute of the LexSourceRepository object
|
||||
*
|
||||
* @param harvestManager The new harvestManager value
|
||||
*/
|
||||
public void setHarvestManager( ScheduledHarvestManager harvestManager )
|
||||
{
|
||||
this.harvestManager = harvestManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the harvestManager attribute of the LexSourceRepository object
|
||||
*
|
||||
* @return The harvestManager value
|
||||
*/
|
||||
public ScheduledHarvestManager getHarvestManager()
|
||||
{
|
||||
return harvestManager;
|
||||
}
|
||||
|
||||
|
||||
//accessors
|
||||
/**
|
||||
* Gets the instance attribute of the LexSourceRepository class
|
||||
*
|
||||
* @return The instance value
|
||||
* @exception Exception Description of the Exception
|
||||
*/
|
||||
public static LexSourceRepository getInstance() throws Exception
|
||||
{
|
||||
if ( null == instance )
|
||||
{
|
||||
instance = new LexSourceRepository();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public void refreshSources() throws LexRepositoryException
|
||||
{
|
||||
/*
|
||||
try
|
||||
{
|
||||
getHarvest().
|
||||
}
|
||||
catch ( Hexception h )
|
||||
{
|
||||
throw new LexRepositoryException( h );
|
||||
}
|
||||
catch ( OAIErrorException h )
|
||||
{
|
||||
throw new LexRepositoryException( h );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Return Value
|
||||
* @exception LexRepositoryException Description of the Exception
|
||||
*/
|
||||
public String[] xmlTesting() throws LexRepositoryException
|
||||
{
|
||||
String[] sa = null;
|
||||
try
|
||||
{
|
||||
File file = new File( "/Users/travis/webapps/lex/dlese-oai/datastore.lib.virginia.edu/tibet/spt/SPT--OAI.php/oai_dc", "oai%3Alib.virginia.edu%3Athdl-267.xml" );
|
||||
DcDocument dcd = DcDocument.Factory.parse( file );
|
||||
OaiDcType oaiDc = dcd.getDc();
|
||||
sa = new String[oaiDc.getTitleArray().length];
|
||||
for ( int i = 0; i < sa.length; i++ )
|
||||
{
|
||||
sa[i] = oaiDc.getTitleArray()[i].toString();
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw new LexRepositoryException( e );
|
||||
}
|
||||
return sa;
|
||||
}
|
||||
//constructors
|
||||
|
||||
/**
|
||||
*Constructor for the LexSourceRepository object
|
||||
*
|
||||
* @exception Exception Description of the Exception
|
||||
*/
|
||||
private LexSourceRepository() throws Exception
|
||||
{
|
||||
/* SimpleDataStore dataStore = new SimpleDataStore( "/Users/travis/webapps/lex/dlese-oai/scheduled-harvester", true );
|
||||
File initialHarvestDir = new File( "/Users/travis/webapps/lex/dlese-oai/datastore.lib.virginia.edu" );
|
||||
SimpleLuceneIndex harvestLogIndex = new SimpleLuceneIndex( "/Users/travis/webapps/lex/dlese-oai/lucene-index" );
|
||||
ScheduledHarvestManager manager = new ScheduledHarvestManager( dataStore, initialHarvestDir, harvestLogIndex );
|
||||
setHarvestManager( manager );
|
||||
|
||||
String repositoryName = "SPT";
|
||||
String setSpec = "";
|
||||
String baseURL = "http://datastore.lib.virginia.edu/tibet/spt/SPT--OAI.php";
|
||||
String metadataPrefix = "oai_dc";
|
||||
int seconds = 1000 * 1;
|
||||
String harvestingInterval = Integer.toString( seconds );
|
||||
String intervalGranularity = "YYYY -MM-DDThh:mm:ssZ";
|
||||
String enabledDisabled = "enabled";
|
||||
ScheduledHarvest harvest = new ScheduledHarvest( repositoryName, setSpec, baseURL, metadataPrefix, harvestingInterval, intervalGranularity, enabledDisabled );
|
||||
setHarvest( harvest );
|
||||
|
||||
getHarvestManager().addScheduledHarvest( getHarvest() );
|
||||
*/ }
|
||||
//main
|
||||
|
||||
/**
|
||||
* The main program for the LexSourceRepository class
|
||||
*
|
||||
* @param args The command line arguments
|
||||
*/
|
||||
public static void main( String[] args )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
19
src/java/org/thdl/lex/LexUser.java
Normal file
19
src/java/org/thdl/lex/LexUser.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
public class LexUser extends org.thdl.users.ThdlUser {
|
||||
public boolean isGuest() {
|
||||
boolean bool = false;
|
||||
if (hasRole("guest")) {
|
||||
bool = true;
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
public boolean isDeveloper() {
|
||||
boolean bool = false;
|
||||
if (hasRole("dev")) {
|
||||
bool = true;
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
}
|
170
src/java/org/thdl/lex/LexUtilities.java
Normal file
170
src/java/org/thdl/lex/LexUtilities.java
Normal file
|
@ -0,0 +1,170 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class LexUtilities {
|
||||
/**
|
||||
* Gets the resultSetSize attribute of the LexUtilities class
|
||||
*
|
||||
* @param rs
|
||||
* Description of the Parameter
|
||||
* @return The resultSetSize value
|
||||
* @exception java.sql.SQLException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static int getResultSetSize(java.sql.ResultSet rs)
|
||||
throws java.sql.SQLException {
|
||||
rs.last();
|
||||
int i = rs.getRow();
|
||||
rs.beforeFirst();
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
* public static String formatTimestamp( Timestamp time ) { SimpleDateFormat
|
||||
* formatter = new SimpleDateFormat("yyyy.MM.dd 'at' hh:mm:ss a zzz"); Date
|
||||
* coDate = new Date( getCreatedOn().getTime() ); String dateString =
|
||||
* formatter.format( coDate ); }
|
||||
*/
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param fromString
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static String escape(String fromString) {
|
||||
HashMap map = new HashMap();
|
||||
map.put("'", "\\'");
|
||||
/*
|
||||
* map.put("%", "\\%"); map.put("_", "\\_"); map.put("\"", "\\\"");
|
||||
*/
|
||||
StringBuffer targetString = new StringBuffer("");
|
||||
if (null != fromString) {
|
||||
StringTokenizer tokens = new StringTokenizer(fromString, "'%_\"",
|
||||
true);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
String temp = tokens.nextToken();
|
||||
if (map.containsKey(temp)) {
|
||||
temp = (String) map.get(temp);
|
||||
}
|
||||
targetString.append(temp);
|
||||
}
|
||||
}
|
||||
return targetString.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param fromString
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static String hqlEscape(String fromString) {
|
||||
HashMap map = new HashMap();
|
||||
map.put("'", "''");
|
||||
StringBuffer targetString = new StringBuffer("");
|
||||
if (null != fromString) {
|
||||
StringTokenizer tokens = new StringTokenizer(fromString, "'%_\"",
|
||||
true);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
String temp = tokens.nextToken();
|
||||
if (map.containsKey(temp)) {
|
||||
temp = (String) map.get(temp);
|
||||
}
|
||||
targetString.append(temp);
|
||||
}
|
||||
}
|
||||
return targetString.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param source
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static Integer[] convertToIntegerArray(String[] source) {
|
||||
if (null == source) {
|
||||
return null;
|
||||
}
|
||||
Integer[] target = new Integer[source.length];
|
||||
for (int i = 0; i < target.length; i++) {
|
||||
target[i] = new Integer(source[i]);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param source
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static Integer[] convertTokensToIntegerArray(String source) {
|
||||
if (null == source || "null".equals(source)) {
|
||||
return null;
|
||||
}
|
||||
StringTokenizer sourceTokens = new StringTokenizer(source, ":");
|
||||
Integer[] target = new Integer[sourceTokens.countTokens()];
|
||||
for (int i = 0; sourceTokens.hasMoreTokens(); i++) {
|
||||
target[i] = new Integer(sourceTokens.nextToken());
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param source
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static String convertIntegerArrayToTokens(Integer[] source) {
|
||||
if (null == source) {
|
||||
return null;
|
||||
}
|
||||
StringBuffer target = new StringBuffer("");
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
target.append(source[i].toString());
|
||||
if (i < (source.length - 1)) {
|
||||
target.append(":");
|
||||
}
|
||||
}
|
||||
return target.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* The main program for the LexUtilities class
|
||||
*
|
||||
* @param args
|
||||
* The command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
String s = "It's stupid to use a % or a _ in a SQL Statement";
|
||||
System.out.println(LexUtilities.escape(s));
|
||||
|
||||
Integer[] ia = { new Integer(1), new Integer(3) };
|
||||
System.out.println(LexUtilities.convertIntegerArrayToTokens(ia));
|
||||
|
||||
String str = "9:8:7:6:5";
|
||||
Integer[] ia2 = LexUtilities.convertTokensToIntegerArray(str);
|
||||
String newStr = "";
|
||||
for (int i = 0; i < 5; i++) {
|
||||
newStr = newStr + ia2[i] + " ";
|
||||
}
|
||||
System.out.println(newStr);
|
||||
|
||||
}
|
||||
}
|
||||
|
221
src/java/org/thdl/lex/LoginServlet.java
Normal file
221
src/java/org/thdl/lex/LoginServlet.java
Normal file
|
@ -0,0 +1,221 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.users.ThdlUser;
|
||||
import org.thdl.users.ThdlUserRepository;
|
||||
import org.thdl.users.ThdlUserRepositoryException;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 2, 2003
|
||||
*/
|
||||
public class LoginServlet extends HttpServlet {
|
||||
//attributes
|
||||
|
||||
private String welcomePage;
|
||||
|
||||
private String loginPage;
|
||||
|
||||
private UserSessionManager sessionManager;
|
||||
|
||||
//accessors
|
||||
/**
|
||||
* Sets the welcomePage attribute of the LoginServlet object
|
||||
*
|
||||
* @param welcomePage
|
||||
* The new welcomePage value
|
||||
* @since
|
||||
*/
|
||||
public void setWelcomePage(String welcomePage) {
|
||||
this.welcomePage = welcomePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the loginPage attribute of the LoginServlet object
|
||||
*
|
||||
* @param loginPage
|
||||
* The new loginPage value
|
||||
* @since
|
||||
*/
|
||||
public void setLoginPage(String loginPage) {
|
||||
this.loginPage = loginPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the welcomePage attribute of the LoginServlet object
|
||||
*
|
||||
* @return The welcomePage value
|
||||
* @since
|
||||
*/
|
||||
public String getWelcomePage() {
|
||||
return welcomePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the loginPage attribute of the LoginServlet object
|
||||
*
|
||||
* @return The loginPage value
|
||||
* @since
|
||||
*/
|
||||
public String getLoginPage() {
|
||||
return loginPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sessionManager attribute of the LoginServlet object
|
||||
*
|
||||
* @return The sessionManager value
|
||||
* @since
|
||||
*/
|
||||
public UserSessionManager getSessionManager() {
|
||||
if (null == sessionManager) {
|
||||
return UserSessionManager.getInstance();
|
||||
} else {
|
||||
return sessionManager;
|
||||
}
|
||||
}
|
||||
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param config
|
||||
* Description of Parameter
|
||||
* @exception ServletException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
setWelcomePage("/action?cmd=menu");
|
||||
|
||||
if (getWelcomePage() == null) {
|
||||
throw new ServletException(
|
||||
"The welcomePage init parameter must be specified.");
|
||||
}
|
||||
|
||||
setLoginPage(config.getInitParameter("loginPage"));
|
||||
|
||||
if (getLoginPage() == null) {
|
||||
throw new ServletException(
|
||||
"The loginPage init parameter must be specified.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of Parameter
|
||||
* @param response
|
||||
* Description of Parameter
|
||||
* @exception ServletException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException {
|
||||
String username = request.getParameter(LexConstants.USERNAME_REQ_PARAM);
|
||||
|
||||
if (username == null) {
|
||||
throw new ServletException("No Username Specified");
|
||||
}
|
||||
|
||||
String password = request.getParameter(LexConstants.PASSWORD_REQ_PARAM);
|
||||
|
||||
if (password == null) {
|
||||
throw new ServletException("No Password Specified");
|
||||
}
|
||||
|
||||
ThdlUser thdlUser = null;
|
||||
try {
|
||||
ThdlUser lexUser = new LexUser();
|
||||
lexUser.setUsername(username);
|
||||
lexUser.setPassword(password);
|
||||
lexUser = ThdlUserRepository.getInstance().validate(lexUser,
|
||||
"dictionary");
|
||||
doLoginSuccess(request, response, lexUser);
|
||||
} catch (ThdlUserRepositoryException ture) {
|
||||
doLoginFailure(request, response, username);
|
||||
//throw new ServletException( ture );
|
||||
} catch (Exception e) {
|
||||
throw new ServletException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param response
|
||||
* Description of Parameter
|
||||
* @param user
|
||||
* Description of Parameter
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @exception IOException
|
||||
* Description of Exception
|
||||
* @exception LexRepositoryException
|
||||
* Description of Exception
|
||||
* @exception LexComponentException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private void doLoginSuccess(HttpServletRequest req,
|
||||
HttpServletResponse response, ThdlUser user) throws IOException,
|
||||
LexRepositoryException, LexComponentException {
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
|
||||
visit.setUser(user);
|
||||
|
||||
Preferences preferences = new Preferences(user);
|
||||
visit.setPreferences(preferences);
|
||||
|
||||
visit.setDisplayMode("brief");
|
||||
String targetPage = UserSessionManager.getInstance()
|
||||
.getSessionLoginTarget(req.getSession(true), true);
|
||||
|
||||
if (targetPage == null) {
|
||||
UserSessionManager.doRedirect(req, response, getWelcomePage());
|
||||
} else {
|
||||
targetPage = response.encodeRedirectURL(targetPage);
|
||||
response.sendRedirect(targetPage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of Parameter
|
||||
* @param response
|
||||
* Description of Parameter
|
||||
* @param username
|
||||
* Description of Parameter
|
||||
* @exception ServletException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
private void doLoginFailure(HttpServletRequest request,
|
||||
HttpServletResponse response, String username)
|
||||
throws ServletException {
|
||||
|
||||
String loginURL = getLoginPage() + "?retry=true&username=" + username;
|
||||
try {
|
||||
UserSessionManager.doRedirect(request, response, loginURL);
|
||||
} catch (IOException ioe) {
|
||||
throw new ServletException(ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
78
src/java/org/thdl/lex/LogoutServlet.java
Normal file
78
src/java/org/thdl/lex/LogoutServlet.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 21, 2003
|
||||
*/
|
||||
public class LogoutServlet extends HttpServlet {
|
||||
private String goodbyePage;
|
||||
|
||||
/**
|
||||
* Sets the goodbyePage attribute of the LogoutServlet object
|
||||
*
|
||||
* @param goodbyePage
|
||||
* The new goodbyePage value
|
||||
*/
|
||||
public void setGoodbyePage(String goodbyePage) {
|
||||
this.goodbyePage = goodbyePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the goodbyePage attribute of the LogoutServlet object
|
||||
*
|
||||
* @return The goodbyePage value
|
||||
*/
|
||||
public String getGoodbyePage() {
|
||||
return goodbyePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param config
|
||||
* Description of the Parameter
|
||||
* @exception ServletException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
setGoodbyePage(config.getInitParameter("goodbyePage"));
|
||||
if (goodbyePage == null) {
|
||||
throw new ServletException(
|
||||
"The goodbyePage init parameter must be specified.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of the Parameter
|
||||
* @param response
|
||||
* Description of the Parameter
|
||||
* @exception ServletException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException {
|
||||
HttpSession session = request.getSession(true);
|
||||
UserSessionManager.getInstance().removeVisit(session);
|
||||
try {
|
||||
String redirect = response.encodeRedirectURL(getGoodbyePage());
|
||||
response.sendRedirect(redirect);
|
||||
} catch (IOException e) {
|
||||
throw new ServletException("could not redirect to goodbye page");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
652
src/java/org/thdl/lex/Preferences.java
Normal file
652
src/java/org/thdl/lex/Preferences.java
Normal file
|
@ -0,0 +1,652 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class Preferences {
|
||||
//attributes
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String preferencesName;
|
||||
|
||||
private Integer projectSubject;
|
||||
|
||||
private Integer source;
|
||||
|
||||
private Integer language;
|
||||
|
||||
private Integer script;
|
||||
|
||||
private Integer dialect;
|
||||
|
||||
private String note;
|
||||
|
||||
private boolean useDefaultProjSub;
|
||||
|
||||
private boolean useDefaultSource;
|
||||
|
||||
private boolean useDefaultLanguage;
|
||||
|
||||
private boolean useDefaultScript;
|
||||
|
||||
private boolean useDefaultDialect;
|
||||
|
||||
private boolean useDefaultNote;
|
||||
|
||||
private Integer[] projectSubjectSet;
|
||||
|
||||
private Integer[] sourceSet;
|
||||
|
||||
private Integer[] languageSet;
|
||||
|
||||
private Integer[] scriptSet;
|
||||
|
||||
private Integer[] dialectSet;
|
||||
|
||||
//accessors
|
||||
|
||||
/**
|
||||
* Sets the id attribute of the Preferences object
|
||||
*
|
||||
* @param id
|
||||
* The new id value
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the userId attribute of the Preferences object
|
||||
*
|
||||
* @param userId
|
||||
* The new userId value
|
||||
*/
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the preferencesName attribute of the Preferences object
|
||||
*
|
||||
* @param preferencesName
|
||||
* The new preferencesName value
|
||||
*/
|
||||
public void setPreferencesName(String preferencesName) {
|
||||
this.preferencesName = preferencesName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the useDefaultNote attribute of the Preferences object
|
||||
*
|
||||
* @param useDefaultNote
|
||||
* The new useDefaultNote value
|
||||
*/
|
||||
public void setUseDefaultNote(boolean useDefaultNote) {
|
||||
this.useDefaultNote = useDefaultNote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the useDefaultProjSub attribute of the Preferences object
|
||||
*
|
||||
* @param useDefaultProjSub
|
||||
* The new useDefaultProjSub value
|
||||
*/
|
||||
public void setUseDefaultProjSub(boolean useDefaultProjSub) {
|
||||
this.useDefaultProjSub = useDefaultProjSub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the useDefaultSource attribute of the Preferences object
|
||||
*
|
||||
* @param useDefaultSource
|
||||
* The new useDefaultSource value
|
||||
*/
|
||||
public void setUseDefaultSource(boolean useDefaultSource) {
|
||||
this.useDefaultSource = useDefaultSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the useDefaultLanguage attribute of the Preferences object
|
||||
*
|
||||
* @param useDefaultLanguage
|
||||
* The new useDefaultLanguage value
|
||||
*/
|
||||
public void setUseDefaultLanguage(boolean useDefaultLanguage) {
|
||||
this.useDefaultLanguage = useDefaultLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the useDefaultScript attribute of the Preferences object
|
||||
*
|
||||
* @param useDefaultScript
|
||||
* The new useDefaultScript value
|
||||
*/
|
||||
public void setUseDefaultScript(boolean useDefaultScript) {
|
||||
this.useDefaultScript = useDefaultScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the useDefaultDialect attribute of the Preferences object
|
||||
*
|
||||
* @param useDefaultDialect
|
||||
* The new useDefaultDialect value
|
||||
*/
|
||||
public void setUseDefaultDialect(boolean useDefaultDialect) {
|
||||
this.useDefaultDialect = useDefaultDialect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projectSubject attribute of the Preferences object
|
||||
*
|
||||
* @param projectSubject
|
||||
* The new projectSubject value
|
||||
*/
|
||||
public void setProjectSubject(Integer projectSubject) {
|
||||
this.projectSubject = projectSubject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the source attribute of the Preferences object
|
||||
*
|
||||
* @param source
|
||||
* The new source value
|
||||
*/
|
||||
public void setSource(Integer source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the language attribute of the Preferences object
|
||||
*
|
||||
* @param language
|
||||
* The new language value
|
||||
*/
|
||||
public void setLanguage(Integer language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the script attribute of the Preferences object
|
||||
*
|
||||
* @param script
|
||||
* The new script value
|
||||
*/
|
||||
public void setScript(Integer script) {
|
||||
this.script = script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dialect attribute of the Preferences object
|
||||
*
|
||||
* @param dialect
|
||||
* The new dialect value
|
||||
*/
|
||||
public void setDialect(Integer dialect) {
|
||||
this.dialect = dialect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projectSubjectSet attribute of the Preferences object
|
||||
*
|
||||
* @param projectSubjectSet
|
||||
* The new projectSubjectSet value
|
||||
*/
|
||||
public void setProjectSubjectSet(Integer[] projectSubjectSet) {
|
||||
this.projectSubjectSet = projectSubjectSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sourceSet attribute of the Preferences object
|
||||
*
|
||||
* @param sourceSet
|
||||
* The new sourceSet value
|
||||
*/
|
||||
public void setSourceSet(Integer[] sourceSet) {
|
||||
this.sourceSet = sourceSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the languageSet attribute of the Preferences object
|
||||
*
|
||||
* @param languageSet
|
||||
* The new languageSet value
|
||||
*/
|
||||
public void setLanguageSet(Integer[] languageSet) {
|
||||
this.languageSet = languageSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the scriptSet attribute of the Preferences object
|
||||
*
|
||||
* @param scriptSet
|
||||
* The new scriptSet value
|
||||
*/
|
||||
public void setScriptSet(Integer[] scriptSet) {
|
||||
this.scriptSet = scriptSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dialectSet attribute of the Preferences object
|
||||
*
|
||||
* @param dialectSet
|
||||
* The new dialectSet value
|
||||
*/
|
||||
public void setDialectSet(Integer[] dialectSet) {
|
||||
this.dialectSet = dialectSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the note attribute of the Preferences object
|
||||
*
|
||||
* @param note
|
||||
* The new note value
|
||||
*/
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id attribute of the Preferences object
|
||||
*
|
||||
* @return The id value
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the userId attribute of the Preferences object
|
||||
*
|
||||
* @return The userId value
|
||||
*/
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the preferencesName attribute of the Preferences object
|
||||
*
|
||||
* @return The preferencesName value
|
||||
*/
|
||||
public String getPreferencesName() {
|
||||
return preferencesName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the useDefaultNote attribute of the Preferences object
|
||||
*
|
||||
* @return The useDefaultNote value
|
||||
*/
|
||||
public boolean getUseDefaultNote() {
|
||||
return useDefaultNote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the useDefaultProjSub attribute of the Preferences object
|
||||
*
|
||||
* @return The useDefaultProjSub value
|
||||
*/
|
||||
public boolean getUseDefaultProjSub() {
|
||||
return useDefaultProjSub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the useDefaultSource attribute of the Preferences object
|
||||
*
|
||||
* @return The useDefaultSource value
|
||||
*/
|
||||
public boolean getUseDefaultSource() {
|
||||
return useDefaultSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the useDefaultLanguage attribute of the Preferences object
|
||||
*
|
||||
* @return The useDefaultLanguage value
|
||||
*/
|
||||
public boolean getUseDefaultLanguage() {
|
||||
return useDefaultLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the useDefaultScript attribute of the Preferences object
|
||||
*
|
||||
* @return The useDefaultScript value
|
||||
*/
|
||||
public boolean getUseDefaultScript() {
|
||||
return useDefaultScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the useDefaultDialect attribute of the Preferences object
|
||||
*
|
||||
* @return The useDefaultDialect value
|
||||
*/
|
||||
public boolean getUseDefaultDialect() {
|
||||
return useDefaultDialect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projectSubject attribute of the Preferences object
|
||||
*
|
||||
* @return The projectSubject value
|
||||
*/
|
||||
public Integer getProjectSubject() {
|
||||
return projectSubject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source attribute of the Preferences object
|
||||
*
|
||||
* @return The source value
|
||||
*/
|
||||
public Integer getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the language attribute of the Preferences object
|
||||
*
|
||||
* @return The language value
|
||||
*/
|
||||
public Integer getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the script attribute of the Preferences object
|
||||
*
|
||||
* @return The script value
|
||||
*/
|
||||
public Integer getScript() {
|
||||
return script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dialect attribute of the Preferences object
|
||||
*
|
||||
* @return The dialect value
|
||||
*/
|
||||
public Integer getDialect() {
|
||||
return dialect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projectSubjectSet attribute of the Preferences object
|
||||
*
|
||||
* @return The projectSubjectSet value
|
||||
*/
|
||||
public Integer[] getProjectSubjectSet() {
|
||||
return projectSubjectSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sourceSet attribute of the Preferences object
|
||||
*
|
||||
* @return The sourceSet value
|
||||
*/
|
||||
public Integer[] getSourceSet() {
|
||||
return sourceSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the languageSet attribute of the Preferences object
|
||||
*
|
||||
* @return The languageSet value
|
||||
*/
|
||||
public Integer[] getLanguageSet() {
|
||||
return languageSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scriptSet attribute of the Preferences object
|
||||
*
|
||||
* @return The scriptSet value
|
||||
*/
|
||||
public Integer[] getScriptSet() {
|
||||
return scriptSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dialectSet attribute of the Preferences object
|
||||
*
|
||||
* @return The dialectSet value
|
||||
*/
|
||||
public Integer[] getDialectSet() {
|
||||
return dialectSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the note attribute of the Preferences object
|
||||
*
|
||||
* @return The note value
|
||||
*/
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
//helpers
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void populate() throws LexRepositoryException, LexComponentException {
|
||||
String sql = "SELECT * FROM Preferences WHERE userId = " + getUserId();
|
||||
try {
|
||||
LexRepository lr = LexRepository.getInstance();
|
||||
Connection con = lr.getDataSource().getConnection();
|
||||
ResultSet results = con.createStatement().executeQuery(sql);
|
||||
if (LexUtilities.getResultSetSize(results) > 0) {
|
||||
results.next();
|
||||
setId(new Integer(results.getInt(1)));
|
||||
setUserId(new Integer(results.getInt(2)));
|
||||
setPreferencesName(results.getString(3));
|
||||
setProjectSubject(new Integer(results.getInt(4)));
|
||||
setSource(new Integer(results.getInt(5)));
|
||||
setLanguage(new Integer(results.getInt(6)));
|
||||
setScript(new Integer(results.getInt(7)));
|
||||
setDialect(new Integer(results.getInt(8)));
|
||||
setNote(results.getString(9));
|
||||
Boolean bool = Boolean.valueOf(results.getString(10));
|
||||
setUseDefaultProjSub(bool.booleanValue());
|
||||
bool = Boolean.valueOf(results.getString(11));
|
||||
setUseDefaultSource(bool.booleanValue());
|
||||
bool = Boolean.valueOf(results.getString(12));
|
||||
setUseDefaultLanguage(bool.booleanValue());
|
||||
bool = Boolean.valueOf(results.getString(13));
|
||||
setUseDefaultScript(bool.booleanValue());
|
||||
bool = Boolean.valueOf(results.getString(14));
|
||||
setUseDefaultDialect(bool.booleanValue());
|
||||
bool = Boolean.valueOf(results.getString(15));
|
||||
setUseDefaultNote(bool.booleanValue());
|
||||
setProjectSubjectSet(LexUtilities
|
||||
.convertTokensToIntegerArray(results.getString(16)));
|
||||
setSourceSet(LexUtilities.convertTokensToIntegerArray(results
|
||||
.getString(17)));
|
||||
setLanguageSet(LexUtilities.convertTokensToIntegerArray(results
|
||||
.getString(18)));
|
||||
setScriptSet(LexUtilities.convertTokensToIntegerArray(results
|
||||
.getString(19)));
|
||||
setDialectSet(LexUtilities.convertTokensToIntegerArray(results
|
||||
.getString(20)));
|
||||
} else {
|
||||
insertNew();
|
||||
}
|
||||
con.close();
|
||||
} catch (SQLException sqle) {
|
||||
throw new LexComponentException(sqle.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void insertNew() throws LexComponentException {
|
||||
try {
|
||||
String sql = "INSERT INTO Preferences ( id, userId ) VALUES ( NULL, "
|
||||
+ getUserId() + " )";
|
||||
Integer i = new Integer(LexRepository.getInstance().doUpdate(sql));
|
||||
setId(i);
|
||||
} catch (LexRepositoryException lre) {
|
||||
throw new LexComponentException(lre.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void save() throws LexComponentException {
|
||||
try {
|
||||
String sql = "SELECT id FROM Preferences WHERE userId = "
|
||||
+ getUserId();
|
||||
LexRepository lr = LexRepository.getInstance();
|
||||
Connection con = lr.getDataSource().getConnection();
|
||||
ResultSet results = con.createStatement().executeQuery(sql);
|
||||
|
||||
if (LexUtilities.getResultSetSize(results) < 1) {
|
||||
insertNew();
|
||||
}
|
||||
con.close();
|
||||
StringBuffer sqlBuffer = new StringBuffer();
|
||||
sqlBuffer.append("UPDATE Preferences SET userId = ");
|
||||
sqlBuffer.append(getUserId());
|
||||
sqlBuffer.append(", preferencesName = '");
|
||||
sqlBuffer.append(getPreferencesName());
|
||||
sqlBuffer.append("', projectSubject = ");
|
||||
sqlBuffer.append(getProjectSubject());
|
||||
sqlBuffer.append(", source = ");
|
||||
sqlBuffer.append(getSource());
|
||||
sqlBuffer.append(", language = ");
|
||||
sqlBuffer.append(getLanguage());
|
||||
sqlBuffer.append(", script = ");
|
||||
sqlBuffer.append(getScript());
|
||||
sqlBuffer.append(", dialect = ");
|
||||
sqlBuffer.append(getDialect());
|
||||
sqlBuffer.append(", note = '");
|
||||
sqlBuffer.append(LexUtilities.escape(getNote()));
|
||||
sqlBuffer.append("', useDefaultProjSub = '");
|
||||
sqlBuffer.append(getUseDefaultProjSub());
|
||||
sqlBuffer.append("', useDefaultSource = '");
|
||||
sqlBuffer.append(getUseDefaultSource());
|
||||
sqlBuffer.append("', useDefaultLanguage = '");
|
||||
sqlBuffer.append(getUseDefaultLanguage());
|
||||
sqlBuffer.append("', useDefaultScript = '");
|
||||
sqlBuffer.append(getUseDefaultScript());
|
||||
sqlBuffer.append("', useDefaultDialect = '");
|
||||
sqlBuffer.append(getUseDefaultDialect());
|
||||
sqlBuffer.append("', useDefaultNote = '");
|
||||
sqlBuffer.append(getUseDefaultNote());
|
||||
sqlBuffer.append("', projectSubjectSet = '");
|
||||
sqlBuffer.append(LexUtilities
|
||||
.convertIntegerArrayToTokens(getProjectSubjectSet()));
|
||||
sqlBuffer.append("', sourceSet = '");
|
||||
sqlBuffer.append(LexUtilities
|
||||
.convertIntegerArrayToTokens(getSourceSet()));
|
||||
sqlBuffer.append("', languageSet = '");
|
||||
sqlBuffer.append(LexUtilities
|
||||
.convertIntegerArrayToTokens(getLanguageSet()));
|
||||
sqlBuffer.append("', scriptSet = '");
|
||||
sqlBuffer.append(LexUtilities
|
||||
.convertIntegerArrayToTokens(getScriptSet()));
|
||||
sqlBuffer.append("', dialectSet = '");
|
||||
sqlBuffer.append(LexUtilities
|
||||
.convertIntegerArrayToTokens(getDialectSet()));
|
||||
sqlBuffer.append("' WHERE id = ");
|
||||
sqlBuffer.append(getId());
|
||||
LexRepository.getInstance().doUpdate(sqlBuffer.toString());
|
||||
} catch (LexRepositoryException lre) {
|
||||
throw new LexComponentException(lre.getMessage());
|
||||
} catch (SQLException sqle) {
|
||||
throw new LexComponentException(sqle.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The main program for the Preferences class
|
||||
*
|
||||
* @param args
|
||||
* The command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
Preferences component = new Preferences();
|
||||
component.setUserId(new Integer(2));
|
||||
component.save();
|
||||
System.out.println(component.getId() + " " + component.getUserId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Constructor for the Preferences object
|
||||
*/
|
||||
public Preferences() {
|
||||
setId(new Integer(0));
|
||||
setUserId(new Integer(1));
|
||||
setProjectSubject(new Integer(1));
|
||||
setSource(new Integer(1));
|
||||
setLanguage(new Integer(1));
|
||||
setScript(new Integer(1));
|
||||
setDialect(new Integer(1));
|
||||
Integer[] temp = { getProjectSubject() };
|
||||
setProjectSubjectSet(temp);
|
||||
Integer[] temp2 = { getSource() };
|
||||
setSourceSet(temp2);
|
||||
Integer[] temp3 = { getLanguage() };
|
||||
setLanguageSet(temp3);
|
||||
Integer[] temp4 = { getDialect() };
|
||||
setDialectSet(temp4);
|
||||
Integer[] temp5 = { getScript() };
|
||||
setScriptSet(temp5);
|
||||
setNote("Default Note");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the Preferences object
|
||||
*
|
||||
* @param user
|
||||
* Description of the Parameter
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public Preferences(ThdlUser user) throws LexRepositoryException,
|
||||
LexComponentException {
|
||||
this();
|
||||
setUserId(user.getId());
|
||||
populate();
|
||||
/*
|
||||
* setProjectSubject( user.getDefaultProjSub() ); setSource(
|
||||
* user.getDefaultSource() ); setLanguage( user.getDefaultLanguage() );
|
||||
* setScript( user.getDefaultScript() ); setDialect(
|
||||
* user.getDefaultDialect() );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
145
src/java/org/thdl/lex/ThdlUtilities.java
Normal file
145
src/java/org/thdl/lex/ThdlUtilities.java
Normal file
|
@ -0,0 +1,145 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 5, 2003
|
||||
*/
|
||||
public class ThdlUtilities {
|
||||
/**
|
||||
* Gets the resultSetSize attribute of the ThdlUtilities class
|
||||
*
|
||||
* @param rs
|
||||
* Description of the Parameter
|
||||
* @return The resultSetSize value
|
||||
* @exception java.sql.SQLException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public static int getResultSetSize(java.sql.ResultSet rs)
|
||||
throws java.sql.SQLException {
|
||||
rs.last();
|
||||
int i = rs.getRow();
|
||||
rs.beforeFirst();
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
* public static String formatTimestamp( Timestamp time ) { /
|
||||
* SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd 'at'
|
||||
* hh:mm:ss a zzz"); / Date coDate = new Date( getCreatedOn().getTime() ); /
|
||||
* String dateString = formatter.format( coDate ); }
|
||||
*/
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param fromString
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static String escape(String fromString) {
|
||||
HashMap map = new HashMap();
|
||||
map.put("'", "\\'");
|
||||
/*
|
||||
* map.put("%", "\\%"); map.put("_", "\\_"); map.put("\"", "\\\"");
|
||||
*/
|
||||
StringBuffer targetString = new StringBuffer("");
|
||||
if (null != fromString) {
|
||||
StringTokenizer tokens = new StringTokenizer(fromString, "'%_\"",
|
||||
true);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
String temp = tokens.nextToken();
|
||||
if (map.containsKey(temp)) {
|
||||
temp = (String) map.get(temp);
|
||||
}
|
||||
targetString.append(temp);
|
||||
}
|
||||
}
|
||||
return targetString.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param source
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static int[] convertToIntArray(String[] source) {
|
||||
if (null == source) {
|
||||
return null;
|
||||
}
|
||||
int[] target = new int[source.length];
|
||||
for (int i = 0; i < target.length; i++) {
|
||||
target[i] = Integer.parseInt(source[i]);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param source
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static int[] convertTokensToIntArray(String source) {
|
||||
if (null == source) {
|
||||
return null;
|
||||
}
|
||||
StringTokenizer sourceTokens = new StringTokenizer(source, ":");
|
||||
int[] target = new int[sourceTokens.countTokens()];
|
||||
for (int i = 0; sourceTokens.hasMoreTokens(); i++) {
|
||||
target[i] = Integer.parseInt(sourceTokens.nextToken());
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param source
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static String convertIntArrayToTokens(int[] source) {
|
||||
if (null == source) {
|
||||
return null;
|
||||
}
|
||||
StringBuffer target = new StringBuffer("");
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
target.append(Integer.toString(source[i]));
|
||||
if (i < (source.length - 1)) {
|
||||
target.append(":");
|
||||
}
|
||||
}
|
||||
return target.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* The main program for the ThdlUtilities class
|
||||
*
|
||||
* @param args
|
||||
* The command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
String s = "It's stupid to use a % or a _ in a SQL Statement";
|
||||
System.out.println(ThdlUtilities.escape(s));
|
||||
|
||||
int[] ia = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
System.out.println(ThdlUtilities.convertIntArrayToTokens(ia));
|
||||
|
||||
String str = "9:8:7:6:5";
|
||||
int[] ia2 = ThdlUtilities.convertTokensToIntArray(str);
|
||||
String newStr = "";
|
||||
for (int i = 0; i < 5; i++) {
|
||||
newStr = newStr + ia2[i] + " ";
|
||||
}
|
||||
System.out.println(newStr);
|
||||
|
||||
}
|
||||
}
|
||||
|
127
src/java/org/thdl/lex/UserSessionManager.java
Normal file
127
src/java/org/thdl/lex/UserSessionManager.java
Normal file
|
@ -0,0 +1,127 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class UserSessionManager {
|
||||
//attributes
|
||||
|
||||
private static UserSessionManager INSTANCE = new UserSessionManager();
|
||||
|
||||
/**
|
||||
* Gets the visit attribute of the UserSessionManager object
|
||||
*
|
||||
* @param session
|
||||
* Description of the Parameter
|
||||
* @return The visit value
|
||||
*/
|
||||
public Visit getVisit(HttpSession session) {
|
||||
if (null == session.getAttribute(LexConstants.VISIT_SESSION_ATTR)) {
|
||||
setVisit(session, new Visit(session));
|
||||
}
|
||||
return (Visit) session.getAttribute(LexConstants.VISIT_SESSION_ATTR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visit attribute of the UserSessionManager object
|
||||
*
|
||||
* @param session
|
||||
* The new visit value
|
||||
* @param visit
|
||||
* The new visit value
|
||||
*/
|
||||
public void setVisit(HttpSession session, Visit visit) {
|
||||
session.setAttribute(LexConstants.VISIT_SESSION_ATTR, visit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param session
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public void removeVisit(HttpSession session) {
|
||||
session.setAttribute(LexConstants.VISIT_SESSION_ATTR, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sessionLoginTarget attribute of the UserSessionManager object
|
||||
*
|
||||
* @param session
|
||||
* The new sessionLoginTarget value
|
||||
* @param loginTarget
|
||||
* The new sessionLoginTarget value
|
||||
* @since
|
||||
*/
|
||||
public void setSessionLoginTarget(HttpSession session, String loginTarget) {
|
||||
session.setAttribute(LexConstants.LOGINTARGET_SESS_PARAM, loginTarget);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the instance attribute of the UserSessionManager class
|
||||
*
|
||||
* @return The instance value
|
||||
* @since
|
||||
*/
|
||||
public static UserSessionManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sessionLoginTarget attribute of the UserSessionManager object
|
||||
*
|
||||
* @param session
|
||||
* Description of Parameter
|
||||
* @param clear
|
||||
* Description of Parameter
|
||||
* @return The sessionLoginTarget value
|
||||
* @since
|
||||
*/
|
||||
public String getSessionLoginTarget(HttpSession session, boolean clear) {
|
||||
String target = (String) session
|
||||
.getAttribute(LexConstants.LOGINTARGET_SESS_PARAM);
|
||||
if (clear) {
|
||||
session.removeAttribute(LexConstants.LOGINTARGET_SESS_PARAM);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param request
|
||||
* Description of Parameter
|
||||
* @param response
|
||||
* Description of Parameter
|
||||
* @param url
|
||||
* Description of Parameter
|
||||
* @exception IOException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public static void doRedirect(HttpServletRequest request,
|
||||
HttpServletResponse response, String url) throws IOException {
|
||||
String redirect = response.encodeRedirectURL(request.getContextPath()
|
||||
+ url);
|
||||
response.sendRedirect(redirect);
|
||||
}
|
||||
|
||||
//constructor
|
||||
/**
|
||||
* Constructor for the UserSessionManager object
|
||||
*
|
||||
* @since
|
||||
*/
|
||||
private UserSessionManager() {
|
||||
}
|
||||
}
|
||||
|
212
src/java/org/thdl/lex/Visit.java
Normal file
212
src/java/org/thdl/lex/Visit.java
Normal file
|
@ -0,0 +1,212 @@
|
|||
package org.thdl.lex;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class Visit {
|
||||
//attributes
|
||||
HttpSession session;
|
||||
|
||||
String token;
|
||||
|
||||
DisplayHelper helper;
|
||||
|
||||
Preferences preferences;
|
||||
|
||||
LexQuery query;
|
||||
|
||||
ThdlUser user;
|
||||
|
||||
String displayMode;
|
||||
|
||||
/**
|
||||
* Sets the token attribute of the Visit object
|
||||
*
|
||||
* @param token
|
||||
* The new token value
|
||||
*/
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token attribute of the Visit object
|
||||
*
|
||||
* @return The token value
|
||||
*/
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the session attribute of the Visit object
|
||||
*
|
||||
* @param session
|
||||
* The new session value
|
||||
*/
|
||||
public void setSession(HttpSession session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the session attribute of the Visit object
|
||||
*
|
||||
* @return The session value
|
||||
*/
|
||||
public HttpSession getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the helper attribute of the Visit object
|
||||
*
|
||||
* @param helper
|
||||
* The new helper value
|
||||
*/
|
||||
public void setHelper(DisplayHelper helper) {
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the preferences attribute of the Visit object
|
||||
*
|
||||
* @param preferences
|
||||
* The new preferences value
|
||||
*/
|
||||
public void setPreferences(Preferences preferences) {
|
||||
this.preferences = preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the query attribute of the Visit object
|
||||
*
|
||||
* @param query
|
||||
* The new query value
|
||||
*/
|
||||
public void setQuery(LexQuery query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user attribute of the Visit object
|
||||
*
|
||||
* @param user
|
||||
* The new user value
|
||||
*/
|
||||
public void setUser(ThdlUser user) {
|
||||
if (user.hasRole("guest")) {
|
||||
getSession().setMaxInactiveInterval(60 * 5);
|
||||
} else {
|
||||
getSession().setMaxInactiveInterval(60 * 60 * 8);
|
||||
}
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the displayMode attribute of the Visit object
|
||||
*
|
||||
* @param displayMode
|
||||
* The new displayMode value
|
||||
*/
|
||||
public void setDisplayMode(String displayMode) {
|
||||
this.displayMode = displayMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the helper attribute of the Visit object
|
||||
*
|
||||
* @return The helper value
|
||||
*/
|
||||
public DisplayHelper getHelper() {
|
||||
if (null == helper) {
|
||||
setHelper(new DisplayHelper());
|
||||
}
|
||||
return helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the preferences attribute of the Visit object
|
||||
*
|
||||
* @return The preferences value
|
||||
*/
|
||||
public Preferences getPreferences() {
|
||||
if (null == preferences) {
|
||||
try {
|
||||
setPreferences(new Preferences(getUser()));
|
||||
} catch (Exception e) {
|
||||
setPreferences(new Preferences());
|
||||
}
|
||||
}
|
||||
return preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the query attribute of the Visit object
|
||||
*
|
||||
* @return The query value
|
||||
*/
|
||||
public LexQuery getQuery() {
|
||||
if (null == query) {
|
||||
setQuery(new LexQuery());
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user attribute of the Visit object
|
||||
*
|
||||
* @return The user value
|
||||
*/
|
||||
public ThdlUser getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the displayMode attribute of the Visit object
|
||||
*
|
||||
* @return The displayMode value
|
||||
*/
|
||||
public String getDisplayMode() {
|
||||
return displayMode;
|
||||
}
|
||||
|
||||
//constructor
|
||||
/**
|
||||
* Constructor for the Visit object
|
||||
*/
|
||||
public Visit() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the Visit object
|
||||
*
|
||||
* @param session
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public Visit(HttpSession session) {
|
||||
this();
|
||||
setSession(session);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the Visit object
|
||||
*
|
||||
* @param session
|
||||
* Description of the Parameter
|
||||
* @param user
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public Visit(HttpSession session, ThdlUser user) {
|
||||
this(session);
|
||||
setUser(user);
|
||||
}
|
||||
|
||||
}
|
||||
|
45
src/java/org/thdl/lex/commands/AbortCommand.java
Normal file
45
src/java/org/thdl/lex/commands/AbortCommand.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class AbortCommand implements Command {
|
||||
private String next;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of Parameter
|
||||
* @param component
|
||||
* Description of Parameter
|
||||
* @return Description of the Returned Value
|
||||
* @exception CommandException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
req.setAttribute("termtool.msg", "Operation Aborted");
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the AbortCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public AbortCommand(String next) {
|
||||
this.next = next;
|
||||
}
|
||||
}
|
||||
|
27
src/java/org/thdl/lex/commands/Command.java
Normal file
27
src/java/org/thdl/lex/commands/Command.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 3, 2003
|
||||
*/
|
||||
public interface Command {
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of Parameter
|
||||
* @param component
|
||||
* Description of Parameter
|
||||
* @return Description of the Returned Value
|
||||
* @exception CommandException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public String execute(javax.servlet.http.HttpServletRequest req,
|
||||
ILexComponent component) throws CommandException;
|
||||
}
|
||||
|
54
src/java/org/thdl/lex/commands/CommandException.java
Normal file
54
src/java/org/thdl/lex/commands/CommandException.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class CommandException extends Exception {
|
||||
/**
|
||||
* Constructor for the CommandException object
|
||||
*
|
||||
* @since
|
||||
*/
|
||||
public CommandException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the CommandException object
|
||||
*
|
||||
* @param msg
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public CommandException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the CommandException object
|
||||
*
|
||||
* @param msg
|
||||
* Description of Parameter
|
||||
* @param e
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public CommandException(String msg, Exception e) {
|
||||
super(msg, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the CommandException object
|
||||
*
|
||||
* @param e
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public CommandException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
}
|
||||
|
79
src/java/org/thdl/lex/commands/CommandToken.java
Normal file
79
src/java/org/thdl/lex/commands/CommandToken.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 22, 2003
|
||||
*/
|
||||
public class CommandToken {
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public static void set(HttpServletRequest req) {
|
||||
HttpSession session = req.getSession(true);
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(session);
|
||||
long systime = System.currentTimeMillis();
|
||||
byte[] time = new Long(systime).toString().getBytes();
|
||||
byte[] id = session.getId().getBytes();
|
||||
try {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
md5.update(id);
|
||||
md5.update(time);
|
||||
String token = toHex(md5.digest());
|
||||
req.setAttribute("token", token);
|
||||
visit.setToken(token);
|
||||
} catch (Exception e) {
|
||||
System.err
|
||||
.println("Unable to calculate MD5 Digests.\nCould not create unique token");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the valid attribute of the CommandToken class
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @return The valid value
|
||||
*/
|
||||
public static boolean isValid(HttpServletRequest req) {
|
||||
boolean valid;
|
||||
HttpSession session = req.getSession(true);
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(session);
|
||||
String requestToken = req.getParameter("token");
|
||||
String sessionToken = visit.getToken();
|
||||
if (requestToken == null && sessionToken == null) {
|
||||
valid = false;
|
||||
} else {
|
||||
valid = requestToken.equals(sessionToken);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param digest
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static String toHex(byte[] digest) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
for (int i = 0; i < digest.length; i++) {
|
||||
buf.append(Integer.toHexString((int) digest[i] & 0x00ff));
|
||||
}//param=BITWISE operation
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
|
115
src/java/org/thdl/lex/commands/DisplayCommand.java
Normal file
115
src/java/org/thdl/lex/commands/DisplayCommand.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.DisplayHelper;
|
||||
import org.thdl.lex.LexComponentRepository;
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexLogger;
|
||||
import org.thdl.lex.LexQuery;
|
||||
import org.thdl.lex.LexRepositoryException;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 3, 2003
|
||||
*/
|
||||
public class DisplayCommand extends LexCommand implements Command {
|
||||
//helper methods
|
||||
/**
|
||||
* Sets the displayMode attribute of the DisplayCommand object
|
||||
*
|
||||
* @param req
|
||||
* The new displayMode value
|
||||
* @since
|
||||
*/
|
||||
public void setDisplayMode(HttpServletRequest req) {
|
||||
String cmd = req.getParameter(LexConstants.COMMAND_REQ_PARAM);
|
||||
if (cmd.equals("display")) {
|
||||
req.getSession(true).setAttribute(
|
||||
LexConstants.DISPLAYMODE_SESS_ATTR, "brief");
|
||||
} else if (cmd.equals("displayFull")) {
|
||||
req.getSession(true).setAttribute(
|
||||
LexConstants.DISPLAYMODE_SESS_ATTR, "full");
|
||||
} else if (cmd.equals("editEntry")) {
|
||||
req.getSession(true).setAttribute(
|
||||
LexConstants.DISPLAYMODE_SESS_ATTR, "edit");
|
||||
}
|
||||
}
|
||||
|
||||
//contract methods
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of Parameter
|
||||
* @param component
|
||||
* Description of Parameter
|
||||
* @return Description of the Returned Value
|
||||
* @exception CommandException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
String msg = null;
|
||||
String next = getNext();
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
DisplayHelper displayHelper = visit.getHelper();
|
||||
try {
|
||||
LexQuery query = visit.getQuery();
|
||||
if (component instanceof ITerm) {
|
||||
ITerm term = (ITerm) component;
|
||||
|
||||
if (null != query.getEntry()
|
||||
&& term.getMetaId()
|
||||
.equals(query.getEntry().getMetaId())) {
|
||||
LexComponentRepository.update(query.getEntry());
|
||||
} else {
|
||||
LexComponentRepository.loadTerm(term);
|
||||
query.setEntry(term);
|
||||
if (query.getResults().keySet().size() < 1) {
|
||||
query.getResults()
|
||||
.put(term.getMetaId(), term.getTerm());
|
||||
}
|
||||
}
|
||||
|
||||
displayHelper.populate(req.getParameterMap());
|
||||
} else {
|
||||
next = "menu.jsp";
|
||||
msg = "The component set for display was not a term.";
|
||||
LexLogger.error(msg);
|
||||
}
|
||||
req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg);
|
||||
|
||||
return next;
|
||||
} catch (LexComponentException e) {
|
||||
throw new CommandException(e);
|
||||
} catch (LexRepositoryException e) {
|
||||
throw new CommandException(e);
|
||||
} catch (Exception e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Constructor for the DisplayCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
* @since
|
||||
*/
|
||||
public DisplayCommand(String next) {
|
||||
super(next);
|
||||
}
|
||||
}
|
||||
|
83
src/java/org/thdl/lex/commands/FindCommand.java
Normal file
83
src/java/org/thdl/lex/commands/FindCommand.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.DisplayHelper;
|
||||
import org.thdl.lex.LexComponentRepository;
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexQuery;
|
||||
import org.thdl.lex.LexRepositoryException;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class FindCommand extends LexCommand implements Command {
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of Parameter
|
||||
* @param component
|
||||
* Description of Parameter
|
||||
* @return Description of the Returned Value
|
||||
* @exception CommandException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
try {
|
||||
String msg = null;
|
||||
String next = getNext();
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
DisplayHelper displayHelper = visit.getHelper();
|
||||
LexQuery query = visit.getQuery();
|
||||
query.populate(req.getParameterMap());
|
||||
|
||||
if (component instanceof ITerm) {
|
||||
ITerm term = (ITerm) component;
|
||||
|
||||
query.setQueryComponent(term);
|
||||
LexComponentRepository.findTermsByTerm(query);
|
||||
Iterator iterator = query.getResults().keySet().iterator();
|
||||
if (iterator.hasNext()) {
|
||||
visit.setQuery(query);
|
||||
msg = "There are " + query.getResults().size()
|
||||
+ " terms matching " + term.getTerm();
|
||||
} else {
|
||||
next = "menu.jsp";
|
||||
msg = "There were no terms matching " + term.getTerm();
|
||||
}
|
||||
}
|
||||
req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg);
|
||||
query.setQueryComponent(null);
|
||||
return next;
|
||||
} catch (LexRepositoryException e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Constructor for the FindCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
* @since
|
||||
*/
|
||||
public FindCommand(String next) {
|
||||
super(next);
|
||||
}
|
||||
}
|
||||
|
186
src/java/org/thdl/lex/commands/GetInsertFormCommand.java
Normal file
186
src/java/org/thdl/lex/commands/GetInsertFormCommand.java
Normal file
|
@ -0,0 +1,186 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.LexComponentRepository;
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexQuery;
|
||||
import org.thdl.lex.LexRepositoryException;
|
||||
import org.thdl.lex.LexUser;
|
||||
import org.thdl.lex.Preferences;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.AnalyticalNote;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
import org.thdl.lex.component.LexComponent;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.lex.component.Meta;
|
||||
import org.thdl.lex.component.Term;
|
||||
import org.thdl.lex.component.Translatable;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class GetInsertFormCommand extends LexCommand implements Command {
|
||||
private boolean termMode;
|
||||
|
||||
/**
|
||||
* Sets the termMode attribute of the GetInsertFormCommand object
|
||||
*
|
||||
* @param termMode
|
||||
* The new termMode value
|
||||
*/
|
||||
public void setTermMode(boolean termMode) {
|
||||
this.termMode = termMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the termMode attribute of the GetInsertFormCommand object
|
||||
*
|
||||
* @return The termMode value
|
||||
*/
|
||||
public boolean isTermMode() {
|
||||
return termMode;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
String next = getNext();
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
LexQuery query = visit.getQuery();
|
||||
ITerm term = query.getEntry();
|
||||
String msg = null;
|
||||
|
||||
try {
|
||||
LexUser user = (LexUser) visit.getUser();
|
||||
Preferences prefs = visit.getPreferences();
|
||||
|
||||
if (isTermMode()) {
|
||||
Term newTerm = new Term();
|
||||
newTerm.populate(component);
|
||||
query.setQueryComponent(newTerm);
|
||||
if (termExists(query)) {
|
||||
msg = newTerm.getTerm()
|
||||
+ " is present in the dictionary, please add to this term.";
|
||||
next = "displayEntry.jsp";
|
||||
visit.setQuery(query);
|
||||
}
|
||||
component = newTerm;
|
||||
}
|
||||
|
||||
Meta meta = new Meta(user, prefs);
|
||||
meta.populate(req.getParameterMap());
|
||||
component.setMeta(meta);
|
||||
|
||||
if (req.getParameter("cmd").equals("getAnnotationForm")) {
|
||||
AnalyticalNote note = new AnalyticalNote();
|
||||
note.setParentId(component.getMetaId());
|
||||
//note.setAnalyticalNote( req.getParameter( "analyticalNote" )
|
||||
// );
|
||||
//note.setPrecedence( new Integer( 0 ) );
|
||||
component.setAnalyticalNotes(new LinkedList());
|
||||
component.getAnalyticalNotes().add(note);
|
||||
meta = new Meta(user, prefs);
|
||||
meta.populate(req.getParameterMap());
|
||||
note.setMeta(meta);
|
||||
req.setAttribute(LexConstants.ORIGINALBEAN_REQ_ATTR, component);
|
||||
component = note;
|
||||
}
|
||||
|
||||
req.setAttribute(LexConstants.COMPONENT_REQ_ATTR, component);
|
||||
|
||||
} catch (LexRepositoryException e) {
|
||||
throw new CommandException(e);
|
||||
} catch (LexComponentException e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
|
||||
//if the component is a translation of another component get the
|
||||
// original as well to assist in editing
|
||||
if (component instanceof Translatable) {
|
||||
Translatable translatable = (Translatable) component;
|
||||
if (null != translatable.getTranslationOf()
|
||||
&& translatable.getTranslationOf().intValue() > 0) {
|
||||
try {
|
||||
LexComponent source = (LexComponent) translatable
|
||||
.getClass().newInstance();
|
||||
Integer sourcePk = translatable.getTranslationOf();
|
||||
source.setMetaId(sourcePk);
|
||||
LexComponentRepository.loadByPk(source);
|
||||
req
|
||||
.setAttribute(LexConstants.ORIGINALBEAN_REQ_ATTR,
|
||||
source);
|
||||
} catch (InstantiationException ie) {
|
||||
throw new CommandException(ie);
|
||||
} catch (IllegalAccessException iae) {
|
||||
throw new CommandException(iae);
|
||||
} catch (LexRepositoryException lre) {
|
||||
throw new CommandException(lre);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
msg = "You have reached the Insert Form";
|
||||
visit.setDisplayMode("addEditForm");
|
||||
|
||||
req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg);
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param query
|
||||
* Description of the Parameter
|
||||
* @return The newTerm value
|
||||
* @exception LexRepositoryException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public boolean termExists(LexQuery query) throws LexRepositoryException {
|
||||
boolean termExists = false;
|
||||
query.setFindMode(LexComponentRepository.EXACT);
|
||||
LexComponentRepository.findTermsByTerm(query);
|
||||
if (query.getResults().keySet().size() > 0) {
|
||||
termExists = true;
|
||||
}
|
||||
query.setFindMode(LexComponentRepository.STARTS_WITH);
|
||||
return termExists;
|
||||
}
|
||||
|
||||
//constructors
|
||||
|
||||
/**
|
||||
* Constructor for the GetInsertFormCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
* @param termMode
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public GetInsertFormCommand(String next, Boolean termMode) {
|
||||
super(next);
|
||||
setTermMode(termMode.booleanValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
148
src/java/org/thdl/lex/commands/GetRemoveFormCommand.java
Normal file
148
src/java/org/thdl/lex/commands/GetRemoveFormCommand.java
Normal file
|
@ -0,0 +1,148 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.LexComponentRepository;
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexLogger;
|
||||
import org.thdl.lex.LexQuery;
|
||||
import org.thdl.lex.LexRepositoryException;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.IAnalyticalNote;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.lex.component.Translatable;
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class GetRemoveFormCommand extends LexCommand implements Command {
|
||||
private boolean termMode;
|
||||
|
||||
/**
|
||||
* Sets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @param termMode
|
||||
* The new termMode value
|
||||
*/
|
||||
public void setTermMode(boolean termMode) {
|
||||
this.termMode = termMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @return The termMode value
|
||||
*/
|
||||
public boolean isTermMode() {
|
||||
return termMode;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
String next = getNext();
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
LexQuery query = visit.getQuery();
|
||||
ITerm term = query.getEntry();
|
||||
String msg = null;
|
||||
ThdlUser user = visit.getUser();
|
||||
if (validate(user, component)) {
|
||||
|
||||
try {
|
||||
|
||||
LexLogger
|
||||
.debug("Checking component state from GetRemoveFormCommand BEFORE component assignment");
|
||||
LexLogger.debugComponent(component);
|
||||
if (isTermMode()) {
|
||||
component = query.getEntry();
|
||||
} else if (component instanceof IAnalyticalNote) {
|
||||
ILexComponent parent = term.findParent(component
|
||||
.getParentId());
|
||||
List notes = parent.getAnalyticalNotes();
|
||||
int index = notes.indexOf(component);
|
||||
component = (ILexComponent) notes.get(index);
|
||||
} else if (component instanceof Translatable
|
||||
&& null != ((Translatable) component)
|
||||
.getTranslationOf()) {
|
||||
LexComponentRepository.update(term);
|
||||
Translatable translation = (Translatable) component;
|
||||
Translatable source = null;
|
||||
try {
|
||||
source = (Translatable) translation.getClass()
|
||||
.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
source.setMetaId(translation.getTranslationOf());
|
||||
source.setParentId(translation.getParentId());
|
||||
source = (Translatable) term.findChild(source);
|
||||
List translationList = source.getTranslations();
|
||||
component = (ILexComponent) translationList
|
||||
.get(translationList.indexOf(translation));
|
||||
req
|
||||
.setAttribute(LexConstants.ORIGINALBEAN_REQ_ATTR,
|
||||
source);
|
||||
} else {
|
||||
LexComponentRepository.update(term);
|
||||
component = term.findChild(component.getMetaId());
|
||||
}
|
||||
req.setAttribute(LexConstants.COMPONENT_REQ_ATTR, component);
|
||||
LexLogger
|
||||
.debug("Checking component state from GetRemoveFormCommand AFTER component assignment");
|
||||
LexLogger.debugComponent(component);
|
||||
} catch (LexRepositoryException e) {
|
||||
throw new CommandException(e);
|
||||
} catch (LexComponentException e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
|
||||
msg = "You have reached the Remove Form";
|
||||
visit.setDisplayMode("addEditForm");
|
||||
} else {
|
||||
msg = "A dictionary component can only be removed by the person who created it or an administrator.";
|
||||
next = "displayEntry.jsp";
|
||||
}
|
||||
|
||||
req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg);
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
//constructors
|
||||
|
||||
/**
|
||||
* Constructor for the GetFormCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
* @param termMode
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public GetRemoveFormCommand(String next, Boolean termMode) {
|
||||
super(next);
|
||||
setTermMode(termMode.booleanValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
151
src/java/org/thdl/lex/commands/GetUpdateFormCommand.java
Normal file
151
src/java/org/thdl/lex/commands/GetUpdateFormCommand.java
Normal file
|
@ -0,0 +1,151 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.LexComponentRepository;
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexLogger;
|
||||
import org.thdl.lex.LexQuery;
|
||||
import org.thdl.lex.LexRepositoryException;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.IAnalyticalNote;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.lex.component.Translatable;
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class GetUpdateFormCommand extends LexCommand implements Command {
|
||||
private boolean termMode;
|
||||
|
||||
/**
|
||||
* Sets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @param termMode
|
||||
* The new termMode value
|
||||
*/
|
||||
public void setTermMode(boolean termMode) {
|
||||
this.termMode = termMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @return The termMode value
|
||||
*/
|
||||
public boolean isTermMode() {
|
||||
return termMode;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
String next = getNext();
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
LexQuery query = visit.getQuery();
|
||||
ITerm term = query.getEntry();
|
||||
String msg = null;
|
||||
ThdlUser user = visit.getUser();
|
||||
if (validate(user, component)) {
|
||||
|
||||
try {
|
||||
|
||||
if (isTermMode()) {
|
||||
component = query.getEntry();
|
||||
} else if (component instanceof IAnalyticalNote) {
|
||||
ILexComponent parent = term.findParent(component
|
||||
.getParentId());
|
||||
List notes = parent.getAnalyticalNotes();
|
||||
int index = notes.indexOf(component);
|
||||
component = (ILexComponent) notes.get(index);
|
||||
LexLogger
|
||||
.debug("Checking component state from getUpdateFormCommand AFTER assignment to analytical Note");
|
||||
LexLogger.debugComponent(component);
|
||||
} else if (component instanceof Translatable
|
||||
&& null != ((Translatable) component)
|
||||
.getTranslationOf()) {
|
||||
LexComponentRepository.update(term);
|
||||
Translatable translation = (Translatable) component;
|
||||
Translatable source = null;
|
||||
try {
|
||||
source = (Translatable) translation.getClass()
|
||||
.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
source.setMetaId(translation.getTranslationOf());
|
||||
source.setParentId(translation.getParentId());
|
||||
source = (Translatable) term.findChild(source);
|
||||
List translationList = source.getTranslations();
|
||||
component = (ILexComponent) translationList
|
||||
.get(translationList.indexOf(translation));
|
||||
req
|
||||
.setAttribute(LexConstants.ORIGINALBEAN_REQ_ATTR,
|
||||
source);
|
||||
} else {
|
||||
LexComponentRepository.update(term);
|
||||
component = term.findChild(component.getMetaId());
|
||||
}
|
||||
req.setAttribute(LexConstants.COMPONENT_REQ_ATTR, component);
|
||||
LexLogger
|
||||
.debug("Checking component state from getUpdateFormCommand AFTER component assignment");
|
||||
LexLogger.debugComponent(component);
|
||||
} catch (LexRepositoryException e) {
|
||||
throw new CommandException(e);
|
||||
} catch (LexComponentException e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
|
||||
//if the component is a translation of another component get the
|
||||
// original as well to assist in editing
|
||||
|
||||
msg = "You have reached the Update Form";
|
||||
visit.setDisplayMode("addEditForm");
|
||||
} else {
|
||||
msg = "A dictionary component can only be edited by the person who created it or an administrator.";
|
||||
next = "displayEntry.jsp";
|
||||
}
|
||||
|
||||
req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg);
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
//constructors
|
||||
|
||||
/**
|
||||
* Constructor for the GetFormCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
* @param termMode
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public GetUpdateFormCommand(String next, Boolean termMode) {
|
||||
super(next);
|
||||
setTermMode(termMode.booleanValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
205
src/java/org/thdl/lex/commands/InsertCommand.java
Normal file
205
src/java/org/thdl/lex/commands/InsertCommand.java
Normal file
|
@ -0,0 +1,205 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.thdl.lex.DisplayHelper;
|
||||
import org.thdl.lex.LexComponentRepository;
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexLogger;
|
||||
import org.thdl.lex.LexQuery;
|
||||
import org.thdl.lex.LexRepositoryException;
|
||||
import org.thdl.lex.LexUser;
|
||||
import org.thdl.lex.Preferences;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.AnalyticalNote;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.lex.component.Meta;
|
||||
import org.thdl.lex.component.Translatable;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class InsertCommand extends LexCommand implements Command {
|
||||
|
||||
private boolean termMode;
|
||||
|
||||
/**
|
||||
* Sets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @param termMode
|
||||
* The new termMode value
|
||||
*/
|
||||
public void setTermMode(boolean termMode) {
|
||||
this.termMode = termMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @return The termMode value
|
||||
*/
|
||||
public boolean isTermMode() {
|
||||
return termMode;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
String msg = null;
|
||||
String next = getNext();
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
DisplayHelper displayHelper = visit.getHelper();
|
||||
try {
|
||||
HttpSession ses = req.getSession(false);
|
||||
if (null == ses) {
|
||||
throw new CommandException(
|
||||
"Could not update component, user's session has expired");
|
||||
}
|
||||
|
||||
LexQuery query = visit.getQuery();
|
||||
ITerm term = query.getEntry();
|
||||
LexUser user = (LexUser) visit.getUser();
|
||||
Preferences prefs = visit.getPreferences();
|
||||
|
||||
if (CommandToken.isValid(req) && validate(user, component)) {
|
||||
if (!isTermMode()) {
|
||||
LexComponentRepository.update(term);
|
||||
}
|
||||
|
||||
if (isTermMode()) {
|
||||
query.setEntry((ITerm) component);
|
||||
term = query.getEntry();
|
||||
} else if (component instanceof AnalyticalNote) {
|
||||
LexLogger
|
||||
.debug("Debugging Component before inserting analytical note");
|
||||
LexLogger.debugComponent(component);
|
||||
ILexComponent parent = term.findParent(component
|
||||
.getParentId());
|
||||
List list = parent.getAnalyticalNotes();
|
||||
if (null == list) {
|
||||
list = new LinkedList();
|
||||
}
|
||||
list.add(component);
|
||||
parent.setAnalyticalNotes(list);
|
||||
//term.addSiblingList( parent, component, list );
|
||||
} else if (component instanceof Translatable
|
||||
&& null != ((Translatable) component)
|
||||
.getTranslationOf()) {
|
||||
Translatable translation = (Translatable) component;
|
||||
Translatable source = null;
|
||||
try {
|
||||
source = (Translatable) translation.getClass()
|
||||
.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
source.setMetaId(translation.getTranslationOf());
|
||||
source.setParentId(translation.getParentId());
|
||||
source = (Translatable) term.findChild(source);
|
||||
List list = source.getTranslations();
|
||||
if (null == list) {
|
||||
list = new LinkedList();
|
||||
}
|
||||
list.add(translation);
|
||||
source.setTranslations(list);
|
||||
} else {
|
||||
term.addChild(component);
|
||||
}
|
||||
|
||||
Meta meta = new Meta(user, prefs);
|
||||
meta.populate(req.getParameterMap());
|
||||
component.setMeta(meta);
|
||||
|
||||
Date now = new Date(System.currentTimeMillis());
|
||||
component.getMeta().setCreatedOn(now);
|
||||
component.getMeta().setModifiedOn(now);
|
||||
component.getMeta().setCreatedBy(user.getId());
|
||||
component.getMeta().setModifiedBy(user.getId());
|
||||
|
||||
LexComponentRepository.save(term);
|
||||
|
||||
if (!isTermMode()) {
|
||||
term.getMeta().setModifiedOn(now);
|
||||
term.getMeta().setModifiedBy(user.getId());
|
||||
}
|
||||
|
||||
if (!(component instanceof AnalyticalNote)
|
||||
&& null != req.getParameter("analyticalNote")
|
||||
&& req.getParameter("analyticalNote").length() > 0) {
|
||||
AnalyticalNote note = new AnalyticalNote();
|
||||
note.setAnalyticalNote(req.getParameter("analyticalNote"));
|
||||
note.setParentId(component.getMetaId());
|
||||
//note.setPrecedence( new Integer( 0 ) );
|
||||
component.setAnalyticalNotes(new LinkedList());
|
||||
component.getAnalyticalNotes().add(note);
|
||||
meta = new Meta(user, prefs);
|
||||
meta.populate(req.getParameterMap());
|
||||
note.setMeta(meta);
|
||||
LexLogger.debug("Adding analytical note to "
|
||||
+ component.getLabel());
|
||||
}
|
||||
|
||||
LexLogger.debugComponent(component);
|
||||
LexLogger.debugComponent(term);
|
||||
|
||||
LexComponentRepository.update(term);
|
||||
msg = "Successful Update";
|
||||
visit.setDisplayMode("edit");
|
||||
|
||||
} else {
|
||||
msg = CommandToken.isValid(req) ? "Unauthorized update attempted"
|
||||
: "Invalid reload attempted.";
|
||||
}
|
||||
return next;
|
||||
} catch (LexComponentException e) {
|
||||
throw new CommandException(e);
|
||||
} catch (LexRepositoryException e) {
|
||||
throw new CommandException("Command had trouble processing "
|
||||
+ component, e);
|
||||
} finally {
|
||||
req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg);
|
||||
LexLogger
|
||||
.debug("Showing Term Map at end of InsertCommand.execute()");
|
||||
LexLogger.debugTerm(((Visit) req.getSession(false).getAttribute(
|
||||
"visit")).getQuery().getEntry());
|
||||
}
|
||||
}
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Constructor for the GetFormCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
* @param termMode
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public InsertCommand(String next, Boolean termMode) {
|
||||
super(next);
|
||||
setTermMode(termMode.booleanValue());
|
||||
}
|
||||
}
|
||||
|
111
src/java/org/thdl/lex/commands/LexCommand.java
Normal file
111
src/java/org/thdl/lex/commands/LexCommand.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 3, 2003
|
||||
*/
|
||||
public abstract class LexCommand implements Command {
|
||||
//attributes
|
||||
private String next;
|
||||
|
||||
private UserSessionManager sessionManager;
|
||||
|
||||
//accessors
|
||||
/**
|
||||
* Sets the sessionManager attribute of the LexCommand object
|
||||
*
|
||||
* @param sessionManager
|
||||
* The new sessionManager value
|
||||
* @since
|
||||
*/
|
||||
public void setSessionManager(UserSessionManager sessionManager) {
|
||||
this.sessionManager = sessionManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the next attribute of the LexCommand object
|
||||
*
|
||||
* @param next
|
||||
* The new next value
|
||||
* @since
|
||||
*/
|
||||
public void setNext(String next) {
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sessionManager attribute of the LexCommand object
|
||||
*
|
||||
* @return The sessionManager value
|
||||
* @since
|
||||
*/
|
||||
public UserSessionManager getSessionManager() {
|
||||
if (null == sessionManager) {
|
||||
setSessionManager(UserSessionManager.getInstance());
|
||||
}
|
||||
return sessionManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the next attribute of the LexCommand object
|
||||
*
|
||||
* @return The next value
|
||||
* @since
|
||||
*/
|
||||
public String getNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the component attribute of the LexCommand object
|
||||
*
|
||||
* @param user
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @since
|
||||
*/
|
||||
/*
|
||||
* public ILexComponent getComponent() { return component; }
|
||||
*/
|
||||
//helpers
|
||||
public boolean validate(ThdlUser user, ILexComponent component) {
|
||||
boolean valid = false;
|
||||
Integer creator = component.getMeta().getCreatedBy();
|
||||
|
||||
if (user.getId().equals(creator) || user.hasRole("admin")
|
||||
|| user.hasRole("dev")) {
|
||||
valid = true;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
//constructors
|
||||
|
||||
/**
|
||||
* Constructor for the LexCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public LexCommand(String next) {
|
||||
setNext(next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexCommand object
|
||||
*
|
||||
* @since
|
||||
*/
|
||||
public LexCommand() {
|
||||
}
|
||||
}
|
||||
|
54
src/java/org/thdl/lex/commands/LexCommandException.java
Normal file
54
src/java/org/thdl/lex/commands/LexCommandException.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public class LexCommandException extends Exception {
|
||||
/**
|
||||
* Constructor for the LexCommandException object
|
||||
*
|
||||
* @since
|
||||
*/
|
||||
public LexCommandException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexCommandException object
|
||||
*
|
||||
* @param msg
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public LexCommandException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexCommandException object
|
||||
*
|
||||
* @param e
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public LexCommandException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the LexCommandException object
|
||||
*
|
||||
* @param msg
|
||||
* Description of Parameter
|
||||
* @param e
|
||||
* Description of Parameter
|
||||
* @since
|
||||
*/
|
||||
public LexCommandException(String msg, Exception e) {
|
||||
super(msg, e);
|
||||
}
|
||||
}
|
||||
|
48
src/java/org/thdl/lex/commands/NullCommand.java
Normal file
48
src/java/org/thdl/lex/commands/NullCommand.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 21, 2003
|
||||
*/
|
||||
public class NullCommand extends LexCommand implements Command {
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
/*
|
||||
* Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
* req.getSession( true ) ); if( null == req.getParameter(
|
||||
* LexConstants.COMMAND_REQ_PARAM ) ) req.setAttribute(
|
||||
* LexConstants.MESSAGE_REQ_ATTR, "Start from here." ); if( "login" ==
|
||||
* req.getParameter( LexConstants.COMMAND_REQ_PARAM ) && null !=
|
||||
* visit.getUser()) setNext("menu.jsp");
|
||||
*/
|
||||
return getNext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the NullCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public NullCommand(String next) {
|
||||
super(next);
|
||||
}
|
||||
}
|
||||
|
116
src/java/org/thdl/lex/commands/PreferencesCommand.java
Normal file
116
src/java/org/thdl/lex/commands/PreferencesCommand.java
Normal file
|
@ -0,0 +1,116 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexUtilities;
|
||||
import org.thdl.lex.Preferences;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class PreferencesCommand extends LexCommand implements Command {
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
try {
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
|
||||
Preferences isb = visit.getPreferences();
|
||||
if (req.getParameter(LexConstants.COMMAND_REQ_PARAM).equals(
|
||||
"setMetaPrefs")) {
|
||||
isb.setLanguageSet(LexUtilities.convertToIntegerArray(req
|
||||
.getParameterValues("languages")));
|
||||
isb.setDialectSet(LexUtilities.convertToIntegerArray(req
|
||||
.getParameterValues("dialects")));
|
||||
isb.setSourceSet(LexUtilities.convertToIntegerArray(req
|
||||
.getParameterValues("sources")));
|
||||
isb.setProjectSubjectSet(LexUtilities.convertToIntegerArray(req
|
||||
.getParameterValues("projectSubjects")));
|
||||
isb.setScriptSet(LexUtilities.convertToIntegerArray(req
|
||||
.getParameterValues("scripts")));
|
||||
} else if (req.getParameter(LexConstants.COMMAND_REQ_PARAM).equals(
|
||||
"setMetaDefaults")) {
|
||||
isb.setLanguage(new Integer(req.getParameter("language")));
|
||||
isb.setDialect(new Integer(req.getParameter("dialect")));
|
||||
isb.setSource(new Integer(req.getParameter("source")));
|
||||
isb.setProjectSubject(new Integer(req
|
||||
.getParameter("projectSubject")));
|
||||
isb.setScript(new Integer(req.getParameter("script")));
|
||||
isb.setNote(req.getParameter("note"));
|
||||
if (null != req.getParameter("useDefaultLanguage")
|
||||
&& req.getParameter("useDefaultLanguage")
|
||||
.equals("true")) {
|
||||
isb.setUseDefaultLanguage(true);
|
||||
} else {
|
||||
isb.setUseDefaultLanguage(false);
|
||||
}
|
||||
if (null != req.getParameter("useDefaultDialect")
|
||||
&& req.getParameter("useDefaultDialect").equals("true")) {
|
||||
isb.setUseDefaultDialect(true);
|
||||
} else {
|
||||
isb.setUseDefaultDialect(false);
|
||||
}
|
||||
if (null != req.getParameter("useDefaultSource")
|
||||
&& req.getParameter("useDefaultSource").equals("true")) {
|
||||
isb.setUseDefaultSource(true);
|
||||
} else {
|
||||
isb.setUseDefaultSource(false);
|
||||
}
|
||||
if (null != req.getParameter("useDefaultProjSub")
|
||||
&& req.getParameter("useDefaultProjSub").equals("true")) {
|
||||
isb.setUseDefaultProjSub(true);
|
||||
} else {
|
||||
isb.setUseDefaultProjSub(false);
|
||||
}
|
||||
if (null != req.getParameter("useDefaultScript")
|
||||
&& req.getParameter("useDefaultScript").equals("true")) {
|
||||
isb.setUseDefaultScript(true);
|
||||
} else {
|
||||
isb.setUseDefaultScript(false);
|
||||
}
|
||||
if (null != req.getParameter("useDefaultNote")
|
||||
&& req.getParameter("useDefaultNote").equals("true")) {
|
||||
isb.setUseDefaultNote(true);
|
||||
} else {
|
||||
isb.setUseDefaultNote(false);
|
||||
}
|
||||
}
|
||||
isb.save();
|
||||
} catch (LexComponentException lre) {
|
||||
throw new CommandException("LexComponentException says: "
|
||||
+ lre.getMessage());
|
||||
}
|
||||
|
||||
return getNext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the PreferencesCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public PreferencesCommand(String next) {
|
||||
super(next);
|
||||
}
|
||||
}
|
||||
|
52
src/java/org/thdl/lex/commands/RefreshSourcesCommand.java
Normal file
52
src/java/org/thdl/lex/commands/RefreshSourcesCommand.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.thdl.lex.*;
|
||||
import org.thdl.lex.component.*;
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class RefreshSourcesCommand extends LexCommand implements Command
|
||||
{
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req Description of the Parameter
|
||||
* @param component Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException Description of the Exception
|
||||
*/
|
||||
public String execute( HttpServletRequest req, ILexComponent component ) throws CommandException
|
||||
{
|
||||
try
|
||||
{
|
||||
LexSourceRepository lcr = LexSourceRepository.getInstance();
|
||||
req.setAttribute( "testArray", lcr.xmlTesting() );
|
||||
|
||||
}
|
||||
catch ( Exception lre )
|
||||
{
|
||||
throw new CommandException( lre );
|
||||
}
|
||||
return getNext();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*Constructor for the PreferencesCommand object
|
||||
*
|
||||
* @param next Description of the Parameter
|
||||
*/
|
||||
public RefreshSourcesCommand( String next )
|
||||
{
|
||||
super( next );
|
||||
}
|
||||
}
|
||||
|
165
src/java/org/thdl/lex/commands/RemoveCommand.java
Normal file
165
src/java/org/thdl/lex/commands/RemoveCommand.java
Normal file
|
@ -0,0 +1,165 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.thdl.lex.LexComponentRepository;
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexLogger;
|
||||
import org.thdl.lex.LexQuery;
|
||||
import org.thdl.lex.LexRepositoryException;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.AnalyticalNote;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.lex.component.Translatable;
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class RemoveCommand extends LexCommand implements Command {
|
||||
|
||||
private boolean termMode;
|
||||
|
||||
/**
|
||||
* Sets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @param termMode
|
||||
* The new termMode value
|
||||
*/
|
||||
public void setTermMode(boolean termMode) {
|
||||
this.termMode = termMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @return The termMode value
|
||||
*/
|
||||
public boolean isTermMode() {
|
||||
return termMode;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
String msg = null;
|
||||
String next = getNext();
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
|
||||
try {
|
||||
HttpSession ses = req.getSession(false);
|
||||
if (null == ses) {
|
||||
throw new CommandException(
|
||||
"Could not remove component, user's session has expired");
|
||||
}
|
||||
|
||||
ThdlUser user = visit.getUser();
|
||||
LexQuery query = visit.getQuery();
|
||||
ITerm term = query.getEntry();
|
||||
LexComponentRepository.update(term);
|
||||
|
||||
if (CommandToken.isValid(req) && validate(user, component)) {
|
||||
if (isTermMode()) {
|
||||
term.setDeleted(Boolean.TRUE);
|
||||
LexComponentRepository.update(term);
|
||||
query.setEntry(null);
|
||||
} else if (component instanceof AnalyticalNote) {
|
||||
LexLogger
|
||||
.debug("Debugging Component before inserting analytical note");
|
||||
LexLogger.debugComponent(component);
|
||||
ILexComponent parent = term.findParent(component
|
||||
.getParentId());
|
||||
List notes = parent.getAnalyticalNotes();
|
||||
notes.remove(component);
|
||||
} else if (component instanceof Translatable
|
||||
&& null != ((Translatable) component)
|
||||
.getTranslationOf()) {
|
||||
Translatable translation = (Translatable) component;
|
||||
LexLogger
|
||||
.debug("Checking translation state before looking for its source");
|
||||
LexLogger.debugComponent(translation);
|
||||
|
||||
Translatable source = null;
|
||||
try {
|
||||
source = (Translatable) translation.getClass()
|
||||
.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
source.setMetaId(translation.getTranslationOf());
|
||||
source.setParentId(translation.getParentId());
|
||||
source = (Translatable) term.findChild(source);
|
||||
LexLogger
|
||||
.debug("Checking source state before looking for its translation list");
|
||||
LexLogger.debugComponent(source);
|
||||
|
||||
List translationList = source.getTranslations();
|
||||
ILexComponent doomedComponent = (ILexComponent) translationList
|
||||
.get(translationList.indexOf(translation));
|
||||
doomedComponent.setDeleted(Boolean.TRUE);
|
||||
LexComponentRepository.update(doomedComponent);
|
||||
translationList.remove(doomedComponent);
|
||||
LexComponentRepository.update(term);
|
||||
} else {
|
||||
LexLogger
|
||||
.debug("Checking component state from updateCommand BEFORE component assignment");
|
||||
LexLogger.debugComponent(component);
|
||||
ILexComponent doomedComponent = term.findChild(component);
|
||||
doomedComponent.setDeleted(Boolean.TRUE);
|
||||
LexComponentRepository.update(doomedComponent);
|
||||
term.removeChild(doomedComponent);
|
||||
LexComponentRepository.update(term);
|
||||
}
|
||||
msg = "Successfully removed component";
|
||||
} else {
|
||||
msg = CommandToken.isValid(req) ? "Unauthorized update attempted"
|
||||
: "Invalid reload attempted.";
|
||||
}
|
||||
return next;
|
||||
} catch (LexComponentException e) {
|
||||
throw new CommandException("Command had trouble processing "
|
||||
+ component, e);
|
||||
} catch (LexRepositoryException e) {
|
||||
throw new CommandException("Command had trouble processing "
|
||||
+ component, e);
|
||||
} finally {
|
||||
req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg);
|
||||
}
|
||||
}
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Constructor for the GetFormCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
* @param termMode
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public RemoveCommand(String next, Boolean termMode) {
|
||||
super(next);
|
||||
setTermMode(termMode.booleanValue());
|
||||
}
|
||||
}
|
||||
|
175
src/java/org/thdl/lex/commands/UpdateCommand.java
Normal file
175
src/java/org/thdl/lex/commands/UpdateCommand.java
Normal file
|
@ -0,0 +1,175 @@
|
|||
package org.thdl.lex.commands;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.thdl.lex.DisplayHelper;
|
||||
import org.thdl.lex.LexComponentRepository;
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexLogger;
|
||||
import org.thdl.lex.LexQuery;
|
||||
import org.thdl.lex.LexRepositoryException;
|
||||
import org.thdl.lex.UserSessionManager;
|
||||
import org.thdl.lex.Visit;
|
||||
import org.thdl.lex.component.AnalyticalNote;
|
||||
import org.thdl.lex.component.ILexComponent;
|
||||
import org.thdl.lex.component.ITerm;
|
||||
import org.thdl.lex.component.LexComponentException;
|
||||
import org.thdl.lex.component.Translatable;
|
||||
import org.thdl.users.ThdlUser;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 6, 2003
|
||||
*/
|
||||
public class UpdateCommand extends LexCommand implements Command {
|
||||
|
||||
private boolean termMode;
|
||||
|
||||
/**
|
||||
* Sets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @param termMode
|
||||
* The new termMode value
|
||||
*/
|
||||
public void setTermMode(boolean termMode) {
|
||||
this.termMode = termMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the termMode attribute of the GetFormCommand object
|
||||
*
|
||||
* @return The termMode value
|
||||
*/
|
||||
public boolean isTermMode() {
|
||||
return termMode;
|
||||
}
|
||||
|
||||
//helper methods
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param req
|
||||
* Description of the Parameter
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception CommandException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public String execute(HttpServletRequest req, ILexComponent component)
|
||||
throws CommandException {
|
||||
String msg = null;
|
||||
String next = getNext();
|
||||
Visit visit = UserSessionManager.getInstance().getVisit(
|
||||
req.getSession(true));
|
||||
|
||||
DisplayHelper displayHelper = visit.getHelper();
|
||||
try {
|
||||
HttpSession ses = req.getSession(false);
|
||||
if (null == ses) {
|
||||
throw new CommandException(
|
||||
"Could not update component, user's session has expired");
|
||||
}
|
||||
|
||||
ThdlUser user = visit.getUser();
|
||||
LexQuery query = visit.getQuery();
|
||||
ITerm term = query.getEntry();
|
||||
|
||||
if (CommandToken.isValid(req) && validate(user, component)) {
|
||||
LexComponentRepository.update(term);
|
||||
|
||||
LexLogger
|
||||
.debug("Checking component state from updateCommand BEFORE component assignment");
|
||||
LexLogger.debugComponent(component);
|
||||
if (isTermMode()) {
|
||||
term.populate(req.getParameterMap());
|
||||
term.getMeta().populate(req.getParameterMap());
|
||||
component = term;
|
||||
} else if (component instanceof AnalyticalNote) {
|
||||
LexLogger
|
||||
.debug("Debugging Component before updating analytical note");
|
||||
LexLogger.debugComponent(component);
|
||||
ILexComponent parent = term.findParent(component
|
||||
.getParentId());
|
||||
List notes = parent.getAnalyticalNotes();
|
||||
ILexComponent ilc = (ILexComponent) notes.get(notes
|
||||
.indexOf(component));
|
||||
ilc.populate(component);
|
||||
} else if (component instanceof Translatable
|
||||
&& null != ((Translatable) component)
|
||||
.getTranslationOf()) {
|
||||
Translatable translation = (Translatable) component;
|
||||
Translatable source = null;
|
||||
try {
|
||||
source = (Translatable) translation.getClass()
|
||||
.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new CommandException(e);
|
||||
}
|
||||
source.setMetaId(translation.getTranslationOf());
|
||||
source.setParentId(translation.getParentId());
|
||||
source = (Translatable) term.findChild(source);
|
||||
List translationList = source.getTranslations();
|
||||
component = (ILexComponent) translationList
|
||||
.get(translationList.indexOf(translation));
|
||||
component.populate(req.getParameterMap());
|
||||
component.getMeta().populate(req.getParameterMap());
|
||||
} else {
|
||||
ILexComponent ilc = term.findChild(component.getMetaId());
|
||||
ilc.populate(req.getParameterMap());
|
||||
ilc.getMeta().populate(req.getParameterMap());
|
||||
component = ilc;
|
||||
}
|
||||
LexLogger
|
||||
.debug("Checking component state from updateCommand AFTER component assignment");
|
||||
LexLogger.debugComponent(component);
|
||||
|
||||
Date now = new Date(System.currentTimeMillis());
|
||||
component.getMeta().setModifiedOn(now);
|
||||
component.getMeta().setModifiedBy(user.getId());
|
||||
term.getMeta().setModifiedOn(now);
|
||||
term.getMeta().setModifiedBy(user.getId());
|
||||
|
||||
LexLogger.debugComponent(component);
|
||||
LexLogger.debugComponent(term);
|
||||
|
||||
LexComponentRepository.update(term);
|
||||
msg = "Successful Update";
|
||||
visit.setDisplayMode("edit");
|
||||
} else {
|
||||
msg = CommandToken.isValid(req) ? "Unauthorized update attempted"
|
||||
: "Invalid reload attempted.";
|
||||
}
|
||||
return next;
|
||||
} catch (LexComponentException e) {
|
||||
throw new CommandException(e);
|
||||
} catch (LexRepositoryException e) {
|
||||
throw new CommandException("Command had trouble processing "
|
||||
+ component, e);
|
||||
} finally {
|
||||
req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg);
|
||||
}
|
||||
}
|
||||
|
||||
//constructors
|
||||
/**
|
||||
* Constructor for the GetFormCommand object
|
||||
*
|
||||
* @param next
|
||||
* Description of the Parameter
|
||||
* @param termMode
|
||||
* Description of the Parameter
|
||||
*/
|
||||
public UpdateCommand(String next, Boolean termMode) {
|
||||
super(next);
|
||||
setTermMode(termMode.booleanValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
7
src/java/org/thdl/lex/component/AnalyticalNote.java
Normal file
7
src/java/org/thdl/lex/component/AnalyticalNote.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AnalyticalNote extends BaseAnalyticalNote implements Serializable {
|
||||
|
||||
}
|
70
src/java/org/thdl/lex/component/BaseAnalyticalNote.java
Normal file
70
src/java/org/thdl/lex/component/BaseAnalyticalNote.java
Normal file
|
@ -0,0 +1,70 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseAnalyticalNote extends LexComponent implements
|
||||
Serializable, org.thdl.lex.component.IAnalyticalNote {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String analyticalNote;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseAnalyticalNote(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String analyticalNote, org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.analyticalNote = analyticalNote;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseAnalyticalNote() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseAnalyticalNote(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getAnalyticalNote() {
|
||||
return this.analyticalNote;
|
||||
}
|
||||
|
||||
public void setAnalyticalNote(String analyticalNote) {
|
||||
this.analyticalNote = analyticalNote;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
208
src/java/org/thdl/lex/component/BaseDefinition.java
Normal file
208
src/java/org/thdl/lex/component/BaseDefinition.java
Normal file
|
@ -0,0 +1,208 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseDefinition extends LexComponent implements
|
||||
org.thdl.lex.component.IDefinition,
|
||||
org.thdl.lex.component.Translatable,
|
||||
org.thdl.lex.component.LexComponentNode, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String definition;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer translationOf;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** persistent field */
|
||||
private List translations;
|
||||
|
||||
/** persistent field */
|
||||
private List subdefinitions;
|
||||
|
||||
/** persistent field */
|
||||
private List glosses;
|
||||
|
||||
/** persistent field */
|
||||
private List keywords;
|
||||
|
||||
/** persistent field */
|
||||
private List modelSentences;
|
||||
|
||||
/** persistent field */
|
||||
private List translationEquivalents;
|
||||
|
||||
/** persistent field */
|
||||
private List relatedTerms;
|
||||
|
||||
/** persistent field */
|
||||
private List passages;
|
||||
|
||||
/** persistent field */
|
||||
private List registers;
|
||||
|
||||
/** full constructor */
|
||||
public BaseDefinition(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String definition, Integer translationOf,
|
||||
org.thdl.lex.component.ILexComponent parent, List translations,
|
||||
List subdefinitions, List glosses, List keywords,
|
||||
List modelSentences, List translationEquivalents,
|
||||
List relatedTerms, List passages, List registers) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.definition = definition;
|
||||
this.translationOf = translationOf;
|
||||
this.parent = parent;
|
||||
this.translations = translations;
|
||||
this.subdefinitions = subdefinitions;
|
||||
this.glosses = glosses;
|
||||
this.keywords = keywords;
|
||||
this.modelSentences = modelSentences;
|
||||
this.translationEquivalents = translationEquivalents;
|
||||
this.relatedTerms = relatedTerms;
|
||||
this.passages = passages;
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseDefinition() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseDefinition(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, List translations,
|
||||
List subdefinitions, List glosses, List keywords,
|
||||
List modelSentences, List translationEquivalents,
|
||||
List relatedTerms, List passages, List registers) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.translations = translations;
|
||||
this.subdefinitions = subdefinitions;
|
||||
this.glosses = glosses;
|
||||
this.keywords = keywords;
|
||||
this.modelSentences = modelSentences;
|
||||
this.translationEquivalents = translationEquivalents;
|
||||
this.relatedTerms = relatedTerms;
|
||||
this.passages = passages;
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return this.definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Integer getTranslationOf() {
|
||||
return this.translationOf;
|
||||
}
|
||||
|
||||
public void setTranslationOf(Integer translationOf) {
|
||||
this.translationOf = translationOf;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List getTranslations() {
|
||||
return this.translations;
|
||||
}
|
||||
|
||||
public void setTranslations(List translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
public List getSubdefinitions() {
|
||||
return this.subdefinitions;
|
||||
}
|
||||
|
||||
public void setSubdefinitions(List subdefinitions) {
|
||||
this.subdefinitions = subdefinitions;
|
||||
}
|
||||
|
||||
public List getGlosses() {
|
||||
return this.glosses;
|
||||
}
|
||||
|
||||
public void setGlosses(List glosses) {
|
||||
this.glosses = glosses;
|
||||
}
|
||||
|
||||
public List getKeywords() {
|
||||
return this.keywords;
|
||||
}
|
||||
|
||||
public void setKeywords(List keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
|
||||
public List getModelSentences() {
|
||||
return this.modelSentences;
|
||||
}
|
||||
|
||||
public void setModelSentences(List modelSentences) {
|
||||
this.modelSentences = modelSentences;
|
||||
}
|
||||
|
||||
public List getTranslationEquivalents() {
|
||||
return this.translationEquivalents;
|
||||
}
|
||||
|
||||
public void setTranslationEquivalents(List translationEquivalents) {
|
||||
this.translationEquivalents = translationEquivalents;
|
||||
}
|
||||
|
||||
public List getRelatedTerms() {
|
||||
return this.relatedTerms;
|
||||
}
|
||||
|
||||
public void setRelatedTerms(List relatedTerms) {
|
||||
this.relatedTerms = relatedTerms;
|
||||
}
|
||||
|
||||
public List getPassages() {
|
||||
return this.passages;
|
||||
}
|
||||
|
||||
public void setPassages(List passages) {
|
||||
this.passages = passages;
|
||||
}
|
||||
|
||||
public List getRegisters() {
|
||||
return this.registers;
|
||||
}
|
||||
|
||||
public void setRegisters(List registers) {
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
85
src/java/org/thdl/lex/component/BaseEncyclopediaArticle.java
Normal file
85
src/java/org/thdl/lex/component/BaseEncyclopediaArticle.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseEncyclopediaArticle extends LexComponent implements
|
||||
org.thdl.lex.component.IEncyclopediaArticle, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** persistent field */
|
||||
private String article;
|
||||
|
||||
/** persistent field */
|
||||
private String articleTitle;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseEncyclopediaArticle(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId, String article,
|
||||
String articleTitle, org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.article = article;
|
||||
this.articleTitle = articleTitle;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseEncyclopediaArticle() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseEncyclopediaArticle(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, String article,
|
||||
String articleTitle) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.article = article;
|
||||
this.articleTitle = articleTitle;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getArticle() {
|
||||
return this.article;
|
||||
}
|
||||
|
||||
public void setArticle(String article) {
|
||||
this.article = article;
|
||||
}
|
||||
|
||||
public String getArticleTitle() {
|
||||
return this.articleTitle;
|
||||
}
|
||||
|
||||
public void setArticleTitle(String articleTitle) {
|
||||
this.articleTitle = articleTitle;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
138
src/java/org/thdl/lex/component/BaseEtymology.java
Normal file
138
src/java/org/thdl/lex/component/BaseEtymology.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseEtymology extends LexComponent implements
|
||||
org.thdl.lex.component.Translatable, Serializable,
|
||||
org.thdl.lex.component.IEtymology {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer loanLanguage;
|
||||
|
||||
/** persistent field */
|
||||
private Integer etymologyType;
|
||||
|
||||
/** persistent field */
|
||||
private String derivation;
|
||||
|
||||
/** persistent field */
|
||||
private String etymologyDescription;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer translationOf;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** persistent field */
|
||||
private List translations;
|
||||
|
||||
/** full constructor */
|
||||
public BaseEtymology(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
Integer loanLanguage, Integer etymologyType, String derivation,
|
||||
String etymologyDescription, Integer translationOf,
|
||||
org.thdl.lex.component.ILexComponent parent, List translations) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.loanLanguage = loanLanguage;
|
||||
this.etymologyType = etymologyType;
|
||||
this.derivation = derivation;
|
||||
this.etymologyDescription = etymologyDescription;
|
||||
this.translationOf = translationOf;
|
||||
this.parent = parent;
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseEtymology() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseEtymology(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer etymologyType,
|
||||
String derivation, String etymologyDescription, List translations) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.etymologyType = etymologyType;
|
||||
this.derivation = derivation;
|
||||
this.etymologyDescription = etymologyDescription;
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getLoanLanguage() {
|
||||
return this.loanLanguage;
|
||||
}
|
||||
|
||||
public void setLoanLanguage(Integer loanLanguage) {
|
||||
this.loanLanguage = loanLanguage;
|
||||
}
|
||||
|
||||
public Integer getEtymologyType() {
|
||||
return this.etymologyType;
|
||||
}
|
||||
|
||||
public void setEtymologyType(Integer etymologyType) {
|
||||
this.etymologyType = etymologyType;
|
||||
}
|
||||
|
||||
public String getDerivation() {
|
||||
return this.derivation;
|
||||
}
|
||||
|
||||
public void setDerivation(String derivation) {
|
||||
this.derivation = derivation;
|
||||
}
|
||||
|
||||
public String getEtymologyDescription() {
|
||||
return this.etymologyDescription;
|
||||
}
|
||||
|
||||
public void setEtymologyDescription(String etymologyDescription) {
|
||||
this.etymologyDescription = etymologyDescription;
|
||||
}
|
||||
|
||||
public Integer getTranslationOf() {
|
||||
return this.translationOf;
|
||||
}
|
||||
|
||||
public void setTranslationOf(Integer translationOf) {
|
||||
this.translationOf = translationOf;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List getTranslations() {
|
||||
return this.translations;
|
||||
}
|
||||
|
||||
public void setTranslations(List translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
82
src/java/org/thdl/lex/component/BaseGloss.java
Normal file
82
src/java/org/thdl/lex/component/BaseGloss.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseGloss extends LexComponent implements
|
||||
org.thdl.lex.component.IGloss, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String gloss;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String translation;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseGloss(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId, String gloss,
|
||||
String translation, org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.gloss = gloss;
|
||||
this.translation = translation;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseGloss() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseGloss(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getGloss() {
|
||||
return this.gloss;
|
||||
}
|
||||
|
||||
public void setGloss(String gloss) {
|
||||
this.gloss = gloss;
|
||||
}
|
||||
|
||||
public String getTranslation() {
|
||||
return this.translation;
|
||||
}
|
||||
|
||||
public void setTranslation(String translation) {
|
||||
this.translation = translation;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
71
src/java/org/thdl/lex/component/BaseGrammaticalFunction.java
Normal file
71
src/java/org/thdl/lex/component/BaseGrammaticalFunction.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseGrammaticalFunction extends LexComponent implements
|
||||
org.thdl.lex.component.IFunction, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** persistent field */
|
||||
private Integer function;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseGrammaticalFunction(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
Integer function, org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.function = function;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseGrammaticalFunction() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseGrammaticalFunction(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer function) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.function = function;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getFunction() {
|
||||
return this.function;
|
||||
}
|
||||
|
||||
public void setFunction(Integer function) {
|
||||
this.function = function;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
70
src/java/org/thdl/lex/component/BaseKeyword.java
Normal file
70
src/java/org/thdl/lex/component/BaseKeyword.java
Normal file
|
@ -0,0 +1,70 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseKeyword extends LexComponent implements
|
||||
org.thdl.lex.component.IKeyword, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String keyword;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseKeyword(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId, String keyword,
|
||||
org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.keyword = keyword;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseKeyword() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseKeyword(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getKeyword() {
|
||||
return this.keyword;
|
||||
}
|
||||
|
||||
public void setKeyword(String keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
87
src/java/org/thdl/lex/component/BaseLexComponent.java
Normal file
87
src/java/org/thdl/lex/component/BaseLexComponent.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseLexComponent implements
|
||||
org.thdl.lex.component.ILexComponent, Serializable {
|
||||
|
||||
/** identifier field */
|
||||
private Integer metaId;
|
||||
|
||||
/** persistent field */
|
||||
private Boolean deleted;
|
||||
|
||||
/** persistent field */
|
||||
private List analyticalNotes;
|
||||
|
||||
/** persistent field */
|
||||
private org.thdl.lex.component.Meta meta;
|
||||
|
||||
/** full constructor */
|
||||
public BaseLexComponent(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta) {
|
||||
this.deleted = deleted;
|
||||
this.analyticalNotes = analyticalNotes;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseLexComponent() {
|
||||
}
|
||||
|
||||
public Integer getMetaId() {
|
||||
return this.metaId;
|
||||
}
|
||||
|
||||
public void setMetaId(Integer metaId) {
|
||||
this.metaId = metaId;
|
||||
}
|
||||
|
||||
public Boolean getDeleted() {
|
||||
return this.deleted;
|
||||
}
|
||||
|
||||
public void setDeleted(Boolean deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public List getAnalyticalNotes() {
|
||||
return this.analyticalNotes;
|
||||
}
|
||||
|
||||
public void setAnalyticalNotes(List analyticalNotes) {
|
||||
this.analyticalNotes = analyticalNotes;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.Meta getMeta() {
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public void setMeta(org.thdl.lex.component.Meta meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof BaseLexComponent))
|
||||
return false;
|
||||
BaseLexComponent castOther = (BaseLexComponent) other;
|
||||
return new EqualsBuilder().append(this.getMetaId(),
|
||||
castOther.getMetaId()).isEquals();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder().append(getMetaId()).toHashCode();
|
||||
}
|
||||
|
||||
}
|
172
src/java/org/thdl/lex/component/BaseMeta.java
Normal file
172
src/java/org/thdl/lex/component/BaseMeta.java
Normal file
|
@ -0,0 +1,172 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseMeta implements Serializable {
|
||||
|
||||
/** persistent field */
|
||||
private Integer createdBy;
|
||||
|
||||
/** persistent field */
|
||||
private Integer modifiedBy;
|
||||
|
||||
/** persistent field */
|
||||
private Integer createdByProjSub;
|
||||
|
||||
/** persistent field */
|
||||
private Integer modifiedByProjSub;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Date createdOn;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Date modifiedOn;
|
||||
|
||||
/** persistent field */
|
||||
private Integer source;
|
||||
|
||||
/** persistent field */
|
||||
private Integer language;
|
||||
|
||||
/** persistent field */
|
||||
private Integer script;
|
||||
|
||||
/** persistent field */
|
||||
private Integer dialect;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String note;
|
||||
|
||||
/** full constructor */
|
||||
public BaseMeta(Integer createdBy, Integer modifiedBy,
|
||||
Integer createdByProjSub, Integer modifiedByProjSub,
|
||||
Date createdOn, Date modifiedOn, Integer source, Integer language,
|
||||
Integer script, Integer dialect, String note) {
|
||||
this.createdBy = createdBy;
|
||||
this.modifiedBy = modifiedBy;
|
||||
this.createdByProjSub = createdByProjSub;
|
||||
this.modifiedByProjSub = modifiedByProjSub;
|
||||
this.createdOn = createdOn;
|
||||
this.modifiedOn = modifiedOn;
|
||||
this.source = source;
|
||||
this.language = language;
|
||||
this.script = script;
|
||||
this.dialect = dialect;
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseMeta() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseMeta(Integer createdBy, Integer modifiedBy,
|
||||
Integer createdByProjSub, Integer modifiedByProjSub,
|
||||
Integer source, Integer language, Integer script, Integer dialect) {
|
||||
this.createdBy = createdBy;
|
||||
this.modifiedBy = modifiedBy;
|
||||
this.createdByProjSub = createdByProjSub;
|
||||
this.modifiedByProjSub = modifiedByProjSub;
|
||||
this.source = source;
|
||||
this.language = language;
|
||||
this.script = script;
|
||||
this.dialect = dialect;
|
||||
}
|
||||
|
||||
public Integer getCreatedBy() {
|
||||
return this.createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(Integer createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Integer getModifiedBy() {
|
||||
return this.modifiedBy;
|
||||
}
|
||||
|
||||
public void setModifiedBy(Integer modifiedBy) {
|
||||
this.modifiedBy = modifiedBy;
|
||||
}
|
||||
|
||||
public Integer getCreatedByProjSub() {
|
||||
return this.createdByProjSub;
|
||||
}
|
||||
|
||||
public void setCreatedByProjSub(Integer createdByProjSub) {
|
||||
this.createdByProjSub = createdByProjSub;
|
||||
}
|
||||
|
||||
public Integer getModifiedByProjSub() {
|
||||
return this.modifiedByProjSub;
|
||||
}
|
||||
|
||||
public void setModifiedByProjSub(Integer modifiedByProjSub) {
|
||||
this.modifiedByProjSub = modifiedByProjSub;
|
||||
}
|
||||
|
||||
public Date getCreatedOn() {
|
||||
return this.createdOn;
|
||||
}
|
||||
|
||||
public void setCreatedOn(Date createdOn) {
|
||||
this.createdOn = createdOn;
|
||||
}
|
||||
|
||||
public Date getModifiedOn() {
|
||||
return this.modifiedOn;
|
||||
}
|
||||
|
||||
public void setModifiedOn(Date modifiedOn) {
|
||||
this.modifiedOn = modifiedOn;
|
||||
}
|
||||
|
||||
public Integer getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
public void setSource(Integer source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public Integer getLanguage() {
|
||||
return this.language;
|
||||
}
|
||||
|
||||
public void setLanguage(Integer language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public Integer getScript() {
|
||||
return this.script;
|
||||
}
|
||||
|
||||
public void setScript(Integer script) {
|
||||
this.script = script;
|
||||
}
|
||||
|
||||
public Integer getDialect() {
|
||||
return this.dialect;
|
||||
}
|
||||
|
||||
public void setDialect(Integer dialect) {
|
||||
this.dialect = dialect;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return this.note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).toString();
|
||||
}
|
||||
|
||||
}
|
97
src/java/org/thdl/lex/component/BaseModelSentence.java
Normal file
97
src/java/org/thdl/lex/component/BaseModelSentence.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseModelSentence extends LexComponent implements
|
||||
org.thdl.lex.component.IModelSentence, Serializable,
|
||||
org.thdl.lex.component.Translatable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String modelSentence;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer translationOf;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** persistent field */
|
||||
private List translations;
|
||||
|
||||
/** full constructor */
|
||||
public BaseModelSentence(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String modelSentence, Integer translationOf,
|
||||
org.thdl.lex.component.ILexComponent parent, List translations) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.modelSentence = modelSentence;
|
||||
this.translationOf = translationOf;
|
||||
this.parent = parent;
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseModelSentence() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseModelSentence(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, List translations) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getModelSentence() {
|
||||
return this.modelSentence;
|
||||
}
|
||||
|
||||
public void setModelSentence(String modelSentence) {
|
||||
this.modelSentence = modelSentence;
|
||||
}
|
||||
|
||||
public Integer getTranslationOf() {
|
||||
return this.translationOf;
|
||||
}
|
||||
|
||||
public void setTranslationOf(Integer translationOf) {
|
||||
this.translationOf = translationOf;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List getTranslations() {
|
||||
return this.translations;
|
||||
}
|
||||
|
||||
public void setTranslations(List translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
134
src/java/org/thdl/lex/component/BasePassage.java
Normal file
134
src/java/org/thdl/lex/component/BasePassage.java
Normal file
|
@ -0,0 +1,134 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BasePassage extends LexComponent implements
|
||||
org.thdl.lex.component.IPassage, org.thdl.lex.component.Translatable,
|
||||
Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String literarySource;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String spelling;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String pagination;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String passage;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer translationOf;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** persistent field */
|
||||
private List translations;
|
||||
|
||||
/** full constructor */
|
||||
public BasePassage(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String literarySource, String spelling, String pagination,
|
||||
String passage, Integer translationOf,
|
||||
org.thdl.lex.component.ILexComponent parent, List translations) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.literarySource = literarySource;
|
||||
this.spelling = spelling;
|
||||
this.pagination = pagination;
|
||||
this.passage = passage;
|
||||
this.translationOf = translationOf;
|
||||
this.parent = parent;
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BasePassage() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BasePassage(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, List translations) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getLiterarySource() {
|
||||
return this.literarySource;
|
||||
}
|
||||
|
||||
public void setLiterarySource(String literarySource) {
|
||||
this.literarySource = literarySource;
|
||||
}
|
||||
|
||||
public String getSpelling() {
|
||||
return this.spelling;
|
||||
}
|
||||
|
||||
public void setSpelling(String spelling) {
|
||||
this.spelling = spelling;
|
||||
}
|
||||
|
||||
public String getPagination() {
|
||||
return this.pagination;
|
||||
}
|
||||
|
||||
public void setPagination(String pagination) {
|
||||
this.pagination = pagination;
|
||||
}
|
||||
|
||||
public String getPassage() {
|
||||
return this.passage;
|
||||
}
|
||||
|
||||
public void setPassage(String passage) {
|
||||
this.passage = passage;
|
||||
}
|
||||
|
||||
public Integer getTranslationOf() {
|
||||
return this.translationOf;
|
||||
}
|
||||
|
||||
public void setTranslationOf(Integer translationOf) {
|
||||
this.translationOf = translationOf;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List getTranslations() {
|
||||
return this.translations;
|
||||
}
|
||||
|
||||
public void setTranslations(List translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
86
src/java/org/thdl/lex/component/BasePronunciation.java
Normal file
86
src/java/org/thdl/lex/component/BasePronunciation.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BasePronunciation extends LexComponent implements
|
||||
org.thdl.lex.component.IPronunciation, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** persistent field */
|
||||
private String phonetics;
|
||||
|
||||
/** persistent field */
|
||||
private Integer phoneticsType;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BasePronunciation(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String phonetics, Integer phoneticsType,
|
||||
org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.phonetics = phonetics;
|
||||
this.phoneticsType = phoneticsType;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BasePronunciation() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BasePronunciation(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, String phonetics,
|
||||
Integer phoneticsType) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.phonetics = phonetics;
|
||||
this.phoneticsType = phoneticsType;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getPhonetics() {
|
||||
return this.phonetics;
|
||||
}
|
||||
|
||||
public void setPhonetics(String phonetics) {
|
||||
this.phonetics = phonetics;
|
||||
}
|
||||
|
||||
public Integer getPhoneticsType() {
|
||||
return this.phoneticsType;
|
||||
}
|
||||
|
||||
public void setPhoneticsType(Integer phoneticsType) {
|
||||
this.phoneticsType = phoneticsType;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
84
src/java/org/thdl/lex/component/BaseRelatedTerm.java
Normal file
84
src/java/org/thdl/lex/component/BaseRelatedTerm.java
Normal file
|
@ -0,0 +1,84 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseRelatedTerm extends LexComponent implements
|
||||
Serializable, org.thdl.lex.component.IRelatedTerm {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String relatedTerm;
|
||||
|
||||
/** persistent field */
|
||||
private Integer relatedTermType;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseRelatedTerm(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String relatedTerm, Integer relatedTermType,
|
||||
org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.relatedTerm = relatedTerm;
|
||||
this.relatedTermType = relatedTermType;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseRelatedTerm() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseRelatedTerm(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer relatedTermType) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.relatedTermType = relatedTermType;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getRelatedTerm() {
|
||||
return this.relatedTerm;
|
||||
}
|
||||
|
||||
public void setRelatedTerm(String relatedTerm) {
|
||||
this.relatedTerm = relatedTerm;
|
||||
}
|
||||
|
||||
public Integer getRelatedTermType() {
|
||||
return this.relatedTermType;
|
||||
}
|
||||
|
||||
public void setRelatedTermType(Integer relatedTermType) {
|
||||
this.relatedTermType = relatedTermType;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
71
src/java/org/thdl/lex/component/BaseSpeechRegister.java
Normal file
71
src/java/org/thdl/lex/component/BaseSpeechRegister.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseSpeechRegister extends LexComponent implements
|
||||
org.thdl.lex.component.IRegister, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** persistent field */
|
||||
private Integer register;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseSpeechRegister(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
Integer register, org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.register = register;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseSpeechRegister() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseSpeechRegister(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer register) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.register = register;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getRegister() {
|
||||
return this.register;
|
||||
}
|
||||
|
||||
public void setRegister(Integer register) {
|
||||
this.register = register;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
86
src/java/org/thdl/lex/component/BaseSpelling.java
Normal file
86
src/java/org/thdl/lex/component/BaseSpelling.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseSpelling extends LexComponent implements
|
||||
Serializable, org.thdl.lex.component.ISpelling {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** persistent field */
|
||||
private String spelling;
|
||||
|
||||
/** persistent field */
|
||||
private Integer spellingType;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseSpelling(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String spelling, Integer spellingType,
|
||||
org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.spelling = spelling;
|
||||
this.spellingType = spellingType;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseSpelling() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseSpelling(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, String spelling,
|
||||
Integer spellingType) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.spelling = spelling;
|
||||
this.spellingType = spellingType;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getSpelling() {
|
||||
return this.spelling;
|
||||
}
|
||||
|
||||
public void setSpelling(String spelling) {
|
||||
this.spelling = spelling;
|
||||
}
|
||||
|
||||
public Integer getSpellingType() {
|
||||
return this.spellingType;
|
||||
}
|
||||
|
||||
public void setSpellingType(Integer spellingType) {
|
||||
this.spellingType = spellingType;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
194
src/java/org/thdl/lex/component/BaseSubdefinition.java
Normal file
194
src/java/org/thdl/lex/component/BaseSubdefinition.java
Normal file
|
@ -0,0 +1,194 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseSubdefinition extends LexComponent implements
|
||||
org.thdl.lex.component.ISubdefinition,
|
||||
org.thdl.lex.component.Translatable,
|
||||
org.thdl.lex.component.LexComponentNode, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String subdefinition;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer translationOf;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** persistent field */
|
||||
private List translations;
|
||||
|
||||
/** persistent field */
|
||||
private List glosses;
|
||||
|
||||
/** persistent field */
|
||||
private List keywords;
|
||||
|
||||
/** persistent field */
|
||||
private List modelSentences;
|
||||
|
||||
/** persistent field */
|
||||
private List translationEquivalents;
|
||||
|
||||
/** persistent field */
|
||||
private List relatedTerms;
|
||||
|
||||
/** persistent field */
|
||||
private List passages;
|
||||
|
||||
/** persistent field */
|
||||
private List registers;
|
||||
|
||||
/** full constructor */
|
||||
public BaseSubdefinition(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String subdefinition, Integer translationOf,
|
||||
org.thdl.lex.component.ILexComponent parent, List translations,
|
||||
List glosses, List keywords, List modelSentences,
|
||||
List translationEquivalents, List relatedTerms, List passages,
|
||||
List registers) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.subdefinition = subdefinition;
|
||||
this.translationOf = translationOf;
|
||||
this.parent = parent;
|
||||
this.translations = translations;
|
||||
this.glosses = glosses;
|
||||
this.keywords = keywords;
|
||||
this.modelSentences = modelSentences;
|
||||
this.translationEquivalents = translationEquivalents;
|
||||
this.relatedTerms = relatedTerms;
|
||||
this.passages = passages;
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseSubdefinition() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseSubdefinition(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, List translations, List glosses,
|
||||
List keywords, List modelSentences, List translationEquivalents,
|
||||
List relatedTerms, List passages, List registers) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.translations = translations;
|
||||
this.glosses = glosses;
|
||||
this.keywords = keywords;
|
||||
this.modelSentences = modelSentences;
|
||||
this.translationEquivalents = translationEquivalents;
|
||||
this.relatedTerms = relatedTerms;
|
||||
this.passages = passages;
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getSubdefinition() {
|
||||
return this.subdefinition;
|
||||
}
|
||||
|
||||
public void setSubdefinition(String subdefinition) {
|
||||
this.subdefinition = subdefinition;
|
||||
}
|
||||
|
||||
public Integer getTranslationOf() {
|
||||
return this.translationOf;
|
||||
}
|
||||
|
||||
public void setTranslationOf(Integer translationOf) {
|
||||
this.translationOf = translationOf;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List getTranslations() {
|
||||
return this.translations;
|
||||
}
|
||||
|
||||
public void setTranslations(List translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
|
||||
public List getGlosses() {
|
||||
return this.glosses;
|
||||
}
|
||||
|
||||
public void setGlosses(List glosses) {
|
||||
this.glosses = glosses;
|
||||
}
|
||||
|
||||
public List getKeywords() {
|
||||
return this.keywords;
|
||||
}
|
||||
|
||||
public void setKeywords(List keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
|
||||
public List getModelSentences() {
|
||||
return this.modelSentences;
|
||||
}
|
||||
|
||||
public void setModelSentences(List modelSentences) {
|
||||
this.modelSentences = modelSentences;
|
||||
}
|
||||
|
||||
public List getTranslationEquivalents() {
|
||||
return this.translationEquivalents;
|
||||
}
|
||||
|
||||
public void setTranslationEquivalents(List translationEquivalents) {
|
||||
this.translationEquivalents = translationEquivalents;
|
||||
}
|
||||
|
||||
public List getRelatedTerms() {
|
||||
return this.relatedTerms;
|
||||
}
|
||||
|
||||
public void setRelatedTerms(List relatedTerms) {
|
||||
this.relatedTerms = relatedTerms;
|
||||
}
|
||||
|
||||
public List getPassages() {
|
||||
return this.passages;
|
||||
}
|
||||
|
||||
public void setPassages(List passages) {
|
||||
this.passages = passages;
|
||||
}
|
||||
|
||||
public List getRegisters() {
|
||||
return this.registers;
|
||||
}
|
||||
|
||||
public void setRegisters(List registers) {
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
213
src/java/org/thdl/lex/component/BaseTerm.java
Normal file
213
src/java/org/thdl/lex/component/BaseTerm.java
Normal file
|
@ -0,0 +1,213 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseTerm extends LexComponent implements
|
||||
org.thdl.lex.component.ITerm, Serializable,
|
||||
org.thdl.lex.component.LexComponentNode {
|
||||
|
||||
/** persistent field */
|
||||
private String term;
|
||||
|
||||
/** persistent field */
|
||||
private List pronunciations;
|
||||
|
||||
/** persistent field */
|
||||
private List etymologies;
|
||||
|
||||
/** persistent field */
|
||||
private List spellings;
|
||||
|
||||
/** persistent field */
|
||||
private List functions;
|
||||
|
||||
/** persistent field */
|
||||
private List encyclopediaArticles;
|
||||
|
||||
/** persistent field */
|
||||
private List transitionalData;
|
||||
|
||||
/** persistent field */
|
||||
private List definitions;
|
||||
|
||||
/** persistent field */
|
||||
private List glosses;
|
||||
|
||||
/** persistent field */
|
||||
private List keywords;
|
||||
|
||||
/** persistent field */
|
||||
private List modelSentences;
|
||||
|
||||
/** persistent field */
|
||||
private List translationEquivalents;
|
||||
|
||||
/** persistent field */
|
||||
private List relatedTerms;
|
||||
|
||||
/** persistent field */
|
||||
private List passages;
|
||||
|
||||
/** persistent field */
|
||||
private List registers;
|
||||
|
||||
/** full constructor */
|
||||
public BaseTerm(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, String term, List pronunciations,
|
||||
List etymologies, List spellings, List functions,
|
||||
List encyclopediaArticles, List transitionalData, List definitions,
|
||||
List glosses, List keywords, List modelSentences,
|
||||
List translationEquivalents, List relatedTerms, List passages,
|
||||
List registers) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.term = term;
|
||||
this.pronunciations = pronunciations;
|
||||
this.etymologies = etymologies;
|
||||
this.spellings = spellings;
|
||||
this.functions = functions;
|
||||
this.encyclopediaArticles = encyclopediaArticles;
|
||||
this.transitionalData = transitionalData;
|
||||
this.definitions = definitions;
|
||||
this.glosses = glosses;
|
||||
this.keywords = keywords;
|
||||
this.modelSentences = modelSentences;
|
||||
this.translationEquivalents = translationEquivalents;
|
||||
this.relatedTerms = relatedTerms;
|
||||
this.passages = passages;
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseTerm() {
|
||||
}
|
||||
|
||||
public String getTerm() {
|
||||
return this.term;
|
||||
}
|
||||
|
||||
public void setTerm(String term) {
|
||||
this.term = term;
|
||||
}
|
||||
|
||||
public List getPronunciations() {
|
||||
return this.pronunciations;
|
||||
}
|
||||
|
||||
public void setPronunciations(List pronunciations) {
|
||||
this.pronunciations = pronunciations;
|
||||
}
|
||||
|
||||
public List getEtymologies() {
|
||||
return this.etymologies;
|
||||
}
|
||||
|
||||
public void setEtymologies(List etymologies) {
|
||||
this.etymologies = etymologies;
|
||||
}
|
||||
|
||||
public List getSpellings() {
|
||||
return this.spellings;
|
||||
}
|
||||
|
||||
public void setSpellings(List spellings) {
|
||||
this.spellings = spellings;
|
||||
}
|
||||
|
||||
public List getFunctions() {
|
||||
return this.functions;
|
||||
}
|
||||
|
||||
public void setFunctions(List functions) {
|
||||
this.functions = functions;
|
||||
}
|
||||
|
||||
public List getEncyclopediaArticles() {
|
||||
return this.encyclopediaArticles;
|
||||
}
|
||||
|
||||
public void setEncyclopediaArticles(List encyclopediaArticles) {
|
||||
this.encyclopediaArticles = encyclopediaArticles;
|
||||
}
|
||||
|
||||
public List getTransitionalData() {
|
||||
return this.transitionalData;
|
||||
}
|
||||
|
||||
public void setTransitionalData(List transitionalData) {
|
||||
this.transitionalData = transitionalData;
|
||||
}
|
||||
|
||||
public List getDefinitions() {
|
||||
return this.definitions;
|
||||
}
|
||||
|
||||
public void setDefinitions(List definitions) {
|
||||
this.definitions = definitions;
|
||||
}
|
||||
|
||||
public List getGlosses() {
|
||||
return this.glosses;
|
||||
}
|
||||
|
||||
public void setGlosses(List glosses) {
|
||||
this.glosses = glosses;
|
||||
}
|
||||
|
||||
public List getKeywords() {
|
||||
return this.keywords;
|
||||
}
|
||||
|
||||
public void setKeywords(List keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
|
||||
public List getModelSentences() {
|
||||
return this.modelSentences;
|
||||
}
|
||||
|
||||
public void setModelSentences(List modelSentences) {
|
||||
this.modelSentences = modelSentences;
|
||||
}
|
||||
|
||||
public List getTranslationEquivalents() {
|
||||
return this.translationEquivalents;
|
||||
}
|
||||
|
||||
public void setTranslationEquivalents(List translationEquivalents) {
|
||||
this.translationEquivalents = translationEquivalents;
|
||||
}
|
||||
|
||||
public List getRelatedTerms() {
|
||||
return this.relatedTerms;
|
||||
}
|
||||
|
||||
public void setRelatedTerms(List relatedTerms) {
|
||||
this.relatedTerms = relatedTerms;
|
||||
}
|
||||
|
||||
public List getPassages() {
|
||||
return this.passages;
|
||||
}
|
||||
|
||||
public void setPassages(List passages) {
|
||||
this.passages = passages;
|
||||
}
|
||||
|
||||
public List getRegisters() {
|
||||
return this.registers;
|
||||
}
|
||||
|
||||
public void setRegisters(List registers) {
|
||||
this.registers = registers;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
97
src/java/org/thdl/lex/component/BaseTransitionalData.java
Normal file
97
src/java/org/thdl/lex/component/BaseTransitionalData.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseTransitionalData extends LexComponent implements
|
||||
org.thdl.lex.component.ITransitionalData, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer transitionalDataLabel;
|
||||
|
||||
/** persistent field */
|
||||
private String forPublicConsumption;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String transitionalDataText;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseTransitionalData(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
Integer transitionalDataLabel, String forPublicConsumption,
|
||||
String transitionalDataText,
|
||||
org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.transitionalDataLabel = transitionalDataLabel;
|
||||
this.forPublicConsumption = forPublicConsumption;
|
||||
this.transitionalDataText = transitionalDataText;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseTransitionalData() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseTransitionalData(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, String forPublicConsumption) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.forPublicConsumption = forPublicConsumption;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getTransitionalDataLabel() {
|
||||
return this.transitionalDataLabel;
|
||||
}
|
||||
|
||||
public void setTransitionalDataLabel(Integer transitionalDataLabel) {
|
||||
this.transitionalDataLabel = transitionalDataLabel;
|
||||
}
|
||||
|
||||
public String getForPublicConsumption() {
|
||||
return this.forPublicConsumption;
|
||||
}
|
||||
|
||||
public void setForPublicConsumption(String forPublicConsumption) {
|
||||
this.forPublicConsumption = forPublicConsumption;
|
||||
}
|
||||
|
||||
public String getTransitionalDataText() {
|
||||
return this.transitionalDataText;
|
||||
}
|
||||
|
||||
public void setTransitionalDataText(String transitionalDataText) {
|
||||
this.transitionalDataText = transitionalDataText;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
|
||||
/** @author Hibernate CodeGenerator */
|
||||
abstract public class BaseTranslationEquivalent extends LexComponent implements
|
||||
org.thdl.lex.component.ITranslationEquivalent, Serializable {
|
||||
|
||||
/** nullable persistent field */
|
||||
private Integer parentId;
|
||||
|
||||
/** nullable persistent field */
|
||||
private String translationEquivalent;
|
||||
|
||||
/** nullable persistent field */
|
||||
private org.thdl.lex.component.ILexComponent parent;
|
||||
|
||||
/** full constructor */
|
||||
public BaseTranslationEquivalent(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta, Integer parentId,
|
||||
String translationEquivalent,
|
||||
org.thdl.lex.component.ILexComponent parent) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
this.parentId = parentId;
|
||||
this.translationEquivalent = translationEquivalent;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/** default constructor */
|
||||
public BaseTranslationEquivalent() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public BaseTranslationEquivalent(Boolean deleted, List analyticalNotes,
|
||||
org.thdl.lex.component.Meta meta) {
|
||||
super(deleted, analyticalNotes, meta);
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getTranslationEquivalent() {
|
||||
return this.translationEquivalent;
|
||||
}
|
||||
|
||||
public void setTranslationEquivalent(String translationEquivalent) {
|
||||
this.translationEquivalent = translationEquivalent;
|
||||
}
|
||||
|
||||
public org.thdl.lex.component.ILexComponent getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(org.thdl.lex.component.ILexComponent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this).append("metaId", getMetaId())
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
187
src/java/org/thdl/lex/component/Definition.java
Normal file
187
src/java/org/thdl/lex/component/Definition.java
Normal file
|
@ -0,0 +1,187 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.thdl.lex.LexConstants;
|
||||
import org.thdl.lex.LexLogger;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 13, 2003
|
||||
*/
|
||||
public class Definition extends BaseDefinition implements Serializable,
|
||||
Translatable, LexComponentNode {
|
||||
private HashMap childMap;
|
||||
|
||||
/**
|
||||
* Sets the childMap attribute of the Term object
|
||||
*
|
||||
* @param childMap
|
||||
* The new childMap value
|
||||
*/
|
||||
public void setChildMap(HashMap childMap) {
|
||||
this.childMap = childMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the childMap attribute of the Term object
|
||||
*
|
||||
* @return The childMap value
|
||||
*/
|
||||
public HashMap getChildMap() {
|
||||
if (null == childMap) {
|
||||
initChildMap();
|
||||
}
|
||||
return childMap;
|
||||
}
|
||||
|
||||
//helpers
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public List findSiblings(ILexComponent component)
|
||||
throws LexComponentException {
|
||||
List list = null;
|
||||
if (null == component.getParent()) {
|
||||
component.setParent(findParent(component.getParentId()));
|
||||
}
|
||||
LexComponentNode node = (LexComponentNode) component.getParent();
|
||||
list = (List) node.getChildMap().get(component.getLabel());
|
||||
LexLogger.debug("[Definition] List derived from " + node + ": " + list);
|
||||
|
||||
if (null == list) {
|
||||
if (null != getSubdefinitions()) {
|
||||
Iterator it = getSubdefinitions().iterator();
|
||||
while (it.hasNext()) {
|
||||
ISubdefinition subdef = (ISubdefinition) it.next();
|
||||
list = subdef.findSiblings(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param parentPk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findParent(Integer parentPk)
|
||||
throws LexComponentException {
|
||||
LexLogger.debug("Finding Parent...");
|
||||
ILexComponent parent = null;
|
||||
if (parentPk.equals(this.getMetaId())) {
|
||||
parent = this;
|
||||
} else {
|
||||
parent = findChild(parentPk);
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the persistentChild attribute of the Term object
|
||||
*
|
||||
* @param child
|
||||
* Description of the Parameter
|
||||
* @return The persistentChild value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(ILexComponent child)
|
||||
throws LexComponentException {
|
||||
List list = findSiblings(child);
|
||||
child = findChild(list, child.getMetaId());
|
||||
return child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(Integer pk) throws LexComponentException {
|
||||
ILexComponent child = null;
|
||||
|
||||
Iterator childMapValues = getChildMap().values().iterator();
|
||||
while (childMapValues.hasNext() && null == child) {
|
||||
List list = (List) childMapValues.next();
|
||||
child = findChild(list, pk);
|
||||
}
|
||||
|
||||
if (null != getSubdefinitions()) {
|
||||
Iterator subdefinitions = getSubdefinitions().iterator();
|
||||
while (subdefinitions.hasNext() && null == child) {
|
||||
ISubdefinition def = (ISubdefinition) subdefinitions.next();
|
||||
child = def.findChild(pk);
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param list
|
||||
* Description of the Parameter
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public ILexComponent findChild(List list, Integer pk) {
|
||||
ILexComponent child = null;
|
||||
if (null != list) {
|
||||
for (Iterator it = list.iterator(); it.hasNext();) {
|
||||
ILexComponent lc = (LexComponent) it.next();
|
||||
if (lc.getMetaId().equals(pk)) {
|
||||
child = lc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*/
|
||||
private void initChildMap() {
|
||||
setChildMap(new HashMap());
|
||||
getChildMap().put(LexConstants.SUBDEFINITIONLABEL_VALUE,
|
||||
getSubdefinitions());
|
||||
getChildMap().put(LexConstants.MODELSENTENCELABEL_VALUE,
|
||||
getModelSentences());
|
||||
getChildMap().put(LexConstants.PASSAGELABEL_VALUE, getPassages());
|
||||
getChildMap().put(LexConstants.TRANSLATIONLABEL_VALUE,
|
||||
getTranslations());
|
||||
getChildMap().put(LexConstants.RELATEDTERMLABEL_VALUE,
|
||||
getRelatedTerms());
|
||||
getChildMap().put(LexConstants.REGISTERLABEL_VALUE, getRegisters());
|
||||
getChildMap().put(LexConstants.KEYWORDLABEL_VALUE, getKeywords());
|
||||
getChildMap().put(LexConstants.ANALYTICALNOTELABEL_VALUE,
|
||||
getAnalyticalNotes());
|
||||
getChildMap().put(LexConstants.TRANSLATIONLABEL_VALUE,
|
||||
getTranslationEquivalents());
|
||||
}
|
||||
|
||||
}
|
||||
|
8
src/java/org/thdl/lex/component/EncyclopediaArticle.java
Normal file
8
src/java/org/thdl/lex/component/EncyclopediaArticle.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class EncyclopediaArticle extends BaseEncyclopediaArticle implements
|
||||
Serializable {
|
||||
|
||||
}
|
8
src/java/org/thdl/lex/component/Etymology.java
Normal file
8
src/java/org/thdl/lex/component/Etymology.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Etymology extends BaseEtymology implements Serializable,
|
||||
Translatable {
|
||||
|
||||
}
|
7
src/java/org/thdl/lex/component/Gloss.java
Normal file
7
src/java/org/thdl/lex/component/Gloss.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Gloss extends BaseGloss implements Serializable {
|
||||
|
||||
}
|
15
src/java/org/thdl/lex/component/GrammaticalFunction.java
Normal file
15
src/java/org/thdl/lex/component/GrammaticalFunction.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Description of the Class
|
||||
*
|
||||
* @author travis
|
||||
* @created October 5, 2003
|
||||
*/
|
||||
public class GrammaticalFunction extends BaseGrammaticalFunction implements
|
||||
Serializable {
|
||||
|
||||
}
|
||||
|
60
src/java/org/thdl/lex/component/IAnalyticalNote.java
Normal file
60
src/java/org/thdl/lex/component/IAnalyticalNote.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 3, 2003
|
||||
*/
|
||||
public interface IAnalyticalNote extends ILexComponent {
|
||||
/**
|
||||
* Gets the parent attribute of the IAnalyticalNote object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
* @since
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the parent attribute of the IAnalyticalNote object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
* @since
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IAnalyticalNote object
|
||||
*
|
||||
* @return The parentId value
|
||||
* @since
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IAnalyticalNote object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
* @since
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the analyticalNote attribute of the IAnalyticalNote object
|
||||
*
|
||||
* @return The analyticalNote value
|
||||
* @since
|
||||
*/
|
||||
public java.lang.String getAnalyticalNote();
|
||||
|
||||
/**
|
||||
* Sets the analyticalNote attribute of the IAnalyticalNote object
|
||||
*
|
||||
* @param analyticalNote
|
||||
* The new analyticalNote value
|
||||
* @since
|
||||
*/
|
||||
public void setAnalyticalNote(java.lang.String analyticalNote);
|
||||
}
|
||||
|
239
src/java/org/thdl/lex/component/IDefinition.java
Normal file
239
src/java/org/thdl/lex/component/IDefinition.java
Normal file
|
@ -0,0 +1,239 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public interface IDefinition extends LexComponentNode {
|
||||
/**
|
||||
* Gets the parent attribute of the IDefinition object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the parent attribute of the IDefinition object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IDefinition object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IDefinition object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the definition attribute of the IDefinition object
|
||||
*
|
||||
* @return The definition value
|
||||
* @since
|
||||
*/
|
||||
public java.lang.String getDefinition();
|
||||
|
||||
/**
|
||||
* Sets the definition attribute of the IDefinition object
|
||||
*
|
||||
* @param definition
|
||||
* The new definition value
|
||||
* @since
|
||||
*/
|
||||
public void setDefinition(java.lang.String definition);
|
||||
|
||||
/**
|
||||
* Gets the subdefinitions attribute of the IDefinition object
|
||||
*
|
||||
* @return The subdefinitions value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getSubdefinitions();
|
||||
|
||||
/**
|
||||
* Sets the subdefinitions attribute of the IDefinition object
|
||||
*
|
||||
* @param subdefinitions
|
||||
* The new subdefinitions value
|
||||
* @since
|
||||
*/
|
||||
public void setSubdefinitions(java.util.List subdefinitions);
|
||||
|
||||
/**
|
||||
* Gets the glosses attribute of the IDefinition object
|
||||
*
|
||||
* @return The glosses value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getGlosses();
|
||||
|
||||
/**
|
||||
* Sets the glosses attribute of the IDefinition object
|
||||
*
|
||||
* @param glosses
|
||||
* The new glosses value
|
||||
* @since
|
||||
*/
|
||||
public void setGlosses(java.util.List glosses);
|
||||
|
||||
/**
|
||||
* Gets the keywords attribute of the IDefinition object
|
||||
*
|
||||
* @return The keywords value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getKeywords();
|
||||
|
||||
/**
|
||||
* Sets the keywords attribute of the IDefinition object
|
||||
*
|
||||
* @param keywords
|
||||
* The new keywords value
|
||||
* @since
|
||||
*/
|
||||
public void setKeywords(java.util.List keywords);
|
||||
|
||||
/**
|
||||
* Gets the modelSentences attribute of the IDefinition object
|
||||
*
|
||||
* @return The modelSentences value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getModelSentences();
|
||||
|
||||
/**
|
||||
* Sets the modelSentences attribute of the IDefinition object
|
||||
*
|
||||
* @param modelSentences
|
||||
* The new modelSentences value
|
||||
* @since
|
||||
*/
|
||||
public void setModelSentences(java.util.List modelSentences);
|
||||
|
||||
/**
|
||||
* Gets the translationEquivalents attribute of the IDefinition object
|
||||
*
|
||||
* @return The translationEquivalents value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getTranslationEquivalents();
|
||||
|
||||
/**
|
||||
* Sets the translationEquivalents attribute of the IDefinition object
|
||||
*
|
||||
* @param translationEquivalents
|
||||
* The new translationEquivalents value
|
||||
* @since
|
||||
*/
|
||||
public void setTranslationEquivalents(java.util.List translationEquivalents);
|
||||
|
||||
/**
|
||||
* Gets the relatedTerms attribute of the IDefinition object
|
||||
*
|
||||
* @return The relatedTerms value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getRelatedTerms();
|
||||
|
||||
/**
|
||||
* Sets the relatedTerms attribute of the IDefinition object
|
||||
*
|
||||
* @param relatedTerms
|
||||
* The new relatedTerms value
|
||||
* @since
|
||||
*/
|
||||
public void setRelatedTerms(java.util.List relatedTerms);
|
||||
|
||||
/**
|
||||
* Gets the passages attribute of the IDefinition object
|
||||
*
|
||||
* @return The passages value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getPassages();
|
||||
|
||||
/**
|
||||
* Sets the passages attribute of the IDefinition object
|
||||
*
|
||||
* @param passages
|
||||
* The new passages value
|
||||
* @since
|
||||
*/
|
||||
public void setPassages(java.util.List passages);
|
||||
|
||||
/**
|
||||
* Gets the registers attribute of the IDefinition object
|
||||
*
|
||||
* @return The registers value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getRegisters();
|
||||
|
||||
/**
|
||||
* Sets the registers attribute of the IDefinition object
|
||||
*
|
||||
* @param registers
|
||||
* The new registers value
|
||||
* @since
|
||||
*/
|
||||
public void setRegisters(java.util.List registers);
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(ILexComponent component)
|
||||
throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param list
|
||||
* Description of the Parameter
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(java.util.List list, Integer pk)
|
||||
throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(Integer pk) throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param parentPk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findParent(Integer parentPk)
|
||||
throws LexComponentException;
|
||||
}
|
||||
|
62
src/java/org/thdl/lex/component/IEncyclopediaArticle.java
Normal file
62
src/java/org/thdl/lex/component/IEncyclopediaArticle.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IEncyclopediaArticle extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the IEncyclopediaArticle object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IEncyclopediaArticle object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IEncyclopediaArticle object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the article attribute of the IEncyclopediaArticle object
|
||||
*
|
||||
* @return The article value
|
||||
*/
|
||||
public java.lang.String getArticle();
|
||||
|
||||
/**
|
||||
* Sets the article attribute of the IEncyclopediaArticle object
|
||||
*
|
||||
* @param article
|
||||
* The new article value
|
||||
*/
|
||||
public void setArticle(java.lang.String article);
|
||||
|
||||
/**
|
||||
* Gets the articleTitle attribute of the IEncyclopediaArticle object
|
||||
*
|
||||
* @return The articleTitle value
|
||||
*/
|
||||
public java.lang.String getArticleTitle();
|
||||
|
||||
/**
|
||||
* Sets the articleTitle attribute of the IEncyclopediaArticle object
|
||||
*
|
||||
* @param articleTitle
|
||||
* The new articleTitle value
|
||||
*/
|
||||
public void setArticleTitle(java.lang.String articleTitle);
|
||||
}
|
||||
|
92
src/java/org/thdl/lex/component/IEtymology.java
Normal file
92
src/java/org/thdl/lex/component/IEtymology.java
Normal file
|
@ -0,0 +1,92 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IEtymology extends Translatable {
|
||||
/**
|
||||
* Sets the parent attribute of the IEtymology object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IEtymology object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IEtymology object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the loanLanguage attribute of the IEtymology object
|
||||
*
|
||||
* @return The loanLanguage value
|
||||
*/
|
||||
public java.lang.Integer getLoanLanguage();
|
||||
|
||||
/**
|
||||
* Sets the loanLanguage attribute of the IEtymology object
|
||||
*
|
||||
* @param loanLanguage
|
||||
* The new loanLanguage value
|
||||
*/
|
||||
public void setLoanLanguage(java.lang.Integer loanLanguage);
|
||||
|
||||
/**
|
||||
* Gets the etymologyType attribute of the IEtymology object
|
||||
*
|
||||
* @return The etymologyType value
|
||||
*/
|
||||
public java.lang.Integer getEtymologyType();
|
||||
|
||||
/**
|
||||
* Sets the etymologyType attribute of the IEtymology object
|
||||
*
|
||||
* @param etymologyType
|
||||
* The new etymologyType value
|
||||
*/
|
||||
public void setEtymologyType(java.lang.Integer etymologyType);
|
||||
|
||||
/**
|
||||
* Gets the derivation attribute of the IEtymology object
|
||||
*
|
||||
* @return The derivation value
|
||||
*/
|
||||
public java.lang.String getDerivation();
|
||||
|
||||
/**
|
||||
* Sets the derivation attribute of the IEtymology object
|
||||
*
|
||||
* @param derivation
|
||||
* The new derivation value
|
||||
*/
|
||||
public void setDerivation(java.lang.String derivation);
|
||||
|
||||
/**
|
||||
* Gets the etymologyDescription attribute of the IEtymology object
|
||||
*
|
||||
* @return The etymologyDescription value
|
||||
*/
|
||||
public java.lang.String getEtymologyDescription();
|
||||
|
||||
/**
|
||||
* Sets the etymologyDescription attribute of the IEtymology object
|
||||
*
|
||||
* @param etymologyDescription
|
||||
* The new etymologyDescription value
|
||||
*/
|
||||
public void setEtymologyDescription(java.lang.String etymologyDescription);
|
||||
}
|
||||
|
47
src/java/org/thdl/lex/component/IFunction.java
Normal file
47
src/java/org/thdl/lex/component/IFunction.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IFunction extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the IFunction object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IFunction object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IFunction object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the function attribute of the IFunction object
|
||||
*
|
||||
* @return The function value
|
||||
*/
|
||||
public java.lang.Integer getFunction();
|
||||
|
||||
/**
|
||||
* Sets the function attribute of the IFunction object
|
||||
*
|
||||
* @param function
|
||||
* The new function value
|
||||
*/
|
||||
public void setFunction(java.lang.Integer function);
|
||||
}
|
||||
|
62
src/java/org/thdl/lex/component/IGloss.java
Normal file
62
src/java/org/thdl/lex/component/IGloss.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IGloss extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the IGloss object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IGloss object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IGloss object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the gloss attribute of the IGloss object
|
||||
*
|
||||
* @return The gloss value
|
||||
*/
|
||||
public java.lang.String getGloss();
|
||||
|
||||
/**
|
||||
* Sets the gloss attribute of the IGloss object
|
||||
*
|
||||
* @param gloss
|
||||
* The new gloss value
|
||||
*/
|
||||
public void setGloss(java.lang.String gloss);
|
||||
|
||||
/**
|
||||
* Gets the translation attribute of the IGloss object
|
||||
*
|
||||
* @return The translation value
|
||||
*/
|
||||
public java.lang.String getTranslation();
|
||||
|
||||
/**
|
||||
* Sets the translation attribute of the IGloss object
|
||||
*
|
||||
* @param translation
|
||||
* The new translation value
|
||||
*/
|
||||
public void setTranslation(java.lang.String translation);
|
||||
}
|
||||
|
47
src/java/org/thdl/lex/component/IKeyword.java
Normal file
47
src/java/org/thdl/lex/component/IKeyword.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IKeyword extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the IKeyword object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IKeyword object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IKeyword object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the keyword attribute of the IKeyword object
|
||||
*
|
||||
* @return The keyword value
|
||||
*/
|
||||
public java.lang.String getKeyword();
|
||||
|
||||
/**
|
||||
* Sets the keyword attribute of the IKeyword object
|
||||
*
|
||||
* @param keyword
|
||||
* The new keyword value
|
||||
*/
|
||||
public void setKeyword(java.lang.String keyword);
|
||||
}
|
||||
|
178
src/java/org/thdl/lex/component/ILexComponent.java
Normal file
178
src/java/org/thdl/lex/component/ILexComponent.java
Normal file
|
@ -0,0 +1,178 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public interface ILexComponent {
|
||||
|
||||
/**
|
||||
* Sets the parent attribute of the ILexComponent object
|
||||
*
|
||||
* @param parent
|
||||
* The new parent value
|
||||
*/
|
||||
public void setParent(ILexComponent parent);
|
||||
|
||||
/**
|
||||
* Gets the parent attribute of the ILexComponent object
|
||||
*
|
||||
* @return The parent value
|
||||
*/
|
||||
public ILexComponent getParent();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the LexComponent object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the parent attribute of the LexComponent object
|
||||
*
|
||||
* @return The parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the LexComponent object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Gets the label attribute of the ILexComponent object
|
||||
*
|
||||
* @return The label value
|
||||
* @since
|
||||
*/
|
||||
public java.lang.String getLabel();
|
||||
|
||||
/**
|
||||
* Gets the metaId attribute of the ILexComponent object
|
||||
*
|
||||
* @return The metaId value
|
||||
* @since
|
||||
*/
|
||||
public java.lang.Integer getMetaId();
|
||||
|
||||
/**
|
||||
* Sets the metaId attribute of the ILexComponent object
|
||||
*
|
||||
* @param metaId
|
||||
* The new metaId value
|
||||
* @since
|
||||
*/
|
||||
public void setMetaId(java.lang.Integer metaId);
|
||||
|
||||
/**
|
||||
* Gets the translations attribute of the ILexComponent object
|
||||
*
|
||||
* @return The translations value
|
||||
* @since
|
||||
*/
|
||||
// public java.util.Set getTranslations();
|
||||
|
||||
/**
|
||||
* Sets the translations attribute of the ILexComponent object
|
||||
*
|
||||
* @return The deleted value
|
||||
* @since
|
||||
*/
|
||||
//public void setTranslations( java.util.Set translations );
|
||||
|
||||
/**
|
||||
* Gets the deleted attribute of the ILexComponent object
|
||||
*
|
||||
* @return The deleted value
|
||||
* @since
|
||||
*/
|
||||
public java.lang.Boolean getDeleted();
|
||||
|
||||
/**
|
||||
* Sets the deleted attribute of the ILexComponent object
|
||||
*
|
||||
* @param deleted
|
||||
* The new deleted value
|
||||
* @since
|
||||
*/
|
||||
public void setDeleted(java.lang.Boolean deleted);
|
||||
|
||||
/**
|
||||
* Gets the analyticalNotes attribute of the ILexComponent object
|
||||
*
|
||||
* @return The analyticalNotes value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getAnalyticalNotes();
|
||||
|
||||
/**
|
||||
* Sets the analyticalNotes attribute of the ILexComponent object
|
||||
*
|
||||
* @param analyticalNotes
|
||||
* The new analyticalNotes value
|
||||
* @since
|
||||
*/
|
||||
public void setAnalyticalNotes(java.util.List analyticalNotes);
|
||||
|
||||
/**
|
||||
* Gets the meta attribute of the ILexComponent object
|
||||
*
|
||||
* @return The meta value
|
||||
* @since
|
||||
*/
|
||||
public org.thdl.lex.component.Meta getMeta();
|
||||
|
||||
/**
|
||||
* Sets the meta attribute of the ILexComponent object
|
||||
*
|
||||
* @param meta
|
||||
* The new meta value
|
||||
* @since
|
||||
*/
|
||||
public void setMeta(org.thdl.lex.component.Meta meta);
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param properties
|
||||
* Description of Parameter
|
||||
* @exception LexComponentException
|
||||
* Description of Exception
|
||||
* @since
|
||||
*/
|
||||
public void populate(java.util.Map properties) throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void populate(ILexComponent component) throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Adds a feature to the SiblingList attribute of the LexComponentNode
|
||||
* object
|
||||
*
|
||||
* @param component
|
||||
* The feature to be added to the SiblingList attribute
|
||||
* @param list
|
||||
* The feature to be added to the SiblingList attribute
|
||||
* @param parent
|
||||
* The feature to be added to the SiblingList attribute
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void addSiblingList(ILexComponent parent, ILexComponent component,
|
||||
List list) throws LexComponentException;
|
||||
}
|
||||
|
197
src/java/org/thdl/lex/component/IMeta.java
Normal file
197
src/java/org/thdl/lex/component/IMeta.java
Normal file
|
@ -0,0 +1,197 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IMeta extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the IMeta object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IMeta object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IMeta object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the createdBy attribute of the IMeta object
|
||||
*
|
||||
* @return The createdBy value
|
||||
*/
|
||||
public java.lang.Integer getCreatedBy();
|
||||
|
||||
/**
|
||||
* Sets the createdBy attribute of the IMeta object
|
||||
*
|
||||
* @param createdBy
|
||||
* The new createdBy value
|
||||
*/
|
||||
public void setCreatedBy(java.lang.Integer createdBy);
|
||||
|
||||
/**
|
||||
* Gets the modifiedBy attribute of the IMeta object
|
||||
*
|
||||
* @return The modifiedBy value
|
||||
*/
|
||||
public java.lang.Integer getModifiedBy();
|
||||
|
||||
/**
|
||||
* Sets the modifiedBy attribute of the IMeta object
|
||||
*
|
||||
* @param modifiedBy
|
||||
* The new modifiedBy value
|
||||
*/
|
||||
public void setModifiedBy(java.lang.Integer modifiedBy);
|
||||
|
||||
/**
|
||||
* Gets the createdByProjSub attribute of the IMeta object
|
||||
*
|
||||
* @return The createdByProjSub value
|
||||
*/
|
||||
public java.lang.Integer getCreatedByProjSub();
|
||||
|
||||
/**
|
||||
* Sets the createdByProjSub attribute of the IMeta object
|
||||
*
|
||||
* @param createdByProjSub
|
||||
* The new createdByProjSub value
|
||||
*/
|
||||
public void setCreatedByProjSub(java.lang.Integer createdByProjSub);
|
||||
|
||||
/**
|
||||
* Gets the modifiedByProjSub attribute of the IMeta object
|
||||
*
|
||||
* @return The modifiedByProjSub value
|
||||
*/
|
||||
public java.lang.Integer getModifiedByProjSub();
|
||||
|
||||
/**
|
||||
* Sets the modifiedByProjSub attribute of the IMeta object
|
||||
*
|
||||
* @param modifiedByProjSub
|
||||
* The new modifiedByProjSub value
|
||||
*/
|
||||
public void setModifiedByProjSub(java.lang.Integer modifiedByProjSub);
|
||||
|
||||
/**
|
||||
* Gets the createdOn attribute of the IMeta object
|
||||
*
|
||||
* @return The createdOn value
|
||||
*/
|
||||
public java.util.Date getCreatedOn();
|
||||
|
||||
/**
|
||||
* Sets the createdOn attribute of the IMeta object
|
||||
*
|
||||
* @param createdOn
|
||||
* The new createdOn value
|
||||
*/
|
||||
public void setCreatedOn(java.util.Date createdOn);
|
||||
|
||||
/**
|
||||
* Gets the modifiedOn attribute of the IMeta object
|
||||
*
|
||||
* @return The modifiedOn value
|
||||
*/
|
||||
public java.util.Date getModifiedOn();
|
||||
|
||||
/**
|
||||
* Sets the modifiedOn attribute of the IMeta object
|
||||
*
|
||||
* @param modifiedOn
|
||||
* The new modifiedOn value
|
||||
*/
|
||||
public void setModifiedOn(java.util.Date modifiedOn);
|
||||
|
||||
/**
|
||||
* Gets the source attribute of the IMeta object
|
||||
*
|
||||
* @return The source value
|
||||
*/
|
||||
public java.lang.Integer getSource();
|
||||
|
||||
/**
|
||||
* Sets the source attribute of the IMeta object
|
||||
*
|
||||
* @param source
|
||||
* The new source value
|
||||
*/
|
||||
public void setSource(java.lang.Integer source);
|
||||
|
||||
/**
|
||||
* Gets the language attribute of the IMeta object
|
||||
*
|
||||
* @return The language value
|
||||
*/
|
||||
public java.lang.Integer getLanguage();
|
||||
|
||||
/**
|
||||
* Sets the language attribute of the IMeta object
|
||||
*
|
||||
* @param language
|
||||
* The new language value
|
||||
*/
|
||||
public void setLanguage(java.lang.Integer language);
|
||||
|
||||
/**
|
||||
* Gets the script attribute of the IMeta object
|
||||
*
|
||||
* @return The script value
|
||||
*/
|
||||
public java.lang.Integer getScript();
|
||||
|
||||
/**
|
||||
* Sets the script attribute of the IMeta object
|
||||
*
|
||||
* @param script
|
||||
* The new script value
|
||||
*/
|
||||
public void setScript(java.lang.Integer script);
|
||||
|
||||
/**
|
||||
* Gets the dialect attribute of the IMeta object
|
||||
*
|
||||
* @return The dialect value
|
||||
*/
|
||||
public java.lang.Integer getDialect();
|
||||
|
||||
/**
|
||||
* Sets the dialect attribute of the IMeta object
|
||||
*
|
||||
* @param dialect
|
||||
* The new dialect value
|
||||
*/
|
||||
public void setDialect(java.lang.Integer dialect);
|
||||
|
||||
/**
|
||||
* Gets the note attribute of the IMeta object
|
||||
*
|
||||
* @return The note value
|
||||
*/
|
||||
public java.lang.String getNote();
|
||||
|
||||
/**
|
||||
* Sets the note attribute of the IMeta object
|
||||
*
|
||||
* @param note
|
||||
* The new note value
|
||||
*/
|
||||
public void setNote(java.lang.String note);
|
||||
}
|
||||
|
46
src/java/org/thdl/lex/component/IModelSentence.java
Normal file
46
src/java/org/thdl/lex/component/IModelSentence.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IModelSentence extends Translatable {
|
||||
/**
|
||||
* Sets the parent attribute of the IModelSentence object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IModelSentence object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IModelSentence object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the modelSentence attribute of the IModelSentence object
|
||||
*
|
||||
* @return The modelSentence value
|
||||
*/
|
||||
public java.lang.String getModelSentence();
|
||||
|
||||
/**
|
||||
* Sets the modelSentence attribute of the IModelSentence object
|
||||
*
|
||||
* @param modelSentence
|
||||
* The new modelSentence value
|
||||
*/
|
||||
public void setModelSentence(java.lang.String modelSentence);
|
||||
}
|
||||
|
99
src/java/org/thdl/lex/component/IPassage.java
Normal file
99
src/java/org/thdl/lex/component/IPassage.java
Normal file
|
@ -0,0 +1,99 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 13, 2003
|
||||
*/
|
||||
public interface IPassage extends Translatable {
|
||||
/**
|
||||
* Gets the parent attribute of the IPassage object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the parent attribute of the IPassage object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IPassage object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IPassage object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the literarySource attribute of the IPassage object
|
||||
*
|
||||
* @return The literarySource value
|
||||
*/
|
||||
public java.lang.String getLiterarySource();
|
||||
|
||||
/**
|
||||
* Sets the literarySource attribute of the IPassage object
|
||||
*
|
||||
* @param literarySource
|
||||
* The new literarySource value
|
||||
*/
|
||||
public void setLiterarySource(java.lang.String literarySource);
|
||||
|
||||
/**
|
||||
* Gets the spelling attribute of the IPassage object
|
||||
*
|
||||
* @return The spelling value
|
||||
*/
|
||||
public java.lang.String getSpelling();
|
||||
|
||||
/**
|
||||
* Sets the spelling attribute of the IPassage object
|
||||
*
|
||||
* @param spelling
|
||||
* The new spelling value
|
||||
*/
|
||||
public void setSpelling(java.lang.String spelling);
|
||||
|
||||
/**
|
||||
* Gets the pagination attribute of the IPassage object
|
||||
*
|
||||
* @return The pagination value
|
||||
*/
|
||||
public java.lang.String getPagination();
|
||||
|
||||
/**
|
||||
* Sets the pagination attribute of the IPassage object
|
||||
*
|
||||
* @param pagination
|
||||
* The new pagination value
|
||||
*/
|
||||
public void setPagination(java.lang.String pagination);
|
||||
|
||||
/**
|
||||
* Gets the passage attribute of the IPassage object
|
||||
*
|
||||
* @return The passage value
|
||||
*/
|
||||
public java.lang.String getPassage();
|
||||
|
||||
/**
|
||||
* Sets the passage attribute of the IPassage object
|
||||
*
|
||||
* @param passage
|
||||
* The new passage value
|
||||
*/
|
||||
public void setPassage(java.lang.String passage);
|
||||
}
|
||||
|
62
src/java/org/thdl/lex/component/IPronunciation.java
Normal file
62
src/java/org/thdl/lex/component/IPronunciation.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IPronunciation extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the IPronunciation object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IPronunciation object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IPronunciation object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the phonetics attribute of the IPronunciation object
|
||||
*
|
||||
* @return The phonetics value
|
||||
*/
|
||||
public java.lang.String getPhonetics();
|
||||
|
||||
/**
|
||||
* Sets the phonetics attribute of the IPronunciation object
|
||||
*
|
||||
* @param phonetics
|
||||
* The new phonetics value
|
||||
*/
|
||||
public void setPhonetics(java.lang.String phonetics);
|
||||
|
||||
/**
|
||||
* Gets the phoneticsType attribute of the IPronunciation object
|
||||
*
|
||||
* @return The phoneticsType value
|
||||
*/
|
||||
public java.lang.Integer getPhoneticsType();
|
||||
|
||||
/**
|
||||
* Sets the phoneticsType attribute of the IPronunciation object
|
||||
*
|
||||
* @param phoneticsType
|
||||
* The new phoneticsType value
|
||||
*/
|
||||
public void setPhoneticsType(java.lang.Integer phoneticsType);
|
||||
}
|
||||
|
47
src/java/org/thdl/lex/component/IRegister.java
Normal file
47
src/java/org/thdl/lex/component/IRegister.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IRegister extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the IRegister object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IRegister object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IRegister object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the register attribute of the IRegister object
|
||||
*
|
||||
* @return The register value
|
||||
*/
|
||||
public java.lang.Integer getRegister();
|
||||
|
||||
/**
|
||||
* Sets the register attribute of the IRegister object
|
||||
*
|
||||
* @param register
|
||||
* The new register value
|
||||
*/
|
||||
public void setRegister(java.lang.Integer register);
|
||||
}
|
||||
|
62
src/java/org/thdl/lex/component/IRelatedTerm.java
Normal file
62
src/java/org/thdl/lex/component/IRelatedTerm.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface IRelatedTerm extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the IRelatedTerm object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the IRelatedTerm object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the IRelatedTerm object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the relatedTerm attribute of the IRelatedTerm object
|
||||
*
|
||||
* @return The relatedTerm value
|
||||
*/
|
||||
public java.lang.String getRelatedTerm();
|
||||
|
||||
/**
|
||||
* Sets the relatedTerm attribute of the IRelatedTerm object
|
||||
*
|
||||
* @param relatedTerm
|
||||
* The new relatedTerm value
|
||||
*/
|
||||
public void setRelatedTerm(java.lang.String relatedTerm);
|
||||
|
||||
/**
|
||||
* Gets the relatedTermType attribute of the IRelatedTerm object
|
||||
*
|
||||
* @return The relatedTermType value
|
||||
*/
|
||||
public java.lang.Integer getRelatedTermType();
|
||||
|
||||
/**
|
||||
* Sets the relatedTermType attribute of the IRelatedTerm object
|
||||
*
|
||||
* @param relatedTermType
|
||||
* The new relatedTermType value
|
||||
*/
|
||||
public void setRelatedTermType(java.lang.Integer relatedTermType);
|
||||
}
|
||||
|
62
src/java/org/thdl/lex/component/ISpelling.java
Normal file
62
src/java/org/thdl/lex/component/ISpelling.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface ISpelling extends ILexComponent {
|
||||
/**
|
||||
* Sets the parent attribute of the ISpelling object
|
||||
*
|
||||
* @param comp
|
||||
* The new parent value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the ISpelling object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the ISpelling object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the spelling attribute of the ISpelling object
|
||||
*
|
||||
* @return The spelling value
|
||||
*/
|
||||
public java.lang.String getSpelling();
|
||||
|
||||
/**
|
||||
* Sets the spelling attribute of the ISpelling object
|
||||
*
|
||||
* @param spelling
|
||||
* The new spelling value
|
||||
*/
|
||||
public void setSpelling(java.lang.String spelling);
|
||||
|
||||
/**
|
||||
* Gets the spellingType attribute of the ISpelling object
|
||||
*
|
||||
* @return The spellingType value
|
||||
*/
|
||||
public java.lang.Integer getSpellingType();
|
||||
|
||||
/**
|
||||
* Sets the spellingType attribute of the ISpelling object
|
||||
*
|
||||
* @param spellingType
|
||||
* The new spellingType value
|
||||
*/
|
||||
public void setSpellingType(java.lang.Integer spellingType);
|
||||
}
|
||||
|
207
src/java/org/thdl/lex/component/ISubdefinition.java
Normal file
207
src/java/org/thdl/lex/component/ISubdefinition.java
Normal file
|
@ -0,0 +1,207 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 13, 2003
|
||||
*/
|
||||
public interface ISubdefinition extends LexComponentNode {
|
||||
/**
|
||||
* Gets the parent attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the parent attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the ISubdefinition object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the subdefinition attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The subdefinition value
|
||||
*/
|
||||
public java.lang.String getSubdefinition();
|
||||
|
||||
/**
|
||||
* Sets the subdefinition attribute of the ISubdefinition object
|
||||
*
|
||||
* @param subdefinition
|
||||
* The new subdefinition value
|
||||
*/
|
||||
public void setSubdefinition(java.lang.String subdefinition);
|
||||
|
||||
/**
|
||||
* Gets the glosses attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The glosses value
|
||||
*/
|
||||
public java.util.List getGlosses();
|
||||
|
||||
/**
|
||||
* Sets the glosses attribute of the ISubdefinition object
|
||||
*
|
||||
* @param glosses
|
||||
* The new glosses value
|
||||
*/
|
||||
public void setGlosses(java.util.List glosses);
|
||||
|
||||
/**
|
||||
* Gets the keywords attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The keywords value
|
||||
*/
|
||||
public java.util.List getKeywords();
|
||||
|
||||
/**
|
||||
* Sets the keywords attribute of the ISubdefinition object
|
||||
*
|
||||
* @param keywords
|
||||
* The new keywords value
|
||||
*/
|
||||
public void setKeywords(java.util.List keywords);
|
||||
|
||||
/**
|
||||
* Gets the modelSentences attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The modelSentences value
|
||||
*/
|
||||
public java.util.List getModelSentences();
|
||||
|
||||
/**
|
||||
* Sets the modelSentences attribute of the ISubdefinition object
|
||||
*
|
||||
* @param modelSentences
|
||||
* The new modelSentences value
|
||||
*/
|
||||
public void setModelSentences(java.util.List modelSentences);
|
||||
|
||||
/**
|
||||
* Gets the translationEquivalents attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The translationEquivalents value
|
||||
*/
|
||||
public java.util.List getTranslationEquivalents();
|
||||
|
||||
/**
|
||||
* Sets the translationEquivalents attribute of the ISubdefinition object
|
||||
*
|
||||
* @param translationEquivalents
|
||||
* The new translationEquivalents value
|
||||
*/
|
||||
public void setTranslationEquivalents(java.util.List translationEquivalents);
|
||||
|
||||
/**
|
||||
* Gets the relatedTerms attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The relatedTerms value
|
||||
*/
|
||||
public java.util.List getRelatedTerms();
|
||||
|
||||
/**
|
||||
* Sets the relatedTerms attribute of the ISubdefinition object
|
||||
*
|
||||
* @param relatedTerms
|
||||
* The new relatedTerms value
|
||||
*/
|
||||
public void setRelatedTerms(java.util.List relatedTerms);
|
||||
|
||||
/**
|
||||
* Gets the passages attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The passages value
|
||||
*/
|
||||
public java.util.List getPassages();
|
||||
|
||||
/**
|
||||
* Sets the passages attribute of the ISubdefinition object
|
||||
*
|
||||
* @param passages
|
||||
* The new passages value
|
||||
*/
|
||||
public void setPassages(java.util.List passages);
|
||||
|
||||
/**
|
||||
* Gets the registers attribute of the ISubdefinition object
|
||||
*
|
||||
* @return The registers value
|
||||
*/
|
||||
public java.util.List getRegisters();
|
||||
|
||||
/**
|
||||
* Sets the registers attribute of the ISubdefinition object
|
||||
*
|
||||
* @param registers
|
||||
* The new registers value
|
||||
*/
|
||||
public void setRegisters(java.util.List registers);
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(ILexComponent component)
|
||||
throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param list
|
||||
* Description of the Parameter
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(java.util.List list, Integer pk)
|
||||
throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(Integer pk) throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param parentPk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findParent(Integer parentPk)
|
||||
throws LexComponentException;
|
||||
|
||||
}
|
||||
|
335
src/java/org/thdl/lex/component/ITerm.java
Normal file
335
src/java/org/thdl/lex/component/ITerm.java
Normal file
|
@ -0,0 +1,335 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 1, 2003
|
||||
*/
|
||||
public interface ITerm extends LexComponentNode {
|
||||
/**
|
||||
* Gets the term attribute of the ITerm object
|
||||
*
|
||||
* @return The term value
|
||||
* @since
|
||||
*/
|
||||
public java.lang.String getTerm();
|
||||
|
||||
/**
|
||||
* Sets the term attribute of the ITerm object
|
||||
*
|
||||
* @param term
|
||||
* The new term value
|
||||
* @since
|
||||
*/
|
||||
public void setTerm(java.lang.String term);
|
||||
|
||||
/**
|
||||
* Gets the pronunciations attribute of the ITerm object
|
||||
*
|
||||
* @return The pronunciations value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getPronunciations();
|
||||
|
||||
/**
|
||||
* Sets the pronunciations attribute of the ITerm object
|
||||
*
|
||||
* @param pronunciations
|
||||
* The new pronunciations value
|
||||
* @since
|
||||
*/
|
||||
public void setPronunciations(java.util.List pronunciations);
|
||||
|
||||
/**
|
||||
* Gets the etymologies attribute of the ITerm object
|
||||
*
|
||||
* @return The etymologies value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getEtymologies();
|
||||
|
||||
/**
|
||||
* Sets the etymologies attribute of the ITerm object
|
||||
*
|
||||
* @param etymologies
|
||||
* The new etymologies value
|
||||
* @since
|
||||
*/
|
||||
public void setEtymologies(java.util.List etymologies);
|
||||
|
||||
/**
|
||||
* Gets the spellings attribute of the ITerm object
|
||||
*
|
||||
* @return The spellings value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getSpellings();
|
||||
|
||||
/**
|
||||
* Sets the spellings attribute of the ITerm object
|
||||
*
|
||||
* @param spellings
|
||||
* The new spellings value
|
||||
* @since
|
||||
*/
|
||||
public void setSpellings(java.util.List spellings);
|
||||
|
||||
/**
|
||||
* Gets the functions attribute of the ITerm object
|
||||
*
|
||||
* @return The functions value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getFunctions();
|
||||
|
||||
/**
|
||||
* Sets the functions attribute of the ITerm object
|
||||
*
|
||||
* @param functions
|
||||
* The new functions value
|
||||
* @since
|
||||
*/
|
||||
public void setFunctions(java.util.List functions);
|
||||
|
||||
/**
|
||||
* Gets the encyclopediaArticles attribute of the ITerm object
|
||||
*
|
||||
* @return The encyclopediaArticles value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getEncyclopediaArticles();
|
||||
|
||||
/**
|
||||
* Sets the encyclopediaArticles attribute of the ITerm object
|
||||
*
|
||||
* @param encyclopediaArticles
|
||||
* The new encyclopediaArticles value
|
||||
* @since
|
||||
*/
|
||||
public void setEncyclopediaArticles(java.util.List encyclopediaArticles);
|
||||
|
||||
/**
|
||||
* Gets the transitionalData attribute of the ITerm object
|
||||
*
|
||||
* @return The transitionalData value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getTransitionalData();
|
||||
|
||||
/**
|
||||
* Sets the transitionalData attribute of the ITerm object
|
||||
*
|
||||
* @param transitionalData
|
||||
* The new transitionalData value
|
||||
* @since
|
||||
*/
|
||||
public void setTransitionalData(java.util.List transitionalData);
|
||||
|
||||
/**
|
||||
* Gets the definitions attribute of the ITerm object
|
||||
*
|
||||
* @return The definitions value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getDefinitions();
|
||||
|
||||
/**
|
||||
* Sets the definitions attribute of the ITerm object
|
||||
*
|
||||
* @param definitions
|
||||
* The new definitions value
|
||||
* @since
|
||||
*/
|
||||
public void setDefinitions(java.util.List definitions);
|
||||
|
||||
/**
|
||||
* Gets the glosses attribute of the ITerm object
|
||||
*
|
||||
* @return The glosses value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getGlosses();
|
||||
|
||||
/**
|
||||
* Sets the glosses attribute of the ITerm object
|
||||
*
|
||||
* @param glosses
|
||||
* The new glosses value
|
||||
* @since
|
||||
*/
|
||||
public void setGlosses(java.util.List glosses);
|
||||
|
||||
/**
|
||||
* Gets the keywords attribute of the ITerm object
|
||||
*
|
||||
* @return The keywords value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getKeywords();
|
||||
|
||||
/**
|
||||
* Sets the keywords attribute of the ITerm object
|
||||
*
|
||||
* @param keywords
|
||||
* The new keywords value
|
||||
* @since
|
||||
*/
|
||||
public void setKeywords(java.util.List keywords);
|
||||
|
||||
/**
|
||||
* Gets the modelSentences attribute of the ITerm object
|
||||
*
|
||||
* @return The modelSentences value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getModelSentences();
|
||||
|
||||
/**
|
||||
* Sets the modelSentences attribute of the ITerm object
|
||||
*
|
||||
* @param modelSentences
|
||||
* The new modelSentences value
|
||||
* @since
|
||||
*/
|
||||
public void setModelSentences(java.util.List modelSentences);
|
||||
|
||||
/**
|
||||
* Gets the translationEquivalents attribute of the ITerm object
|
||||
*
|
||||
* @return The translationEquivalents value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getTranslationEquivalents();
|
||||
|
||||
/**
|
||||
* Sets the translationEquivalents attribute of the ITerm object
|
||||
*
|
||||
* @param translationEquivalents
|
||||
* The new translationEquivalents value
|
||||
* @since
|
||||
*/
|
||||
public void setTranslationEquivalents(java.util.List translationEquivalents);
|
||||
|
||||
/**
|
||||
* Gets the relatedTerms attribute of the ITerm object
|
||||
*
|
||||
* @return The relatedTerms value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getRelatedTerms();
|
||||
|
||||
/**
|
||||
* Sets the relatedTerms attribute of the ITerm object
|
||||
*
|
||||
* @param relatedTerms
|
||||
* The new relatedTerms value
|
||||
* @since
|
||||
*/
|
||||
public void setRelatedTerms(java.util.List relatedTerms);
|
||||
|
||||
/**
|
||||
* Gets the passages attribute of the ITerm object
|
||||
*
|
||||
* @return The passages value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getPassages();
|
||||
|
||||
/**
|
||||
* Sets the passages attribute of the ITerm object
|
||||
*
|
||||
* @param passages
|
||||
* The new passages value
|
||||
* @since
|
||||
*/
|
||||
public void setPassages(java.util.List passages);
|
||||
|
||||
/**
|
||||
* Gets the registers attribute of the ITerm object
|
||||
*
|
||||
* @return The registers value
|
||||
* @since
|
||||
*/
|
||||
public java.util.List getRegisters();
|
||||
|
||||
/**
|
||||
* Sets the registers attribute of the ITerm object
|
||||
*
|
||||
* @param registers
|
||||
* The new registers value
|
||||
* @since
|
||||
*/
|
||||
public void setRegisters(java.util.List registers);
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(ILexComponent component)
|
||||
throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param list
|
||||
* Description of the Parameter
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(java.util.List list, Integer pk)
|
||||
throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param pk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findChild(Integer pk) throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param parentPk
|
||||
* Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public ILexComponent findParent(Integer parentPk)
|
||||
throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Adds a feature to the Child attribute of the ITerm object
|
||||
*
|
||||
* @param component
|
||||
* The feature to be added to the Child attribute
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void addChild(ILexComponent component) throws LexComponentException;
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param component
|
||||
* Description of the Parameter
|
||||
* @exception LexComponentException
|
||||
* Description of the Exception
|
||||
*/
|
||||
public void removeChild(ILexComponent component)
|
||||
throws LexComponentException;
|
||||
}
|
||||
|
71
src/java/org/thdl/lex/component/ITransitionalData.java
Normal file
71
src/java/org/thdl/lex/component/ITransitionalData.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 16, 2003
|
||||
*/
|
||||
public interface ITransitionalData extends ILexComponent {
|
||||
|
||||
/**
|
||||
* Gets the parentId attribute of the ITransitionalData object
|
||||
*
|
||||
* @return The parentId value
|
||||
*/
|
||||
public java.lang.Integer getParentId();
|
||||
|
||||
/**
|
||||
* Sets the parentId attribute of the ITransitionalData object
|
||||
*
|
||||
* @param parentId
|
||||
* The new parentId value
|
||||
*/
|
||||
public void setParentId(java.lang.Integer parentId);
|
||||
|
||||
/**
|
||||
* Gets the transitionalDataLabel attribute of the ITransitionalData object
|
||||
*
|
||||
* @return The transitionalDataLabel value
|
||||
*/
|
||||
public java.lang.Integer getTransitionalDataLabel();
|
||||
|
||||
/**
|
||||
* Sets the transitionalDataLabel attribute of the ITransitionalData object
|
||||
*
|
||||
* @param transitionalDataLabel
|
||||
* The new transitionalDataLabel value
|
||||
*/
|
||||
public void setTransitionalDataLabel(java.lang.Integer transitionalDataLabel);
|
||||
|
||||
/**
|
||||
* Gets the forPublicConsumption attribute of the ITransitionalData object
|
||||
*
|
||||
* @return The forPublicConsumption value
|
||||
*/
|
||||
public java.lang.String getForPublicConsumption();
|
||||
|
||||
/**
|
||||
* Sets the forPublicConsumption attribute of the ITransitionalData object
|
||||
*
|
||||
* @param forPublicConsumption
|
||||
* The new forPublicConsumption value
|
||||
*/
|
||||
public void setForPublicConsumption(java.lang.String forPublicConsumption);
|
||||
|
||||
/**
|
||||
* Gets the transitionalDataText attribute of the ITransitionalData object
|
||||
*
|
||||
* @return The transitionalDataText value
|
||||
*/
|
||||
public java.lang.String getTransitionalDataText();
|
||||
|
||||
/**
|
||||
* Sets the transitionalDataText attribute of the ITransitionalData object
|
||||
*
|
||||
* @param transitionalDataText
|
||||
* The new transitionalDataText value
|
||||
*/
|
||||
public void setTransitionalDataText(java.lang.String transitionalDataText);
|
||||
}
|
||||
|
30
src/java/org/thdl/lex/component/ITranslationEquivalent.java
Normal file
30
src/java/org/thdl/lex/component/ITranslationEquivalent.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
/**
|
||||
* Description of the Interface
|
||||
*
|
||||
* @author travis
|
||||
* @created October 3, 2003
|
||||
*/
|
||||
public interface ITranslationEquivalent extends ILexComponent {
|
||||
|
||||
/**
|
||||
* Gets the translationEquivalent attribute of the ITranslationEquivalent
|
||||
* object
|
||||
*
|
||||
* @return The translationEquivalent value
|
||||
* @since
|
||||
*/
|
||||
public java.lang.String getTranslationEquivalent();
|
||||
|
||||
/**
|
||||
* Sets the translationEquivalent attribute of the ITranslationEquivalent
|
||||
* object
|
||||
*
|
||||
* @param translationEquivalent
|
||||
* The new translationEquivalent value
|
||||
* @since
|
||||
*/
|
||||
public void setTranslationEquivalent(java.lang.String translationEquivalent);
|
||||
}
|
||||
|
7
src/java/org/thdl/lex/component/Keyword.java
Normal file
7
src/java/org/thdl/lex/component/Keyword.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package org.thdl.lex.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Keyword extends BaseKeyword implements Serializable {
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue