rebuilding head
[mir.git] / source / mircoders / localizer / basic / MirBasicChildArticlePostingHandler.java
index 4a2cee7..f8c49fe 100755 (executable)
@@ -1,62 +1,78 @@
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer.basic;\r
-\r
-import mir.session.Request;\r
-import mir.session.Session;\r
-import mir.session.SessionExc;\r
-import mir.session.SessionFailure;\r
-import mircoders.entity.EntityContent;\r
-\r
-\r
-public class MirBasicChildArticlePostingHandler extends MirBasicArticlePostingHandler {\r
-  public MirBasicChildArticlePostingHandler() {\r
-    super();\r
-\r
-    setNormalResponseGenerator(configuration.getString("Localizer.OpenSession.article.EditTemplate"));\r
-  }\r
-\r
-  public void finalizeArticle(Request aRequest, Session aSession, EntityContent anArticle) throws SessionExc, SessionFailure {\r
-    super.finalizeArticle(aRequest, aSession, anArticle);\r
-\r
-    anArticle.setValueForProperty("to_content", (String) aSession.getAttribute("to_content"));\r
-  }\r
-\r
-  protected void initializeSession(Request aRequest, Session aSession) throws SessionExc, SessionFailure {\r
-    super.initializeSession(aRequest, aSession);\r
-\r
-    String parentId = aRequest.getParameter("to_content");\r
-    if (parentId==null)\r
-      throw new SessionExc("initializeSession: parent id not set!");\r
-\r
-    aSession.setAttribute("to_content", parentId);\r
-  };\r
+/*
+ * 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}
+   *
+   * <p>
+   * 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}
+   *
+   * <p>
+   * 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