Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOEditingContext.lock()


      String pageName = (String) pages.nextElement();
      WOContext context = ERXWOContext.newContext();
      session._awakeInContext(context);
      try {
        EOEditingContext ec = ERXEC.newEditingContext();
        ec.lock();
        try {
          log.info("Creating page: " + pageName);
          WOComponent page = D2W.factory().pageForConfigurationNamed(pageName, session);
          context._setPageElement(page);
          context._setCurrentComponent(page);
View Full Code Here


        this.pickRelationshipName = pickRelationshipName;
    }
   
    public WOComponent nextPage(WOComponent sender) {
        EOEditingContext ec = eo.editingContext();
        ec.lock();
        try {
            NSArray selectedObjects;
            if(sender instanceof ERDPickPageInterface) {
              selectedObjects = ((ERDPickPageInterface)sender).selectedObjects();
            } else {
View Full Code Here

        NSArray<ERIndex> incides = indicesForEntity(entity.name());
        if(incides.count() > 0) {
            long start = System.currentTimeMillis();
            int treshhold = 10;
            EOEditingContext ec = ERXEC.newEditingContext();
            ec.lock();
            try {
                EOFetchSpecification fs = new EOFetchSpecification(entity.name(), null, null);
                ERXFetchSpecificationBatchIterator iterator = new ERXFetchSpecificationBatchIterator(fs);
                iterator.setEditingContext(ec);
                while(iterator.hasNextBatch()) {
View Full Code Here

                    NSArray objects = iterator.nextBatch();
                    if(iterator.currentBatchIndex() % treshhold == 0) {
                        ec.unlock();
                        // ec.dispose();
                        ec = ERXEC.newEditingContext();
                        ec.lock();
                        iterator.setEditingContext(ec);
                    }
                    for(Enumeration i = incides.objectEnumerator(); i.hasMoreElements(); ) {
                        ERIndex index = (ERIndex) i.nextElement();
                        index.addObjectsToIndex(ec, objects);
View Full Code Here

        for (Enumeration names = entities().objectEnumerator(); names.hasMoreElements();) {
            String entityName = (String) names.nextElement();
            long start = System.currentTimeMillis();
            int treshhold = 10;
            EOEditingContext ec = ERXEC.newEditingContext();
            ec.lock();
            try {
                EOFetchSpecification fs = new EOFetchSpecification(entityName, null, null);
                ERXFetchSpecificationBatchIterator iterator = new ERXFetchSpecificationBatchIterator(fs);
                iterator.setEditingContext(ec);
                while (iterator.hasNextBatch()) {
View Full Code Here

                    NSArray objects = iterator.nextBatch();
                    if (iterator.currentBatchIndex() % treshhold == 0) {
                        ec.unlock();
                        // ec.dispose();
                        ec = ERXEC.newEditingContext();
                        ec.lock();
                        iterator.setEditingContext(ec);
                    }
                    NSArray<Document> documents = addedDocumentsForObjects(objects);
                    Transaction transaction = new Transaction(ec);
                    handler().addObjectsToIndex(transaction, objects);
View Full Code Here

                if (_dataSource != null) _dataSource.deleteObject(_object);
                if (editingContext instanceof EOSharedEditingContext) {
                    //fault the eo into another ec, one cannot delete objects
                    // in an shared editing context
                    EOEditingContext ec = ERXEC.newEditingContext();
                    ec.lock();
                    try {
                        ec.setSharedEditingContext(null);
                        EOEnterpriseObject object = EOUtilities.localInstanceOfObject(ec, _object);
                        ec.deleteObject(object);
                        ec.saveChanges();
View Full Code Here

    Object pkValue = eoEntity.primaryKeyAttributes().objectAtIndex(0).validateValue(strPKValue);
    EOEditingContext editingContext = context.editingContext();
    if (editingContext == null) {
      throw new IllegalArgumentException("There was no editing context attached to this rest context.");
    }
    editingContext.lock();
    Object obj;
    try {
      EOGlobalID gid = ERXEOControlUtilities.globalIDForString(editingContext, entity.entityName(), strPKValue);
      return editingContext.faultForGlobalID(gid, editingContext);
    }
View Full Code Here

                return;
        }

        NSArray entityNames = ercnSnapshot.shapshotsForUpdateGroupedByEntity().allKeys();
        EOEditingContext ec = new EOEditingContext();
        ec.lock();

        Enumeration entitiesEnumerator = entityNames.objectEnumerator();
        while (entitiesEnumerator.hasMoreElements()) {
            String entityName = (String)entitiesEnumerator.nextElement();
            if (! ERCNSnapshot.shouldSynchronizeEntity(entityName))   continue;
View Full Code Here

                    File indexDirectory = new File(new URL(_store).getFile());
                    _indexDirectory = FSDirectory.open(indexDirectory);
                } else {
                    EOEditingContext ec = ERXEC.newEditingContext();

                    ec.lock();
                    try {
                        _indexDirectory = ERIDirectory.clazz.directoryForName(ec, _store);
                    } finally {
                        ec.unlock();
                    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.