Package er.indexing

Source Code of er.indexing.ERDocument

package er.indexing;

import org.apache.lucene.document.Document;

import com.webobjects.eocontrol.EOKeyGlobalID;
import com.webobjects.foundation.NSKeyValueCoding;

import er.extensions.eof.ERXKeyGlobalID;

public class ERDocument implements NSKeyValueCoding {
 
  private static final String GID = "EOGlobalID";
  
  private Document _doc;
  private Float _score;
 
  public ERDocument(Document doc, float score) {
    super();
    _doc = doc;
    _score = Float.valueOf(score);
  }
 
  // ACCESSORS
 
  public Float score() {
    return _score;
  }
 
  public void setScore(Float score) {
    _score = score;
  }
 
  public EOKeyGlobalID eoKeyGlobalId() {
    String gidString = _doc.get(GID);
    EOKeyGlobalID gid = ERXKeyGlobalID.fromString(gidString).globalID();
    return gid;
  }
 
  // KVC
 
  public Object valueForKey(String key) {
    Object result =  _doc.get(key);
    if (result == null) {
      result =  NSKeyValueCoding.DefaultImplementation.valueForKey(this, key);
    }
    return result;
  }
 
  public void takeValueForKey(Object obj, String key) {
    // do nuttin'
  }
 
}
TOP

Related Classes of er.indexing.ERDocument

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.