Package net.csdn.mongo

Examples of net.csdn.mongo.Document


* Date: 12-11-6
* Time: 下午2:34
*/
public class Insert {
    public static boolean execute(Document doc, boolean validate) {
        Document parent = doc._parent;
        if (parent != null) {
            Insert.execute(parent, validate);
        } else {
            doc.runCallbacks(Callbacks.Callback.before_save);
            //we cannot call doc.collection().remove() directly,because of the dam inheritance of static methods in java
View Full Code Here


* Time: 下午2:07
*/
public class Save {

    public static boolean execute(Document doc) {
        Document parent = doc._parent;
        if (parent != null) {
            Save.execute(parent);
        } else {
            doc.runCallbacks(Callbacks.Callback.before_save);
            //we cannot call doc.collection().remove() directly,because of the dam inheritance of static methods in java
View Full Code Here

    public Inc() {
    }

    public boolean persist(String field, Object value) {
        Document parent = doc._parent;
        if (parent != null) {
            //Update.execute(parent, validate);
        } else {
            doc.runCallbacks(Callbacks.Callback.before_update);
            //we cannot call doc.collection().remove() directly,because of the dam inheritance of static methods in java
View Full Code Here

public class Delete {


    public static boolean execute(Document doc) {

        Document parent = doc._parent;

        if (parent != null) {
            parent.remove(doc);
        } else {
            doc.runCallbacks(Callbacks.Callback.before_destroy);
            //we cannot call doc.collection().remove() directly,because of the dam inheritance of static methods in java
            DBCollection collection = (DBCollection) ReflectHelper.staticMethod(doc.getClass(), "collection");
            collection.remove(new BasicDBObject("_id", doc.id()));
View Full Code Here

* Date: 12-11-6
* Time: 下午2:38
*/
public class Update {
    public static boolean execute(Document doc, boolean validate) {
        Document parent = doc._parent;
        if (parent != null) {
            Update.execute(parent, validate);
        } else {
            doc.runCallbacks(Callbacks.Callback.before_update);
            //we cannot call doc.collection().remove() directly,because of the dam inheritance of static methods in java
View Full Code Here

                    Object obj = objField.get(target);
                    if (obj instanceof Collection) {
                        Collection objs = (Collection) obj;
                        Iterator iterator = objs.iterator();
                        while (iterator.hasNext()) {
                            Document member = (Document) iterator.next();
                            if (member == null) continue;
                            if (!member.valid()) {
                                validateResultList.addAll(member.validateResults);
                            }

                        }
                    } else/*单个对象*/ {
                        Document member = (Document) obj;
                        if (member == null) continue;
                        if (!member.valid()) {
                            validateResultList.addAll(member.validateResults);
                        }
                    }
                }
            }
View Full Code Here

    }


    @Override
    public Association build(Map params) {
        Document child = (Document) ReflectHelper.staticMethod(kclass, "create", params);
        documentList.add(child);
        return this;
    }
View Full Code Here

        List<Map> attributes = (List<Map>) document.attributes().get(name);
        if (attributes == null) return;
        //Children share the same HashMap in parent.So modify will be know by parent
        for (Map item : attributes) {
            Document child = (Document) staticMethod(kclass, "create9", item);
            child._parent = document;
            child.associationEmbeddedName = name;
            children.add(child);
        }
    }
View Full Code Here

    @Override
    public AssociationEmbedded build(Map params) {
        Map temp = map();
        temp.putAll(params);
        Document child = (Document) staticMethod(kclass, "create9", temp);
        child._parent = document;
        child.associationEmbeddedName = name;
        children.add(child);
        List childAttr = (List) document.attributes().get(name);
        if (isEmpty(childAttr)) document.attributes().put(name, list());
View Full Code Here

TOP

Related Classes of net.csdn.mongo.Document

Copyright © 2018 www.massapicom. 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.