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