protected static NSDictionary expansionLookup() { if (RuleModelUtilities.expansionLookup == null) { NSDictionary lookupDictionary = RuleModelUtilities.compressionLookup(); Enumeration keys = lookupDictionary.keyEnumerator(); NSMutableDictionary lookup = new NSMutableDictionary(lookupDictionary.count()); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = lookupDictionary.objectForKey(key); lookup.setObjectForKey(key, value); } // Direct To Web rule editor compatibility lookup.setObjectForKey( BooleanAssignment.class.getName(), "com.webobjects.directtoweb.BooleanAssignment"); lookup.setObjectForKey(Rule.class.getName(), "com.webobjects.directtoweb.Rule"); lookup.setObjectForKey( SimpleAssignment.class.getName(), "com.webobjects.directtoweb.Assignment"); lookup.setObjectForKey( KeyValueAssignment.class.getName(), "com.webobjects.directtoweb.KeyValueAssignment"); RuleModelUtilities.expansionLookup = lookup; } return RuleModelUtilities.expansionLookup; }
protected static String encode(NSArray rules) { if (rules != null) { EOKeyValueArchiver archiver = new EOKeyValueArchiver(); archiver.encodeObject(rules, RuleModel.RULES_KEY); return NSPropertyListSerialization.stringFromPropertyList( transformDictionary(archiver.dictionary(), RuleModelUtilities.compressionLookup())); } else { return null; } }