Пример #1
0
 private ViewConfigurationModel fetchTypeViewConfig(Topic typeTopic) {
   try {
     // Note: othersTopicTypeUri=null, the view config's topic type is unknown (it is
     // client-specific)
     ResultSet<RelatedTopic> configTopics =
         typeTopic.getRelatedTopics(
             "dm4.core.aggregation",
             "dm4.core.type",
             "dm4.core.view_config",
             null,
             true,
             false,
             0,
             null);
     return new ViewConfigurationModel(DeepaMehtaUtils.toTopicModels(configTopics.getItems()));
   } catch (Exception e) {
     throw new RuntimeException(
         "Fetching view configuration for type \"" + typeTopic.getUri() + "\" failed", e);
   }
 }
Пример #2
0
 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;
 }