@Test public void fromXml() throws XMLSemanticError { UserMessageArchivePreferences preferences = new SimpleUserMessageArchivePreferences( DefaultUserArchiveBehaviour.ROSTER, Collections.singleton(EntityImpl.parseUnchecked("always@foo.com")), Collections.singleton(EntityImpl.parseUnchecked("never@foo.com"))); XMLElement prefsElement = UserMessageArchivePreferencesElement.toXml("foo", preferences); UserMessageArchivePreferences parsedPreferences = UserMessageArchivePreferencesElement.fromXml(prefsElement); assertEquals(preferences.getDefaultBehaviour(), parsedPreferences.getDefaultBehaviour()); assertEquals(preferences.getAlwaysArchivedToOrFromJids().size(), parsedPreferences.getAlwaysArchivedToOrFromJids().size()); assertEquals(preferences.getNeverArchivedToOrFromJids().size(), parsedPreferences.getNeverArchivedToOrFromJids().size()); }
static UserMessageArchivePreferences fromXml(XMLElement prefsElement) throws XMLSemanticError { DefaultUserArchiveBehaviour defaultbehaviour = DefaultUserArchiveBehaviour .valueOf(prefsElement.getAttributeValue("default").toUpperCase()); Set<Entity> alwaysJids = parseJids(prefsElement, "always"); Set<Entity> neverJids = parseJids(prefsElement, "never"); return new SimpleUserMessageArchivePreferences(defaultbehaviour, alwaysJids, neverJids); }
UserMessageArchivePreferencesElement { static UserMessageArchivePreferences fromXml(XMLElement prefsElement) throws XMLSemanticError { DefaultUserArchiveBehaviour defaultbehaviour = DefaultUserArchiveBehaviour .valueOf(prefsElement.getAttributeValue("default").toUpperCase()); Set<Entity> alwaysJids = parseJids(prefsElement, "always"); Set<Entity> neverJids = parseJids(prefsElement, "never"); return new SimpleUserMessageArchivePreferences(defaultbehaviour, alwaysJids, neverJids); } }
UserMessageArchivePreferencesElement { static UserMessageArchivePreferences fromXml(XMLElement prefsElement) throws XMLSemanticError { DefaultUserArchiveBehaviour defaultbehaviour = DefaultUserArchiveBehaviour .valueOf(prefsElement.getAttributeValue("default").toUpperCase()); Set<Entity> alwaysJids = parseJids(prefsElement, "always"); Set<Entity> neverJids = parseJids(prefsElement, "never"); return new SimpleUserMessageArchivePreferences(defaultbehaviour, alwaysJids, neverJids); } private  UserMessageArchivePreferencesElement(); }
UserMessageArchivePreferencesElement { static UserMessageArchivePreferences fromXml(XMLElement prefsElement) throws XMLSemanticError { DefaultUserArchiveBehaviour defaultbehaviour = DefaultUserArchiveBehaviour .valueOf(prefsElement.getAttributeValue("default").toUpperCase()); Set<Entity> alwaysJids = parseJids(prefsElement, "always"); Set<Entity> neverJids = parseJids(prefsElement, "never"); return new SimpleUserMessageArchivePreferences(defaultbehaviour, alwaysJids, neverJids); } private  UserMessageArchivePreferencesElement();  }
UserMessageArchivePreferencesElement { static UserMessageArchivePreferences fromXml(XMLElement prefsElement) throws XMLSemanticError { DefaultUserArchiveBehaviour defaultbehaviour = DefaultUserArchiveBehaviour .valueOf(prefsElement.getAttributeValue("default").toUpperCase()); Set<Entity> alwaysJids = parseJids(prefsElement, "always"); Set<Entity> neverJids = parseJids(prefsElement, "never"); return new SimpleUserMessageArchivePreferences(defaultbehaviour, alwaysJids, neverJids); } private  UserMessageArchivePreferencesElement();   }