Package com.webobjects.eocontrol

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


  public static class SimpleInsertTest extends ThrashTest {
    @Override
    protected void _run() {
      EOEditingContext ec = editingContext();

      ec.lock();
      EOEnterpriseObject company = EOUtilities.createAndInsertInstance(ec, "Company");
      company.takeValueForKey("SomeBody.com", "name");
      ec.saveChanges();
      ec.unlock();
View Full Code Here


      String lastName = Thread.currentThread().getName() + System.currentTimeMillis() + "Person";

      int iters = 10;

      for (int idx = 0; idx < iters; idx++) {
        ec.lock();
        EOEnterpriseObject eo = EOUtilities.createAndInsertInstance(ec, "Employee");
        eo.addObjectToBothSidesOfRelationshipWithKey(company, "company");
        eo.takeValueForKey(Boolean.TRUE, "manager");
        eo.takeValueForKey("Bob" + idx, "name");
        eo.takeValueForKey(lastName, "state");
View Full Code Here

        eo.takeValueForKey(Boolean.TRUE, "manager");
        eo.takeValueForKey("Bob" + idx, "name");
        eo.takeValueForKey(lastName, "state");
        ec.unlock();
      }
      ec.lock();
      ec.saveChanges();
      ec.unlock();

      ec.lock();
      NSArray rowsInserted = EOUtilities.objectsMatchingKeyAndValue(ec, "Employee", "state", lastName);
View Full Code Here

      }
      ec.lock();
      ec.saveChanges();
      ec.unlock();

      ec.lock();
      NSArray rowsInserted = EOUtilities.objectsMatchingKeyAndValue(ec, "Employee", "state", lastName);
      boolean insertOk = (rowsInserted.count() == iters);

      for (int idx = 0; idx < iters; idx++) {
        ec.deleteObject((EOEnterpriseObject) rowsInserted.get(idx));
View Full Code Here

        ec.deleteObject((EOEnterpriseObject) rowsInserted.get(idx));
      }
      ec.saveChanges();
      ec.unlock();

      ec.lock();
      NSArray rowsDeleted = EOUtilities.objectsMatchingKeyAndValue(ec, "Employee", "state", lastName);
      ec.unlock();

      boolean deleteOk = (rowsDeleted.count() == 0);
View Full Code Here

      NSArray rowsDeleted = EOUtilities.objectsMatchingKeyAndValue(ec, "Employee", "state", lastName);
      ec.unlock();

      boolean deleteOk = (rowsDeleted.count() == 0);

      ec.lock();
      ec.deleteObject(company);
      ec.saveChanges();
      ec.unlock();

      end();
View Full Code Here

   * @return the gid of the created company having 3 employees.
   */
  public static EOGlobalID createCompanyAnd3Employees() {
   
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
      Company c = (Company) EOUtilities.createAndInsertInstance(ec, Company.ENTITY_NAME);
      c.setName(randomName("Disney World"));
      Employee e1 = c.createEmployeesRelationship();
      e1.setFirstName(randomName("Mickey"));
View Full Code Here

   * @return the gid of the created company having zero employees.
   */
  public static EOGlobalID createCompanyAndNoEmployees() {
   
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
      Company c = (Company) EOUtilities.createAndInsertInstance(ec, Company.ENTITY_NAME);
      c.setName("Disney World");
      ec.saveChanges();
      return ec.globalIDForObject(c);
View Full Code Here

        return ERTaggable.taggable(this);
    }

    public void markAsRead() {
    EOEditingContext ec = ERXEC.newEditingContext();
    ec.lock();
    try {
      People people = (People) ERCoreBusinessLogic.actor(ec);
      Bug copy = ERXEOControlUtilities.localInstanceOfObject(ec, this);
      if(copy != null && !copy.isRead() && copy.owner().equals(people)) {
        copy.setIsRead(true);
View Full Code Here

        super(aRequest);
    }

    public WOActionResults calendarAction() {
        EOEditingContext ec = ERXEC.newEditingContext();
        ec.lock();
        try {
            ERPublishCalendarPage calendar = (ERPublishCalendarPage) pageWithName("ERPublishCalendarPage");
            calendar.setCalendarName("Release Map");
            NSMutableArray releases = new NSMutableArray();
            for (Enumeration e = Release.clazz.allObjects(ec).objectEnumerator(); e.hasMoreElements();) {
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.