Author: ssmiweve
Date: 2008-09-29 11:22:45 +0200 (Mon, 29 Sep 2008)
New Revision: 6852
Added:
trunk/generic.sesam/result-handler-config/src/main/java/no/sesat/search/result/handler/FieldSplitterResultHandlerConfig.java
Log:
dawdle duckling: SKER4752 Promote FieldSplitter result handler (from Schibsted
S?\195?\184k AS)
Added:
trunk/generic.sesam/result-handler-config/src/main/java/no/sesat/search/result/handler/FieldSplitterResultHandlerConfig.java
===================================================================
---
trunk/generic.sesam/result-handler-config/src/main/java/no/sesat/search/result/handler/FieldSplitterResultHandlerConfig.java
(rev 0)
+++
trunk/generic.sesam/result-handler-config/src/main/java/no/sesat/search/result/handler/FieldSplitterResultHandlerConfig.java
2008-09-29 09:22:45 UTC (rev 6852)
@@ -0,0 +1,125 @@
+/* Copyright (2008) Schibsted Søk AS
+ * This file is part of SESAT.
+ *
+ * SESAT is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SESAT 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with SESAT. If not, see <http://www.gnu.org/licenses/>.
+ */
+package no.sesat.search.result.handler;
+
+import no.sesat.search.result.handler.AbstractResultHandlerConfig.Controller;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+
+/**
+ * Config for the result handler to split a field into an array.
+ *
+ * @version $Id$
+ */
[EMAIL PROTECTED]("FieldSplitter")
+public final class FieldSplitterResultHandlerConfig extends
AbstractResultHandlerConfig {
+
+ // Constants -----------------------------------------------------
+
+ private static final Logger LOG =
Logger.getLogger(FieldSplitterResultHandlerConfig.class);
+
+ private static final long serialVersionUID = -4594292275796458399L;
+
+ private static final String DEFAULT_SEPARATOR = "fastpbfast";
+
+ // Attributes ----------------------------------------------------
+
+ private String fromField;
+
+ private String toField;
+
+ private String separator;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public AbstractResultHandlerConfig readResultHandler(final Element
element) {
+ super.readResultHandler(element);
+
+ fromField = element.getAttribute("from-field");
+ toField = element.getAttribute("to-field");
+
+ if (element.getAttribute("separator") != null &&
element.getAttribute("separator").length() > 0) {
+ separator = element.getAttribute("separator");
+ } else {
+ separator = DEFAULT_SEPARATOR;
+ }
+
+ return this;
+ }
+
+ // Getters / Setters ---------------------------------------------
+
+ /** The field whose content will be split.
+ * @return the fromField
+ */
+ public String getFromField() {
+ return fromField;
+ }
+
+ /** @see #getFromField()
+ *
+ * @param from Set from field.
+ */
+ public void setFromField(final String from) {
+ fromField = from;
+ }
+
+ /** The field where the array resulting from the split will end up in.
+ * @return the toField
+ */
+ public String getToField() {
+ return toField;
+ }
+
+ /** @see #getToField()
+ *
+ * @param to set to field.
+ */
+ public void setToField(final String to) {
+ toField = to;
+ }
+
+ /** The separator to split upon.
+ * @return the separator
+ */
+ public String getSeparator() {
+ return separator;
+ }
+
+ /** @see #getSeparator()
+ *
+ * @param s separator to use.
+ */
+ public void setSeparator(final String s) {
+ separator = s;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Property changes on:
trunk/generic.sesam/result-handler-config/src/main/java/no/sesat/search/result/handler/FieldSplitterResultHandlerConfig.java
___________________________________________________________________
Name: svn:keywords
+ Id
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits