From 57c4afe8bc1cb7b1eeec6721f486794664d9f32b Mon Sep 17 00:00:00 2001 From: travismccauley Date: Fri, 19 Dec 2003 19:32:04 +0000 Subject: [PATCH] Added Remove functionality for all components and fixed broken Edit for Passage Translations --- images/remove.gif | Bin 0 -> 137 bytes src/java/hibernate.cfg.xml | 2 +- src/java/org/thdl/lex/LexActionServlet.java | 5 +- .../org/thdl/lex/LexComponentRepository.java | 22 +++ src/java/org/thdl/lex/LogoutServlet.java | 3 +- .../lex/commands/GetUpdateFormCommand.java | 51 +++---- .../org/thdl/lex/commands/InsertCommand.java | 18 +++ .../org/thdl/lex/commands/RemoveCommand.java | 141 ++++++++++++++---- .../org/thdl/lex/commands/UpdateCommand.java | 24 ++- .../thdl/lex/component/BaseDefinition.java | 31 ++-- .../org/thdl/lex/component/BaseEtymology.java | 11 +- .../thdl/lex/component/BaseModelSentence.java | 11 +- .../org/thdl/lex/component/BasePassage.java | 11 +- .../thdl/lex/component/BaseSubdefinition.java | 31 ++-- src/java/org/thdl/lex/component/ITerm.java | 9 ++ .../thdl/lex/component/LexComponent.hbm.xml | 25 ++-- .../org/thdl/lex/component/LexComponent.java | 16 ++ src/java/org/thdl/lex/component/Term.java | 14 ++ .../org/thdl/lex/component/Translatable.java | 8 +- src/jsp/jsp/displayDefinition.jsf | 1 + src/jsp/jsp/displayEncyclopediaArticle.jsf | 1 + src/jsp/jsp/displayEtymology.jsf | 1 + src/jsp/jsp/displayForm.jsp | 88 +++++++++++ src/jsp/jsp/displayFunction.jsf | 1 + src/jsp/jsp/displayKeyword.jsf | 1 + src/jsp/jsp/displayModelSentence.jsf | 1 + src/jsp/jsp/displayNotes.jsf | 8 + src/jsp/jsp/displayPassage.jsf | 11 +- src/jsp/jsp/displayPronunciation.jsf | 1 + src/jsp/jsp/displayRegister.jsf | 1 + src/jsp/jsp/displayRelatedTerm.jsf | 1 + src/jsp/jsp/displaySpelling.jsf | 1 + src/jsp/jsp/displaySubdefinition.jsf | 1 + src/jsp/jsp/displayTerm.jsf | 5 +- src/jsp/jsp/displayTransitionalData.jsf | 1 + src/jsp/jsp/displayTranslationEquivalent.jsf | 7 +- src/jsp/jsp/error.jsp | 4 +- src/jsp/jsp/passageForm.jsf | 8 +- 38 files changed, 430 insertions(+), 146 deletions(-) create mode 100644 images/remove.gif diff --git a/images/remove.gif b/images/remove.gif new file mode 100644 index 0000000000000000000000000000000000000000..78e1023dc09b5e5f9d90d507e96a80607d1667be GIT binary patch literal 137 zcmZ?wbhEHblwjazSj58c9|#y2X3m_+zyM+cNeEE<$->CMz`~#d;)2vNF#CC!-1+CP z>#%xnxepK1`>6+Nw?-%Wo=S$;et=&F1aOs_|Vf!W5 f{>XA|p06`u8dfA literal 0 HcmV?d00001 diff --git a/src/java/hibernate.cfg.xml b/src/java/hibernate.cfg.xml index 3e77d50..ca38ebe 100644 --- a/src/java/hibernate.cfg.xml +++ b/src/java/hibernate.cfg.xml @@ -8,7 +8,7 @@ java:comp/env/jdbc/lex-datasource true - false + true net.sf.hibernate.dialect.MySQLDialect diff --git a/src/java/org/thdl/lex/LexActionServlet.java b/src/java/org/thdl/lex/LexActionServlet.java index 22e7e16..1715f78 100644 --- a/src/java/org/thdl/lex/LexActionServlet.java +++ b/src/java/org/thdl/lex/LexActionServlet.java @@ -209,7 +209,10 @@ public class LexActionServlet extends HttpServlet commands.put( "displayFull", new DisplayCommand( "displayEntry.jsp" ) ); commands.put( "editEntry", new DisplayCommand( "displayEntry.jsp" ) ); - commands.put( "remove", new RemoveCommand( "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" ) ); diff --git a/src/java/org/thdl/lex/LexComponentRepository.java b/src/java/org/thdl/lex/LexComponentRepository.java index 88c8fa9..5b565b8 100644 --- a/src/java/org/thdl/lex/LexComponentRepository.java +++ b/src/java/org/thdl/lex/LexComponentRepository.java @@ -426,6 +426,28 @@ public class LexComponentRepository } + /** + * 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 ); + } + catch ( HibernateException he ) + { + throw new LexRepositoryException( he ); + } + } + + /** * Description of the Method * diff --git a/src/java/org/thdl/lex/LogoutServlet.java b/src/java/org/thdl/lex/LogoutServlet.java index f54de65..85b1aaa 100644 --- a/src/java/org/thdl/lex/LogoutServlet.java +++ b/src/java/org/thdl/lex/LogoutServlet.java @@ -66,7 +66,8 @@ public class LogoutServlet extends HttpServlet UserSessionManager.getInstance().removeVisit( session ); try { - UserSessionManager.doRedirect( request, response, goodbyePage ); + String redirect = response.encodeRedirectURL( getGoodbyePage() ); + response.sendRedirect( redirect ); } catch ( IOException e ) { diff --git a/src/java/org/thdl/lex/commands/GetUpdateFormCommand.java b/src/java/org/thdl/lex/commands/GetUpdateFormCommand.java index 2e4231d..70c240f 100644 --- a/src/java/org/thdl/lex/commands/GetUpdateFormCommand.java +++ b/src/java/org/thdl/lex/commands/GetUpdateFormCommand.java @@ -1,7 +1,7 @@ package org.thdl.lex.commands; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.HashMap; +import java.util.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; @@ -58,7 +58,7 @@ public class GetUpdateFormCommand extends LexCommand implements Command { String next = getNext(); Visit visit = UserSessionManager.getInstance().getVisit( req.getSession( true ) ); - LexQuery query = visit.getQuery( ); + LexQuery query = visit.getQuery(); ITerm term = query.getEntry(); String msg = null; ThdlUser user = visit.getUser(); @@ -74,6 +74,26 @@ public class GetUpdateFormCommand extends LexCommand implements Command { component = query.getEntry(); } + 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 ); @@ -93,33 +113,6 @@ public class GetUpdateFormCommand extends LexCommand implements Command } //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 Update Form"; visit.setDisplayMode( "addEditForm" ); diff --git a/src/java/org/thdl/lex/commands/InsertCommand.java b/src/java/org/thdl/lex/commands/InsertCommand.java index 811fcfd..98089c1 100644 --- a/src/java/org/thdl/lex/commands/InsertCommand.java +++ b/src/java/org/thdl/lex/commands/InsertCommand.java @@ -91,6 +91,24 @@ public class InsertCommand extends LexCommand implements Command ILexComponent parent = term.findParent( component.getParentId() ); parent.getAnalyticalNotes().add( 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 l = source.getTranslations(); + l.add( translation ); + } else { term.addChild( component ); diff --git a/src/java/org/thdl/lex/commands/RemoveCommand.java b/src/java/org/thdl/lex/commands/RemoveCommand.java index a1ae449..b1c1b12 100644 --- a/src/java/org/thdl/lex/commands/RemoveCommand.java +++ b/src/java/org/thdl/lex/commands/RemoveCommand.java @@ -1,23 +1,51 @@ package org.thdl.lex.commands; + import java.sql.ResultSet; import java.sql.SQLException; -import java.util.HashMap; - +import java.util.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.thdl.lex.*; import org.thdl.lex.component.*; +import org.thdl.users.*; /** * Description of the Class * * @author travis - * @created October 14, 2003 + * @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 @@ -29,46 +57,95 @@ public class RemoveCommand extends LexCommand implements Command */ 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 remove component, user's session has expired" ); + } - /* - try - { - setComponent( (LexComponent)component ); - getComponent().query( Integer.parseInt( req.getParameter("id") ) ); - String msg=null; - int successCode = getComponent().remove(); - msg=null; - String label = req.getParameter( LexConstants.LABEL_REQ_PARAM ); - if (successCode > 0) - { msg = "The " + label +" was successfully removed."; } - else - { msg = "Failure: The " + getComponent().getLabel() +" was not removed."; } - req.setAttribute(LexConstants.MESSAGE_REQ_ATTR, msg); - */ - return getNext(); - /* - } - catch (LexComponentException e) - { - throw new CommandException("Lex Action Exception: " + e.getMessage()); - } - */ + ThdlUser user = visit.getUser(); + LexQuery query = visit.getQuery(); + ITerm term = query.getEntry(); + + if ( CommandToken.isValid( req ) && validate( user, component ) ) + { + if ( isTermMode() ) + { + term.setDeleted( Boolean.TRUE ); + LexComponentRepository.update( term ); + query.setEntry( null ); + } + 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(); + 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 RemoveCommand object + *Constructor for the GetFormCommand object * - * @param next Description of the Parameter + * @param next Description of the Parameter + * @param termMode Description of the Parameter */ - public RemoveCommand( String next ) + public RemoveCommand( String next, Boolean termMode ) { super( next ); + setTermMode( termMode.booleanValue() ); } } diff --git a/src/java/org/thdl/lex/commands/UpdateCommand.java b/src/java/org/thdl/lex/commands/UpdateCommand.java index 2ce44c1..319a3bc 100644 --- a/src/java/org/thdl/lex/commands/UpdateCommand.java +++ b/src/java/org/thdl/lex/commands/UpdateCommand.java @@ -59,9 +59,9 @@ public class UpdateCommand extends LexCommand implements Command { String msg = null; String next = getNext(); - Visit visit = UserSessionManager.getInstance().getVisit( req.getSession( true ) ); + Visit visit = UserSessionManager.getInstance().getVisit( req.getSession( true ) ); - DisplayHelper displayHelper = visit.getHelper( ); + DisplayHelper displayHelper = visit.getHelper(); try { HttpSession ses = req.getSession( false ); @@ -86,6 +86,26 @@ public class UpdateCommand extends LexCommand implements Command term.getMeta().populate( req.getParameterMap() ); component = term; } + 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() ); diff --git a/src/java/org/thdl/lex/component/BaseDefinition.java b/src/java/org/thdl/lex/component/BaseDefinition.java index f3b419a..e52c320 100644 --- a/src/java/org/thdl/lex/component/BaseDefinition.java +++ b/src/java/org/thdl/lex/component/BaseDefinition.java @@ -2,7 +2,6 @@ package org.thdl.lex.component; import java.io.Serializable; import java.util.List; -import java.util.Set; import org.apache.commons.lang.builder.ToStringBuilder; /** @author Hibernate CodeGenerator */ @@ -23,6 +22,9 @@ abstract public class BaseDefinition extends LexComponent implements org.thdl.le /** nullable persistent field */ private org.thdl.lex.component.ILexComponent parent; + /** persistent field */ + private List translations; + /** persistent field */ private List subdefinitions; @@ -47,17 +49,15 @@ abstract public class BaseDefinition extends LexComponent implements org.thdl.le /** persistent field */ private List registers; - /** persistent field */ - private Set translations; - /** full constructor */ - public BaseDefinition(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.String definition, java.lang.Integer translationOf, org.thdl.lex.component.ILexComponent parent, List subdefinitions, List glosses, List keywords, List modelSentences, List translationEquivalents, List relatedTerms, List passages, List registers, Set translations) { + public BaseDefinition(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.String definition, java.lang.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.precedence = precedence; this.definition = definition; this.translationOf = translationOf; this.parent = parent; + this.translations = translations; this.subdefinitions = subdefinitions; this.glosses = glosses; this.keywords = keywords; @@ -66,7 +66,6 @@ abstract public class BaseDefinition extends LexComponent implements org.thdl.le this.relatedTerms = relatedTerms; this.passages = passages; this.registers = registers; - this.translations = translations; } /** default constructor */ @@ -74,9 +73,10 @@ abstract public class BaseDefinition extends LexComponent implements org.thdl.le } /** minimal constructor */ - public BaseDefinition(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer precedence, List subdefinitions, List glosses, List keywords, List modelSentences, List translationEquivalents, List relatedTerms, List passages, List registers, Set translations) { + public BaseDefinition(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer precedence, List translations, List subdefinitions, List glosses, List keywords, List modelSentences, List translationEquivalents, List relatedTerms, List passages, List registers) { super(deleted, analyticalNotes, meta); this.precedence = precedence; + this.translations = translations; this.subdefinitions = subdefinitions; this.glosses = glosses; this.keywords = keywords; @@ -85,7 +85,6 @@ abstract public class BaseDefinition extends LexComponent implements org.thdl.le this.relatedTerms = relatedTerms; this.passages = passages; this.registers = registers; - this.translations = translations; } public java.lang.Integer getParentId() { @@ -128,6 +127,14 @@ abstract public class BaseDefinition extends LexComponent implements org.thdl.le this.parent = parent; } + public java.util.List getTranslations() { + return this.translations; + } + + public void setTranslations(java.util.List translations) { + this.translations = translations; + } + public java.util.List getSubdefinitions() { return this.subdefinitions; } @@ -192,14 +199,6 @@ abstract public class BaseDefinition extends LexComponent implements org.thdl.le this.registers = registers; } - public java.util.Set getTranslations() { - return this.translations; - } - - public void setTranslations(java.util.Set translations) { - this.translations = translations; - } - public String toString() { return new ToStringBuilder(this) .append("metaId", getMetaId()) diff --git a/src/java/org/thdl/lex/component/BaseEtymology.java b/src/java/org/thdl/lex/component/BaseEtymology.java index 5a46e76..032190a 100644 --- a/src/java/org/thdl/lex/component/BaseEtymology.java +++ b/src/java/org/thdl/lex/component/BaseEtymology.java @@ -2,7 +2,6 @@ package org.thdl.lex.component; import java.io.Serializable; import java.util.List; -import java.util.Set; import org.apache.commons.lang.builder.ToStringBuilder; /** @author Hibernate CodeGenerator */ @@ -33,10 +32,10 @@ abstract public class BaseEtymology extends LexComponent implements org.thdl.lex private org.thdl.lex.component.ILexComponent parent; /** persistent field */ - private Set translations; + private List translations; /** full constructor */ - public BaseEtymology(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.Integer loanLanguage, java.lang.Integer etymologyType, java.lang.String derivation, java.lang.String etymologyDescription, java.lang.Integer translationOf, org.thdl.lex.component.ILexComponent parent, Set translations) { + public BaseEtymology(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.Integer loanLanguage, java.lang.Integer etymologyType, java.lang.String derivation, java.lang.String etymologyDescription, java.lang.Integer translationOf, org.thdl.lex.component.ILexComponent parent, List translations) { super(deleted, analyticalNotes, meta); this.parentId = parentId; this.precedence = precedence; @@ -54,7 +53,7 @@ abstract public class BaseEtymology extends LexComponent implements org.thdl.lex } /** minimal constructor */ - public BaseEtymology(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer etymologyType, java.lang.String derivation, java.lang.String etymologyDescription, Set translations) { + public BaseEtymology(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer etymologyType, java.lang.String derivation, java.lang.String etymologyDescription, List translations) { super(deleted, analyticalNotes, meta); this.etymologyType = etymologyType; this.derivation = derivation; @@ -126,11 +125,11 @@ abstract public class BaseEtymology extends LexComponent implements org.thdl.lex this.parent = parent; } - public java.util.Set getTranslations() { + public java.util.List getTranslations() { return this.translations; } - public void setTranslations(java.util.Set translations) { + public void setTranslations(java.util.List translations) { this.translations = translations; } diff --git a/src/java/org/thdl/lex/component/BaseModelSentence.java b/src/java/org/thdl/lex/component/BaseModelSentence.java index 8625a56..2c9ee58 100644 --- a/src/java/org/thdl/lex/component/BaseModelSentence.java +++ b/src/java/org/thdl/lex/component/BaseModelSentence.java @@ -2,7 +2,6 @@ package org.thdl.lex.component; import java.io.Serializable; import java.util.List; -import java.util.Set; import org.apache.commons.lang.builder.ToStringBuilder; /** @author Hibernate CodeGenerator */ @@ -24,10 +23,10 @@ abstract public class BaseModelSentence extends LexComponent implements org.thdl private org.thdl.lex.component.ILexComponent parent; /** persistent field */ - private Set translations; + private List translations; /** full constructor */ - public BaseModelSentence(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.String modelSentence, java.lang.Integer translationOf, org.thdl.lex.component.ILexComponent parent, Set translations) { + public BaseModelSentence(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.String modelSentence, java.lang.Integer translationOf, org.thdl.lex.component.ILexComponent parent, List translations) { super(deleted, analyticalNotes, meta); this.parentId = parentId; this.precedence = precedence; @@ -42,7 +41,7 @@ abstract public class BaseModelSentence extends LexComponent implements org.thdl } /** minimal constructor */ - public BaseModelSentence(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, Set translations) { + public BaseModelSentence(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, List translations) { super(deleted, analyticalNotes, meta); this.translations = translations; } @@ -87,11 +86,11 @@ abstract public class BaseModelSentence extends LexComponent implements org.thdl this.parent = parent; } - public java.util.Set getTranslations() { + public java.util.List getTranslations() { return this.translations; } - public void setTranslations(java.util.Set translations) { + public void setTranslations(java.util.List translations) { this.translations = translations; } diff --git a/src/java/org/thdl/lex/component/BasePassage.java b/src/java/org/thdl/lex/component/BasePassage.java index 2315dd4..c2391da 100644 --- a/src/java/org/thdl/lex/component/BasePassage.java +++ b/src/java/org/thdl/lex/component/BasePassage.java @@ -2,7 +2,6 @@ package org.thdl.lex.component; import java.io.Serializable; import java.util.List; -import java.util.Set; import org.apache.commons.lang.builder.ToStringBuilder; /** @author Hibernate CodeGenerator */ @@ -33,10 +32,10 @@ abstract public class BasePassage extends LexComponent implements org.thdl.lex.c private org.thdl.lex.component.ILexComponent parent; /** persistent field */ - private Set translations; + private List translations; /** full constructor */ - public BasePassage(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.String literarySource, java.lang.String spelling, java.lang.String pagination, java.lang.String passage, java.lang.Integer translationOf, org.thdl.lex.component.ILexComponent parent, Set translations) { + public BasePassage(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.String literarySource, java.lang.String spelling, java.lang.String pagination, java.lang.String passage, java.lang.Integer translationOf, org.thdl.lex.component.ILexComponent parent, List translations) { super(deleted, analyticalNotes, meta); this.parentId = parentId; this.precedence = precedence; @@ -54,7 +53,7 @@ abstract public class BasePassage extends LexComponent implements org.thdl.lex.c } /** minimal constructor */ - public BasePassage(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, Set translations) { + public BasePassage(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, List translations) { super(deleted, analyticalNotes, meta); this.translations = translations; } @@ -123,11 +122,11 @@ abstract public class BasePassage extends LexComponent implements org.thdl.lex.c this.parent = parent; } - public java.util.Set getTranslations() { + public java.util.List getTranslations() { return this.translations; } - public void setTranslations(java.util.Set translations) { + public void setTranslations(java.util.List translations) { this.translations = translations; } diff --git a/src/java/org/thdl/lex/component/BaseSubdefinition.java b/src/java/org/thdl/lex/component/BaseSubdefinition.java index 5c782e0..e09cebb 100644 --- a/src/java/org/thdl/lex/component/BaseSubdefinition.java +++ b/src/java/org/thdl/lex/component/BaseSubdefinition.java @@ -2,7 +2,6 @@ package org.thdl.lex.component; import java.io.Serializable; import java.util.List; -import java.util.Set; import org.apache.commons.lang.builder.ToStringBuilder; /** @author Hibernate CodeGenerator */ @@ -23,6 +22,9 @@ abstract public class BaseSubdefinition extends LexComponent implements org.thdl /** nullable persistent field */ private org.thdl.lex.component.ILexComponent parent; + /** persistent field */ + private List translations; + /** persistent field */ private List glosses; @@ -44,17 +46,15 @@ abstract public class BaseSubdefinition extends LexComponent implements org.thdl /** persistent field */ private List registers; - /** persistent field */ - private Set translations; - /** full constructor */ - public BaseSubdefinition(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.String subdefinition, java.lang.Integer translationOf, org.thdl.lex.component.ILexComponent parent, List glosses, List keywords, List modelSentences, List translationEquivalents, List relatedTerms, List passages, List registers, Set translations) { + public BaseSubdefinition(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, java.lang.Integer parentId, java.lang.Integer precedence, java.lang.String subdefinition, java.lang.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.precedence = precedence; this.subdefinition = subdefinition; this.translationOf = translationOf; this.parent = parent; + this.translations = translations; this.glosses = glosses; this.keywords = keywords; this.modelSentences = modelSentences; @@ -62,7 +62,6 @@ abstract public class BaseSubdefinition extends LexComponent implements org.thdl this.relatedTerms = relatedTerms; this.passages = passages; this.registers = registers; - this.translations = translations; } /** default constructor */ @@ -70,8 +69,9 @@ abstract public class BaseSubdefinition extends LexComponent implements org.thdl } /** minimal constructor */ - public BaseSubdefinition(java.lang.Boolean deleted, List analyticalNotes, org.thdl.lex.component.Meta meta, List glosses, List keywords, List modelSentences, List translationEquivalents, List relatedTerms, List passages, List registers, Set translations) { + public BaseSubdefinition(java.lang.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; @@ -79,7 +79,6 @@ abstract public class BaseSubdefinition extends LexComponent implements org.thdl this.relatedTerms = relatedTerms; this.passages = passages; this.registers = registers; - this.translations = translations; } public java.lang.Integer getParentId() { @@ -122,6 +121,14 @@ abstract public class BaseSubdefinition extends LexComponent implements org.thdl this.parent = parent; } + public java.util.List getTranslations() { + return this.translations; + } + + public void setTranslations(java.util.List translations) { + this.translations = translations; + } + public java.util.List getGlosses() { return this.glosses; } @@ -178,14 +185,6 @@ abstract public class BaseSubdefinition extends LexComponent implements org.thdl this.registers = registers; } - public java.util.Set getTranslations() { - return this.translations; - } - - public void setTranslations(java.util.Set translations) { - this.translations = translations; - } - public String toString() { return new ToStringBuilder(this) .append("metaId", getMetaId()) diff --git a/src/java/org/thdl/lex/component/ITerm.java b/src/java/org/thdl/lex/component/ITerm.java index c3780e9..47372b2 100644 --- a/src/java/org/thdl/lex/component/ITerm.java +++ b/src/java/org/thdl/lex/component/ITerm.java @@ -345,5 +345,14 @@ public interface ITerm extends LexComponentNode * @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; } diff --git a/src/java/org/thdl/lex/component/LexComponent.hbm.xml b/src/java/org/thdl/lex/component/LexComponent.hbm.xml index 361e68c..3438332 100644 --- a/src/java/org/thdl/lex/component/LexComponent.hbm.xml +++ b/src/java/org/thdl/lex/component/LexComponent.hbm.xml @@ -144,10 +144,11 @@ - + + - + @@ -203,10 +204,11 @@ - + + - + @@ -274,10 +276,11 @@ - + + - + @@ -361,10 +364,11 @@ - + + - + @@ -410,10 +414,11 @@ - + + - + diff --git a/src/java/org/thdl/lex/component/LexComponent.java b/src/java/org/thdl/lex/component/LexComponent.java index ad6db40..a5d646f 100644 --- a/src/java/org/thdl/lex/component/LexComponent.java +++ b/src/java/org/thdl/lex/component/LexComponent.java @@ -205,6 +205,22 @@ public abstract class LexComponent extends BaseLexComponent implements Serializa } + + /** + * Description of the Method + * + * @param o Description of the Parameter + * @return Description of the Return Value + */ + public boolean equals( Object o ) + { + boolean b = false; + if ( o instanceof ILexComponent ) + { + b = this.metaId.equals( ( (ILexComponent) o ).getMetaId() ); + } + return b; + } //constructors /** diff --git a/src/java/org/thdl/lex/component/Term.java b/src/java/org/thdl/lex/component/Term.java index c8a6f18..9641c90 100644 --- a/src/java/org/thdl/lex/component/Term.java +++ b/src/java/org/thdl/lex/component/Term.java @@ -160,6 +160,20 @@ public class Term extends BaseTerm implements Serializable, LexComponentNode } + /** + * Description of the Method + * + * @param child Description of the Parameter + * @exception LexComponentException Description of the Exception + */ + public void removeChild( ILexComponent child ) throws LexComponentException + { + List list = findSiblings( child ); + child = findChild( list, child.getMetaId() ); + list.remove( child ); + } + + /** * Description of the Method * diff --git a/src/java/org/thdl/lex/component/Translatable.java b/src/java/org/thdl/lex/component/Translatable.java index 83c4cde..af467c1 100644 --- a/src/java/org/thdl/lex/component/Translatable.java +++ b/src/java/org/thdl/lex/component/Translatable.java @@ -18,7 +18,7 @@ public interface Translatable extends ILexComponent /** - * Sets the translationOf attribute of the Translatable object + * Lists the translationOf attribute of the Translatable object * * @param pkReference The new translationOf value */ @@ -30,15 +30,15 @@ public interface Translatable extends ILexComponent * * @return The translations value */ - public java.util.Set getTranslations(); + public java.util.List getTranslations(); /** - * Sets the translations attribute of the Translatable object + * Lists the translations attribute of the Translatable object * * @param translations The new translations value */ - public void setTranslations( java.util.Set translations ); + public void setTranslations( java.util.List translations ); } diff --git a/src/jsp/jsp/displayDefinition.jsf b/src/jsp/jsp/displayDefinition.jsf index d8ec152..17abb4b 100644 --- a/src/jsp/jsp/displayDefinition.jsf +++ b/src/jsp/jsp/displayDefinition.jsf @@ -14,6 +14,7 @@ + diff --git a/src/jsp/jsp/displayEncyclopediaArticle.jsf b/src/jsp/jsp/displayEncyclopediaArticle.jsf index f4b3746..0c5a78b 100644 --- a/src/jsp/jsp/displayEncyclopediaArticle.jsf +++ b/src/jsp/jsp/displayEncyclopediaArticle.jsf @@ -9,6 +9,7 @@ + diff --git a/src/jsp/jsp/displayEtymology.jsf b/src/jsp/jsp/displayEtymology.jsf index 7020da9..df46a10 100644 --- a/src/jsp/jsp/displayEtymology.jsf +++ b/src/jsp/jsp/displayEtymology.jsf @@ -13,6 +13,7 @@ + diff --git a/src/jsp/jsp/displayForm.jsp b/src/jsp/jsp/displayForm.jsp index 08b2be2..0eb96c4 100644 --- a/src/jsp/jsp/displayForm.jsp +++ b/src/jsp/jsp/displayForm.jsp @@ -3,6 +3,7 @@ <% request.setCharacterEncoding("UTF-8"); %> + @@ -36,8 +37,95 @@ Back to: + + + + + + +

