001package systems.dmx.core.model.facets; 002 003import systems.dmx.core.model.ChildTopicsModel; 004import systems.dmx.core.model.RelatedTopicModel; 005import systems.dmx.core.model.TopicModel; 006 007import java.util.List; 008 009 010 011/** 012 * A facet value as used in update facet calls. 013 * Used for both, single-valued facets and multiple-valued facets. 014 */ 015public interface FacetValueModel extends ChildTopicsModel { 016 017 018 019 // === Single-valued Facets === 020 021 /** 022 * Accesses a single-valued facet. 023 */ 024 RelatedTopicModel getTopic(); 025 026 /** 027 * Accesses a multiple-valued facet. 028 */ 029 List<? extends RelatedTopicModel> getTopics(); 030 031 // --- 032 033 /** 034 * Puts a value in a single-valued facet. 035 */ 036 FacetValueModel put(RelatedTopicModel value); 037 038 FacetValueModel put(TopicModel value); 039 040 // --- 041 042 /** 043 * Convenience method to put a *simple* value in a single-valued facet. 044 */ 045 FacetValueModel put(Object value); 046 047 /** 048 * Convenience method to put a *composite* value in a single-valued facet. 049 */ 050 FacetValueModel put(ChildTopicsModel value); 051 052 // --- 053 054 /** 055 * Puts a by-ID topic reference in a single-valued facet. 056 * An existing reference is overwritten. 057 */ 058 FacetValueModel putRef(long refTopicId); 059 060 /** 061 * Puts a by-URI topic reference in a single-valued facet. 062 * An existing reference is overwritten. 063 */ 064 FacetValueModel putRef(String refTopicUri); 065 066 // --- 067 068 /** 069 * Puts a by-ID topic deletion reference in a single-valued facet. 070 * An existing value is overwritten. 071 */ 072 FacetValueModel putDeletionRef(long refTopicId); 073 074 /** 075 * Puts a by-URI topic deletion reference in a single-valued facet. 076 * An existing value is overwritten. 077 */ 078 FacetValueModel putDeletionRef(String refTopicUri); 079 080 081 082 // === Multiple-valued Facets === 083 084 /** 085 * Sets the values of a multiple-valued facet. 086 */ 087 FacetValueModel put(List<RelatedTopicModel> values); 088 089 // --- 090 091 /** 092 * Adds a by-ID topic reference to a multiple-valued facet. 093 */ 094 FacetValueModel addRef(long refTopicId); 095 096 /** 097 * Adds a by-URI topic reference to a multiple-valued facet. 098 */ 099 FacetValueModel addRef(String refTopicUri); 100 101 // --- 102 103 /** 104 * Adds a by-ID topic deletion reference to a multiple-valued facet. 105 */ 106 FacetValueModel addDeletionRef(long refTopicId); 107 108 /** 109 * Adds a by-URI topic deletion reference to a multiple-valued facet. 110 */ 111 FacetValueModel addDeletionRef(String refTopicUri); 112}