package act.db.morphia;

import act.util.General;
import org.bson.types.ObjectId;
import org.mongodb.morphia.Datastore;

/**
 * The morphia dao base implementation use {@link org.bson.types.ObjectId} as the ID type
 */
@General
public class MorphiaDao<MODEL_TYPE>
        extends MorphiaDaoBase<ObjectId, MODEL_TYPE> {

    public MorphiaDao(Class<MODEL_TYPE> modelType, Datastore ds) {
        super(modelType, ds);
    }

    public MorphiaDao(Class<MODEL_TYPE> modelType) {
        super(modelType);
    }

    public MorphiaDao() {}
}

@@ -112,16 +112,92 @@
 tastore;
+%0Aimport org.osgl.Osgl;%0Aimport org.osgl.util.C;%0A%0Aimport java.util.Collection;
 %0A%0A/**%0A *
@@ -605,11 +605,512 @@
 Dao() %7B%7D
+%0A%0A    public MODEL_TYPE findById(String id) %7B%0A        return findById(new ObjectId(id));%0A    %7D%0A%0A    public void deleteById(String id) %7B%0A        super.deleteById(new ObjectId(id));%0A    %7D%0A%0A    public Iterable%3CMODEL_TYPE%3E findByIdList(Collection%3CString%3E idList) %7B%0A        return super.findByIdList(C.list(idList).map(new Osgl.Transformer%3CString, ObjectId%3E() %7B%0A            @Override%0A            public ObjectId transform(String s) %7B%0A                return new ObjectId(s);%0A            %7D%0A        %7D));%0A    %7D
 %0A%7D%0A

add findById(String) method to MorphiaDao