public static ERTag localInstanceIn(EOEditingContext editingContext, ERTag eo) { ERTag localInstance = (eo == null) ? null : ERXEOControlUtilities.localInstanceOfObject(editingContext, eo); if (localInstance == null && eo != null) { throw new IllegalStateException("You attempted to localInstance " + eo + ", which has not yet committed."); } return localInstance; } }
public ERCMailMessage archive() { return (ERCMailMessage)ERXEOControlUtilities.createAndInsertObject(editingContext(), "ERCMailMessageArchive", snapshot()); }
/** * DataSource for the relationship. * * @return EODataSource an EODetailDataSource created from the masterObject and relationshipKey. */ @Override public EODataSource dataSource() { if (_dataSource == null) { _dataSource = ERXEOControlUtilities.dataSourceForObjectAndKey(masterObject(), relationshipKey()); } return _dataSource; }
/** * Gets the actor as a local instance in the given context. * @param ec editing context to pull a local copy of the actor * into * @return actor instance in the given editing context */ public static EOEnterpriseObject actor(EOEditingContext ec) { EOEnterpriseObject actor = actor(); if (actor != null && actor.editingContext() != ec) { EOEditingContext actorEc = actor.editingContext(); actorEc.lock(); try { EOEnterpriseObject localActor = ERXEOControlUtilities.localInstanceOfObject(ec, actor); try { if(actor instanceof ERCoreUserInterface) { NSArray prefs = ((ERCoreUserInterface)actor).preferences(); prefs = ERXEOControlUtilities.localInstancesOfObjects(ec, prefs); ((ERCoreUserInterface)localActor).setPreferences(prefs); } } catch(RuntimeException ex) { log.error("Error while setting getting actor's preferences: ", actor, ex); } actor = localActor; } finally { actorEc.unlock(); } } return actor; }
/** * Used to show/hide the confirmation dialog */ public boolean showDialog() { boolean show = object() != null && ERXEOControlUtilities.eoEquals(object(), (EOEnterpriseObject)d2wContext().valueForKey(Keys.objectPendingDeletion)); return show; }
gid = ERXEOControlUtilities.globalIDForString(ec, entityName, pk); eo = ec.faultForGlobalID(gid, ec); eo = ERXEOControlUtilities.createAndInsertObject(ec, entityName);
pref = ERXEOControlUtilities.createAndInsertObject(ec, "ERCPreference"); u.newPreference(pref); pref.takeValueForKey(ERXEOControlUtilities.primaryKeyObjectForObject((EOEnterpriseObject)u),"userID"); pref.takeValueForKey(key,"key"); pref.takeValueForKey(encodedValue(value),"value");
/** * Utility method to return the local instance of the object as determined by the * useNestedEditingContext binding */ protected EOEnterpriseObject localInstanceOfObject() { boolean createNestedContext = ERXValueUtilities.booleanValue(d2wContext().valueForKey(Keys.useNestedEditingContext)); return ERXEOControlUtilities.editableInstanceOfObject(object(), createNestedContext); }
/** * Perform the cancel action. Overridden to handle showing a cancel dialog in-line if * useAjaxControlsWhenEmbedded is true. */ @Override public WOComponent cancelAction() { boolean useAjax = ERXValueUtilities.booleanValue(d2wContext().valueForKey(Keys.useAjaxControlsWhenEmbedded)); if (useAjax && showCancel()) { if (_currentStep>1 && ERXEOControlUtilities.isNewObject(object())) { showCancelDialog = true; return null; } else { return super.superCancelAction(); } } else { return super.cancelAction(); } }
/** * Called when an {@link ERMDActionButton} changes the related object. */ @SuppressWarnings("unchecked") public void relatedObjectDidChange(NSNotification notif) { NSDictionary<String, Object>userInfo = notif.userInfo(); if (userInfo != null) { Object key = userInfo.valueForKey("propertyKey"); EOEnterpriseObject obj = (EOEnterpriseObject)userInfo.valueForKey("object"); if (propertyKey() != null && propertyKey().equals(key) && ERXEOControlUtilities.eoEquals(object(), obj)) { _currentSelection = null; } } }
public WOComponent editHelpText() { EditPageInterface page = D2W.factory().editPageForEntityNamed(ERCHelpText.ENTITY, session()); EOEnterpriseObject eo = ERXEOControlUtilities.editableInstanceOfObject(helpText(), false); page.setObject(eo); page.setNextPage(context().page()); return (WOComponent) page; }
displayGroup().displayPreviousBatch(); if (finalCommit && !ERXEOControlUtilities.isNewObject(object())) {
public static Person localInstanceIn(EOEditingContext editingContext, Person eo) { Person localInstance = (eo == null) ? null : ERXEOControlUtilities.localInstanceOfObject(editingContext, eo); if (localInstance == null && eo != null) { throw new IllegalStateException("You attempted to localInstance " + eo + ", which has not yet committed."); } return localInstance; } }
/** * Called when an {@link ERMDActionButton} changes the related object. * Forces the displayGroup to fetch. */ @SuppressWarnings("unchecked") public void relatedObjectDidChange(NSNotification notif) { NSDictionary<String, Object>userInfo = notif.userInfo(); if (userInfo != null) { Object key = userInfo.valueForKey("propertyKey"); EOEnterpriseObject obj = (EOEnterpriseObject)userInfo.valueForKey("object"); if (relationshipKey() != null && relationshipKey().equals(key) && ERXEOControlUtilities.eoEquals(masterObject(), obj)) { relationshipDisplayGroup().fetch(); // when the last object of the last batch gets removed, select the new last batch if (relationshipDisplayGroup().currentBatchIndex() > relationshipDisplayGroup().batchCount()) { relationshipDisplayGroup().setCurrentBatchIndex(relationshipDisplayGroup().batchCount()); } } } if (notif.userInfo().valueForKey("ajaxNotificationCenterId") == null) { // the change notification was not sent from ERMDAjaxNotificationCenter postChangeNotification(); } }
public void takeStaticStoredValueForKey(EOEditingContext editingContext, String value, String key) { ERCStatic entry = ERCStatic.clazz.objectMatchingKey(editingContext,key); // AK: this is totally thread unsafe... if (entry==null) { entry=(ERCStatic)ERXEOControlUtilities.createAndInsertObject(editingContext, "ERCStatic"); entry.setKey(key); } entry.setValue(value); } }
public EODataSource dataSource() { return ERXEOControlUtilities.dataSourceForObjectAndKey(object(), propertyKey()); }
public static GenderType localInstanceIn(EOEditingContext editingContext, GenderType eo) { GenderType localInstance = (eo == null) ? null : ERXEOControlUtilities.localInstanceOfObject(editingContext, eo); if (localInstance == null && eo != null) { throw new IllegalStateException("You attempted to localInstance " + eo + ", which has not yet committed."); } return localInstance; } }
(masterObject() != null && !ERXEOControlUtilities.eoEquals(masterObject(), eo))) {
public void attachFileWithMimeType(String filePath, String mimeType) { ERCMessageAttachment attachment = (ERCMessageAttachment)ERXEOControlUtilities.createAndInsertObject(editingContext(), "ERCMessageAttachment"); attachment.setFilePath(filePath); if(mimeType != null) attachment.setMimeType(mimeType); addToBothSidesOfAttachments(attachment); }
public ERCStatic objectMatchingKey(EOEditingContext ec, String key, boolean noCache) { // If noCache is true we always go to the database Object result = noCache ? null : _staticsPerKey.objectForKey(key); if (result == null) { NSArray arr = staticsForKey(ec, key); if (arr.count() > 1) throw new IllegalStateException("Found " + arr.count() + " rows for key " + key); result = arr.count() == 1 ? arr.objectAtIndex(0) : NSKeyValueCoding.NullValue; if (result instanceof EOEnterpriseObject) { privateEditingContext().lock(); try { _staticsPerKey.setObjectForKey(ERXEOControlUtilities.localInstanceOfObject(privateEditingContext(), (ERCStatic) result), key); } finally { privateEditingContext().unlock(); } } result = result == NSKeyValueCoding.NullValue ? null : result; } else if (result instanceof EOEnterpriseObject) { privateEditingContext().lock(); try { result = ERXEOControlUtilities.localInstanceOfObject(ec, (ERCStatic) result); } finally { privateEditingContext().unlock(); } } else if (result.equals(NSKeyValueCoding.NullValue)) { result = null; } return (ERCStatic) result; }