public ERCAuditTrail auditTrailForObject(EOEditingContext ec, EOEnterpriseObject eo) { EOKeyGlobalID gid = null; if (eo instanceof ERXGenericRecord) { gid = ((ERXGenericRecord) eo).permanentGlobalID(); } else { throw new IllegalArgumentException("Can't handle non ERXGenericRecord"); } ERCAuditTrail trail = (ERCAuditTrail) ERXEOControlUtilities.objectWithQualifier(ec, ENTITY_NAME, ERXQ.equals(Key.GID, ERXKeyGlobalID.globalIDForGID(gid))); if (trail == null) { trail = (ERCAuditTrail) EOQualifier.filteredArrayWithQualifier(ec.insertedObjects(), ERXQ.equals("entityName", ENTITY_NAME).and(ERXQ.equals(Key.GID + ".globalID", gid))).lastObject(); } return trail; }
public NSArray unclosedTestItemsWithUser(EOEditingContext ec, People people) { EOQualifier q = ERXQ.and(ERXQ.equals(Key.OWNER, people), ERXQ.notEquals(Key.STATE, TestItemState.CLOSED)); return objectsMatchingQualifier(ec, q); } }
/** * Will fetch related rows for the given row relationship. The * context will be used to access the needed entity store. * * @param entity * the current entity * @param row * the currently selected row * @param relationship * the relationship * @param context * the memory adaptor context * @return array of rows from related entity store */ protected NSArray<NSMutableDictionary<String, Object>> fetchRelatedRows(EOEntity entity, NSDictionary<String, Object> row, EORelationship relationship, ERMemoryAdaptorContext context) { EOEntity destEntity = relationship.destinationEntity(); EREntityStore destStore = context._entityStoreForEntity(destEntity); String sourceAttribute = relationship.sourceAttributes().get(0).name(); String destinationAttribute = relationship.destinationAttributes().get(0).name(); ERXFetchSpecification fs = new ERXFetchSpecification(destEntity.name(), ERXQ.equals(destinationAttribute, row.valueForKey(sourceAttribute)), null); return destStore.fetch(destEntity.attributesToFetch(), fs, false, destEntity, context); }
/** * Action called when the user makes a selection from the AjaxAutoComplete */ public WOActionResults selectObject() { // log.debug("selectobject called: " + item); EOQualifier qual = ERXQ.equals(keyWhenRelationship(), searchValue()); NSArray<EOEnterpriseObject> objs = destinationObjectsWithQualifier(qual); if (objs != null && objs.count() > 0) { EOEnterpriseObject localEO = ERXEOControlUtilities.localInstanceOfObject(object().editingContext(), objs.objectAtIndex(0)); object().addObjectToBothSidesOfRelationshipWithKey(localEO, propertyKey()); } else { EOEnterpriseObject existingObj = (EOEnterpriseObject)object().valueForKey(propertyKey()); if (existingObj != null) { object().removeObjectFromBothSidesOfRelationshipWithKey(existingObj, propertyKey()); } } // support for ERMDAjaxNotificationCenter if (ERXValueUtilities.booleanValueWithDefault(d2wContext().valueForKey("shouldObserve"), false)) { NSNotificationCenter.defaultCenter().postNotification( ERMDAjaxNotificationCenter.PropertyChangedNotification, parent().valueForKeyPath("d2wContext")); } // NSLog.out.appendln("Select Object Called: " + object().valueForKey(propertyKey()) + " " + searchValue()); return null; }
} else { _qualifier = ERXQ.and(_qualifier, ERXQ.equals(filterChoicesKey, filterChoice()));
String destinationAttribute = toJoinRelationship.destinationAttributes().get(0).name(); ERXFetchSpecification fs = new ERXFetchSpecification(joinEntity.name(), ERXQ.equals(destinationAttribute, row.valueForKey(sourceAttribute)), null); NSArray<NSMutableDictionary<String, Object>> fetchedObjects = joinStore.fetch(joinEntity.attributesToFetch(),