Package org.mongodb.morphia

Examples of org.mongodb.morphia.DatastoreImpl


        processIgnoreFieldsAnnotations();
    }

    //remove any MappedField specified in @IgnoreFields on the class.
    void processIgnoreFieldsAnnotations() {
        final DatastoreImpl dsi = (DatastoreImpl) getDs();
        for (final MappedClass mc : dsi.getMapper().getMappedClasses()) {
            final IgnoreFields ignores = (IgnoreFields) mc.getAnnotation(IgnoreFields.class);
            if (ignores != null) {
                for (final String field : ignores.value().split(",")) {
                    final MappedField mf = mc.getMappedFieldByJavaField(field);
                    mc.getPersistenceFields().remove(mf);
View Full Code Here


                final ProxiedEntityReferenceList referencesAsProxy = (ProxiedEntityReferenceList) references;

                if (dbVal instanceof List) {
                    final List<Object> refList = (List) dbVal;
                    final List<DBRef> dbRefList = (List) dbVal;
                    final DatastoreImpl dsi = (DatastoreImpl) mapper.getDatastoreProvider().get();
                    final List<Key<Object>> keys = refAnn.idOnly()
                                                   ? dsi.getKeysByManualRefs(referenceObjClass, refList)
                                                   : dsi.getKeysByRefs(dbRefList);

                    if (keys.size() != refList.size()) {
                        final String msg = "Some of the references could not be fetched for " + mf.getFullName() + ". " + refList + " != "
                                           + keys;
                        if (!refAnn.ignoreMissing()) {
View Full Code Here

        final Boolean cached = cache.exists(key);
        if (cached != null) {
            return cached;
        }

        final DatastoreImpl dsi = (DatastoreImpl) mapper.getDatastoreProvider().get();

        final DBCollection dbColl = dsi.getCollection(c);
        if (!idOnly && !dbColl.getName().equals(dbRef.getRef())) {
            LOG.warning("Class " + c.getName() + " is stored in the '" + dbColl.getName()
                        + "' collection but a reference was found for this type to another collection, '" + dbRef.getRef()
                        + "'. The reference will be loaded using the class anyway. " + dbRef);
        }
        final boolean exists;
        if (idOnly) {
            exists = (dsi.find(dbColl.getName(), c).disableValidation().filter("_id", ref).asKeyList().size() == 1);
        } else {
            exists = (dsi.find(dbRef.getRef(), c).disableValidation().filter("_id", dbRef.getId()).asKeyList().size() == 1);
        }
        cache.notifyExists(key, exists);
        return exists;
    }
View Full Code Here

        entityClazz = type;
        ds.getMapper().addMappedClass(type);
    }

    protected void initDS(final MongoClient mongoClient, final Morphia mor, final String db) {
        ds = new DatastoreImpl(mor, mongoClient, db);
    }
View Full Code Here

TOP

Related Classes of org.mongodb.morphia.DatastoreImpl

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.