BrightSide Workbench Full Report + Source Code
org.turro.attach.entity.Attachment Class Reference
Inheritance diagram for org.turro.attach.entity.Attachment:
Collaboration diagram for org.turro.attach.entity.Attachment:

Public Member Functions

AttachContent getAttachContent ()
 
void setAttachContent (AttachContent attachContent)
 
Long getId ()
 
void setId (Long id)
 
String getOwner ()
 
void setOwner (String owner)
 
boolean isOnlyOwner ()
 
void setOnlyOwner (boolean onlyOwner)
 
String getLockComment ()
 
void setLockComment (String lockComment)
 
Date getLockCommit ()
 
void setLockCommit (Date lockCommit)
 
Date getLockDate ()
 
void setLockDate (Date lockDate)
 
boolean isLocked ()
 
void setLocked (boolean locked)
 
String getLocker ()
 
void setLocker (String locker)
 
String getPath ()
 
void setPath (String path)
 
String getRelatedPath ()
 
void setRelatedPath (String relatedPath)
 
Date getModification ()
 
void setModification (Date modification)
 
String getComment ()
 
void setComment (String comment)
 
String getFileContentType ()
 
void setFileContentType (String fileContentType)
 
String getFileName ()
 
void setFileName (String fileName)
 
long getFileSize ()
 
void setFileSize (long fileSize)
 
String getShowKey ()
 
void setShowKey (String showKey)
 
boolean isValidated ()
 
void setValidated (boolean validated)
 
boolean isPublishable ()
 
void setPublishable (boolean publishable)
 
boolean isRequiresAcceptance ()
 
void setRequiresAcceptance (boolean requiresAcceptance)
 
boolean isWatermark ()
 
void setWatermark (boolean watermark)
 
String getFileExtension ()
 
String getRelativePath (String root)
 
Attachment cloneEntity ()
 
void setDateModification (Date value)
 
void setTimeModification (Date value)
 
Attachment getWithContent ()
 
byte[] getContentModified (IContact contact) throws IOException, DocumentException
 
boolean isPDF ()
 
IContact getIOwner ()
 
IElephantEntity getOwnerEntity ()
 
boolean canShow (HashSet< String > restrictedFolders)
 
boolean canShowTo (IContact contact, HashSet< String > restrictedFolders)
 
String getShowURL (IConstructor constructor)
 
String getROShowURL (IConstructor constructor)
 
String getByteString ()
 
String getDateString (IConstructor constructor)
 
AcceptanceSingleStatus getSingleStatus ()
 
AcceptanceSingleStatus getSingleStatus (IContact contact)
 

Detailed Description

Definition at line 60 of file Attachment.java.

Member Function Documentation

◆ canShow()

boolean org.turro.attach.entity.Attachment.canShow ( HashSet< String >  restrictedFolders)

Definition at line 409 of file Attachment.java.

409  {
410  return canShow(restrictedFolders, Application.getApplication().isInRole("attach-show:all"));
411  }
boolean canShow(HashSet< String > restrictedFolders)
Here is the call graph for this function:

◆ canShowTo()

boolean org.turro.attach.entity.Attachment.canShowTo ( IContact  contact,
HashSet< String >  restrictedFolders 
)

Definition at line 413 of file Attachment.java.

