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.indexing.solr.SolrAclCacheUninfluentialObject; 021import org.ametys.plugins.repository.AmetysRepositoryException; 022import org.ametys.plugins.repository.metadata.BinaryMetadata; 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 /** 051 * Get the URL. 052 * 053 * @return the link URL. 054 * @throws AmetysRepositoryException if an error occurs. 055 */ 056 public String getUrl() throws AmetysRepositoryException; 057 058 /** 059 * Set the URL. 060 * 061 * @param type The URL type 062 * @param url the link URL to set. 063 * @throws AmetysRepositoryException if an error occurs. 064 */ 065 public void setUrl(LinkType type, String url) throws AmetysRepositoryException; 066 067 /** 068 * Get the internal URL. 069 * 070 * @return the link internal URL. 071 * @throws AmetysRepositoryException if an error occurs. 072 */ 073 public String getInternalUrl() throws AmetysRepositoryException; 074 075 /** 076 * Set the internal URL. 077 * 078 * @param url the link internal URL to set. 079 * @throws AmetysRepositoryException if an error occurs. 080 */ 081 public void setInternalUrl(String url) throws AmetysRepositoryException; 082 083 /** 084 * Retrieves the linked URL type. 085 * 086 * @return the linked URL type. 087 * @throws AmetysRepositoryException if an error occurs. 088 */ 089 public LinkType getUrlType() throws AmetysRepositoryException; 090 091 /** 092 * Get the link title. 093 * 094 * @return the link title. 095 * @throws AmetysRepositoryException if an error occurs. 096 */ 097 public String getTitle() throws AmetysRepositoryException; 098 099 /** 100 * Set the title. 101 * 102 * @param title the link title to set. 103 * @throws AmetysRepositoryException if an error occurs. 104 */ 105 public void setTitle(String title) throws AmetysRepositoryException; 106 107 /** 108 * Get the link content. 109 * 110 * @return the link content. 111 * @throws AmetysRepositoryException if an error occurs. 112 */ 113 public String getContent() throws AmetysRepositoryException; 114 115 /** 116 * Set the content. 117 * 118 * @param content the link content to set. 119 * @throws AmetysRepositoryException if an error occurs. 120 */ 121 public void setContent(String content) throws AmetysRepositoryException; 122 123 /** 124 * Get the link alternative. 125 * 126 * @return the link alternative. 127 * @throws AmetysRepositoryException if an error occurs. 128 */ 129 public String getAlternative() throws AmetysRepositoryException; 130 131 /** 132 * Set the link alternative. 133 * 134 * @param alternative the link alternative to set. 135 * @throws AmetysRepositoryException if an error occurs. 136 */ 137 public void setAlternative(String alternative) throws AmetysRepositoryException; 138 139 /** 140 * Get the picture as a binary metadata. 141 * 142 * @return the picture as a binary metadata. 143 * @throws AmetysRepositoryException if an error occurs. 144 */ 145 public BinaryMetadata getExternalPicture() throws AmetysRepositoryException; 146 147 /** 148 * Set the picture from an external file. 149 * 150 * @param mimeType the file MIME type. 151 * @param filename the file name. 152 * @param stream an input stream on the file bytes. 153 * @throws AmetysRepositoryException if an error occurs. 154 */ 155 public void setExternalPicture(String mimeType, String filename, InputStream stream) throws AmetysRepositoryException; 156 157 /** 158 * Get the picture resource ID. 159 * 160 * @return the resource ID. 161 * @throws AmetysRepositoryException if an error occurs. 162 */ 163 public String getResourcePictureId() throws AmetysRepositoryException; 164 165 /** 166 * Set the picture from an explorer resource. 167 * 168 * @param resourceId the resource ID. 169 * @throws AmetysRepositoryException if an error occurs. 170 */ 171 public void setResourcePicture(String resourceId) throws AmetysRepositoryException; 172 173 /** 174 * Removes any picture currently assigned. 175 * 176 * @throws AmetysRepositoryException if an error occurs. 177 */ 178 public void setNoPicture() throws AmetysRepositoryException; 179 180 /** 181 * Get the picture type. 182 * 183 * @return the picture type. 184 * @throws AmetysRepositoryException if an error occurs. 185 */ 186 public String getPictureType() throws AmetysRepositoryException; 187 188 /** 189 * Set the picture type. 190 * 191 * @param type the picture type to set. 192 * @throws AmetysRepositoryException if an error occurs. 193 */ 194 public void setPictureType(String type) throws AmetysRepositoryException; 195 196 /** 197 * Get the picture glyph. 198 * 199 * @return the picture glyph. 200 * @throws AmetysRepositoryException if an error occurs. 201 */ 202 public String getPictureGlyph() throws AmetysRepositoryException; 203 204 /** 205 * Set the picture glyph. 206 * 207 * @param glyph the glyph picture to set. 208 * @throws AmetysRepositoryException if an error occurs. 209 */ 210 public void setPictureGlyph(String glyph) throws AmetysRepositoryException; 211 212 /** 213 * Get the picture alternative. 214 * 215 * @return the picture alternative. 216 * @throws AmetysRepositoryException if an error occurs. 217 */ 218 public String getPictureAlternative() throws AmetysRepositoryException; 219 220 /** 221 * Set the picture alternative. 222 * 223 * @param alternative the picture alternative to set. 224 * @throws AmetysRepositoryException if an error occurs. 225 */ 226 public void setPictureAlternative(String alternative) throws AmetysRepositoryException; 227 228 /** 229 * Get the themes. 230 * 231 * @return the themes in an Array 232 * @throws AmetysRepositoryException if an error occurs. 233 */ 234 public String[] getThemes() throws AmetysRepositoryException; 235 236 /** 237 * Set the themes. 238 * 239 * @param themes the themes to set. 240 * @throws AmetysRepositoryException if an error occurs. 241 */ 242 public void setThemes(String[] themes) throws AmetysRepositoryException; 243 244 /** 245 * Remove theme if exist 246 * 247 * @param themeId The id of theme to remove 248 * @throws AmetysRepositoryException if an error occurs 249 */ 250 public void removeTheme(String themeId) throws AmetysRepositoryException; 251 252 /** 253 * Get the id of the provider of dynamic information. 254 * @return the id of provider. Can be null. 255 * @throws AmetysRepositoryException if an error occurs. 256 */ 257 public String getDynamicInformationProvider() throws AmetysRepositoryException; 258 259 /** 260 * Set the id of the provider of dynamic information. 261 * @param providerId the id of provider 262 * @throws AmetysRepositoryException if an error occurs. 263 */ 264 public void setDynamicInformationProvider(String providerId) throws AmetysRepositoryException; 265 266 /** 267 * Get the color. 268 * 269 * @return the color. 270 * @throws AmetysRepositoryException if an error occurs. 271 */ 272 public String getColor() throws AmetysRepositoryException; 273 274 /** 275 * Set the color. 276 * 277 * @param color the color to set. 278 * @throws AmetysRepositoryException if an error occurs. 279 */ 280 public void setColor(String color) throws AmetysRepositoryException; 281 282 /** 283 * Get the page. 284 * 285 * @return the page. 286 * @throws AmetysRepositoryException if an error occurs. 287 */ 288 public String getPage() throws AmetysRepositoryException; 289 290 /** 291 * Set the page. 292 * 293 * @param pageId the page id to set. 294 * @throws AmetysRepositoryException if an error occurs. 295 */ 296 public void setPage(String pageId) throws AmetysRepositoryException; 297 298 /** 299 * Get the status. 300 * 301 * @return the status. 302 * @throws AmetysRepositoryException if an error occurs. 303 */ 304 public LinkStatus getStatus() throws AmetysRepositoryException; 305 306 /** 307 * Set the status. 308 * 309 * @param status the status to set. 310 * @throws AmetysRepositoryException if an error occurs. 311 */ 312 public void setStatus(LinkStatus status) throws AmetysRepositoryException; 313}