public EOEditingContext newEditingContext() { return ERXEC.newEditingContext(); } }
private static synchronized EOEditingContext privateEditingContext() { if (_privateEditingContext == null) { if (ERXProperties.booleanForKeyWithDefault("er.corebusinesslogic.ERCStatic.UseSeparateChannel", true)) { _privateEditingContext = ERXEC.newEditingContext(ERXObjectStoreCoordinator.create()); _privateEditingContext.setSharedEditingContext(null); } else { _privateEditingContext = ERXEC.newEditingContext(); } } return _privateEditingContext; }
/** * Deletes the tag with the given name and removes the tag from all taggables. * * @param tagName the tag name to delete */ public static void deleteTagNamed(String tagName) { EOEditingContext editingContext = ERXEC.newEditingContext(); ERTag.deleteTagNamed(editingContext, tagName); editingContext.saveChanges(); }
private Directory indexDirectory() { if(_indexDirectory == null) { try { if (_store.startsWith("file://")) { File indexDirectory = new File(new URL(_store).getFile()); _indexDirectory = FSDirectory.open(indexDirectory); } else { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { _indexDirectory = ERIDirectory.clazz.directoryForName(ec, _store); } finally { ec.unlock(); } } } catch (IOException e) { throw NSForwardException._runtimeExceptionForThrowable(e); } } return _indexDirectory; }
public Object valueForKey(String key) { Object result=null; EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { EOEnterpriseObject pref = preferenceRecordForKey(key, ec); if (pref != null) { String encodedValue = (String)pref.valueForKey("value"); if(encodedValue !=null) { result = decodedValue(encodedValue); } } } catch(RuntimeException ex) { log.error("Error while getting preference {}", key, ex); } finally { ec.unlock(); } ec.dispose(); log.debug("Prefs vfk {} = {}", key, result); return result; }
long start = System.currentTimeMillis(); int treshhold = 10; EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { ec.unlock(); ec = ERXEC.newEditingContext(); ec.lock(); iterator.setEditingContext(ec);
@Override public void finishInitialization() { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try {
long start = System.currentTimeMillis(); int treshhold = 10; EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { ec.unlock(); ec = ERXEC.newEditingContext(); ec.lock(); iterator.setEditingContext(ec);
ERXFetchSpecificationBatchIterator iterator = ERCMailMessage.mailMessageClazz().batchIteratorForUnsentMessages(); EOEditingContext ec = ERXEC.newEditingContext(); iterator.setEditingContext(ec); ec.lock(); EOEditingContext temp = ERXEC.newEditingContext(); temp.lock(); try {
/** * Action for inspect button */ public WOActionResults inspectObjectAction() { WOActionResults result = null; if (shouldAllowInlineEditing()) { EOEditingContext ec = ERXEC.newEditingContext(object().editingContext()); EOEnterpriseObject localObj = ERXEOControlUtilities.localInstanceOfObject(ec, object()); SelectPageInterface parent = parentSelectPage(); if(parent != null) { d2wContext().takeValueForKey("inspect", Keys.inlineTask); parent.setSelectedObject(localObj); } else { throw new IllegalStateException("This page is not an instance of SelectPageInterface. I can't select here."); } } else { result = inspectObjectInPageAction(); } return result; }
standardExceptionPage.setExtraInfo(extraInfo); EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try {
/** * Action performed by the edit button */ public WOComponent editObjectAction() { WOComponent result = null; if (shouldAllowInlineEditing()) { EOEditingContext ec = ERXEC.newEditingContext(object().editingContext()); EOEnterpriseObject localObj = ERXEOControlUtilities.localInstanceOfObject(ec, object()); SelectPageInterface parent = parentSelectPage(); if(parent != null) { d2wContext().takeValueForKey("edit", Keys.inlineTask); parent.setSelectedObject(localObj); } else { throw new IllegalStateException("This page is not an instance of SelectPageInterface. I can't select here."); } } else { result = editObjectInPageAction(); } return result; }
@Override protected void handleUnsuccessfullQueryForKey(Object key) { EOEditingContext ec = ERXEC.newEditingContext(); EOGlobalID gid = NO_GID_MARKER; ec.lock(); try { EOEnterpriseObject eo = (EOEnterpriseObject) EOUtilities.objectsMatchingKeyAndValue(ec, ENTITY, Key.KEY, key).lastObject(); if(eo != null) { gid = ec.globalIDForObject(eo); } } finally { ec.unlock(); } cache().setObjectForKey(createRecord(gid, null), key); } };
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); ec.saveChanges(); } } finally { ec.unlock(); } }
EOEditingContext newEditingContext = ERXEC.newEditingContext(); try { ERTag newTag = createTagNamed(newEditingContext, tagName);
EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try {
public WOComponent edit() { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { ERCHelpText text = ERCHelpText.clazz.helpTextForKey(ec, key); if(text == null) { text = ERCHelpText.clazz.createAndInsertObject(ec); text.setKey(key); } EditPageInterface page = D2W.factory().editPageForEntityNamed(ERCHelpText.ENTITY, session()); page.setObject(text); page.setNextPage(context().page()); return (WOComponent)page; } finally { ec.unlock(); } }
/** * Performs the newObjectAction. Creates a new object and sets the inline task * to 'create' */ public WOComponent newObjectAction() { EOEditingContext newEc = ERXEC.newEditingContext(masterObject().editingContext()); EOClassDescription relatedObjectClassDescription = masterObject().classDescriptionForDestinationKey(relationshipKey()); EOEnterpriseObject relatedObject = EOUtilities.createAndInsertInstance(newEc, relatedObjectClassDescription.entityName()); EOEnterpriseObject localObj = EOUtilities.localInstanceOfObject(relatedObject.editingContext(), masterObject()); if (localObj instanceof ERXGenericRecord) { ((ERXGenericRecord)localObj).setValidatedWhenNested(false); } localObj.addObjectToBothSidesOfRelationshipWithKey(relatedObject, relationshipKey()); setSelectedObject(relatedObject); setInlineTaskSafely("create"); return null; }
@SuppressWarnings("unchecked") public NSArray<EOEnterpriseObject> destinationObjectsWithQualifier(EOQualifier qual) { NSArray<EOEnterpriseObject> result = null; NSArray<EOSortOrdering> orderings = null; if (!ERXStringUtilities.stringIsNullOrEmpty(sortKey())) { orderings = ERXS.ascs(sortKey()); } if (extraQualifier() != null) { qual = ERXQ.and(qual, extraQualifier()); } if (useFetch() && ERXStringUtilities.stringIsNullOrEmpty(restrictedChoiceKey())) { if(restrictingFetchSpecificationName() != null) { qual = ERXQ.and(qual, restrictingFetchSpec().qualifier()); } EOFetchSpecification fetchSpec = new EOFetchSpecification(destinationEntityName(), qual, orderings); if (!ERXStringUtilities.stringIsNullOrEmpty((String) d2wContext() .valueForKey(Keys.fetchLimit))) { fetchSpec.setFetchLimit(Integer.valueOf((String) d2wContext() .valueForKey(Keys.fetchLimit))); } fetchSpec.setIsDeep(true); EOEditingContext ec = ERXEC.newEditingContext(); result = ec.objectsWithFetchSpecification(fetchSpec); } else { result = ERXQ.filtered(allItems(), qual); } return result; }
public NSDictionary<String, String> tagCloud() { if (_tagCloud == null || !booleanValueForBinding("cache", true)) { EOEditingContext editingContext = ERXEC.newEditingContext(); ERTaggableEntity<?> taggableEntity = ERTaggableEntity.taggableEntity(entityName()); NSDictionary<String, Integer> tagCount; int limit = limit(); int minimum = minimum(); if (limit == -1 && minimum == -1) { tagCount = taggableEntity.tagCount(editingContext, -1, additionalQualifier()); } else if (minimum == -1) { tagCount = taggableEntity.tagCount(editingContext, limit, additionalQualifier()); } else { tagCount = taggableEntity.tagCount(editingContext, ERXQ.GTEQ, minimum, limit, additionalQualifier()); } NSArray<String> categories = categories(); if (categories == null) { NSMutableArray<String> mutableCategories = new NSMutableArray<>(); int categoryCount = categoryCount(); for (int i = 1; i <= categoryCount; i++) { mutableCategories.addObject(tagClassPrefix() + i); } categories = mutableCategories; } _tagCloud = taggableEntity.cloud(tagCount, categories); } return _tagCloud; }