001 package de.deepamehta.core; 002 003 import de.deepamehta.core.model.AssociationDefinitionModel; 004 import de.deepamehta.core.model.IndexMode; 005 import de.deepamehta.core.model.TypeModel; 006 007 import java.util.Collection; 008 import java.util.List; 009 010 011 012 public interface Type extends Topic { 013 014 015 016 // === Model === 017 018 // --- Data Type --- 019 020 String getDataTypeUri(); 021 022 void setDataTypeUri(String dataTypeUri); 023 024 // --- Index Modes --- 025 026 List<IndexMode> getIndexModes(); 027 028 void addIndexMode(IndexMode indexMode); 029 030 // --- Association Definitions --- 031 032 Collection<AssociationDefinition> getAssocDefs(); 033 034 AssociationDefinition getAssocDef(String childTypeUri); 035 036 boolean hasAssocDef(String childTypeUri); 037 038 void addAssocDef(AssociationDefinitionModel assocDef); 039 040 /** 041 * Note: in contrast to the other "update" methods this one updates the memory only, not the DB! 042 * If you want to update memory and DB use {@link AssociationDefinition#update}. 043 * <p> 044 * This method is here to support a special case: the user retypes an association which results in 045 * a changed type definition. In this case the DB is already up-to-date and only the type's memory 046 * representation must be updated. So, here the DB update is the *cause* for a necessary memory-update. 047 * Normally the situation is vice-versa: the DB update is the necessary *effect* of a memory-update. 048 * <p> 049 * ### TODO: get rid of this peculiar situation and remove this method. This might be achieved by using 050 * the PRE_UPDATE_ASSOCIATION hook instead the POST_UPDATE_ASSOCIATION hook in the Type Editor module. 051 * On pre-update we would perform a regular {@link AssociationDefinition#update} and suppress further 052 * processing by returning false. 053 * 054 * @param assocDef the new association definition. 055 * Note: in contrast to the other "update" methods this one does not support partial updates. 056 * That is all association definition fields must be initialized. 057 */ 058 void updateAssocDef(AssociationDefinitionModel assocDef); 059 060 void removeAssocDef(String childTypeUri); 061 062 // --- Label Configuration --- 063 064 List<String> getLabelConfig(); 065 066 void setLabelConfig(List<String> labelConfig); 067 068 // --- View Configuration --- 069 070 ViewConfiguration getViewConfig(); 071 072 // FIXME: to be dropped 073 Object getViewConfig(String typeUri, String settingUri); 074 075 // --- 076 077 TypeModel getModel(); 078 079 080 081 // === Updating === 082 083 void update(TypeModel model); 084 }