413  {
414  return canShow(restrictedFolders, contact.getPermissions().isInRole("attach-show:all"));
415  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cloneEntity()

Attachment org.turro.attach.entity.Attachment.cloneEntity ( )

Definition at line 317 of file Attachment.java.

317  {
318  Attachment a = AttachmentUtil.withContent(this);
319  Attachment na = new Attachment();
320  na.setComment(a.comment);
321  na.setFileContentType(a.fileContentType);
322  na.setFileName(a.fileName);
323  na.setFileSize(a.fileSize);
324  na.setLockComment(a.lockComment);
325  na.setLockCommit(a.lockCommit);
326  na.setLockDate(a.lockDate);
327  na.setLocked(a.locked);
328  na.setLocker(a.locker);
329  na.setModification(a.modification);
330  na.setOnlyOwner(a.onlyOwner);
331  na.setOwner(a.owner);
332  na.setPath(a.path);
333  na.setShowKey(a.showKey);
334  na.setValidated(a.validated);
335  AttachContent nac = new AttachContent();
336  nac.setFileContent(a.attachContent.getFileContent());
337  na.setAttachContent(nac);
338  return na;
339  }
Here is the call graph for this function:

◆ getAttachContent()

AttachContent org.turro.attach.entity.Attachment.getAttachContent ( )

Definition at line 116 of file Attachment.java.

116  {
117  return attachContent;
118  }
Here is the caller graph for this function:

◆ getByteString()

String org.turro.attach.entity.Attachment.getByteString ( )

Definition at line 447 of file Attachment.java.

447  {
448  return new BytesFormatter(getFileSize()).toString();
449  }
Here is the caller graph for this function:

◆ getComment()

String org.turro.attach.entity.Attachment.getComment ( )

Definition at line 223 of file Attachment.java.

223  {
224  return comment;
225  }
Here is the caller graph for this function:

◆ getContentModified()

byte [] org.turro.attach.entity.Attachment.getContentModified ( IContact  contact) throws IOException, DocumentException

Definition at line 355 of file Attachment.java.

355  {
356  AttachContent ac = getWithContent().getAttachContent();
357  if(isWatermark() && isPDF()) {
358  if(contact != null && contact.isValid()) {
359  WatermarkCfg cfg = new WatermarkCfg(getContactName(contact), 45.0F);
360  Watermark mark = new Watermark();
361  ByteArrayOutputStream output = new ByteArrayOutputStream((int) getFileSize());
362  mark.addWatermark(
363  new ByteArrayInputStream(ac.getFileContent()),
364  output, cfg);
365  return output.toByteArray();
366  } else {
367  return new byte[] {};
368  }
369  }
370  return ac.getFileContent();
371  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDateString()

String org.turro.attach.entity.Attachment.getDateString ( IConstructor  constructor)

Definition at line 451 of file Attachment.java.

451  {
452  return DateFormats.format(getModification(),
453  DateFormat.SHORT, I_.api().used());
454  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFileContentType()

String org.turro.attach.entity.Attachment.getFileContentType ( )

Definition at line 231 of file Attachment.java.

231  {
232  return fileContentType;
233  }
Here is the caller graph for this function:

◆ getFileExtension()

String org.turro.attach.entity.Attachment.getFileExtension ( )

Definition at line 297 of file Attachment.java.

297  {
298  if(fileName != null) {
299  int p = fileName.lastIndexOf(".");
300  if(p > 0) {
301  return fileName.substring(p + 1).toLowerCase();
302  }
303  }
304  return "bin";
305  }
Here is the caller graph for this function:

◆ getFileName()

String org.turro.attach.entity.Attachment.getFileName ( )

Definition at line 239 of file Attachment.java.

239  {
240  return fileName;
241  }
Here is the caller graph for this function:

◆ getFileSize()

long org.turro.attach.entity.Attachment.getFileSize ( )

Definition at line 247 of file Attachment.java.

247  {
248  return fileSize;
249  }
Here is the caller graph for this function:

◆ getId()

Long org.turro.attach.entity.Attachment.getId ( )

Definition at line 124 of file Attachment.java.

124  {
125  return id;
126  }
Here is the caller graph for this function:

◆ getIOwner()

IContact org.turro.attach.entity.Attachment.getIOwner ( )

Definition at line 388 of file Attachment.java.

388  {
389  if(!Strings.isBlank(owner)) {
390  IContact contact = Contacts.getContactById(owner);
391  if(!contact.isValid()) {
392  contact.loadByLogin(owner);
393  }
394  if(contact.isValid()) {
395  return contact;
396  }
397  }
398  return null;
399  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLockComment()

String org.turro.attach.entity.Attachment.getLockComment ( )

Definition at line 148 of file Attachment.java.

148  {
149  return lockComment;
150  }

◆ getLockCommit()

Date org.turro.attach.entity.Attachment.getLockCommit ( )

Definition at line 156 of file Attachment.java.

156  {
157  return lockCommit;
158  }

◆ getLockDate()

Date org.turro.attach.entity.Attachment.getLockDate ( )

Definition at line 164 of file Attachment.java.

164  {
165  return lockDate;
166  }

◆ getLocker()

String org.turro.attach.entity.Attachment.getLocker ( )

Definition at line 180 of file Attachment.java.

180  {
181  return locker;
182  }
Here is the caller graph for this function:

◆ getModification()

Date org.turro.attach.entity.Attachment.getModification ( )

Definition at line 215 of file Attachment.java.

215  {
216  return modification;
217  }
Here is the caller graph for this function:

◆ getOwner()

String org.turro.attach.entity.Attachment.getOwner ( )

Definition at line 132 of file Attachment.java.

132  {
133  return owner;
134  }
Here is the caller graph for this function:

◆ getOwnerEntity()

IElephantEntity org.turro.attach.entity.Attachment.getOwnerEntity ( )

Definition at line 403 of file Attachment.java.

403  {
404  return Entities.getController(new Path(path).getTill(2));
405  }
Here is the call graph for this function:

◆ getPath()

String org.turro.attach.entity.Attachment.getPath ( )

Definition at line 188 of file Attachment.java.

188  {
189  return path;
190  }
Here is the caller graph for this function:

◆ getRelatedPath()

String org.turro.attach.entity.Attachment.getRelatedPath ( )

Definition at line 207 of file Attachment.java.

207  {
208  return relatedPath;
209  }

◆ getRelativePath()

String org.turro.attach.entity.Attachment.getRelativePath ( String  root)

Definition at line 307 of file Attachment.java.

307  {
308  if(root == null) {
309  return path;
310  }
311  if(path.toUpperCase().startsWith(root.toUpperCase())) {
312  return path.substring(root.length());
313  }
314  return "";
315  }

◆ getROShowURL()

String org.turro.attach.entity.Attachment.getROShowURL ( IConstructor  constructor)

Definition at line 443 of file Attachment.java.

443  {
444  return AttachDownload.createROURL(constructor, this);
445  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getShowKey()

String org.turro.attach.entity.Attachment.getShowKey ( )

Definition at line 255 of file Attachment.java.

255  {
256  return showKey;
257  }

◆ getShowURL()

String org.turro.attach.entity.Attachment.getShowURL ( IConstructor  constructor)

Definition at line 439 of file Attachment.java.

439  {
440  return AttachDownload.createURL(constructor, this);
441  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSingleStatus() [1/2]

AcceptanceSingleStatus org.turro.attach.entity.Attachment.getSingleStatus ( )

Definition at line 458 of file Attachment.java.

458  {
459  return getSingleStatus(Authentication.getIContact());
460  }
AcceptanceSingleStatus getSingleStatus()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSingleStatus() [2/2]

AcceptanceSingleStatus org.turro.attach.entity.Attachment.getSingleStatus ( IContact  contact)

Definition at line 462 of file Attachment.java.

462  {
463  IAcceptances acceptances = Plugins.loadImplementation(IAcceptances.class);
464  return acceptances.getStatusFor(AttachPU.getObjectPath(this), contact, getIOwner());
465  }
Here is the call graph for this function:

◆ getWithContent()

Attachment org.turro.attach.entity.Attachment.getWithContent ( )

Definition at line 351 of file Attachment.java.

351  {
352  return AttachmentUtil.withContent(this);
353  }
Here is the call graph for this function:

◆ isLocked()

boolean org.turro.attach.entity.Attachment.isLocked ( )

Definition at line 172 of file Attachment.java.

172  {
173  return locked;
174  }
Here is the caller graph for this function:

◆ isOnlyOwner()

boolean org.turro.attach.entity.Attachment.isOnlyOwner ( )

Definition at line 140 of file Attachment.java.

140  {
141  return onlyOwner;
142  }

◆ isPDF()

boolean org.turro.attach.entity.Attachment.isPDF ( )

Definition at line 373 of file Attachment.java.

373  {
374  return fileName.toLowerCase().endsWith(".pdf");
375  }

◆ isPublishable()

boolean org.turro.attach.entity.Attachment.isPublishable ( )

Definition at line 271 of file Attachment.java.

271  {
272  return publishable;
273  }
Here is the caller graph for this function:

◆ isRequiresAcceptance()

boolean org.turro.attach.entity.Attachment.isRequiresAcceptance ( )

Definition at line 279 of file Attachment.java.

279  {
280  return requiresAcceptance;
281  }
Here is the caller graph for this function:

◆ isValidated()

boolean org.turro.attach.entity.Attachment.isValidated ( )

Definition at line 263 of file Attachment.java.

263  {
264  return validated;
265  }

◆ isWatermark()

boolean org.turro.attach.entity.Attachment.isWatermark ( )

Definition at line 287 of file Attachment.java.

287  {
288  return watermark;
289  }

◆ setAttachContent()

void org.turro.attach.entity.Attachment.setAttachContent ( AttachContent  attachContent)

Definition at line 120 of file Attachment.java.

120  {
121  this.attachContent = attachContent;
122  }
Here is the caller graph for this function:

◆ setComment()

void org.turro.attach.entity.Attachment.setComment ( String  comment)

Definition at line 227 of file Attachment.java.

227  {
228  this.comment = comment;
229  }
Here is the caller graph for this function:

◆ setDateModification()

void org.turro.attach.entity.Attachment.setDateModification ( Date  value)

Definition at line 341 of file Attachment.java.

341  {
342  modification = new CheckDate(modification).setDayMonthYear(value).getDate();
343  }

◆ setFileContentType()

void org.turro.attach.entity.Attachment.setFileContentType ( String  fileContentType)

Definition at line 235 of file Attachment.java.

235  {
236  this.fileContentType = fileContentType;
237  }
Here is the caller graph for this function:

◆ setFileName()

void org.turro.attach.entity.Attachment.setFileName ( String  fileName)

Definition at line 243 of file Attachment.java.

243  {
244  this.fileName = fileName;
245  }
Here is the caller graph for this function:

◆ setFileSize()

void org.turro.attach.entity.Attachment.setFileSize ( long  fileSize)

Definition at line 251 of file Attachment.java.

251  {
252  this.fileSize = fileSize;
253  }
Here is the caller graph for this function:

◆ setId()

void org.turro.attach.entity.Attachment.setId ( Long  id)

Definition at line 128 of file Attachment.java.

128  {
129  this.id = id;
130  }

◆ setLockComment()

void org.turro.attach.entity.Attachment.setLockComment ( String  lockComment)

Definition at line 152 of file Attachment.java.

152  {
153  this.lockComment = lockComment;
154  }
Here is the caller graph for this function:

◆ setLockCommit()

void org.turro.attach.entity.Attachment.setLockCommit ( Date  lockCommit)

Definition at line 160 of file Attachment.java.

160  {
161  this.lockCommit = lockCommit;
162  }
Here is the caller graph for this function:

◆ setLockDate()

void org.turro.attach.entity.Attachment.setLockDate ( Date  lockDate)

Definition at line 168 of file Attachment.java.

168  {
169  this.lockDate = lockDate;
170  }
Here is the caller graph for this function:

◆ setLocked()

void org.turro.attach.entity.Attachment.setLocked ( boolean  locked)

Definition at line 176 of file Attachment.java.

176  {
177  this.locked = locked;
178  }
Here is the caller graph for this function:

◆ setLocker()

void org.turro.attach.entity.Attachment.setLocker ( String  locker)

Definition at line 184 of file Attachment.java.

184  {
185  this.locker = locker;
186  }
Here is the caller graph for this function:

◆ setModification()

void org.turro.attach.entity.Attachment.setModification ( Date  modification)

Definition at line 219 of file Attachment.java.

219  {
220  this.modification = modification;
221  }
Here is the caller graph for this function:

◆ setOnlyOwner()

void org.turro.attach.entity.Attachment.setOnlyOwner ( boolean  onlyOwner)

Definition at line 144 of file Attachment.java.

144  {
145  this.onlyOwner = onlyOwner;
146  }
Here is the caller graph for this function:

◆ setOwner()

void org.turro.attach.entity.Attachment.setOwner ( String  owner)

Definition at line 136 of file Attachment.java.

136  {
137  this.owner = owner;
138  }
Here is the caller graph for this function:

◆ setPath()

void org.turro.attach.entity.Attachment.setPath ( String  path)

Definition at line 192 of file Attachment.java.

192  {
193  if(path != null) {
194  while(path.indexOf("//") > -1) {
195  path = path.replaceAll("//", "/");
196  }
197  if(path.endsWith("/")) {
198  path = path.substring(0, path.length() - 1);
199  }
200  if(!path.startsWith("/")) {
201  path = "/" + path;
202  }
203  }
204  this.path = path;
205  }
Here is the caller graph for this function:

◆ setPublishable()

void org.turro.attach.entity.Attachment.setPublishable ( boolean  publishable)

Definition at line 275 of file Attachment.java.

275  {
276  this.publishable = publishable;
277  }
Here is the caller graph for this function:

◆ setRelatedPath()

void org.turro.attach.entity.Attachment.setRelatedPath ( String  relatedPath)

Definition at line 211 of file Attachment.java.

211  {
212  this.relatedPath = relatedPath;
213  }

◆ setRequiresAcceptance()

void org.turro.attach.entity.Attachment.setRequiresAcceptance ( boolean  requiresAcceptance)

Definition at line 283 of file Attachment.java.

283  {
284  this.requiresAcceptance = requiresAcceptance;
285  }

◆ setShowKey()

void org.turro.attach.entity.Attachment.setShowKey ( String  showKey)

Definition at line 259 of file Attachment.java.

259  {
260  this.showKey = showKey;
261  }
Here is the caller graph for this function:

◆ setTimeModification()

void org.turro.attach.entity.Attachment.setTimeModification ( Date  value)

Definition at line 345 of file Attachment.java.

345  {
346  modification = new CheckDate(modification).setHourMinute(value).getDate();
347  }

◆ setValidated()

void org.turro.attach.entity.Attachment.setValidated ( boolean  validated)

Definition at line 267 of file Attachment.java.

267  {
268  this.validated = validated;
269  }
Here is the caller graph for this function:

◆ setWatermark()

void org.turro.attach.entity.Attachment.setWatermark ( boolean  watermark)

Definition at line 291 of file Attachment.java.

291  {
292  this.watermark = watermark;
293  }

The documentation for this class was generated from the following file: