*** empty log message ***
This commit is contained in:
parent
9501976593
commit
ec0d7206f3
3 changed files with 506 additions and 50 deletions
115
build.xml
115
build.xml
|
@ -5,7 +5,7 @@ This build file requires a build.properties file with the following properties:
|
||||||
catalina.home=/usr/local/tomcat
|
catalina.home=/usr/local/tomcat
|
||||||
catalina.base=/usr/local/tomcat
|
catalina.base=/usr/local/tomcat
|
||||||
url=http://localhost:2020/manager
|
url=http://localhost:2020/manager
|
||||||
username=
|
username=c
|
||||||
password=
|
password=
|
||||||
|
|
||||||
#provide location of working copy of lex-context-config.xml
|
#provide location of working copy of lex-context-config.xml
|
||||||
|
@ -32,7 +32,8 @@ jmeterhome=../jmeter
|
||||||
|
|
||||||
<!-- <property file="${user.home}/.${ant.project.name}-build.properties"/>
|
<!-- <property file="${user.home}/.${ant.project.name}-build.properties"/>
|
||||||
<property file="${user.home}/.build.properties"/>
|
<property file="${user.home}/.build.properties"/>
|
||||||
--> <property file="build.properties"/>
|
-->
|
||||||
|
<property file="build.properties"/>
|
||||||
|
|
||||||
<!-- Configure the custom Ant tasks for the Manager application
|
<!-- Configure the custom Ant tasks for the Manager application
|
||||||
These tasks require catalina-ant.jar in $ANT_HOME/lib-->
|
These tasks require catalina-ant.jar in $ANT_HOME/lib-->
|
||||||
|
@ -54,6 +55,7 @@ jmeterhome=../jmeter
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir="${catalina.home}/common/lib">
|
<fileset dir="${catalina.home}/common/lib">
|
||||||
<include name="servlet.jar"/>
|
<include name="servlet.jar"/>
|
||||||
|
<include name="*.jar"/>
|
||||||
<include name="mysql-connector-java-3.0.8-stable-bin.jar"/>
|
<include name="mysql-connector-java-3.0.8-stable-bin.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<!--point to org/thdl/users-->
|
<!--point to org/thdl/users-->
|
||||||
|
@ -110,45 +112,48 @@ jmeterhome=../jmeter
|
||||||
<include name="*.tld"/>
|
<include name="*.tld"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<copy todir="${build}/WEB-INF/lib">
|
<copy todir="${build}/WEB-INF/lib">
|
||||||
<fileset dir="${basedir}/lib/jstl">
|
<fileset dir="${basedir}/lib/jstl">
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir="${basedir}/lib/hibernate">
|
<fileset dir="${basedir}/lib/hibernate">
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir="${basedir}/lib/thdl">
|
<fileset dir="${basedir}/lib/thdl">
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|
||||||
|
<fileset dir="${basedir}/lib/commons">
|
||||||
|
<include name="*.jar"/>
|
||||||
|
</fileset>
|
||||||
<fileset dir="${basedir}/lib/jwebunit">
|
<fileset dir="${basedir}/lib/jwebunit">
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir="${basedir}/lib/dlese-oai">
|
<!--<fileset dir="${basedir}/lib/dlese-oai">
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir="${basedir}/lib/oai-xmlbeans">
|
<fileset dir="${basedir}/lib/oai-xmlbeans">
|
||||||
<include name="*.jar"/>
|
<include name="*.jar"/>
|
||||||
</fileset>
|
</fileset>-->
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="compile" description="Compile web application" depends="copy">
|
<target name="compile" description="Compile web application" depends="copy">
|
||||||
<mkdir dir="${build}/WEB-INF/classes"/>
|
<mkdir dir="${build}/WEB-INF/classes"/>
|
||||||
<javac srcdir="${thdluser.home}/src/java"
|
<javac srcdir="${thdluser.home}/src/java" destdir="${build}/WEB-INF/classes" deprecation="on" classpathref="classpath" debug="on"></javac>
|
||||||
destdir="${build}/WEB-INF/classes"
|
<javac destdir="${build}/WEB-INF/classes" classpathref="classpath" debug="on" listfiles="no">
|
||||||
deprecation="on"
|
<src path="${source}/java"/>
|
||||||
classpathref="classpath"
|
<include name="org/thdl/lex/**"/>
|
||||||
debug="on"/>
|
<exclude name="**/old/**"/>
|
||||||
<javac destdir="${build}/WEB-INF/classes" classpathref="classpath" debug="on" listfiles="no">
|
<exclude name="**/test/**"/>
|
||||||
<src path="${source}/java"/>
|
<exclude name="**/util/**"/>
|
||||||
<include name="org/thdl/lex/**"/>
|
<exclude name="**/LexSourceRepository.java/**"/>
|
||||||
<exclude name="**/old/**"/>
|
</javac>
|
||||||
</javac>
|
</target>
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="javadoc" description="Create Javadocs">
|
<target name="javadoc" description="Create Javadocs">
|
||||||
<javadoc destdir="${build}/apidocs/" classpathref="classpath" author="true" version="true" use="true" windowtitle="THDL Tibetan Collaborative Dictionary API">
|
<javadoc destdir="${build}/apidocs/" classpathref="classpath" author="true" version="true" use="true" windowtitle="THDL Tibetan Collaborative Dictionary API">
|
||||||
|
|
||||||
<fileset dir="${source}/java" defaultexcludes="yes">
|
<fileset dir="${source}/java" defaultexcludes="yes">
|
||||||
|
@ -192,14 +197,17 @@ jmeterhome=../jmeter
|
||||||
<remove url="${url}" username="${username}" password="${password}" path="${path}"/>
|
<remove url="${url}" username="${username}" password="${password}" path="${path}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="test" description="Run load and functional tests">
|
<target name="compile-test" description="Run load and functional tests" depends="compile">
|
||||||
<java classname="org.thdl.lex.test.MainMenuTestCase" classpathref="classpath" fork="yes">
|
<javac srcdir="${source}/java/test/org/thdl/lex" destdir="${build}/WEB-INF/classes" deprecation="on" classpathref="classpath" debug="on"></javac>
|
||||||
<classpath>
|
</target>
|
||||||
|
<target name="test" description="Run load and functional tests" depends="compile-test">
|
||||||
|
|
||||||
|
|
||||||
|
<java classname="org.thdl.lex.TestAll" classpathref="classpath" fork="yes">
|
||||||
|
<!-- <classpath>
|
||||||
<pathelement location="${build}/WEB-INF/classes"/>
|
<pathelement location="${build}/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
<arg value="${ lex.username }"/>
|
<jvmarg value="-Djava.naming.factory.initial=org.apache.naming.ResourceFactory"/> --></java>
|
||||||
<arg value="${ lex.password }"/>
|
|
||||||
</java>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="reload-test" description="Remove and Re-install web application" depends="reload">
|
<target name="reload-test" description="Remove and Re-install web application" depends="reload">
|
||||||
|
@ -211,25 +219,19 @@ jmeterhome=../jmeter
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<target name="jmeter">
|
<target name="jmeter">
|
||||||
<taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"/>
|
<taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"/>
|
||||||
<echo message="${jmeterhome}"/>
|
<echo message="${jmeterhome}"/>
|
||||||
<jmeter
|
<jmeter jmeterhome="../jmeter" testplan="${basedir}/loadtests/LoadTest.jmx" resultlog="${basedir}/loadtests/JMeterResults.jtl"/>
|
||||||
jmeterhome="../jmeter"
|
|
||||||
testplan="${basedir}/loadtests/LoadTest.jmx"
|
|
||||||
resultlog="${basedir}/loadtests/JMeterResults.jtl"/>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
For the following task to work, jmeter.properties needs to have the following properties set thusly:
|
For the following task to work, jmeter.properties needs to have the following properties set thusly:
|
||||||
jmeter.save.saveservice.assertion_results=all
|
jmeter.save.saveservice.assertion_results=all
|
||||||
jmeter.save.saveservice.output_format=xml
|
jmeter.save.saveservice.output_format=xml
|
||||||
-->
|
-->
|
||||||
<xslt
|
<xslt in="${basedir}/loadtests/JMeterResults.jtl" out="${basedir}/loadtests/JMeterResults.html" style="${jmeterhome}/extras/jmeter-results-report.xsl"/>
|
||||||
in="${basedir}/loadtests/JMeterResults.jtl"
|
</target>
|
||||||
out="${basedir}/loadtests/JMeterResults.html"
|
|
||||||
style="${jmeterhome}/extras/jmeter-results-report.xsl"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="hbm2java" description="generate source code">
|
<target name="hbm2java" description="generate source code">
|
||||||
<!-- <tstamp prefix="now"/>
|
<!-- <tstamp prefix="now"/>
|
||||||
<echo message="time is: ${now.DSTAMP}_${now.TSTAMP}"/>
|
<echo message="time is: ${now.DSTAMP}_${now.TSTAMP}"/>
|
||||||
|
@ -241,7 +243,8 @@ jmeter.save.saveservice.output_format=xml
|
||||||
<java classname="net.sf.hibernate.tool.hbm2java.CodeGenerator" classpathref="classpath" fork="yes">
|
<java classname="net.sf.hibernate.tool.hbm2java.CodeGenerator" classpathref="classpath" fork="yes">
|
||||||
<arg value="--output=${source}/java"/>
|
<arg value="--output=${source}/java"/>
|
||||||
<arg value="--config=${basedir}/config/lex-codegen-cfg.xml"/>
|
<arg value="--config=${basedir}/config/lex-codegen-cfg.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/LexComponent.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/util/LexComponentDataTransfer.hbm.xml"/>
|
||||||
|
<!-- <arg value="${source}/java/org/thdl/lex/component/LexComponent.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/Author.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/Author.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/Dialect.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/Dialect.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/EtymologyType.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/EtymologyType.hbm.xml"/>
|
||||||
|
@ -262,7 +265,7 @@ jmeter.save.saveservice.output_format=xml
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/Source.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/Source.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/SpecificDialect.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/SpecificDialect.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/SpellingType.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/SpellingType.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/TransitionalDataLabel.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/TransitionalDataLabel.hbm.xml"/> -->
|
||||||
</java>
|
</java>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -276,9 +279,9 @@ jmeter.save.saveservice.output_format=xml
|
||||||
<arg value="--format"/>
|
<arg value="--format"/>
|
||||||
<arg value="--quiet"/>
|
<arg value="--quiet"/>
|
||||||
<arg value="--delimiter=;"/>
|
<arg value="--delimiter=;"/>
|
||||||
<arg value="--properties=${config}/hibernate.properties"/>
|
<arg value="--properties=${basedir}/hibernate.properties"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/LexComponent.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/util/LexComponentDataTransfer.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/Author.hbm.xml"/>
|
<!--<arg value="${source}/java/org/thdl/lex/component/child/Author.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/Dialect.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/Dialect.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/EtymologyType.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/EtymologyType.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/Function.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/Function.hbm.xml"/>
|
||||||
|
@ -298,7 +301,7 @@ jmeter.save.saveservice.output_format=xml
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/Source.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/Source.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/SpecificDialect.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/SpecificDialect.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/SpellingType.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/SpellingType.hbm.xml"/>
|
||||||
<arg value="${source}/java/org/thdl/lex/component/child/TransitionalDataLabel.hbm.xml"/>
|
<arg value="${source}/java/org/thdl/lex/component/child/TransitionalDataLabel.hbm.xml"/>-->
|
||||||
</java>
|
</java>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -310,4 +313,24 @@ jmeter.save.saveservice.output_format=xml
|
||||||
</fileset>
|
</fileset>
|
||||||
</schemaupdate>
|
</schemaupdate>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="convert-to-new-mapping" description="convert old data to a new db mapping" depends="copy, compile">
|
||||||
|
<java classname="org.thdl.lex.ConvertDataToNewMapping" classpathref="classpath" fork="yes">
|
||||||
|
<classpath>
|
||||||
|
<pathelement location="${build}/WEB-INF/classes"/>
|
||||||
|
</classpath>
|
||||||
|
<arg value="${source}/java/org/thdl/lex/util/hibernate-data-transfer.cfg.xml"/>
|
||||||
|
</java>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="importer" description="run the dictionary importer. " depends="copy, compile">
|
||||||
|
<java classname="org.thdl.lex.util.DictionaryImporter" classpathref="classpath" fork="yes">
|
||||||
|
<classpath>
|
||||||
|
<pathelement location="${build}/WEB-INF/classes"/>
|
||||||
|
</classpath>
|
||||||
|
<!-- Pass Command-line arguments to the Dictionary Importer. The first argument must always be the Hibernate config file. -->
|
||||||
|
<arg value="${source}/java/hibernate.cfg.xml"/>
|
||||||
|
</java>
|
||||||
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class LexComponentRepository
|
||||||
* @exception HibernateException Description of Exception
|
* @exception HibernateException Description of Exception
|
||||||
* @since
|
* @since
|
||||||
*/
|
*/
|
||||||
private static Session getSession() throws HibernateException
|
protected static Session getSession() throws HibernateException
|
||||||
{
|
{
|
||||||
Session session = HibernateSession.currentSession();
|
Session session = HibernateSession.currentSession();
|
||||||
if ( !session.isConnected() )
|
if ( !session.isConnected() )
|
||||||
|
@ -125,7 +125,7 @@ public class LexComponentRepository
|
||||||
*
|
*
|
||||||
* @exception LexRepositoryException Description of the Exception
|
* @exception LexRepositoryException Description of the Exception
|
||||||
*/
|
*/
|
||||||
private static void beginTransaction() throws LexRepositoryException
|
protected static void beginTransaction() throws LexRepositoryException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ public class LexComponentRepository
|
||||||
* @exception LexRepositoryException Description of the Exception
|
* @exception LexRepositoryException Description of the Exception
|
||||||
* @since
|
* @since
|
||||||
*/
|
*/
|
||||||
private static void endTransaction( boolean commit ) throws LexRepositoryException
|
protected static void endTransaction( boolean commit ) throws LexRepositoryException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -226,10 +226,13 @@ public class LexComponentRepository
|
||||||
{
|
{
|
||||||
termForQuery = "%" + termForQuery + "%";
|
termForQuery = "%" + termForQuery + "%";
|
||||||
}
|
}
|
||||||
String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term.term like '" + termForQuery + "' AND term.deleted=0 ORDER BY term.term";
|
|
||||||
|
String queryString = " FROM org.thdl.lex.component.ITerm as term WHERE term like :term AND term.deleted=0 ORDER BY term";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
query = getSession().createQuery( queryString );
|
query = getSession().createQuery( queryString );
|
||||||
|
query.setString( "term", termForQuery );
|
||||||
|
|
||||||
}
|
}
|
||||||
catch ( HibernateException he )
|
catch ( HibernateException he )
|
||||||
{
|
{
|
||||||
|
@ -292,6 +295,278 @@ public class LexComponentRepository
|
||||||
endTransaction( false );
|
endTransaction( false );
|
||||||
return term;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -335,6 +610,26 @@ public class LexComponentRepository
|
||||||
endTransaction( false );
|
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
|
* Description of the Method
|
||||||
|
@ -521,3 +816,126 @@ public class LexComponentRepository
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
/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";
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
15
src/sql/import-updates.sql
Normal file
15
src/sql/import-updates.sql
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
use lex;
|
||||||
|
|
||||||
|
--add TransitionalDataLabels
|
||||||
|
insert into TransitionalDataLabels values ( null, "Text That You Want To Appear In The Public Interface To Describe This Dictionary" );
|
||||||
|
|
||||||
|
--add some new project subjects
|
||||||
|
insert int ProjectSubjects( id, projectSubject, leader, participantList )
|
||||||
|
values ( null, "The Name Of The New Project Subject,bod yig med", 0, null );
|
||||||
|
|
||||||
|
select "+++++Display Newly inserted ids";
|
||||||
|
select id, transitionalDataLabel from TransitionalDataLabels order by id desc;
|
||||||
|
select id, projectSubject from ProjectSubjects order by id desc;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue