Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOObjectStore


     *
     */
  private static final long serialVersionUID = 1L;

  public static EODistributedObjectStore _distributedObjectStore() {
    EOObjectStore objectStore = EOEditingContext.defaultParentObjectStore();
    if (objectStore == null || !(objectStore instanceof EODistributedObjectStore)) {
      throw new IllegalStateException("Default parent object store needs to be an EODistributedObjectStore");
    }
    return (EODistributedObjectStore) objectStore;
  }
View Full Code Here


     *          The SQL query
     * @param bindings
     *          The variable bindings, wrapped in {@link ERXSQLBinding} objects
     */
    public static void runSqlQueryWithBindings( EOEditingContext ec, String modelName, String query, ERXSQLBinding... bindings ) {
        EOObjectStore osc = ec.rootObjectStore();
        EODatabaseChannel databaseChannel = databaseContextForModelName(ec,modelName).availableChannel();
        osc.lock();

        try {
            EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel();
           
            if (!adaptorChannel.isOpen()) {
                adaptorChannel.openChannel();
            }

            EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForString( query );

            String proceccedQuery = processedQueryString(query, expression, bindings);
            expression.setStatement(proceccedQuery);

            try {
                adaptorChannel.evaluateExpression( expression );
            } finally {
                databaseChannel.cancelFetch();
            }
        } finally {
            osc.unlock();
        }
    }
View Full Code Here

            return true;
        }
        Object delegate=editingContext.delegate();
        if (delegate==null) {
            boolean _raiseOnMissingEditingContextDelegate = ERXProperties.booleanForKeyWithDefault("er.extensions.ERXRaiseOnMissingEditingContextDelegate", true);
            EOObjectStore parent = editingContext.parentObjectStore();
            if(!_raiseOnMissingEditingContextDelegate && parent != null && parent instanceof EOEditingContext) {
                Object parentDelegate=((EOEditingContext)parent).delegate();
                if(parentDelegate != null && (parentDelegate instanceof ERXEditingContextDelegate)) {
                    editingContext.setDelegate(parentDelegate);
                    log.info("Found null delegate. Setting to the parent's delegate.");
View Full Code Here

        }
      }
     
      if (includeNewObjectsInParentEditingContext && ! (editingContext.parentObjectStore() instanceof EOObjectStoreCoordinator) ) {
        final NSMutableArray parentEditingContexts = new NSMutableArray();
        EOObjectStore objectStore = editingContext.parentObjectStore();
        NSArray objects = NSArray.EmptyArray;
        int i;
        while (!(objectStore instanceof EOObjectStoreCoordinator)) {
          final EOEditingContext theEC = (EOEditingContext)objectStore;
          parentEditingContexts.addObject(theEC);
View Full Code Here

   *
   * @return the parent, usually an {@link EOObjectStoreCoordinator} to
   *         partition the task's EOF intensive work form the rest of the app.
   */
  protected final EOObjectStore parentObjectStore() {
    EOObjectStore osc = _parentObjectStore;
    if (osc == null) {
      synchronized (this) {
        osc = _parentObjectStore;
        if (osc == null) {
          _parentObjectStore = osc = ERXTaskObjectStoreCoordinatorPool.objectStoreCoordinator();
View Full Code Here

   *
   * @return the parent, usually an {@link EOObjectStoreCoordinator} to
   *         partition the task's EOF intensive work form the rest of the app.
   */
  final protected EOObjectStore parentObjectStore() {
    EOObjectStore osc = _parentObjectStore;
    if (osc == null) {
      synchronized (this) {
        osc = _parentObjectStore;
        if (osc == null) {
          _parentObjectStore = osc = ERXTaskObjectStoreCoordinatorPool.objectStoreCoordinator();
View Full Code Here

   *
   * @return the parent, usually an {@link EOObjectStoreCoordinator} to
   *         partition the task's EOF intensive work form the rest of the app.
   */
  protected final EOObjectStore parentObjectStore() {
    EOObjectStore osc = _parentObjectStore;
    if (osc == null) {
      synchronized (this) {
        osc = _parentObjectStore;
        if (osc == null) {
          _parentObjectStore = osc = ERXTaskObjectStoreCoordinatorPool.objectStoreCoordinator();
View Full Code Here

    public static ERXJDBCConnectionBroker connectionBrokerForModel(EOModel model) {
        return connectionBrokerForConnectionDictionary(model.connectionDictionary());
    }

    public static ERXJDBCConnectionBroker connectionBrokerForEoInEditingContext(EOEnterpriseObject eo) {
        EOObjectStore os = eo.editingContext().rootObjectStore();
        if (os instanceof EOObjectStoreCoordinator) {
            EOObjectStoreCoordinator osc = (EOObjectStoreCoordinator)os;
            EOCooperatingObjectStore cos = osc.objectStoreForObject(eo);
            if (cos instanceof EODatabaseContext) {
                EODatabaseContext dbctx = (EODatabaseContext)cos;
View Full Code Here

        public EOEditingContext _newEditingContext() {
            return _newEditingContext(true);
        }

        public EOEditingContext _newEditingContext(boolean validationEnabled) {
            EOObjectStore os = _pool.currentRootObjectStore();
            EOEditingContext ec = _newEditingContext(os, validationEnabled);
            ec.lock();
            try {
                EOSharedEditingContext sec = (useSharedEditingContext()) ? _pool.sharedEditingContextForObjectStore(os) : null;
                ec.setSharedEditingContext(sec);
View Full Code Here

     * This method is used to create new EOEditingContexts with the MultiOSCFactory
     * @return an EOEditingContext
     */
    public EOObjectStore currentRootObjectStore() {
        String sessionID = sessionID();
        EOObjectStore os = null;
        if (sessionID != null) {
            os = _oscForSession.get(sessionID);
            if (os == null) {
              os = currentThreadObjectStore();
                _oscForSession.put(sessionID, os);
View Full Code Here

TOP

Related Classes of com.webobjects.eocontrol.EOObjectStore

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.