All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.bonita.search.ObjectMapFieldBridge Maven / Gradle / Ivy

package org.ow2.bonita.search;

import java.util.Map;
import java.util.Map.Entry;

import org.apache.lucene.document.Document;
import org.hibernate.search.bridge.FieldBridge;
import org.hibernate.search.bridge.LuceneOptions;

public class ObjectMapFieldBridge implements FieldBridge {

  @SuppressWarnings("unchecked")
  public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
    Map variables = (Map) value;
    if (variables != null) {
      for (Entry variable : variables.entrySet()) {
        Object variableValue = variable.getValue();
        if (variableValue != null) {
          luceneOptions.addFieldToDocument(name + "_name", variable.getKey().toString(), document);
          luceneOptions.addFieldToDocument(name + "_value", variable.getValue().toString(), document);
        }
      }
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy