Package com.webobjects.eocontrol

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


      } else if (p != null) {
    NSLog.out.appendln("attribute "+attribute.name() + " in entity " + name() + " is (now?) an relationship which cannot have a validation rule, deleted from Valididy model");
    removeAttribute(attribute);
      } else {
                EOEditingContext ec = new EOEditingContext();
                ec.lock();
    try {
        if (attribute == null) {
      NSLog.debug.appendln("attribute == null");
        } else if (attribute.name() == null) {
      NSLog.debug.appendln("attribute.name() == null, attribute = "+attribute);
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

    }

    public void testSendingMail() {
        log.info("Sending test mail");
        EOEditingContext ec = ERXEC.newEditingContext();
        ec.lock();
        try {
            if(false) {
                // ak: you may need to tweak with ERXSQLHelper.createSchemaSQLForEntitiesInModelWithName() options for this to work
                // if the tables weren't already present
                ERCoreBusinessLogic.sharedInstance().createTables(ec);
View Full Code Here

        String fetchSpecName = (String) d2wContext().valueForKey("restrictingFetchSpecification");
        if (fetchSpecName != null) {
            EOEditingContext ec = ERXEC.newEditingContext();
            EOEntity entity = d2wContext().entity();
            EORelationship relationship = entity.relationshipNamed((String) d2wContext().valueForKey("propertyKey"));
            ec.lock();
            try {
                return EOUtilities.objectsWithFetchSpecificationAndBindings(ec,
                        relationship.destinationEntity().name(), fetchSpecName, null);
            } finally {
                ec.unlock();
View Full Code Here

     * Unwraps and performs the supplied adaptor operations.
     * @param ops
     */
    public static void performWrappedAdaptorOperations(NSArray ops) {
        EOEditingContext ec = ERXEC.newEditingContext();
        ec.lock();
        try {
            // FIXME use the entityName information from each EOAdaptorOperation to get the correct
            // database context, this implementation here only works if all EOModels use the same database
            ERXAdaptorOperationWrapper op = (ERXAdaptorOperationWrapper) ops.lastObject();
            EODatabaseContext context = EOUtilities.databaseContextForModelNamed(ec, op.operation().entity().model().name());
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

    // background thread during report generation, we need to ensure we have a schema-based
    // qualifier instead of a memory-based qualifier that might have references to EOs
    // in an RR-locked editing context
    EOFetchSpecification fs = null;
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
      fs = schemaBasedFetchSpecification(fetchSpecification);
    } catch (Exception e) {
      throw new RuntimeException("Failed to convert fetchSpecification to schema-based", e);
    } finally {
View Full Code Here

    reportFile = null;
   
    if (log.isDebugEnabled())
      log.debug("Starting JasperReportTask: " + toString());
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
     
      @SuppressWarnings("unchecked")
      NSArray<EOEnterpriseObject> objects = ec.objectsWithFetchSpecification(fetchSpecification);
     
View Full Code Here

     
      // Clone the fetchSpec
      fetchSpecification = (EOFetchSpecification) fetchSpecification.clone();

      EOEditingContext ec = ERXEC.newEditingContext();
      ec.lock();
      try {
        EOEntity entity = ERXEOAccessUtilities.entityMatchingString(ec, fetchSpecification.entityName());
        // Convert the qualifier to a schema-based qualifier
        q = entity.schemaBasedQualifier(q);
        fetchSpecification.setQualifier(q);
View Full Code Here

    int maxNumberOfAttempts = 100;
    boolean doneWithSecretPals = false;
    while (!doneWithSecretPals && numberOfAttempts < maxNumberOfAttempts) {
      log.info("attempt #" + numberOfAttempts + " of " + maxNumberOfAttempts);
      EOEditingContext nestedEditingContext = ERXEC.newEditingContext(editingContext());
      nestedEditingContext.lock();
      SPEvent localEvent = localInstanceIn(nestedEditingContext);
      try {
        for (SPPerson selectedGiver : eligibleGivers) {
          NSArray<SPPerson> eligibleReceivers = _eligibleReceiversForPerson(selectedGiver, allPeople, consumedReceivers);
          if (eligibleReceivers.count() == 0) {
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.