/** * Writes the specified name. * * @param name The name to serialize. * @throws IOException In case of an error. */ private void _writeName(final Name name) throws IOException { _attrs.clear(); _addScopeAndReifier(name); final String element = _nameType(name); _out.startElement(element, _attrs); _out.dataElement(_EL_VALUE, name.getValue()); for (Variant variant : name.getVariants()) { _writeVariant(variant); } _out.endElement(element); }
/** * Generates the prefixes for the specified topic (incl. its played roles and occurrences and * names). * * @param topic The topic to generate the prefixes for. */ private void _registerPrefixes(final Topic topic) { _generateTopicReferences(topic.getTypes()); for (Occurrence occ : topic.getOccurrences()) { _generatePrefixes(occ); } for (Name name : topic.getNames()) { _generatePrefixes(name); for (Variant variant : name.getVariants()) { _generatePrefixes(variant); } } for (Role rolePlayed : topic.getRolesPlayed()) { Association assoc = rolePlayed.getParent(); _generatePrefixes(assoc); for (Role role : assoc.getRoles()) { _getTopicReference(role.getType()); } } }
/** * Returns a reference to the name type. * * @param name The name. * @return A reference to the name type. */ private String _nameType(final Name name) { if (name.getType().getSubjectIdentifiers().contains(_defaultNameTypeLocator)) { return _DEFAULT_NAME_TYPE; } return _getTopicReference(name.getType()); }