001package org.nuxeo.box.api.marshalling.dao; 002 003import com.fasterxml.jackson.annotation.JsonProperty; 004 005import java.util.Map; 006 007// CHECKSTYLE:OFF 008 009/** 010 * Shared link. 011 */ 012public class BoxSharedLink extends BoxObject { 013 014 public static final String FIELD_URL = "url"; 015 016 public static final String FIELD_DOWNLOAD_URL = "download_url"; 017 018 public static final String FIELD_PASSWORD_ENABLED = "password_enabled"; 019 020 public static final String FIELD_UNSHARED_AT = "unshared_at"; 021 022 public static final String FIELD_DOWNLOAD_COUNT = "download_count"; 023 024 public static final String FIELD_PREVIEW_COUNT = "preview_count"; 025 026 public static final String FIELD_ACCESS = "access"; 027 028 public static final String FIELD_PERMISSIONS = "permissions"; 029 030 public BoxSharedLink() { 031 } 032 033 /** 034 * Copy constructor, this does deep copy for all the fields. 035 * 036 * @param obj 037 */ 038 public BoxSharedLink(BoxSharedLink obj) { 039 super(obj); 040 } 041 042 /** 043 * Instantiate the object from a map. Each entry in the map reflects to a field. 044 * 045 * @param map 046 */ 047 public BoxSharedLink(Map<String, Object> map) { 048 super(map); 049 } 050 051 /** 052 * Get the url of the shared link. 053 * 054 * @return the url 055 */ 056 @JsonProperty(FIELD_URL) 057 public String getUrl() { 058 return (String) getValue(FIELD_URL); 059 } 060 061 /** 062 * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>} 063 * 064 * @param theUrl the url to set 065 */ 066 @JsonProperty(FIELD_URL) 067 private void setUrl(final String theUrl) { 068 put(FIELD_URL, theUrl); 069 } 070 071 /** 072 * Get the url to download the shared item. 073 * 074 * @return the download_url 075 */ 076 @JsonProperty(FIELD_DOWNLOAD_URL) 077 public String getDownloadUrl() { 078 return (String) getValue(FIELD_DOWNLOAD_URL); 079 } 080 081 /** 082 * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>} 083 * 084 * @param downloadUrl the download_url to set 085 */ 086 @JsonProperty(FIELD_DOWNLOAD_URL) 087 private void setDownloadUrl(final String downloadUrl) { 088 put(FIELD_DOWNLOAD_URL, downloadUrl); 089 } 090 091 /** 092 * Whether this shared link is password enabled. 093 * 094 * @return the password_enabled 095 */ 096 @JsonProperty(FIELD_PASSWORD_ENABLED) 097 public Boolean isPasswordEnabled() { 098 return (Boolean) getValue(FIELD_PASSWORD_ENABLED); 099 } 100 101 /** 102 * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>} 103 * 104 * @param passwordEnabled the password_enabled to set 105 */ 106 @JsonProperty(FIELD_PASSWORD_ENABLED) 107 private void setPasswordEnabled(final Boolean passwordEnabled) { 108 put(FIELD_PASSWORD_ENABLED, passwordEnabled); 109 } 110 111 /** 112 * Get download count. 113 * 114 * @return the download_count 115 */ 116 @JsonProperty(FIELD_DOWNLOAD_COUNT) 117 public Integer getDownloadCount() { 118 return (Integer) getValue(FIELD_DOWNLOAD_COUNT); 119 } 120 121 /** 122 * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>} 123 * 124 * @param downloadCount the download_count to set 125 */ 126 @JsonProperty(FIELD_DOWNLOAD_COUNT) 127 private void setDownloadCount(final Integer downloadCount) { 128 put(FIELD_DOWNLOAD_COUNT, downloadCount); 129 } 130 131 /** 132 * Get the time to unshare this link. This returns a String and can be parsed into {@link java.util.Date} by 133 * 134 * @return the unshared_at 135 */ 136 @JsonProperty(FIELD_UNSHARED_AT) 137 public String getUnsharedAt() { 138 return (String) getValue(FIELD_UNSHARED_AT); 139 } 140 141 /** 142 * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>} 143 * 144 * @param unsharedAt the unshared_at to set 145 */ 146 @JsonProperty(FIELD_UNSHARED_AT) 147 private void setUnsharedAt(final String unsharedAt) { 148 put(FIELD_UNSHARED_AT, unsharedAt); 149 } 150 151 /** 152 * Get the preview count. 153 * 154 * @return the preview_count 155 */ 156 @JsonProperty(FIELD_PREVIEW_COUNT) 157 public Integer getPreviewCount() { 158 return (Integer) getValue(FIELD_PREVIEW_COUNT); 159 } 160 161 /** 162 * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>} 163 * 164 * @param previewCount the preview_count to set 165 */ 166 @JsonProperty(FIELD_PREVIEW_COUNT) 167 private void setPreviewCount(final Integer previewCount) { 168 put(FIELD_PREVIEW_COUNT, previewCount); 169 } 170 171 /** 172 * Get access. This can only be the strings defined in {@link com.box .boxjavalibv2.dao.BoxSharedLinkAccess} 173 * 174 * @return the access 175 */ 176 @JsonProperty(FIELD_ACCESS) 177 public String getAccess() { 178 return (String) getValue(FIELD_ACCESS); 179 } 180 181 /** 182 * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>} 183 * 184 * @param accessLevel the access to set 185 */ 186 @JsonProperty(FIELD_ACCESS) 187 private void setAccess(final String accessLevel) { 188 put(FIELD_ACCESS, accessLevel); 189 } 190 191 /** 192 * Get permissions. 193 * 194 * @return the permissions 195 */ 196 @JsonProperty(FIELD_PERMISSIONS) 197 public BoxSharedLinkPermissions getPermissions() { 198 return (BoxSharedLinkPermissions) getValue(FIELD_PERMISSIONS); 199 } 200 201 /** 202 * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>} 203 * 204 * @param permissionsEntity the permissions to set 205 */ 206 @JsonProperty(FIELD_PERMISSIONS) 207 private void setPermissions(final BoxSharedLinkPermissions permissionsEntity) { 208 put(FIELD_PERMISSIONS, permissionsEntity); 209 } 210}