Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EODatabaseContext


                return;
            }

            //if entity caches objects, clear out the cache
            if( entity.cachesObjects() ) {
                EODatabaseContext databaseContext = EOUtilities.databaseContextForModelNamed(sharedEC, entity.model().name());
                EODatabase database = databaseContext.database();
                database.invalidateResultCacheForEntityNamed(entityName);
            }

            NSArray fetchSpecNames = entity.sharedObjectFetchSpecificationNames();
            int count =  (fetchSpecNames != null) ? fetchSpecNames.count() : 0;
View Full Code Here


  @SuppressWarnings( { "unchecked", "cast" })
  protected void ensureSnapshotsLoaded() {
    if (_entityStats == null) {
      _entityStats = new NSMutableDictionary<String, SEEntityStats>();
      EODatabaseContext databaseContext = EODatabaseContext.registeredDatabaseContextForModel(_model, ERXEC.newEditingContext());
      databaseContext.lock();
      try {
        EODatabase database = databaseContext.database();
        for (EOGlobalID gid : (NSArray<EOGlobalID>) database.snapshots().allKeys()) {
          if (gid instanceof EOKeyGlobalID) {
            EOKeyGlobalID kgid = (EOKeyGlobalID) gid;
            String entityName = kgid.entityName();
            SEEntityStats entityStats = _entityStats.get(entityName);
            if (entityStats == null) {
              EOEntity entity = _model.entityNamed(entityName);
              if (entity != null) {
                entityStats = new SEEntityStats(databaseContext, entity);
                _entityStats.put(entityName, entityStats);
              }
            }
            if (entityStats != null) {
              NSDictionary<String, Object> snapshot = (NSDictionary<String, Object>) database.snapshotForGlobalID(gid);
              entityStats.addSnapshot(kgid, snapshot);
            }
          }
        }
      }
      finally {
        databaseContext.unlock();
      }
    }
  }
View Full Code Here

   *            the EOModel
   * @return the database the database product name ("FrontBase",
   *         "PostgreSQL")
   */
  public static String databaseProductName(EOModel model) {
    EODatabaseContext databaseContext = EODatabaseContext.registeredDatabaseContextForModel(model, ERXEC.newEditingContext());
    EOAdaptor adaptor = databaseContext.database().adaptor();
    String databaseProductName;
    if (adaptor instanceof JDBCAdaptor) {
      databaseProductName = ((JDBCAdaptor) adaptor).plugIn().databaseProductName();
    }
    else {
View Full Code Here

    }
  }
 
  private static Neo4JContext context() {
    EOEditingContext ec = ERXEC.newEditingContext();
    EODatabaseContext dbContext = EOUtilities.databaseContextForModelNamed(ec, MODEL_NAME);
    Neo4JContext context = (Neo4JContext) dbContext.availableChannel().adaptorChannel().adaptorContext();
   
    return context;
  }
View Full Code Here

      final EOEditingContext ec = object.editingContext();
      EOEntity entity = EOUtilities.entityForObject(ec, object);

        final EOGlobalID gid = ec.globalIDForObject(object);
        String modelName = entity.model().name();
        final EODatabaseContext dbc = EOUtilities.databaseContextForModelNamed(ec, modelName);

        NSArray toManySnapshot = ERXEOAccessUtilities.executeDatabaseContextOperation(dbc, 2,
                new DatabaseContextOperation<NSArray>() {
                    public NSArray execute(EODatabaseContext databaseContext) throws Exception {
                        // Search for and return the snapshot
                        return dbc.snapshotForSourceGlobalID(gid, relationshipName, ec.fetchTimestamp());
                    }
                });
        return toManySnapshot;
  }
View Full Code Here

        final EOEditingContext ec = object.editingContext();
        EOEntity entity = EOUtilities.entityForObject(ec, object);

        final EOGlobalID gid = ec.globalIDForObject(object);
        String modelName = entity.model().name();
        final EODatabaseContext dbc = EOUtilities.databaseContextForModelNamed(ec, modelName);

        NSDictionary snapshot = ERXEOAccessUtilities.executeDatabaseContextOperation(dbc, 2,
                new DatabaseContextOperation<NSDictionary>() {
                    public NSDictionary execute(EODatabaseContext databaseContext) throws Exception {
                        // Search for and return the snapshot
                        return dbc.snapshotForGlobalID(gid, ec.fetchTimestamp());
                    }
                });
        return snapshot;
    }
View Full Code Here

TOP

Related Classes of com.webobjects.eoaccess.EODatabaseContext

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.