protected static String resolveEntity(String entityName, EOEditingContext ec) { if (entityName == null) return null; try { EOEntity entity = EOUtilities.entityNamed(ec, entityName); if (entity != null) { return entityName; } } catch (EOObjectNotAvailableException naex) { } entityName = SettingsReader.stringForKeyPath("interfaces." + entityName, null); int dot = entityName.lastIndexOf('.'); if (dot > 0) { entityName = entityName.substring(dot + 1); } // return resolveEntity(entityName); if (entityName == null) return null; try { EOEntity entity = EOUtilities.entityNamed(ec, entityName); if (entity != null) { return entityName; } } catch (EOObjectNotAvailableException naex2) { } return null; }
public static Category createCategory(EOEditingContext editingContext, Integer id, String name) { Category eo = (Category) EOUtilities.createAndInsertInstance(editingContext, _Category.ENTITY_NAME); eo.setId(id); eo.setName(name); return eo; }
/** * Retrieve this object's <code>id</code> value. * * @return the value of the attribute */ public Number id() { try { return (Number) EOUtilities.primaryKeyForObject(editingContext(), this).objectForKey("id"); } catch (Exception e) { return er.extensions.eof.ERXConstant.ZeroInteger; } }
public void appendToResponse(WOResponse aResponse, WOContext aContext) { try { Number b = (Number) valueForBinding("firstNameDisplay"); if (b != null) firstNameDisplay = b.intValue(); else firstNameDisplay = 2; b = (Number) valueForBinding("secondNameDisplay"); if (b != null) secondNameDisplay = b.intValue(); else secondNameDisplay = 2; } catch (ClassCastException cex) { throw new IllegalArgumentException("NameDisplay bindings should be integer"); } String request = (String) valueForBinding("searchRequest"); if (request != null) { performSearchRequest(request); } else { selection = (PersonLink) EOUtilities.localInstanceOfObject( ec, (EOEnterpriseObject) valueForBinding("selection")); // syncSelection(); } if (selection == null && Various.boolForObject(valueForBinding("showPopup"))) { selection = defaultSelectionValue(); setValueForBinding(selection, "selection"); } super.appendToResponse(aResponse, aContext); found = null; // searchMessage = null; }
public org.pachyderm.foundation.eof.PDBScreen createEveryScreenRelationship() { EOEnterpriseObject eo = EOUtilities.createAndInsertInstance( editingContext(), org.pachyderm.foundation.eof.PDBScreen.ENTITY_NAME); addObjectToBothSidesOfRelationshipWithKey(eo, _PDBPresentation.EVERY_SCREEN_KEY); return (org.pachyderm.foundation.eof.PDBScreen) eo; }
public Group localInstanceIn(EOEditingContext editingContext) { Group localInstance = (Group) EOUtilities.localInstanceOfObject(editingContext, this); if (localInstance == null) { throw new IllegalStateException( "You attempted to localInstance " + this + ", which has not yet committed."); } return localInstance; }
public static Group localInstanceIn(EOEditingContext editingContext, Group eo) { Group localInstance = (eo == null) ? null : (Group) EOUtilities.localInstanceOfObject(editingContext, eo); if (localInstance == null && eo != null) { throw new IllegalStateException( "You attempted to localInstance " + eo + ", which has not yet committed."); } return localInstance; }
public static ERSyncClientDevice createERSyncClientDevice( EOEditingContext editingContext, Boolean disable, String name) { ERSyncClientDevice eo = (ERSyncClientDevice) EOUtilities.createAndInsertInstance(editingContext, _ERSyncClientDevice.ENTITY_NAME); eo.setDisable(disable); eo.setName(name); return eo; }
/** * A static factory method for creating a new UserMessageSubscription object given required * attributes and relationships. * * @param editingContext The context in which the new object will be inserted * @param isEnabledValue * @return The newly created object */ public static UserMessageSubscription create( EOEditingContext editingContext, boolean isEnabledValue) { UserMessageSubscription eoObject = (UserMessageSubscription) EOUtilities.createAndInsertInstance( editingContext, _UserMessageSubscription.ENTITY_NAME); eoObject.setIsEnabled(isEnabledValue); return eoObject; }
public void takeValuesFromRequest(WORequest aRequest, WOContext aContext) { super.takeValuesFromRequest(aRequest, aContext); if (!Various.boolForObject(valueForBinding("showPopup"))) { selection = (PersonLink) EOUtilities.localInstanceOfObject( ec, (EOEnterpriseObject) valueForBinding("selection")); // syncSelection(); } }
/** * Retrieve an object using a dictionary of keys and values to match. * * @param context The editing context to use * @param keysAndValues a dictionary of keys and values to match * @return the single entity that was retrieved, or null if there was none * @throws EOUtilities.MoreThanOneException if there is more than one matching object */ public static UserMessageSubscription uniqueObjectMatchingValues( EOEditingContext context, NSDictionary<String, Object> keysAndValues) throws EOUtilities.MoreThanOneException { try { return (UserMessageSubscription) EOUtilities.objectMatchingValues(context, ENTITY_NAME, keysAndValues); } catch (EOObjectNotAvailableException e) { return null; } }
public static MovieRole createMovieRole( EOEditingContext editingContext, webobjectsexamples.businesslogic.movies.common.Movie movie, webobjectsexamples.businesslogic.movies.common.Talent talent) { MovieRole eo = (MovieRole) EOUtilities.createAndInsertInstance(editingContext, _MovieRole.ENTITY_NAME); eo.setMovieRelationship(movie); eo.setTalentRelationship(talent); return eo; }
public static PDBPresentation createPDBPresentation( EOEditingContext editingContext, String identifier, Integer pk, org.pachyderm.foundation.eof.PDBScreen primeScreen) { PDBPresentation eo = (PDBPresentation) EOUtilities.createAndInsertInstance(editingContext, _PDBPresentation.ENTITY_NAME); eo.setIdentifier(identifier); eo.setPk(pk); eo.setPrimeScreenRelationship(primeScreen); return eo; }
public static TimePointApplication createTimePointApplication( EOEditingContext editingContext, Integer instanceWeight, com.dyned.woremotesiteconfig.eom.StoredApp storedApp, com.dyned.woremotesiteconfig.eom.TimePoint timePoint) { TimePointApplication eo = (TimePointApplication) EOUtilities.createAndInsertInstance(editingContext, _TimePointApplication.ENTITY_NAME); eo.setInstanceWeight(instanceWeight); eo.setStoredAppRelationship(storedApp); eo.setTimePointRelationship(timePoint); return eo; }
public WOActionResults delete() { NSMutableArray personList = (NSMutableArray) session().valueForKey("personList"); if (personList != null && personList.count() > 0) { for (int i = 0; i < personList.count(); i++) { PersonLink pers = (PersonLink) personList.objectAtIndex(i); if (item == EOUtilities.localInstanceOfObject(ec, pers.person())) { personList.removeObjectAtIndex(i); break; } } } return context().page(); // onEdit = null; }
public NSArray personList() { NSArray forcedList = (NSArray) valueForBinding("forcedList"); NSMutableArray result = (forcedList == null) ? new NSMutableArray() : EOUtilities.localInstancesOfObjects(ec, forcedList).mutableClone(); NSArray personList = (NSArray) session().valueForKey("personList"); if (personList != null && personList.count() > 0) { Enumeration enu = personList.objectEnumerator(); while (enu.hasMoreElements()) { EOEnterpriseObject pers = (EOEnterpriseObject) enu.nextElement(); if (!result.contains(pers) && (entity().equals(pers.entityName()) || pers.entityName().equals(alterEntity()))) result.addObject(pers); } } return result; }
protected PersonLink defaultSelectionValue() { NSArray list = (NSArray) valueForBinding("forcedList"); if (list != null && list.count() > 0) { return (PersonLink) EOUtilities.localInstanceOfObject(ec, (EOEnterpriseObject) list.objectAtIndex(0)); } list = (NSArray) session().valueForKey("personList"); if (list != null && list.count() > 0) { Enumeration enu = list.objectEnumerator(); while (enu.hasMoreElements()) { EOEnterpriseObject pers = (EOEnterpriseObject) enu.nextElement(); if (entity().equals(pers.entityName())) { return (PersonLink) pers; } } } return null; }
public static Employee createEmployee( EOEditingContext editingContext, Boolean admin, String firstName, NSTimestamp hireDate, Boolean insured, String lastName, er.uber.model.EmployeeStatus status, er.uber.model.Company company) { Employee eo = (Employee) EOUtilities.createAndInsertInstance(editingContext, _Employee.ENTITY_NAME); eo.setAdmin(admin); eo.setFirstName(firstName); eo.setHireDate(hireDate); eo.setInsured(insured); eo.setLastName(lastName); eo.setStatus(status); eo.setCompanyRelationship(company); return eo; }
public static Group createGroup(EOEditingContext editingContext) { Group eo = (Group) EOUtilities.createAndInsertInstance(editingContext, _Group.ENTITY_NAME); return eo; }
/** * Get a local instance of the given object in another editing context. * * @param editingContext The target editing context * @param eo The object to import * @return An instance of the given object in the target editing context */ public static UserMessageSubscription localInstance( EOEditingContext editingContext, UserMessageSubscription eo) { return (eo == null) ? null : (UserMessageSubscription) EOUtilities.localInstanceOfObject(editingContext, eo); }
public static ERRole createERRole(EOEditingContext editingContext, String name) { ERRole eo = (ERRole) EOUtilities.createAndInsertInstance(editingContext, _ERRole.ENTITY_NAME); eo.setName(name); return eo; }
// ---------------------------------------------------------- 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()); } }
/** * Retrieve objects using a dictionary of keys and values to match. * * @param context The editing context to use * @param keysAndValues a dictionary of keys and values to match * @return an NSArray of the entities retrieved */ @SuppressWarnings("unchecked") public static NSArray<UserMessageSubscription> objectsMatchingValues( EOEditingContext context, NSDictionary<String, Object> keysAndValues) { return EOUtilities.objectsMatchingValues(context, ENTITY_NAME, keysAndValues); }
/** * Get a local instance of this object in another editing context. * * @param editingContext The target editing context * @return An instance of this object in the target editing context */ public UserMessageSubscription localInstance(EOEditingContext editingContext) { return (UserMessageSubscription) EOUtilities.localInstanceOfObject(editingContext, this); }