示例#1
0
 public void cancel() {
   ec.revert();
   // NSDictionary snapshot = ec.committedSnapshotForObject(onEdit);
   if (ec.insertedObjects().contains(item)) {
     NSMutableArray fullList = (NSMutableArray) session().valueForKey("personList");
     fullList.removeObject(item);
   }
   //		onEdit = null;
 }
示例#2
0
 private static EOTypeGroupe localInstanceOfObject(EOEditingContext ec, EOTypeGroupe object) {
   if (object != null && ec != null) {
     EOEditingContext otherEditingContext = object.editingContext();
     if (otherEditingContext == null) {
       throw new IllegalArgumentException(
           "The EOTypeGroupe " + object + " is not in an EOEditingContext.");
     } else {
       com.webobjects.eocontrol.EOGlobalID globalID =
           otherEditingContext.globalIDForObject(object);
       return (EOTypeGroupe) ec.faultForGlobalID(globalID, ec);
     }
   } else {
     return null;
   }
 }
示例#3
0
 public static NSArray<edu.umich.marketplace.eof.Category> fetchTopCategories(
     EOEditingContext editingContext) {
   EOFetchSpecification fetchSpec =
       EOFetchSpecification.fetchSpecificationNamed("topCategories", "Category");
   return (NSArray<edu.umich.marketplace.eof.Category>)
       editingContext.objectsWithFetchSpecification(fetchSpec);
 }
 public static NSArray<org.pachyderm.foundation.eof.PDBPresentation> fetchAllPresentations(
     EOEditingContext editingContext) {
   EOFetchSpecification fetchSpec =
       EOFetchSpecification.fetchSpecificationNamed(
           "allPresentations", _PDBPresentation.ENTITY_NAME);
   return (NSArray<org.pachyderm.foundation.eof.PDBPresentation>)
       editingContext.objectsWithFetchSpecification(fetchSpec);
 }
 public static NSArray fetchVPersonnelActuelEnses(
     EOEditingContext editingContext, EOQualifier qualifier, NSArray sortOrderings) {
   EOFetchSpecification fetchSpec =
       new EOFetchSpecification(_EOVPersonnelActuelEns.ENTITY_NAME, qualifier, sortOrderings);
   fetchSpec.setIsDeep(true);
   NSArray eoObjects = (NSArray) editingContext.objectsWithFetchSpecification(fetchSpec);
   return eoObjects;
 }
示例#6
0
 public static NSArray<edu.umich.marketplace.eof.Category> fetchTopCategories(
     EOEditingContext editingContext, NSDictionary<String, Object> bindings) {
   EOFetchSpecification fetchSpec =
       EOFetchSpecification.fetchSpecificationNamed("topCategories", "Category");
   fetchSpec = fetchSpec.fetchSpecificationWithQualifierBindings(bindings);
   return (NSArray<edu.umich.marketplace.eof.Category>)
       editingContext.objectsWithFetchSpecification(fetchSpec);
 }
示例#7
0
 public static NSArray fetchAll(
     EOEditingContext editingContext,
     EOQualifier qualifier,
     NSArray sortOrderings,
     boolean distinct,
     int fetchLimit,
     DTEOEditingContextHandler handler) {
   EOFetchSpecification fetchSpec =
       new EOFetchSpecification(ENTITY_NAME, qualifier, sortOrderings);
   fetchSpec.setIsDeep(true);
   fetchSpec.setUsesDistinct(distinct);
   fetchSpec.setFetchLimit(fetchLimit);
   if (handler != null) {
     fetchSpec.setPromptsAfterFetchLimit(true);
     editingContext.setMessageHandler(handler);
   }
   return (NSArray) editingContext.objectsWithFetchSpecification(fetchSpec);
 }
 public static NSArray<org.pachyderm.foundation.eof.PDBPresentation> fetchAllPresentations(
     EOEditingContext editingContext, NSDictionary<String, Object> bindings) {
   EOFetchSpecification fetchSpec =
       EOFetchSpecification.fetchSpecificationNamed(
           "allPresentations", _PDBPresentation.ENTITY_NAME);
   fetchSpec = fetchSpec.fetchSpecificationWithQualifierBindings(bindings);
   return (NSArray<org.pachyderm.foundation.eof.PDBPresentation>)
       editingContext.objectsWithFetchSpecification(fetchSpec);
 }
示例#9
0
 public static NSArray<edu.umich.marketplace.eof.Category> fetchSubCategories(
     EOEditingContext editingContext, edu.umich.marketplace.eof.Category parentBinding) {
   EOFetchSpecification fetchSpec =
       EOFetchSpecification.fetchSpecificationNamed("subCategories", "Category");
   NSMutableDictionary<String, Object> bindings = new NSMutableDictionary<String, Object>();
   bindings.takeValueForKey(parentBinding, "parent");
   fetchSpec = fetchSpec.fetchSpecificationWithQualifierBindings(bindings);
   return (NSArray<edu.umich.marketplace.eof.Category>)
       editingContext.objectsWithFetchSpecification(fetchSpec);
 }
示例#10
0
 public static NSArray<Group> fetchGroups(
     EOEditingContext editingContext,
     EOQualifier qualifier,
     NSArray<EOSortOrdering> sortOrderings) {
   EOFetchSpecification fetchSpec =
       new EOFetchSpecification(_Group.ENTITY_NAME, qualifier, sortOrderings);
   fetchSpec.setIsDeep(true);
   NSArray<Group> eoObjects =
       (NSArray<Group>) editingContext.objectsWithFetchSpecification(fetchSpec);
   return eoObjects;
 }
