001package systems.dmx.core; 002 003import systems.dmx.core.model.ChildTopicsModel; 004import systems.dmx.core.model.DMXObjectModel; 005import systems.dmx.core.model.RelatedTopicModel; 006import systems.dmx.core.model.SimpleValue; 007 008import java.util.List; 009 010 011 012public interface DMXObject extends Identifiable, JSONEnabled { 013 014 015 016 // === Model === 017 018 // --- ID --- 019 020 long getId(); 021 022 // --- URI --- 023 024 String getUri(); 025 026 void setUri(String uri); 027 028 // --- Type URI --- 029 030 String getTypeUri(); 031 032 void setTypeUri(String typeUri); 033 034 // --- Simple Value --- 035 036 SimpleValue getSimpleValue(); 037 038 void setSimpleValue(String value); 039 void setSimpleValue(int value); 040 void setSimpleValue(long value); 041 void setSimpleValue(boolean value); 042 void setSimpleValue(SimpleValue value); 043 044 // --- Child Topics --- 045 046 ChildTopics getChildTopics(); 047 048 void setChildTopics(ChildTopicsModel childTopics); 049 050 // --- 051 052 DMXObject loadChildTopics(); 053 DMXObject loadChildTopics(String assocDefUri); 054 055 // --- 056 057 /** 058 * Returns the type of this object. 059 * <p> 060 * No access control is performed as <i>Implicit READ permission</i> applies: if a user has READ access to an object 061 * she has READ access to its type as well. 062 * <p> 063 * Note: if the user would have no READ access to this object the DMX Core would not instantiate it in the 064 * first place, but throw an <code>AccessControlException</code>. 065 */ 066 DMXType getType(); 067 068 DMXObjectModel getModel(); 069 070 071 072 // === Updating === 073 074 void updateChildTopics(ChildTopicsModel updateModel, AssociationDefinition assocDef); 075 076 077 078 // === Deletion === 079 080 /** 081 * Deletes the DMX object in its entirety, that is 082 * - the object itself (the <i>parent</i>) 083 * - all child topics associated via "dmx.core.composition", recusively 084 * - all the remaining direct associations, e.g. "dmx.core.instantiation" 085 */ 086 void delete(); 087 088 089 090 // === Traversal === 091 092 // --- Topic Retrieval --- 093 094 /** 095 * Fetches and returns a related topic or <code>null</code> if no such topic extists. 096 * 097 * @param assocTypeUri may be null 098 * @param myRoleTypeUri may be null 099 * @param othersRoleTypeUri may be null 100 * @param othersTopicTypeUri may be null 101 */ 102 RelatedTopic getRelatedTopic(String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, 103 String othersTopicTypeUri); 104 105 List<RelatedTopic> getRelatedTopics(String assocTypeUri); 106 107 /** 108 * @param assocTypeUri may be null 109 * @param myRoleTypeUri may be null 110 * @param othersRoleTypeUri may be null 111 * @param othersTopicTypeUri may be null 112 */ 113 List<RelatedTopic> getRelatedTopics(String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, 114 String othersTopicTypeUri); 115 116 /** 117 * @param assocTypeUris may *not* be null 118 * @param myRoleTypeUri may be null 119 * @param othersRoleTypeUri may be null 120 * @param othersTopicTypeUri may be null 121 */ 122 List<RelatedTopic> getRelatedTopics(List assocTypeUris, String myRoleTypeUri, String othersRoleTypeUri, 123 String othersTopicTypeUri); 124 125 // --- Association Retrieval --- 126 127 /** 128 * @param assocTypeUri may be null 129 * @param myRoleTypeUri may be null 130 * @param othersRoleTypeUri may be null 131 * @param othersAssocTypeUri may be null 132 */ 133 RelatedAssociation getRelatedAssociation(String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, 134 String othersAssocTypeUri); 135 136 /** 137 * @param assocTypeUri may be null 138 * @param myRoleTypeUri may be null 139 * @param othersRoleTypeUri may be null 140 * @param othersAssocTypeUri may be null 141 */ 142 List<RelatedAssociation> getRelatedAssociations(String assocTypeUri, String myRoleTypeUri, 143 String othersRoleTypeUri, String othersAssocTypeUri); 144 145 // --- 146 147 Association getAssociation(String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, long othersTopicId); 148 149 /** 150 * Fetches all associations this object is a player in. 151 */ 152 List<Association> getAssociations(); 153 154 155 156 // === Properties === 157 158 /** 159 * Returns this object's property value associated with the given property URI. 160 * If there's no property value associated with the property URI an exception is thrown. 161 */ 162 Object getProperty(String propUri); 163 164 /** 165 * Checks whether for this object a property value is associated with a given property URI. 166 */ 167 boolean hasProperty(String propUri); 168 169 void setProperty(String propUri, Object propValue, boolean addToIndex); 170 171 /** 172 * Removes this object's property associated with the given property URI. 173 * If there's no property value associated with the property URI nothing is performed. 174 */ 175 void removeProperty(String propUri); 176 177 178 179 // === Misc === 180 181 Object getDatabaseVendorObject(); 182}