Package er.extensions.eof

Examples of er.extensions.eof.ERXGenericRecord$InverseRelationshipUpdater


        }

        private final NSMutableSet<String> _warned = new NSMutableSet();

        protected NSArray indexableObjectsForObject(String type, EOEnterpriseObject object) {
            ERXGenericRecord eo = (ERXGenericRecord) object;
            EOEditingContext ec = eo.editingContext();
            NSMutableSet<EOEnterpriseObject> result = new NSMutableSet();
            String entityName = eo.entityName();
            ConfigurationEntry config = _configuration.entryForKey(entityName);
            if (config != null) {
                if (!config.active) {
                    for (Enumeration e1 = config.notificationKeys.objectEnumerator(); e1.hasMoreElements();) {
                        String key = (String) e1.nextElement();
                        Object value = null;

                        if (type.equals(EOEditingContext.DeletedKey)) {
                            value = ec.committedSnapshotForObject(eo);
                        }

                        EOEntity source = ERXEOAccessUtilities.entityForEo(eo);

                        if (source.classPropertyNames().containsObject(key)) {
                            value = eo.valueForKey(key);
                        } else {
                            if (eo.isNewObject()) {
                                if (!_warned.containsObject(entityName)) {
                                    log.error("We currently don't support unsaved related objects for this entity: " + entityName);
                                    _warned.addObject(entityName);
                                }
                            } else {
View Full Code Here


                ERXConstant.Constant constant = (ERXConstant.Constant) value;
                result.setObjectForKey(constant.value(), key);
            } else if (value == NSKeyValueCoding.NullValue) {
                result.removeObjectForKey(key);
            } else if (value instanceof ERXGenericRecord) {
                ERXGenericRecord rec = (ERXGenericRecord) value;
                result.setObjectForKey(ERXKeyGlobalID.globalIDForGID(rec.permanentGlobalID()).asString(), key);
            } else if (value instanceof NSArray) {
                NSArray oldValue = (NSArray) value;
                NSMutableArray newValue = new NSMutableArray(oldValue.count());
                for (Enumeration e1 = newValue.objectEnumerator(); e1.hasMoreElements();) {
                    ERXGenericRecord rec = (ERXGenericRecord) e1.nextElement();
                    newValue.addObject(ERXKeyGlobalID.globalIDForGID(rec.permanentGlobalID()).asString());
                }
                result.setObjectForKey(newValue, key);
            }
        }
        return result;
View Full Code Here

    protected void handleDelete(EOEditingContext ec, EOEnterpriseObject eo, Object oldValue) {
        handleChange(ec, eo, ERCAuditTrailType.DELETED, null, oldValue, null);
    }

    protected void handleRemove(EOEditingContext ec, EOEnterpriseObject target, String keyPath, EOEnterpriseObject eo) {
        ERXGenericRecord rec = (ERXGenericRecord) target;
        handleChange(ec, target, ERCAuditTrailType.REMOVED, keyPath, serializeObject(eo), null);
    }
View Full Code Here

        ERXGenericRecord rec = (ERXGenericRecord) target;
        handleChange(ec, target, ERCAuditTrailType.REMOVED, keyPath, serializeObject(eo), null);
    }

    protected void handleAdd(EOEditingContext ec, EOEnterpriseObject target, String keyPath, EOEnterpriseObject eo) {
        ERXGenericRecord rec = (ERXGenericRecord) target;
        handleChange(ec, target, ERCAuditTrailType.ADDED, keyPath, null, serializeObject(eo));
    }
View Full Code Here

        ERXGenericRecord rec = (ERXGenericRecord) target;
        handleChange(ec, target, ERCAuditTrailType.ADDED, keyPath, null, serializeObject(eo));
    }

    protected void handleUpdate(EOEditingContext ec, EOEnterpriseObject target, String keyPath, EOEnterpriseObject eo) {
        ERXGenericRecord rec = (ERXGenericRecord) target;
        EOEnterpriseObject oldValue = (EOEnterpriseObject) rec.valueForKeyPath(keyPath);
        handleChange(ec, target, ERCAuditTrailType.UPDATED, keyPath, oldValue, oldValue);
    }
View Full Code Here

        EOEnterpriseObject oldValue = (EOEnterpriseObject) rec.valueForKeyPath(keyPath);
        handleChange(ec, target, ERCAuditTrailType.UPDATED, keyPath, oldValue, oldValue);
    }

    protected void handleChange(EOEditingContext ec, EOEnterpriseObject eo, ERCAuditTrailType type, String keyPath, Object oldValue, Object newValue) {
        ERXGenericRecord rec = (ERXGenericRecord) eo;
        ERCAuditTrail trail = ERCAuditTrail.clazz.auditTrailForObject(ec, eo);
        if (trail == null) {
            trail = ERCAuditTrail.clazz.createAuditTrailForObject(ec, eo);
        }
        log.info(trail + " " + type + ": " + rec.permanentGlobalID() + " " + keyPath + " from " + oldValue + " to " + newValue);
        if (oldValue instanceof ERXGenericRecord) {
            ERXGenericRecord rec1 = (ERXGenericRecord) oldValue;
            oldValue = ERXKeyGlobalID.globalIDForGID(rec1.permanentGlobalID()).asString();
        }
        if (newValue instanceof ERXGenericRecord) {
            ERXGenericRecord rec1 = (ERXGenericRecord) newValue;
            newValue = ERXKeyGlobalID.globalIDForGID(rec1.permanentGlobalID()).asString();
        }
        trail.createEntry(type, keyPath, oldValue, newValue);
    }
View Full Code Here

TOP

Related Classes of er.extensions.eof.ERXGenericRecord$InverseRelationshipUpdater

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.