001    package de.deepamehta.core.model;
002    
003    import org.codehaus.jettison.json.JSONException;
004    import org.codehaus.jettison.json.JSONObject;
005    
006    import java.util.List;
007    import java.util.logging.Logger;
008    
009    
010    
011    /**
012     * Collection of the data that makes up a {@link TopicType}.
013     *
014     * @author <a href="mailto:jri@deepamehta.de">Jörg Richter</a>
015     */
016    public class TopicTypeModel extends TypeModel {
017    
018        // ---------------------------------------------------------------------------------------------- Instance Variables
019    
020        private Logger logger = Logger.getLogger(getClass().getName());
021    
022        // ---------------------------------------------------------------------------------------------------- Constructors
023    
024        public TopicTypeModel(String uri, String value, String dataTypeUri) {
025            this(uri, "dm4.core.topic_type", value, dataTypeUri);
026        }
027    
028        public TopicTypeModel(String uri, String topicTypeUri, String value, String dataTypeUri) {
029            super(uri, topicTypeUri, new SimpleValue(value), dataTypeUri);
030        }
031    
032        public TopicTypeModel(TopicModel topic, String dataTypeUri, List<IndexMode> indexModes,
033                              List<AssociationDefinitionModel> assocDefs, List<String> labelConfig,
034                              ViewConfigurationModel viewConfig) {
035            super(topic, dataTypeUri, indexModes, assocDefs, labelConfig, viewConfig);
036        }
037    
038        public TopicTypeModel(JSONObject topicType) throws JSONException {
039            super(topicType.put("type_uri", "dm4.core.topic_type"));
040        }
041    
042        // -------------------------------------------------------------------------------------------------- Public Methods
043    
044        @Override
045        public TopicTypeModel addAssocDef(AssociationDefinitionModel assocDef) {
046            return (TopicTypeModel) super.addAssocDef(assocDef);
047        }
048    
049        // ---
050    
051        @Override
052        public String toString() {
053            return "topic type (" + super.toString() + ")";
054        }
055    }