|
Lines 24-142
Link Here
|
| 24 |
*/ |
24 |
*/ |
| 25 |
public class TaskAttachmentMapper { |
25 |
public class TaskAttachmentMapper { |
| 26 |
|
26 |
|
| 27 |
private IRepositoryPerson author; |
|
|
| 28 |
|
| 29 |
private String comment; |
| 30 |
|
| 31 |
private String contentType; |
| 32 |
|
| 33 |
private Date creationDate; |
| 34 |
|
| 35 |
private Boolean deprecated; |
| 36 |
|
| 37 |
private String description; |
| 38 |
|
| 39 |
private String fileName; |
| 40 |
|
| 41 |
private Long length; |
| 42 |
|
| 43 |
private Boolean patch; |
| 44 |
|
| 45 |
private String url; |
| 46 |
|
| 47 |
private String attachmentId; |
| 48 |
|
| 49 |
public TaskAttachmentMapper() { |
| 50 |
} |
| 51 |
|
| 52 |
public String getAttachmentId() { |
| 53 |
return attachmentId; |
| 54 |
} |
| 55 |
|
| 56 |
public IRepositoryPerson getAuthor() { |
| 57 |
return author; |
| 58 |
} |
| 59 |
|
| 60 |
public String getComment() { |
| 61 |
return comment; |
| 62 |
} |
| 63 |
|
| 64 |
public String getContentType() { |
| 65 |
return contentType; |
| 66 |
} |
| 67 |
|
| 68 |
public Date getCreationDate() { |
| 69 |
return creationDate; |
| 70 |
} |
| 71 |
|
| 72 |
public String getDescription() { |
| 73 |
return description; |
| 74 |
} |
| 75 |
|
| 76 |
public String getFileName() { |
| 77 |
return fileName; |
| 78 |
} |
| 79 |
|
| 80 |
public Long getLength() { |
| 81 |
return length; |
| 82 |
} |
| 83 |
|
| 84 |
public String getUrl() { |
| 85 |
return url; |
| 86 |
} |
| 87 |
|
| 88 |
public Boolean isDeprecated() { |
| 89 |
return deprecated; |
| 90 |
} |
| 91 |
|
| 92 |
public Boolean isPatch() { |
| 93 |
return patch; |
| 94 |
} |
| 95 |
|
| 96 |
public void setAttachmentId(String attachmentId) { |
| 97 |
this.attachmentId = attachmentId; |
| 98 |
} |
| 99 |
|
| 100 |
public void setAuthor(IRepositoryPerson author) { |
| 101 |
this.author = author; |
| 102 |
} |
| 103 |
|
| 104 |
public void setComment(String comment) { |
| 105 |
this.comment = comment; |
| 106 |
} |
| 107 |
|
| 108 |
public void setContentType(String contentType) { |
| 109 |
this.contentType = contentType; |
| 110 |
} |
| 111 |
|
| 112 |
public void setCreationDate(Date creationDate) { |
| 113 |
this.creationDate = creationDate; |
| 114 |
} |
| 115 |
|
| 116 |
public void setDeprecated(Boolean deprecated) { |
| 117 |
this.deprecated = deprecated; |
| 118 |
} |
| 119 |
|
| 120 |
public void setDescription(String description) { |
| 121 |
this.description = description; |
| 122 |
} |
| 123 |
|
| 124 |
public void setFileName(String fileName) { |
| 125 |
this.fileName = fileName; |
| 126 |
} |
| 127 |
|
| 128 |
public void setLength(Long length) { |
| 129 |
this.length = length; |
| 130 |
} |
| 131 |
|
| 132 |
public void setPatch(Boolean patch) { |
| 133 |
this.patch = patch; |
| 134 |
} |
| 135 |
|
| 136 |
public void setUrl(String url) { |
| 137 |
this.url = url; |
| 138 |
} |
| 139 |
|
| 140 |
public static TaskAttachmentMapper createFrom(TaskAttribute taskAttribute) { |
27 |
public static TaskAttachmentMapper createFrom(TaskAttribute taskAttribute) { |
| 141 |
Assert.isNotNull(taskAttribute); |
28 |
Assert.isNotNull(taskAttribute); |
| 142 |
TaskAttributeMapper mapper = taskAttribute.getTaskData().getAttributeMapper(); |
29 |
TaskAttributeMapper mapper = taskAttribute.getTaskData().getAttributeMapper(); |
|
Lines 170-175
Link Here
|
| 170 |
if (child != null) { |
57 |
if (child != null) { |
| 171 |
attachment.setPatch(mapper.getBooleanValue(child)); |
58 |
attachment.setPatch(mapper.getBooleanValue(child)); |
| 172 |
} |
59 |
} |
|
|
60 |
child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_REPLACE_EXISTING); |
| 61 |
if (child != null) { |
| 62 |
attachment.setReplaceExisting(mapper.getBooleanValue(child)); |
| 63 |
} |
| 173 |
child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_SIZE); |
64 |
child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_SIZE); |
| 174 |
if (child != null) { |
65 |
if (child != null) { |
| 175 |
Long value = mapper.getLongValue(child); |
66 |
Long value = mapper.getLongValue(child); |
|
Lines 184-189
Link Here
|
| 184 |
return attachment; |
75 |
return attachment; |
| 185 |
} |
76 |
} |
| 186 |
|
77 |
|
|
|
78 |
private String attachmentId; |
| 79 |
|
| 80 |
private IRepositoryPerson author; |
| 81 |
|
| 82 |
private String comment; |
| 83 |
|
| 84 |
private String contentType; |
| 85 |
|
| 86 |
private Date creationDate; |
| 87 |
|
| 88 |
private Boolean deprecated; |
| 89 |
|
| 90 |
private String description; |
| 91 |
|
| 92 |
private String fileName; |
| 93 |
|
| 94 |
private Long length; |
| 95 |
|
| 96 |
private Boolean patch; |
| 97 |
|
| 98 |
private Boolean replaceExisting; |
| 99 |
|
| 100 |
private String url; |
| 101 |
|
| 102 |
public TaskAttachmentMapper() { |
| 103 |
} |
| 104 |
|
| 105 |
public void applyTo(ITaskAttachment taskAttachment) { |
| 106 |
Assert.isNotNull(taskAttachment); |
| 107 |
if (getAuthor() != null) { |
| 108 |
taskAttachment.setAuthor(getAuthor()); |
| 109 |
} |
| 110 |
if (getContentType() != null) { |
| 111 |
taskAttachment.setContentType(getContentType()); |
| 112 |
} |
| 113 |
if (getCreationDate() != null) { |
| 114 |
taskAttachment.setCreationDate(getCreationDate()); |
| 115 |
} |
| 116 |
if (getDescription() != null) { |
| 117 |
taskAttachment.setDescription(getDescription()); |
| 118 |
} |
| 119 |
if (getFileName() != null) { |
| 120 |
taskAttachment.setFileName(getFileName()); |
| 121 |
} |
| 122 |
if (isDeprecated() != null) { |
| 123 |
taskAttachment.setDeprecated(isDeprecated()); |
| 124 |
} |
| 125 |
if (isPatch() != null) { |
| 126 |
taskAttachment.setPatch(isPatch()); |
| 127 |
} |
| 128 |
if (getLength() != null) { |
| 129 |
taskAttachment.setLength(getLength()); |
| 130 |
} |
| 131 |
if (url != null) { |
| 132 |
taskAttachment.setUrl(getUrl()); |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 187 |
public void applyTo(TaskAttribute taskAttribute) { |
136 |
public void applyTo(TaskAttribute taskAttribute) { |
| 188 |
Assert.isNotNull(taskAttribute); |
137 |
Assert.isNotNull(taskAttribute); |
| 189 |
TaskData taskData = taskAttribute.getTaskData(); |
138 |
TaskData taskData = taskAttribute.getTaskData(); |
|
Lines 217-222
Link Here
|
| 217 |
taskAttribute); |
166 |
taskAttribute); |
| 218 |
mapper.setValue(child, getFileName()); |
167 |
mapper.setValue(child, getFileName()); |
| 219 |
} |
168 |
} |
|
|
169 |
if (getReplaceExisting() != null) { |
| 170 |
TaskAttribute child = DefaultTaskSchema.getField(TaskAttribute.ATTACHMENT_REPLACE_EXISTING) |
| 171 |
.createAttribute(taskAttribute); |
| 172 |
mapper.setBooleanValue(child, getReplaceExisting()); |
| 173 |
} |
| 220 |
if (isDeprecated() != null) { |
174 |
if (isDeprecated() != null) { |
| 221 |
TaskAttribute child = DefaultTaskSchema.getField(TaskAttribute.ATTACHMENT_IS_DEPRECATED).createAttribute( |
175 |
TaskAttribute child = DefaultTaskSchema.getField(TaskAttribute.ATTACHMENT_IS_DEPRECATED).createAttribute( |
| 222 |
taskAttribute); |
176 |
taskAttribute); |
|
Lines 239-275
Link Here
|
| 239 |
} |
193 |
} |
| 240 |
} |
194 |
} |
| 241 |
|
195 |
|
| 242 |
public void applyTo(ITaskAttachment taskAttachment) { |
|
|
| 243 |
Assert.isNotNull(taskAttachment); |
| 244 |
if (getAuthor() != null) { |
| 245 |
taskAttachment.setAuthor(getAuthor()); |
| 246 |
} |
| 247 |
if (getContentType() != null) { |
| 248 |
taskAttachment.setContentType(getContentType()); |
| 249 |
} |
| 250 |
if (getCreationDate() != null) { |
| 251 |
taskAttachment.setCreationDate(getCreationDate()); |
| 252 |
} |
| 253 |
if (getDescription() != null) { |
| 254 |
taskAttachment.setDescription(getDescription()); |
| 255 |
} |
| 256 |
if (getFileName() != null) { |
| 257 |
taskAttachment.setFileName(getFileName()); |
| 258 |
} |
| 259 |
if (isDeprecated() != null) { |
| 260 |
taskAttachment.setDeprecated(isDeprecated()); |
| 261 |
} |
| 262 |
if (isPatch() != null) { |
| 263 |
taskAttachment.setPatch(isPatch()); |
| 264 |
} |
| 265 |
if (getLength() != null) { |
| 266 |
taskAttachment.setLength(getLength()); |
| 267 |
} |
| 268 |
if (url != null) { |
| 269 |
taskAttachment.setUrl(getUrl()); |
| 270 |
} |
| 271 |
} |
| 272 |
|
| 273 |
@Override |
196 |
@Override |
| 274 |
public boolean equals(Object obj) { |
197 |
public boolean equals(Object obj) { |
| 275 |
if (!(obj instanceof TaskAttachmentMapper)) { |
198 |
if (!(obj instanceof TaskAttachmentMapper)) { |
|
Lines 294-300
Link Here
|
| 294 |
if ((other.fileName != null && this.fileName != null) && !other.fileName.equals(this.fileName)) { |
217 |
if ((other.fileName != null && this.fileName != null) && !other.fileName.equals(this.fileName)) { |
| 295 |
return false; |
218 |
return false; |
| 296 |
} |
219 |
} |
|
|
220 |
if ((other.replaceExisting != null && this.replaceExisting != null) |
| 221 |
&& !other.replaceExisting.equals(this.replaceExisting)) { |
| 222 |
return false; |
| 223 |
} |
| 297 |
return true; |
224 |
return true; |
| 298 |
} |
225 |
} |
| 299 |
|
226 |
|
|
|
227 |
public String getAttachmentId() { |
| 228 |
return attachmentId; |
| 229 |
} |
| 230 |
|
| 231 |
public IRepositoryPerson getAuthor() { |
| 232 |
return author; |
| 233 |
} |
| 234 |
|
| 235 |
public String getComment() { |
| 236 |
return comment; |
| 237 |
} |
| 238 |
|
| 239 |
public String getContentType() { |
| 240 |
return contentType; |
| 241 |
} |
| 242 |
|
| 243 |
public Date getCreationDate() { |
| 244 |
return creationDate; |
| 245 |
} |
| 246 |
|
| 247 |
public String getDescription() { |
| 248 |
return description; |
| 249 |
} |
| 250 |
|
| 251 |
public String getFileName() { |
| 252 |
return fileName; |
| 253 |
} |
| 254 |
|
| 255 |
public Long getLength() { |
| 256 |
return length; |
| 257 |
} |
| 258 |
|
| 259 |
/** |
| 260 |
* @since 3.4 |
| 261 |
*/ |
| 262 |
public Boolean getReplaceExisting() { |
| 263 |
return replaceExisting; |
| 264 |
} |
| 265 |
|
| 266 |
public String getUrl() { |
| 267 |
return url; |
| 268 |
} |
| 269 |
|
| 270 |
public Boolean isDeprecated() { |
| 271 |
return deprecated; |
| 272 |
} |
| 273 |
|
| 274 |
public Boolean isPatch() { |
| 275 |
return patch; |
| 276 |
} |
| 277 |
|
| 278 |
public void setAttachmentId(String attachmentId) { |
| 279 |
this.attachmentId = attachmentId; |
| 280 |
} |
| 281 |
|
| 282 |
public void setAuthor(IRepositoryPerson author) { |
| 283 |
this.author = author; |
| 284 |
} |
| 285 |
|
| 286 |
public void setComment(String comment) { |
| 287 |
this.comment = comment; |
| 288 |
} |
| 289 |
|
| 290 |
public void setContentType(String contentType) { |
| 291 |
this.contentType = contentType; |
| 292 |
} |
| 293 |
|
| 294 |
public void setCreationDate(Date creationDate) { |
| 295 |
this.creationDate = creationDate; |
| 296 |
} |
| 297 |
|
| 298 |
public void setDeprecated(Boolean deprecated) { |
| 299 |
this.deprecated = deprecated; |
| 300 |
} |
| 301 |
|
| 302 |
public void setDescription(String description) { |
| 303 |
this.description = description; |
| 304 |
} |
| 305 |
|
| 306 |
public void setFileName(String fileName) { |
| 307 |
this.fileName = fileName; |
| 308 |
} |
| 309 |
|
| 310 |
public void setLength(Long length) { |
| 311 |
this.length = length; |
| 312 |
} |
| 313 |
|
| 314 |
public void setPatch(Boolean patch) { |
| 315 |
this.patch = patch; |
| 316 |
} |
| 317 |
|
| 318 |
/** |
| 319 |
* @since 3.4 |
| 320 |
*/ |
| 321 |
public void setReplaceExisting(Boolean replaceExisting) { |
| 322 |
this.replaceExisting = replaceExisting; |
| 323 |
} |
| 324 |
|
| 325 |
public void setUrl(String url) { |
| 326 |
this.url = url; |
| 327 |
} |
| 328 |
|
| 300 |
} |
329 |
} |