001/* 002 * Copyright 2017 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.plugins.linkdirectory; 017 018import java.io.InputStream; 019 020import org.ametys.cms.data.Binary; 021import org.ametys.cms.indexing.solr.SolrAclCacheUninfluentialObject; 022import org.ametys.plugins.repository.AmetysRepositoryException; 023 024/** 025 * A link in the directory. 026 */ 027@SolrAclCacheUninfluentialObject 028public interface Link 029{ 030 /** Type of a link. */ 031 public enum LinkType 032 { 033 /** External URL */ 034 URL, 035 /** Internal page */ 036 PAGE 037 } 038 039 /** Status of a link. */ 040 public enum LinkStatus 041 { 042 /** Normal link */ 043 NORMAL, 044 /** New link */ 045 NEW, 046 /** Broken link */ 047 BROKEN 048 } 049 050 /** Default visibility of a link. */ 051 public enum LinkVisibility 052 { 053 /** Visible by default */ 054 VISIBLE, 055 /** Hidden by default */ 056 HIDDEN, 057 } 058 059 /** 060 * Get the URL. 061 * 062 * @return the link URL. 063 * @throws AmetysRepositoryException if an error occurs. 064 */ 065 public String getUrl() throws AmetysRepositoryException; 066 067 /** 068 * Set the URL. 069 * 070 * @param type The URL type 071 * @param url the link URL to set. 072 * @throws AmetysRepositoryException if an error occurs. 073 */ 074 public void setUrl(LinkType type, String url) throws AmetysRepositoryException; 075 076 /** 077 * Get the internal URL. 078 * 079 * @return the link internal URL. 080 * @throws AmetysRepositoryException if an error occurs. 081 */ 082 public String getInternalUrl() throws AmetysRepositoryException; 083 084 /** 085 * Set the internal URL. 086 * 087 * @param url the link internal URL to set. 088 * @throws AmetysRepositoryException if an error occurs. 089 */ 090 public void setInternalUrl(String url) throws AmetysRepositoryException; 091 092 /** 093 * Retrieves the linked URL type. 094 * 095 * @return the linked URL type. 096 * @throws AmetysRepositoryException if an error occurs. 097 */ 098 public LinkType getUrlType() throws AmetysRepositoryException; 099 100 /** 101 * Get the link title. 102 * 103 * @return the link title. 104 * @throws AmetysRepositoryException if an error occurs. 105 */ 106 public String getTitle() throws AmetysRepositoryException; 107 108 /** 109 * Set the title. 110 * 111 * @param title the link title to set. 112 * @throws AmetysRepositoryException if an error occurs. 113 */ 114 public void setTitle(String title) throws AmetysRepositoryException; 115 116 /** 117 * Get the link content. 118 * 119 * @return the link content. 120 * @throws AmetysRepositoryException if an error occurs. 121 */ 122 public String getContent() throws AmetysRepositoryException; 123 124 /** 125 * Set the content. 126 * 127 * @param content the link content to set. 128 * @throws AmetysRepositoryException if an error occurs. 129 */ 130 public void setContent(String content) throws AmetysRepositoryException; 131 132 /** 133 * Get the link alternative. 134 * 135 * @return the link alternative. 136 * @throws AmetysRepositoryException if an error occurs. 137 */ 138 public String getAlternative() throws AmetysRepositoryException; 139 140 /** 141 * Set the link alternative. 142 * 143 * @param alternative the link alternative to set. 144 * @throws AmetysRepositoryException if an error occurs. 145 */ 146 public void setAlternative(String alternative) throws AmetysRepositoryException; 147 148 /** 149 * Get the picture as a binary metadata. 150 * 151 * @return the picture as a binary metadata. 152 * @throws AmetysRepositoryException if an error occurs. 153 */ 154 public Binary getExternalPicture() throws AmetysRepositoryException; 155 156 /** 157 * Set the picture from an external file. 158 * 159 * @param mimeType the file MIME type. 160 * @param filename the file name. 161 * @param stream an input stream on the file bytes. 162 * @throws AmetysRepositoryException if an error occurs. 163 */ 164 public void setExternalPicture(String mimeType, String filename, InputStream stream) throws AmetysRepositoryException; 165 166 /** 167 * Get the picture resource ID. 168 * 169 * @return the resource ID. 170 * @throws AmetysRepositoryException if an error occurs. 171 */ 172 public String getResourcePictureId() throws AmetysRepositoryException; 173 174 /** 175 * Set the picture from an explorer resource. 176 * 177 * @param resourceId the resource ID. 178 * @throws AmetysRepositoryException if an error occurs. 179 */ 180 public void setResourcePicture(String resourceId) throws AmetysRepositoryException; 181 182 /** 183 * Removes any picture currently assigned. 184 * 185 * @throws AmetysRepositoryException if an error occurs. 186 */ 187 public void setNoPicture() throws AmetysRepositoryException; 188 189 /** 190 * Get the picture type. 191 * 192 * @return the picture type. 193 * @throws AmetysRepositoryException if an error occurs. 194 */ 195 public String getPictureType() throws AmetysRepositoryException; 196 197 /** 198 * Set the picture type. 199 * 200 * @param type the picture type to set. 201 * @throws AmetysRepositoryException if an error occurs. 202 */ 203 public void setPictureType(String type) throws AmetysRepositoryException; 204 205 /** 206 * Get the picture glyph. 207 * 208 * @return the picture glyph. 209 * @throws AmetysRepositoryException if an error occurs. 210 */ 211 public String getPictureGlyph() throws AmetysRepositoryException; 212 213 /** 214 * Set the picture glyph. 215 * 216 * @param glyph the glyph picture to set. 217 * @throws AmetysRepositoryException if an error occurs. 218 */ 219 public void setPictureGlyph(String glyph) throws AmetysRepositoryException; 220 221 /** 222 * Get the picture alternative. 223 * 224 * @return the picture alternative. 225 * @throws AmetysRepositoryException if an error occurs. 226 */ 227 public String getPictureAlternative() throws AmetysRepositoryException; 228 229 /** 230 * Set the picture alternative. 231 * 232 * @param alternative the picture alternative to set. 233 * @throws AmetysRepositoryException if an error occurs. 234 */ 235 public void setPictureAlternative(String alternative) throws AmetysRepositoryException; 236 237 /** 238 * Get the themes. 239 * 240 * @return the themes in an Array 241 * @throws AmetysRepositoryException if an error occurs. 242 */ 243 public String[] getThemes() throws AmetysRepositoryException; 244 245 /** 246 * Set the themes. 247 * 248 * @param themes the themes to set. 249 * @throws AmetysRepositoryException if an error occurs. 250 */ 251 public void setThemes(String[] themes) throws AmetysRepositoryException; 252 253 /** 254 * Remove theme if exist 255 * 256 * @param themeId The id of theme to remove 257 * @throws AmetysRepositoryException if an error occurs 258 */ 259 public void removeTheme(String themeId) throws AmetysRepositoryException; 260 261 /** 262 * Get the id of the provider of dynamic information. 263 * @return the id of provider. Can be null. 264 * @throws AmetysRepositoryException if an error occurs. 265 */ 266 public String getDynamicInformationProvider() throws AmetysRepositoryException; 267 268 /** 269 * Set the id of the provider of dynamic information. 270 * @param providerId the id of provider 271 * @throws AmetysRepositoryException if an error occurs. 272 */ 273 public void setDynamicInformationProvider(String providerId) throws AmetysRepositoryException; 274 275 /** 276 * Get the color. 277 * 278 * @return the color. 279 * @throws AmetysRepositoryException if an error occurs. 280 */ 281 public String getColor() throws AmetysRepositoryException; 282 283 /** 284 * Set the color. 285 * 286 * @param color the color to set. 287 * @throws AmetysRepositoryException if an error occurs. 288 */ 289 public void setColor(String color) throws AmetysRepositoryException; 290 291 /** 292 * Get the page. 293 * 294 * @return the page. 295 * @throws AmetysRepositoryException if an error occurs. 296 */ 297 public String getPage() throws AmetysRepositoryException; 298 299 /** 300 * Set the page. 301 * 302 * @param pageId the page id to set. 303 * @throws AmetysRepositoryException if an error occurs. 304 */ 305 public void setPage(String pageId) throws AmetysRepositoryException; 306 307 /** 308 * Get the status. 309 * 310 * @return the status. 311 * @throws AmetysRepositoryException if an error occurs. 312 */ 313 public LinkStatus getStatus() throws AmetysRepositoryException; 314 315 /** 316 * Set the status. 317 * @param status the status to set. 318 * @throws AmetysRepositoryException if an error occurs. 319 */ 320 public void setStatus(LinkStatus status) throws AmetysRepositoryException; 321 322 /** 323 * Get the default visibility. 324 * @return the default visibility. 325 * @throws AmetysRepositoryException if an error occurs. 326 */ 327 public LinkVisibility getDefaultVisibility() throws AmetysRepositoryException; 328 329 /** 330 * Set the default visibility. 331 * @param visibility the default visibility to set. 332 * @throws AmetysRepositoryException if an error occurs. 333 */ 334 public void setDefaultVisibility(LinkVisibility visibility) throws AmetysRepositoryException; 335}