void storeLabelConfig(
     List<String> labelConfig, Collection<AssociationDefinitionModel> assocDefs) {
   for (AssociationDefinitionModel assocDef : assocDefs) {
     boolean includeInLabel = labelConfig.contains(assocDef.getUri());
     new AttachedAssociationDefinition(assocDef, dms)
         .setChildTopicValue("dm4.core.include_in_label", new SimpleValue(includeInLabel));
   }
 }
 void appendToSequence(
     String typeUri, AssociationDefinitionModel assocDef, AssociationDefinitionModel predecessor) {
   if (predecessor == null) {
     storeSequenceStart(typeUri, assocDef.getId());
   } else {
     storeSequenceSegment(predecessor.getId(), assocDef.getId());
   }
 }
 private List<String> fetchLabelConfig(List<AssociationDefinitionModel> assocDefs) {
   List<String> labelConfig = new ArrayList();
   for (AssociationDefinitionModel assocDef : assocDefs) {
     RelatedTopicModel includeInLabel = fetchLabelConfigTopic(assocDef.getId());
     if (includeInLabel != null && includeInLabel.getSimpleValue().booleanValue()) {
       labelConfig.add(assocDef.getUri());
     }
   }
   return labelConfig;
 }
 void storeAssociationDefinition(AssociationDefinitionModel assocDef) {
   try {
     // Note: creating the underlying association is conditional. It exists already for
     // an interactively created association definition. Its ID is already set.
     if (assocDef.getId() == -1) {
       dms.createAssociation(assocDef, null); // clientState=null
     }
     // Note: the assoc def ID is known only after creating the association
     long assocDefId = assocDef.getId();
     // role types
     associateWholeRoleType(assocDefId, assocDef.getWholeRoleTypeUri());
     associatePartRoleType(assocDefId, assocDef.getPartRoleTypeUri());
     // cardinality
     associateWholeCardinality(assocDefId, assocDef.getWholeCardinalityUri());
     associatePartCardinality(assocDefId, assocDef.getPartCardinalityUri());
     //
     storeViewConfig(createConfigurableAssocDef(assocDefId), assocDef.getViewConfigModel());
   } catch (Exception e) {
     throw new RuntimeException(
         "Storing association definition \""
             + assocDef.getUri()
             + "\" of type \""
             + assocDef.getWholeTypeUri()
             + "\" failed",
         e);
   }
 }
 private Map<Long, AssociationDefinitionModel> fetchAssociationDefinitionsUnsorted(
     Topic typeTopic) {
   Map<Long, AssociationDefinitionModel> assocDefs = new HashMap();
   //
   // 1) fetch part topic types
   // Note: we must set fetchRelatingComposite to false here. Fetching the composite of association
   // type
   // Composition Definition would cause an endless recursion. Composition Definition is defined
   // through
   // Composition Definition itself (child types "Include in Label", "Ordered").
   // Note: "othersTopicTypeUri" is set to null. We want consider "dm4.core.topic_type" and
   // "dm4.core.meta_type"
   // as well (the latter required e.g. by dm4-mail) ### TODO: add a getRelatedTopics() method that
   // takes a list
   // of topic types.
   ResultSet<RelatedTopic> partTypes =
       typeTopic.getRelatedTopics(
           asList("dm4.core.aggregation_def", "dm4.core.composition_def"),
           "dm4.core.whole_type",
           "dm4.core.part_type",
           null,
           false,
           false,
           0,
           null);
   // othersTopicTypeUri=null, fetchComposite=false, fetchRelatingComposite=false, clientState=null
   //
   // 2) create association definitions
   // Note: the returned map is an intermediate, hashed by ID. The actual type model is
   // subsequently build from it by sorting the assoc def's according to the sequence IDs.
   for (RelatedTopic partType : partTypes) {
     AssociationDefinitionModel assocDef =
         fetchAssociationDefinition(
             partType.getAssociation(), typeTopic.getUri(), partType.getUri());
     assocDefs.put(assocDef.getId(), assocDef);
   }
   return assocDefs;
 }