Package com.webobjects.eocontrol

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


      }
      if(ec == null) {
        ec = _editingContextFactory.newEditingContext();
        registerEditingContext(ec);
      }
      ec.lock();
      try {
        String type = null;
        String pk = null;
        if (parts.length > 2) {
          type = parts[2];
View Full Code Here


    registerForNotifications();
  }

  private static String entityNameForClass(Class c) {
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
      EOEntity entity = EOUtilities.entityForClass(ec, c);
      if (entity != null) {
        return entity.name();
      }
View Full Code Here

    return D2W.factory().defaultPage(session());
  }

  public WOActionResults eofQueryAction() throws IOException {
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
      EOQualifier q1 = new EOKeyValueQualifier("contents", EOQualifier.QualifierOperatorLike, "suspend*");
      EOQualifier q2 = new ERXBetweenQualifier("userCount", Long.valueOf(30), Long.valueOf(800));
      // EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorEqual, Long.valueOf(82));
      //EOQualifier q3 = new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThan, Long.valueOf(82));
View Full Code Here

    return D2W.factory().defaultPage(session());
  }

  public WOActionResults createAction() {
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
      Random random = new Random(12);
      for (int i = 0; i < 100; i++) {
        EOEnterpriseObject eo = EOUtilities.createAndInsertInstance(ec, "LuceneAsset");
        eo.takeValueForKey(new NSTimestamp().timestampByAddingGregorianUnits(0, 0, -random.nextInt(2500), 0, 0, 0), "creationDate");
View Full Code Here

                // before this method is called, but we do need to lock our parent

                if (isNestedEditingContext) {
                    EOEditingContext parentEC = (EOEditingContext) ec.parentObjectStore();

                    parentEC.lock();

                    try {
                        if (ec.deletedObjects().count() > 0) {
                            final NSArray deletedObjectsToFlushInParent = ERXEOControlUtilities.localInstancesOfObjects(parentEC, ec.deletedObjects());
View Full Code Here

                if (insertedObjects.count() > 0 || updatedObjects.count() > 0) {
                    NSMutableArray flushableObjects = new NSMutableArray();
                    flushableObjects.addObjectsFromArray(insertedObjects);
                    flushableObjects.addObjectsFromArray(updatedObjects);

                    parentEC.lock();
                    try {
                        final NSArray flushableObjectsInParent = ERXEOControlUtilities.localInstancesOfObjects(parentEC, flushableObjects);

                        if ( log.isDebugEnabled() ) {
                            log.debug("saveChanges: before save to child context " + ec +
View Full Code Here

    protected void prepareEditPage(D2WContext context, EditPageInterface epi, String entityName) {
        EOEditingContext ec = newEditingContext();
        EOEnterpriseObject eo = null;

        ec.lock();
        try {
            if(context.dynamicPage().startsWith(createPrefix) || primaryKeyFromRequest(ec, entityName) == null) {
                eo = EOUtilities.createAndInsertInstance(ec,entityName);
            } else {
                eo = ERXEOControlUtilities.objectWithPrimaryKeyValue(ec, entityName, primaryKeyFromRequest(ec, entityName), null);
View Full Code Here

    protected void prepareInspectPage(D2WContext context, InspectPageInterface ipi, String entityName) {
        EOEditingContext ec = session().defaultEditingContext();
        EOEnterpriseObject eo = null;

        ec.lock();
        try {
            eo = EOUtilities.objectWithPrimaryKey(ec, entityName, primaryKeyFromRequest(ec, entityName));
        } finally {
            ec.unlock();
        }
View Full Code Here

   
    long startTime = System.currentTimeMillis();
   
    // Create an EC and lock/try/finally/unlock.
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
      // Create the new TaskInfo
      TaskInfo taskInfo = ERXEOControlUtilities.createAndInsertObject(ec, TaskInfo.class);
     
      // Task start time
View Full Code Here

    @Override
    public WOComponent backAction() {
        if(_masterObject != null) {
            EOEditingContext ec = _masterObject.editingContext();
            ec.lock();
            try {
                _masterObject.takeValueForKey(singleSelection() ? selectedObjects().lastObject() : selectedObjects(), _relationshipKey);
                ec.saveChanges();
            } 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.