Package mops.businesslogic.file
Class FileListEntry
- java.lang.Object
-
- mops.businesslogic.file.FileListEntry
-
public final class FileListEntry extends java.lang.ObjectWrapper for FileInfo and its permissions.
-
-
Constructor Summary
Constructors Constructor Description FileListEntry(FileInfo fileInfo, UserPermission userPermission, boolean isAdmin, boolean isOwner, java.time.Instant now)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.time.InstantgetAvailableFrom()File available from time.java.time.InstantgetAvailableTo()File available to time.java.time.InstantgetCreationTime()File creation time.longgetDirectoryId()Id of the Directory this file resides in.FileInfogetFileInfo()File.java.lang.LonggetId()File id.java.time.InstantgetLastModifiedTime()File last modified time.java.lang.StringgetName()File name.java.time.InstantgetNow()Current time.java.lang.StringgetOwner()File owner.longgetSize()File size.java.lang.StringgetSizeString()File size string.java.lang.StringgetType()File type.UserPermissiongetUserPermission()User Permissions in containing folder.inthashCode()booleanisAdmin()Is the user an admin of the group.booleanisAvailable(java.time.Instant time)Tests whether this file is available at the given time.booleanisDelete()Checks whether this file list entry can be deleted.booleanisEdit()Checks whether this file list entry can be edited.booleanisPrivileged()Checks whether this file list entry can be accessed because the user is privileged (admin or owner).booleanisRead()Checks whether this file list entry can be read.java.lang.StringtoString()
-
-
-
Constructor Detail
-
FileListEntry
public FileListEntry(FileInfo fileInfo, UserPermission userPermission, boolean isAdmin, boolean isOwner, java.time.Instant now)
-
-
Method Detail
-
isPrivileged
public boolean isPrivileged()
Checks whether this file list entry can be accessed because the user is privileged (admin or owner).- Returns:
- true if privileged
-
isRead
public boolean isRead()
Checks whether this file list entry can be read.- Returns:
- true if read is allowed
-
isEdit
public boolean isEdit()
Checks whether this file list entry can be edited.- Returns:
- true if edit is allowed
-
isDelete
public boolean isDelete()
Checks whether this file list entry can be deleted.- Returns:
- true if delete is allowed
-
getId
public java.lang.Long getId()
File id.- Returns:
- file id
-
getType
public java.lang.String getType()
File type.- Returns:
- file type
-
getName
public java.lang.String getName()
File name.- Returns:
- file name
-
getDirectoryId
public long getDirectoryId()
Id of the Directory this file resides in.- Returns:
- directory id
-
getSize
public long getSize()
File size.- Returns:
- file size
-
getSizeString
public java.lang.String getSizeString()
File size string.- Returns:
- file size string
-
getOwner
public java.lang.String getOwner()
File owner.- Returns:
- file owner
-
getAvailableFrom
public java.time.Instant getAvailableFrom()
File available from time.- Returns:
- file available from time
-
getAvailableTo
public java.time.Instant getAvailableTo()
File available to time.- Returns:
- file available to time
-
isAvailable
public boolean isAvailable(java.time.Instant time)
Tests whether this file is available at the given time.- Parameters:
time- current time- Returns:
- if this file is available
-
getCreationTime
public java.time.Instant getCreationTime()
File creation time.- Returns:
- file creation time
-
getLastModifiedTime
public java.time.Instant getLastModifiedTime()
File last modified time.- Returns:
- file last modified time
-
getFileInfo
public FileInfo getFileInfo()
File.
-
getUserPermission
public UserPermission getUserPermission()
User Permissions in containing folder.
-
isAdmin
public boolean isAdmin()
Is the user an admin of the group.
-
getNow
public java.time.Instant getNow()
Current time.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-