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 an {@link AssociationType}.
013     *
014     * @author <a href="mailto:jri@deepamehta.de">Jörg Richter</a>
015     */
016    public class AssociationTypeModel extends TypeModel {
017    
018        // ---------------------------------------------------------------------------------------------- Instance Variables
019    
020        private Logger logger = Logger.getLogger(getClass().getName());
021    
022        // ---------------------------------------------------------------------------------------------------- Constructors
023    
024        public AssociationTypeModel(String uri, String value, String dataTypeUri) {
025            super(uri, "dm4.core.assoc_type", new SimpleValue(value), dataTypeUri);
026        }
027    
028        public AssociationTypeModel(TopicModel topic, String dataTypeUri, List<IndexMode> indexModes,
029                                    List<AssociationDefinitionModel> assocDefs, List<String> labelConfig,
030                                    ViewConfigurationModel viewConfig) {
031            super(topic, dataTypeUri, indexModes, assocDefs, labelConfig, viewConfig);
032        }
033    
034        public AssociationTypeModel(JSONObject assocType) throws JSONException {
035            super(assocType.put("type_uri", "dm4.core.assoc_type"));
036        }
037    
038        // -------------------------------------------------------------------------------------------------- Public Methods
039    
040        @Override
041        public AssociationTypeModel addAssocDef(AssociationDefinitionModel assocDef) {
042            return (AssociationTypeModel) super.addAssocDef(assocDef);
043        }
044    
045        // ---
046    
047        @Override
048        public String toString() {
049            return "association type (" + super.toString() + ")";
050        }
051    }