void storeType(TypeModel type, String defaultUriPrefix) { // 1) store the base-topic parts ### TODO: call storeTopic() instead? dms.storage.createTopic(type); associateWithTopicType(type.getId(), type.getTypeUri()); // Note: the created AttachedTopic is just a temporary vehicle to // let us call its setUri() and storeAndIndexValue() methods. AttachedTopic typeTopic = new AttachedTopic(type, dms); // If no URI is set the type gets a default URI based on its ID. // Note: this must be done *after* the topic is created. The ID is not known before. if (typeTopic.getUri().equals("")) { typeTopic.setUri(defaultUriPrefix + type.getId()); } // typeTopic.storeAndIndexValue(type.getSimpleValue()); // // 2) put in type cache // Note: an association type must be put in type cache *before* storing its association // definitions. // Consider creation of association type "Composition Definition": it has a composition // definition itself. putInTypeCache(type); // // 3) store the type-specific parts associateDataType(type.getUri(), type.getDataTypeUri()); storeIndexModes(type.getUri(), type.getIndexModes()); storeAssocDefs(type.getUri(), type.getAssocDefs()); storeLabelConfig(type.getLabelConfig(), type.getAssocDefs()); storeViewConfig(createConfigurableType(type.getId()), type.getViewConfigModel()); }
Topic storeTopic(TopicModel model, ClientState clientState, Directives directives) { setDefaults(model); dms.storage.createTopic(model); associateWithTopicType(model.getId(), model.getTypeUri()); // AttachedTopic topic = new AttachedTopic(model, dms); topic.storeValue(clientState, directives); // return topic; }