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 value or <code>null</code> if no such topic extists.
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 facet values. The list may be empty.
045         */
046        List<RelatedTopic> getFacets(DeepaMehtaObject object, String facetTypeUri);
047    
048        // ---
049    
050        Topic getFacettedTopic(long topicId, List<String> facetTypeUris);
051    
052        void addFacetTypeToTopic(long topicId, String facetTypeUri);
053    
054        // ---
055    
056        void updateFacet(long topicId, String facetTypeUri, FacetValue value, ClientState clientState);
057    
058        /**
059         * Updates a facet.
060         *
061         * @param   object          The facetted object: a topic, association, a type ...
062         * @param   facetTypeUri    URI of the facet type.
063         * @param   facetValue      The new facet value.
064         * @param   directives      Must be not null at least for aggregated facets ### FIXME: directives are ignored
065         */
066        void updateFacet(DeepaMehtaObject object, String facetTypeUri, FacetValue value, ClientState clientState,
067                                                                                         Directives directives);
068    
069        // ---
070    
071        boolean hasFacet(long topicId, String facetTypeUri, long facetTopicId);
072    }