X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Flocalizer%2Fbasic%2FMirBasicChildArticlePostingHandler.java;h=311f1260a630fdd068f2278c1df38ef63ddab93f;hb=2d3a3231809a1af4e373c3fd13902eeee26728c9;hp=4a2cee782fe733ac172058c9e47a6caa2e3f44cf;hpb=8297c34c7a424107fd7d1980b6e8e5a3ae26494b;p=mir.git diff --git a/source/mircoders/localizer/basic/MirBasicChildArticlePostingHandler.java b/source/mircoders/localizer/basic/MirBasicChildArticlePostingHandler.java index 4a2cee78..311f1260 100755 --- a/source/mircoders/localizer/basic/MirBasicChildArticlePostingHandler.java +++ b/source/mircoders/localizer/basic/MirBasicChildArticlePostingHandler.java @@ -1,62 +1,78 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Mir is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. - * If you do not wish to do so, delete this exception statement from your version. - */ - -package mircoders.localizer.basic; - -import mir.session.Request; -import mir.session.Session; -import mir.session.SessionExc; -import mir.session.SessionFailure; -import mircoders.entity.EntityContent; - - -public class MirBasicChildArticlePostingHandler extends MirBasicArticlePostingHandler { - public MirBasicChildArticlePostingHandler() { - super(); - - setNormalResponseGenerator(configuration.getString("Localizer.OpenSession.article.EditTemplate")); - } - - public void finalizeArticle(Request aRequest, Session aSession, EntityContent anArticle) throws SessionExc, SessionFailure { - super.finalizeArticle(aRequest, aSession, anArticle); - - anArticle.setValueForProperty("to_content", (String) aSession.getAttribute("to_content")); - } - - protected void initializeSession(Request aRequest, Session aSession) throws SessionExc, SessionFailure { - super.initializeSession(aRequest, aSession); - - String parentId = aRequest.getParameter("to_content"); - if (parentId==null) - throw new SessionExc("initializeSession: parent id not set!"); - - aSession.setAttribute("to_content", parentId); - }; +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mircoders.localizer.basic; + +import mir.session.Request; +import mir.session.Session; +import mir.session.SessionExc; +import mir.session.SessionFailure; +import mircoders.entity.EntityContent; + +/** + * Handler for open postings of "child articles", that is articles + * linked to other articles. Used frequently for translations. + */ +public class MirBasicChildArticlePostingHandler extends MirBasicArticlePostingHandler { + public MirBasicChildArticlePostingHandler() { + super(); + + setNormalResponseGenerator(configuration.getString("Localizer.OpenSession.article.EditTemplate")); + } + + /** + * {@inheritDoc} + * + *

+ * This class overrides this method to set the parent article. + */ + public void finalizeArticle(Request aRequest, Session aSession, EntityContent anArticle) throws SessionExc, SessionFailure { + super.finalizeArticle(aRequest, aSession, anArticle); + + anArticle.setFieldValue("to_content", (String) aSession.getAttribute("to_content")); + } + + /** + * {@inheritDoc} + * + *

+ * Overridden by this class to retrieve and store the to be associated + * parent article for subsequent usage. + */ + protected void initializeSession(Request aRequest, Session aSession) throws SessionExc, SessionFailure { + super.initializeSession(aRequest, aSession); + + String parentId = aRequest.getParameter("to_content"); + if (parentId==null) + throw new SessionExc("initializeSession: parent id not set!"); + + aSession.setAttribute("to_content", parentId); + } } \ No newline at end of file