<commit_before>package foam.dao;

import foam.core.FObject;
import foam.nanos.pm.PM;

/**
 * Created by nick on 19/05/17.
 */
public class PMDAO extends ProxyDAO {

  @Override
  public FObject put(FObject obj) {
    PM pm = new PM(PMDAO.class, obj.getClassInfo().getId());
    try {
      getDelegate().put(obj);
    } catch(Exception e) {
      e.printStackTrace();
    } finally {
      pm.log(getX());
    }
    return obj;
  }
}<commit_msg>Implemented PMDAO<commit_after>package foam.dao;

import foam.core.FObject;
import foam.mlang.order.Comparator;
import foam.mlang.predicate.Predicate;
import foam.nanos.pm.PM;

/**
 * Created by nick on 19/05/17.
 */
public class PMDAO extends ProxyDAO {

  @Override
  public FObject put(FObject obj) {
    PM pm = new PM(PMDAO.class, obj.getClassInfo().getId() + ":put");
    try {
      super.put(obj);
    } catch(Exception e) {
      e.printStackTrace();
    } finally {
      pm.log(getX());
    }
    return obj;
  }

  @Override
  public FObject find(Object id) {
    PM pm;
    if (id instanceof FObject) {
      FObject obj = (FObject)id;
      pm = new PM(PMDAO.class, obj.getClassInfo().getId() + ":find");
    } else {
      pm = new PM(PMDAO.class, id.getClass().getName() + ":find");
    }
    FObject fobj = null;
    try {
      fobj = super.find(id);
    } catch(Exception e) {
      e.printStackTrace();
    } finally {
      pm.log(getX());
    }
    return fobj;
  }

  @Override
  public FObject remove(FObject obj) {
    PM pm = new PM(PMDAO.class, obj.getClassInfo().getId() + ":remove");
    try {
      super.remove(obj);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      pm.log(getX());
    }
    return obj;
  }

  @Override
  public void removeAll(Integer skip, Integer limit, Comparator order, Predicate predicate) {
    // Is this the right key to use?
    PM pm = new PM(PMDAO.class, getOwnClassInfo().getId() + ":removeAll");
    try {
      super.removeAll(skip, limit, order, predicate);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      pm.log(getX());
    }
  }
}
{'fraction_non_alphanumeric': 0.14721295855169128, 'fraction_numerical': 0.005717008099094807, 'mean_word_length': 2.577512776831346, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6859782', 'n_tokens_mistral': 738, 'n_tokens_neox': 725, 'n_words': 170}