001package systems.dmx.core;
002
003import systems.dmx.core.model.TopicModel;
004
005
006
007/**
008 * Specification of a topic -- DMX's central data object.
009 *
010 * @author <a href="mailto:jri@deepamehta.de">Jörg Richter</a>
011 */
012public interface Topic extends DMXObject {
013
014    void update(TopicModel model);
015
016    // ---
017
018    /**
019     * Searches this topic's child topics for a topic of the given type.
020     * Only the child topics which are already loaded into memory are searched; the DB is not accessed.
021     * <p>
022     * The first topic found is returned, according to a depth-first search.
023     * For multiple-value childs the first topic is returned.
024     * If the given type matches this topic directly it is returned immediately.
025     * <p>
026     * The search is driven by this topic's type definition. That is child topics which do not adhere
027     * to the type definition are not found.
028     * <p>
029     * TODO: make this generic by moving to DMXObject interface?
030     *
031     * @return  the found topic, or <code>null</code>.
032     */
033    Topic findChildTopic(String topicTypeUri);
034
035    // ---
036
037    @Override
038    Topic loadChildTopics();
039
040    @Override
041    Topic loadChildTopics(String assocDefUri);
042
043    // ---
044
045    @Override
046    TopicModel getModel();
047}