001package de.deepamehta.core.model; 002 003import org.codehaus.jettison.json.JSONArray; 004 005 006 007/** 008 * A container for config topics. 009 * <p> 010 * Config topics can be accessed by their type URI. 011 * A view config can contain only one config topic with a certain type URI. 012 * 013 * @author <a href="mailto:jri@deepamehta.de">Jörg Richter</a> 014 */ 015public interface ViewConfigurationModel { 016 017 Iterable<? extends TopicModel> getConfigTopics(); 018 019 /** 020 * @return the config topic for the given type URI, or <code>null</code> if there is none. 021 */ 022 TopicModel getConfigTopic(String configTypeUri); 023 024 /** 025 * Adds a config topic to this view config. 026 * 027 * @throws RuntimeException if this view config already contains a config topic with the same type URI. 028 */ 029 void addConfigTopic(TopicModel configTopic); 030 031 void updateConfigTopic(TopicModel configTopic); 032 033 // --- 034 035 /** 036 * Lookup a view config value. 037 * <p> 038 * Compare to client-side counterpart: function get_view_config() in webclient.js 039 * 040 * @param configTypeUri The type URI of the config topic, e.g. "dm4.webclient.view_config" 041 * @param childTypeUri The child type URI of the config value to lookup, e.g. "dm4.webclient.icon" 042 * 043 * @return The config value, or <code>null</code> if no value is set 044 */ 045 Object getConfigValue(String configTypeUri, String childTypeUri); 046 047 // --- 048 049 JSONArray toJSONArray(); 050}