Esempio n. 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;
 }
Esempio n. 2
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);
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
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);
 }
Esempio n. 5
0
 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);
 }
Esempio n. 6
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);
 }
Esempio n. 7
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;
 }
Esempio n. 8
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;
 }
 /**
  * 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);
 }
Esempio n. 11
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());
    }
  }