Package com.webobjects.eocontrol

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


  public WOActionResults togglePurchased() {
    EOEditingContext editingContext = ERXEC.newEditingContext();
    SPWish wish = _wish.localInstanceIn(editingContext);
    wish.setPurchased(Boolean.valueOf(!wish.purchased().booleanValue()));
    editingContext.saveChanges();
    return null;
  }
 
  public boolean isMe() {
    return booleanValueForBinding("me");
View Full Code Here


  public static void declineInvitation(SPMembership membership) {
    EOEditingContext editingContext = ERXEC.newEditingContext();
    SPMembership localMembership = membership.localInstanceIn(editingContext);
    localMembership.person().setEmailDeliveryFailure(Boolean.FALSE);
    localMembership.delete();
    editingContext.saveChanges();
  }
 
  public void acceptInvitation() {
    setConfirmed(Boolean.TRUE);
    setConfirmationCode(null);
View Full Code Here

    public Application() {
        NSLog.out.appendln("Welcome to " + this.name() + " !");
        EOEditingContext ec = ERXEC.newEditingContext();
        new DataCreator().run(ec);
        ec.saveChanges();
       
        ERXDefaultRestDelegate restDelegate = new ERD2RestDelegate();

        IERXRestAuthenticationDelegate authenticationDelegate = new IERXRestAuthenticationDelegate() {
View Full Code Here

                    ec.lock();
                    try {
                        ec.setSharedEditingContext(null);
                        EOEnterpriseObject object = EOUtilities.localInstanceOfObject(ec, object());
                        ec.deleteObject(object);
                        ec.saveChanges();
                    } finally {
                        ec.unlock();
                        ec.dispose();
                    }
                } else {
View Full Code Here

  public WOActionResults testCompany() {
    EOEditingContext editingContext = editingContext();
    Company company = company();
    Assert.assertEquals("Company name should have been " + _initialCompanyName + " before we save to the database.", _initialCompanyName , company.name());
    editingContext.saveChanges();

    Company reloadCompany = (Company) company.refetchObjectFromDBinEditingContext(editingContext());
    Assert.assertEquals("Company name should have been " + _initialCompanyName  + " after saving and refetching from the database.", _initialCompanyName, reloadCompany.name());

    String newName = "北方話 " + System.currentTimeMillis();
View Full Code Here

    Company fetchCompany = Company.fetchCompany(editingContext, Company.NAME_KEY, newName);
    Assert.assertNotNull("There should have been a Company named " + newName + " after updating and refetching from the database.", fetchCompany);
    Assert.assertEquals("There should have been a Company named " + newName + " after updating and refetching from the database.", newName, fetchCompany.name());
   
    updateCompany.delete();
    editingContext.saveChanges();

    _company = null;

    return null;
  }
View Full Code Here

          SPPerson selectedReceiver = eligibleReceivers.objectAtIndex(selectedReceiverNum);
          log.info("   " + selectedGiver.name() + "=>" + selectedReceiver.name() + ", " +selectedGiver + "," + selectedReceiver);
          SPSecretPal.createSPSecretPal(nestedEditingContext, localEvent, selectedGiver.localInstanceIn(nestedEditingContext), selectedReceiver.localInstanceIn(nestedEditingContext));
          consumedReceivers.addObject(selectedReceiver);
        }
        nestedEditingContext.saveChanges();
        doneWithSecretPals = true;
      }
      catch (IllegalStateException e) {
        numberOfAttempts ++;
      }
View Full Code Here

    for (SPPerson person : SPPerson.fetchAllSPPersons(editingContext)) {
      EOEditingContext nestedEditingContext = ERXEC.newEditingContext(editingContext);
      SPPerson nestedPerson = person.localInstanceIn(nestedEditingContext);
      nestedPerson.setEmailAddress(SPUtilities.cleanseEmailAddress(nestedPerson.emailAddress()));
      try {
        nestedEditingContext.saveChanges();
      }
      catch (NSValidation.ValidationException e) {
        // this probably means the person realized they screwed up and reinvited the person with the proper email address
        if (person.memberships().count() == 0) {
          person.delete();
View Full Code Here

        // this means that tags will ALWAYS be created even if the parent transaction
        // rolls back.  It's mostly for your own good :)
        EOEditingContext newEditingContext = ERXEC.newEditingContext();
        try {
          ERTag newTag = createTagNamed(newEditingContext, tagName);
          newEditingContext.saveChanges();
          tag = newTag.localInstanceIn(editingContext);
        }
        catch (EOGeneralAdaptorException e) {
          // We'll assume this was because of a duplicate key exception and just retry the original
          // fetch WITHOUT createIfMissing.  If that returns a null, then we know it was some other
View Full Code Here

   * @param tagName the tag name to delete
   */
  public static void deleteTagNamed(String tagName) {
    EOEditingContext editingContext = ERXEC.newEditingContext();
    ERTag.deleteTagNamed(editingContext, tagName);
    editingContext.saveChanges();
  }

  /**
   * Deletes the tag with the given name and removes the tag from all taggables.
   *
 
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.