示例#11
0
 public static NSArray<org.pachyderm.foundation.eof.PDBPresentation>
     fetchPresentationNamesAndIdentities(EOEditingContext editingContext, String authorBinding) {
   EOFetchSpecification fetchSpec =
       EOFetchSpecification.fetchSpecificationNamed(
           "presentationNamesAndIdentities", _PDBPresentation.ENTITY_NAME);
   NSMutableDictionary<String, Object> bindings = new NSMutableDictionary<String, Object>();
   bindings.takeValueForKey(authorBinding, "author");
   fetchSpec = fetchSpec.fetchSpecificationWithQualifierBindings(bindings);
   return (NSArray<org.pachyderm.foundation.eof.PDBPresentation>)
       editingContext.objectsWithFetchSpecification(fetchSpec);
 }
 public static NSArray<ERSyncClientDevice> fetchERSyncClientDevices(
     EOEditingContext editingContext,
     EOQualifier qualifier,
     NSArray<EOSortOrdering> sortOrderings) {
   EOFetchSpecification fetchSpec =
       new EOFetchSpecification(_ERSyncClientDevice.ENTITY_NAME, qualifier, sortOrderings);
   fetchSpec.setIsDeep(true);
   NSArray<ERSyncClientDevice> eoObjects =
       (NSArray<ERSyncClientDevice>) editingContext.objectsWithFetchSpecification(fetchSpec);
   return eoObjects;
 }
示例#13
0
 private static EOActivites createAndInsertInstance(EOEditingContext ec) {
   EOClassDescription classDescription =
       EOClassDescription.classDescriptionForEntityName(_EOActivites.ENTITY_NAME);
   if (classDescription == null) {
     throw new IllegalArgumentException(
         "Could not find EOClassDescription for entity name '" + _EOActivites.ENTITY_NAME + "' !");
   } else {
     EOActivites object =
         (EOActivites) classDescription.createInstanceWithEditingContext(ec, null);
     ec.insertObject(object);
     return object;
   }
 }
 /**
  * Retrieve objects using a fetch specification.
  *
  * @param context The editing context to use
  * @param fspec The fetch specification to use
  * @return an NSArray of the entities retrieved
  */
 @SuppressWarnings("unchecked")
 public static NSArray<UserMessageSubscription> objectsWithFetchSpecification(
     EOEditingContext context, EOFetchSpecification fspec) {
   return context.objectsWithFetchSpecification(fspec);
 }
示例#15
0
  // ----------------------------------------------------------
  public void takeFormValues(NSDictionary<?, ?> formValues) {
    WCConfigurationFile configuration = Application.configurationProperties();
    if (log.isDebugEnabled()) {
      log.debug("takeFormValues(): initial config = ");
      log.debug(configuration.configSettingsAsString());
    }
    String email =
        storeFormValueToConfig(
            formValues, "coreAdminEmail", "Please specify the administrator's e-mail address.");
    storeFormValueToConfig(formValues, "adminNotifyAddrs", null);
    String authDomainName = configuration.getProperty("authenticator.default");
    String username =
        storeFormValueToConfig(
            formValues, "AdminUsername", "Please specify the administrator's user name.");
    if (log.isDebugEnabled()) {
      log.debug("takeFormValues(): middle = ");
      log.debug(configuration.configSettingsAsString());
    }
    if (authDomainName == null || authDomainName.equals("")) {
      error("Cannot identify default institution's " + "authentication configuration.");
    } else if (username != null && !hasMessages()) {
      EOEditingContext ec = WCEC.newEditingContext();
      try {
        ec.lock();
        AuthenticationDomain domain = AuthenticationDomain.authDomainByName(authDomainName);
        NSArray<?> users =
            EOUtilities.objectsMatchingValues(
                ec,
                User.ENTITY_NAME,
                new NSDictionary<String, Object>(
                    new Object[] {username, domain},
                    new String[] {User.USER_NAME_KEY, User.AUTHENTICATION_DOMAIN_KEY}));
        User admin;
        if (users.count() > 0) {
          admin = (User) users.objectAtIndex(0);
          admin.setEmail(email);
          String first = extractFormValue(formValues, "AdminFirstName");
          if (first != null && !first.equals("")) {
            admin.setFirstName(first);
          }
          String last = extractFormValue(formValues, "AdminLastName");
          if (last != null && !last.equals("")) {
            admin.setLastName(last);
          }
          ec.saveChanges();
        } else {
          String password =
              storeFormValueToConfig(
                  formValues, "AdminPassword", "An administrator password is required.");
          if (authDomainName.equals(DatabaseAuthenticator.class.getName())
              && (password == null || password.equals(""))) {
            // Don't need this anymore, since the error message is
            // posted by storeFormValuesToConfig() above.

            // errorMessage(
            //     "An administrator password is required." );
          } else {
            admin = User.createUser(username, password, domain, (byte) 100, ec);
            admin.setEmail(email);
            String first = extractFormValue(formValues, "AdminFirstName");
            if (first != null && !first.equals("")) {
              admin.setFirstName(first);
            }
            String last = extractFormValue(formValues, "AdminLastName");
            if (last != null && !last.equals("")) {
              admin.setLastName(last);
            }
            ec.saveChanges();
          }
        }
      } finally {
        ec.unlock();
        ec.dispose();
      }
    }
    if (log.isDebugEnabled()) {
      log.debug("takeFormValues(): near end = ");
      log.debug(configuration.configSettingsAsString());
    }
    if (!hasMessages()) {
      configuration.remove("AdminFirstName");
      configuration.remove("AdminLastName");
    }
    if (log.isDebugEnabled()) {
      log.debug("takeFormValues(): finals = ");
      log.debug(configuration.configSettingsAsString());
    }
  }