+ + + + + + +Warning!! This is your last chance. Are you sure you want to remove this component and all of its sub-components? + +

+ +
+ + + + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ + +

+
+ +<%--Insert Form--%> + diff --git a/src/jsp/jsp/displayFunction.jsf b/src/jsp/jsp/displayFunction.jsf index 6fc84f4..a291d50 100644 --- a/src/jsp/jsp/displayFunction.jsf +++ b/src/jsp/jsp/displayFunction.jsf @@ -7,6 +7,7 @@ + diff --git a/src/jsp/jsp/displayKeyword.jsf b/src/jsp/jsp/displayKeyword.jsf index 3adeacf..5d44fb3 100644 --- a/src/jsp/jsp/displayKeyword.jsf +++ b/src/jsp/jsp/displayKeyword.jsf @@ -11,6 +11,7 @@ + diff --git a/src/jsp/jsp/displayModelSentence.jsf b/src/jsp/jsp/displayModelSentence.jsf index c29e6c3..07d39f2 100644 --- a/src/jsp/jsp/displayModelSentence.jsf +++ b/src/jsp/jsp/displayModelSentence.jsf @@ -12,6 +12,7 @@ + diff --git a/src/jsp/jsp/displayNotes.jsf b/src/jsp/jsp/displayNotes.jsf index 2e908da..24106e0 100644 --- a/src/jsp/jsp/displayNotes.jsf +++ b/src/jsp/jsp/displayNotes.jsf @@ -11,6 +11,14 @@
  1. + + + + + + + + diff --git a/src/jsp/jsp/displayPassage.jsf b/src/jsp/jsp/displayPassage.jsf index 6f7fa01..e9ceb30 100644 --- a/src/jsp/jsp/displayPassage.jsf +++ b/src/jsp/jsp/displayPassage.jsf @@ -12,7 +12,7 @@ - + @@ -63,6 +63,13 @@
    • +

      + + + + + + <%-- @@ -93,7 +100,7 @@ - +

    diff --git a/src/jsp/jsp/displayPronunciation.jsf b/src/jsp/jsp/displayPronunciation.jsf index e48231d..48cdebf 100644 --- a/src/jsp/jsp/displayPronunciation.jsf +++ b/src/jsp/jsp/displayPronunciation.jsf @@ -12,6 +12,7 @@ + diff --git a/src/jsp/jsp/displayRegister.jsf b/src/jsp/jsp/displayRegister.jsf index dc0cb60..08cb5f7 100644 --- a/src/jsp/jsp/displayRegister.jsf +++ b/src/jsp/jsp/displayRegister.jsf @@ -11,6 +11,7 @@ + diff --git a/src/jsp/jsp/displayRelatedTerm.jsf b/src/jsp/jsp/displayRelatedTerm.jsf index e2eec88..c6f8c49 100644 --- a/src/jsp/jsp/displayRelatedTerm.jsf +++ b/src/jsp/jsp/displayRelatedTerm.jsf @@ -10,6 +10,7 @@ + diff --git a/src/jsp/jsp/displaySpelling.jsf b/src/jsp/jsp/displaySpelling.jsf index 5ad1f19..10bf1cb 100644 --- a/src/jsp/jsp/displaySpelling.jsf +++ b/src/jsp/jsp/displaySpelling.jsf @@ -7,6 +7,7 @@ + diff --git a/src/jsp/jsp/displaySubdefinition.jsf b/src/jsp/jsp/displaySubdefinition.jsf index 4c601fd..e046dc8 100644 --- a/src/jsp/jsp/displaySubdefinition.jsf +++ b/src/jsp/jsp/displaySubdefinition.jsf @@ -20,6 +20,7 @@ + diff --git a/src/jsp/jsp/displayTerm.jsf b/src/jsp/jsp/displayTerm.jsf index 4a8da85..7d85a80 100644 --- a/src/jsp/jsp/displayTerm.jsf +++ b/src/jsp/jsp/displayTerm.jsf @@ -29,11 +29,12 @@ + - + - + diff --git a/src/jsp/jsp/displayTransitionalData.jsf b/src/jsp/jsp/displayTransitionalData.jsf index ae5351f..7a0cf72 100644 --- a/src/jsp/jsp/displayTransitionalData.jsf +++ b/src/jsp/jsp/displayTransitionalData.jsf @@ -13,6 +13,7 @@ + diff --git a/src/jsp/jsp/displayTranslationEquivalent.jsf b/src/jsp/jsp/displayTranslationEquivalent.jsf index 19f2914..a6b32d4 100644 --- a/src/jsp/jsp/displayTranslationEquivalent.jsf +++ b/src/jsp/jsp/displayTranslationEquivalent.jsf @@ -11,20 +11,15 @@ + - - - - - - diff --git a/src/jsp/jsp/error.jsp b/src/jsp/jsp/error.jsp index 4e74b27..f9a7dbb 100644 --- a/src/jsp/jsp/error.jsp +++ b/src/jsp/jsp/error.jsp @@ -41,8 +41,8 @@ The message appears below.
    Message: <%= exception.getMessage() %>

    -<% if (request.getAttribute("component") != null) - { LexComponent lab = (LexComponent) request.getAttribute("component"); +<% if (request.getAttribute("comp") != null) + { LexComponent lab = (LexComponent) request.getAttribute("comp"); %> Label: <%= lab %>

    diff --git a/src/jsp/jsp/passageForm.jsf b/src/jsp/jsp/passageForm.jsf index ee19cbc..e906255 100644 --- a/src/jsp/jsp/passageForm.jsf +++ b/src/jsp/jsp/passageForm.jsf @@ -39,8 +39,8 @@ - - + <%-- + --%>
    @@ -61,11 +61,11 @@ Spelling: Pagination:
    -
    +
    Passage:
    -
    +