001    package de.deepamehta.plugins.facets.service;
002    
003    import de.deepamehta.plugins.facets.model.FacetValue;
004    
005    import de.deepamehta.core.DeepaMehtaObject;
006    import de.deepamehta.core.RelatedTopic;
007    import de.deepamehta.core.Topic;
008    import de.deepamehta.core.service.ClientState;
009    import de.deepamehta.core.service.Directives;
010    import de.deepamehta.core.service.PluginService;
011    
012    import java.util.List;
013    
014    
015    
016    public interface FacetsService extends PluginService {
017    
018        // ### TODO: rename to getFacetValue
019        Topic getFacet(long topicId, String facetTypeUri);
020    
021        /**
022         * Retrieves a facet value.
023         * ### TODO: rename to getFacetValue
024         *
025         * @param   object          The facetted object: a topic, association, a type ...
026         * @param   facetTypeUri    URI of the facet type.
027         *
028         * @return  The retrieved facet.
029         */
030        Topic getFacet(DeepaMehtaObject object, String facetTypeUri);
031    
032        // ---
033    
034        // ### TODO: rename to getFacetValues
035        List<RelatedTopic> getFacets(long topicId, String facetTypeUri);
036    
037        /**
038         * Retrieves the values of a multi-facet.
039         * ### TODO: rename to getFacetValues
040         *
041         * @param   object          The facetted object: a topic, association, a type ...
042         * @param   facetTypeUri    URI of the facet type.
043         *
044         * @return  The retrieved multi-facet.
045         */
046        List<RelatedTopic> getFacets(DeepaMehtaObject object, String facetTypeUri);
047    
048        // ---
049    
050        void addFacetTypeToTopic(long topicId, String facetTypeUri);
051    
052        // ---
053    
054        void updateFacet(long topicId, String facetTypeUri, FacetValue value, ClientState clientState);
055    
056        /**
057         * Updates a facet.
058         *
059         * @param   object          The facetted object: a topic, association, a type ...
060         * @param   facetTypeUri    URI of the facet type.
061         * @param   facetValue      The new facet value.
062         * @param   directives      Must be not null at least for aggregated facets ### FIXME: directives are ignored
063         */
064        void updateFacet(DeepaMehtaObject object, String facetTypeUri, FacetValue value, ClientState clientState,
065                                                                                         Directives directives);
066    
067        // ---
068    
069        boolean hasFacet(long topicId, String facetTypeUri, long facetTopicId);
070    }