package com.qianwen.smartman.modules.dnc.entity;
|
|
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
import java.io.Serializable;
|
import java.util.ArrayList;
|
import java.util.Arrays;
|
import java.util.Collection;
|
import java.util.Date;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Optional;
|
import java.util.stream.Collectors;
|
import lombok.NonNull;
|
import com.qianwen.core.mp.base.BaseEntity;
|
import com.qianwen.smartman.modules.dnc.enums.FileType;
|
|
@TableName(File.TABLE_NAME)
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/dnc/entity/File.class */
|
public class File extends BaseEntity implements Serializable {
|
public static final String TABLE_NAME = "blade_dnc_craft_file";
|
private static final long serialVersionUID = 1;
|
private static final String PATH_SPLIT = "/";
|
@TableField("display_name")
|
private String displayName;
|
@TableField(value = "pid", insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
|
private Long parentId;
|
@TableField("all_path")
|
private String allPath;
|
@TableField("content_length")
|
private Long contentLength;
|
@TableField("content_type")
|
private String contentType;
|
@TableField("suffix")
|
private String suffix;
|
private Integer fileType;
|
@TableField("object_key")
|
private String objectKey;
|
@TableField("content_md5")
|
private String contentMd5;
|
@TableField("is_locked")
|
private boolean isLocked;
|
@TableField("owner")
|
private Long owner;
|
@TableField("tenant_id")
|
private String tenantId;
|
private Boolean isCurrent;
|
private Date coverTime;
|
private String link;
|
private Integer version;
|
@TableField(exist = false)
|
private Long mark;
|
|
public void setDisplayName(final String displayName) {
|
this.displayName = displayName;
|
}
|
|
public void setParentId(final Long parentId) {
|
this.parentId = parentId;
|
}
|
|
public void setAllPath(final String allPath) {
|
this.allPath = allPath;
|
}
|
|
public void setContentLength(final Long contentLength) {
|
this.contentLength = contentLength;
|
}
|
|
public void setContentType(final String contentType) {
|
this.contentType = contentType;
|
}
|
|
public void setSuffix(final String suffix) {
|
this.suffix = suffix;
|
}
|
|
public void setFileType(final Integer fileType) {
|
this.fileType = fileType;
|
}
|
|
public void setObjectKey(final String objectKey) {
|
this.objectKey = objectKey;
|
}
|
|
public void setContentMd5(final String contentMd5) {
|
this.contentMd5 = contentMd5;
|
}
|
|
public void setLocked(final boolean isLocked) {
|
this.isLocked = isLocked;
|
}
|
|
public void setOwner(final Long owner) {
|
this.owner = owner;
|
}
|
|
public void setTenantId(final String tenantId) {
|
this.tenantId = tenantId;
|
}
|
|
public void setIsCurrent(final Boolean isCurrent) {
|
this.isCurrent = isCurrent;
|
}
|
|
public void setCoverTime(final Date coverTime) {
|
this.coverTime = coverTime;
|
}
|
|
public void setLink(final String link) {
|
this.link = link;
|
}
|
|
public void setVersion(final Integer version) {
|
this.version = version;
|
}
|
|
public void setMark(final Long mark) {
|
this.mark = mark;
|
}
|
|
public String toString() {
|
return "File(displayName=" + getDisplayName() + ", parentId=" + getParentId() + ", allPath=" + getAllPath() + ", contentLength=" + getContentLength() + ", contentType=" + getContentType() + ", suffix=" + getSuffix() + ", fileType=" + getFileType() + ", objectKey=" + getObjectKey() + ", contentMd5=" + getContentMd5() + ", isLocked=" + isLocked() + ", owner=" + getOwner() + ", tenantId=" + getTenantId() + ", isCurrent=" + getIsCurrent() + ", coverTime=" + getCoverTime() + ", link=" + getLink() + ", version=" + getVersion() + ", mark=" + getMark() + ")";
|
}
|
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/dnc/entity/File$FileBuilder.class */
|
public static class FileBuilder {
|
private String displayName;
|
private Long parentId;
|
private String allPath;
|
private boolean contentLength$set;
|
private Long contentLength$value;
|
private String contentType;
|
private String suffix;
|
private Integer fileType;
|
private String objectKey;
|
private String contentMd5;
|
private boolean isLocked;
|
private Long owner;
|
private String tenantId;
|
private Boolean isCurrent;
|
private Date coverTime;
|
private String link;
|
private Integer version;
|
private Long mark;
|
|
FileBuilder() {
|
}
|
|
public FileBuilder displayName(final String displayName) {
|
this.displayName = displayName;
|
return this;
|
}
|
|
public FileBuilder parentId(final Long parentId) {
|
this.parentId = parentId;
|
return this;
|
}
|
|
public FileBuilder allPath(final String allPath) {
|
this.allPath = allPath;
|
return this;
|
}
|
|
public FileBuilder contentLength(final Long contentLength) {
|
this.contentLength$value = contentLength;
|
this.contentLength$set = true;
|
return this;
|
}
|
|
public FileBuilder contentType(final String contentType) {
|
this.contentType = contentType;
|
return this;
|
}
|
|
public FileBuilder suffix(final String suffix) {
|
this.suffix = suffix;
|
return this;
|
}
|
|
public FileBuilder fileType(final Integer fileType) {
|
this.fileType = fileType;
|
return this;
|
}
|
|
public FileBuilder objectKey(final String objectKey) {
|
this.objectKey = objectKey;
|
return this;
|
}
|
|
public FileBuilder contentMd5(final String contentMd5) {
|
this.contentMd5 = contentMd5;
|
return this;
|
}
|
|
public FileBuilder isLocked(final boolean isLocked) {
|
this.isLocked = isLocked;
|
return this;
|
}
|
|
public FileBuilder owner(final Long owner) {
|
this.owner = owner;
|
return this;
|
}
|
|
public FileBuilder tenantId(final String tenantId) {
|
this.tenantId = tenantId;
|
return this;
|
}
|
|
public FileBuilder isCurrent(final Boolean isCurrent) {
|
this.isCurrent = isCurrent;
|
return this;
|
}
|
|
public FileBuilder coverTime(final Date coverTime) {
|
this.coverTime = coverTime;
|
return this;
|
}
|
|
public FileBuilder link(final String link) {
|
this.link = link;
|
return this;
|
}
|
|
public FileBuilder version(final Integer version) {
|
this.version = version;
|
return this;
|
}
|
|
public FileBuilder mark(final Long mark) {
|
this.mark = mark;
|
return this;
|
}
|
|
public File build() {
|
Long contentLength$value = this.contentLength$value;
|
if (!this.contentLength$set) {
|
contentLength$value = File.access$000();
|
}
|
return new File(this.displayName, this.parentId, this.allPath, contentLength$value, this.contentType, this.suffix, this.fileType, this.objectKey, this.contentMd5, this.isLocked, this.owner, this.tenantId, this.isCurrent, this.coverTime, this.link, this.version, this.mark);
|
}
|
|
public String toString() {
|
return "File.FileBuilder(displayName=" + this.displayName + ", parentId=" + this.parentId + ", allPath=" + this.allPath + ", contentLength$value=" + this.contentLength$value + ", contentType=" + this.contentType + ", suffix=" + this.suffix + ", fileType=" + this.fileType + ", objectKey=" + this.objectKey + ", contentMd5=" + this.contentMd5 + ", isLocked=" + this.isLocked + ", owner=" + this.owner + ", tenantId=" + this.tenantId + ", isCurrent=" + this.isCurrent + ", coverTime=" + this.coverTime + ", link=" + this.link + ", version=" + this.version + ", mark=" + this.mark + ")";
|
}
|
}
|
|
private static Long $default$contentLength() {
|
return 0L;
|
}
|
|
public static FileBuilder builder() {
|
return new FileBuilder();
|
}
|
|
public File(final String displayName, final Long parentId, final String allPath, final Long contentLength, final String contentType, final String suffix, final Integer fileType, final String objectKey, final String contentMd5, final boolean isLocked, final Long owner, final String tenantId, final Boolean isCurrent, final Date coverTime, final String link, final Integer version, final Long mark) {
|
this.displayName = displayName;
|
this.parentId = parentId;
|
this.allPath = allPath;
|
this.contentLength = contentLength;
|
this.contentType = contentType;
|
this.suffix = suffix;
|
this.fileType = fileType;
|
this.objectKey = objectKey;
|
this.contentMd5 = contentMd5;
|
this.isLocked = isLocked;
|
this.owner = owner;
|
this.tenantId = tenantId;
|
this.isCurrent = isCurrent;
|
this.coverTime = coverTime;
|
this.link = link;
|
this.version = version;
|
this.mark = mark;
|
}
|
|
public File() {
|
this.contentLength = $default$contentLength();
|
}
|
|
public boolean equals(final Object o) {
|
if (o == this) {
|
return true;
|
}
|
if (o instanceof File) {
|
File other = (File) o;
|
if (other.canEqual(this) && super.equals(o) && isLocked() == other.isLocked()) {
|
Object this$parentId = getParentId();
|
Object other$parentId = other.getParentId();
|
if (this$parentId == null) {
|
if (other$parentId != null) {
|
return false;
|
}
|
} else if (!this$parentId.equals(other$parentId)) {
|
return false;
|
}
|
Object this$contentLength = getContentLength();
|
Object other$contentLength = other.getContentLength();
|
if (this$contentLength == null) {
|
if (other$contentLength != null) {
|
return false;
|
}
|
} else if (!this$contentLength.equals(other$contentLength)) {
|
return false;
|
}
|
Object this$fileType = getFileType();
|
Object other$fileType = other.getFileType();
|
if (this$fileType == null) {
|
if (other$fileType != null) {
|
return false;
|
}
|
} else if (!this$fileType.equals(other$fileType)) {
|
return false;
|
}
|
Object this$owner = getOwner();
|
Object other$owner = other.getOwner();
|
if (this$owner == null) {
|
if (other$owner != null) {
|
return false;
|
}
|
} else if (!this$owner.equals(other$owner)) {
|
return false;
|
}
|
Object this$isCurrent = getIsCurrent();
|
Object other$isCurrent = other.getIsCurrent();
|
if (this$isCurrent == null) {
|
if (other$isCurrent != null) {
|
return false;
|
}
|
} else if (!this$isCurrent.equals(other$isCurrent)) {
|
return false;
|
}
|
Object this$version = getVersion();
|
Object other$version = other.getVersion();
|
if (this$version == null) {
|
if (other$version != null) {
|
return false;
|
}
|
} else if (!this$version.equals(other$version)) {
|
return false;
|
}
|
Object this$mark = getMark();
|
Object other$mark = other.getMark();
|
if (this$mark == null) {
|
if (other$mark != null) {
|
return false;
|
}
|
} else if (!this$mark.equals(other$mark)) {
|
return false;
|
}
|
Object this$displayName = getDisplayName();
|
Object other$displayName = other.getDisplayName();
|
if (this$displayName == null) {
|
if (other$displayName != null) {
|
return false;
|
}
|
} else if (!this$displayName.equals(other$displayName)) {
|
return false;
|
}
|
Object this$allPath = getAllPath();
|
Object other$allPath = other.getAllPath();
|
if (this$allPath == null) {
|
if (other$allPath != null) {
|
return false;
|
}
|
} else if (!this$allPath.equals(other$allPath)) {
|
return false;
|
}
|
Object this$contentType = getContentType();
|
Object other$contentType = other.getContentType();
|
if (this$contentType == null) {
|
if (other$contentType != null) {
|
return false;
|
}
|
} else if (!this$contentType.equals(other$contentType)) {
|
return false;
|
}
|
Object this$suffix = getSuffix();
|
Object other$suffix = other.getSuffix();
|
if (this$suffix == null) {
|
if (other$suffix != null) {
|
return false;
|
}
|
} else if (!this$suffix.equals(other$suffix)) {
|
return false;
|
}
|
Object this$objectKey = getObjectKey();
|
Object other$objectKey = other.getObjectKey();
|
if (this$objectKey == null) {
|
if (other$objectKey != null) {
|
return false;
|
}
|
} else if (!this$objectKey.equals(other$objectKey)) {
|
return false;
|
}
|
Object this$contentMd5 = getContentMd5();
|
Object other$contentMd5 = other.getContentMd5();
|
if (this$contentMd5 == null) {
|
if (other$contentMd5 != null) {
|
return false;
|
}
|
} else if (!this$contentMd5.equals(other$contentMd5)) {
|
return false;
|
}
|
Object this$tenantId = getTenantId();
|
Object other$tenantId = other.getTenantId();
|
if (this$tenantId == null) {
|
if (other$tenantId != null) {
|
return false;
|
}
|
} else if (!this$tenantId.equals(other$tenantId)) {
|
return false;
|
}
|
Object this$coverTime = getCoverTime();
|
Object other$coverTime = other.getCoverTime();
|
if (this$coverTime == null) {
|
if (other$coverTime != null) {
|
return false;
|
}
|
} else if (!this$coverTime.equals(other$coverTime)) {
|
return false;
|
}
|
Object this$link = getLink();
|
Object other$link = other.getLink();
|
return this$link == null ? other$link == null : this$link.equals(other$link);
|
}
|
return false;
|
}
|
return false;
|
}
|
|
protected boolean canEqual(final Object other) {
|
return other instanceof File;
|
}
|
|
public int hashCode() {
|
int result = super.hashCode();
|
int result2 = (result * 59) + (isLocked() ? 79 : 97);
|
Object $parentId = getParentId();
|
int result3 = (result2 * 59) + ($parentId == null ? 43 : $parentId.hashCode());
|
Object $contentLength = getContentLength();
|
int result4 = (result3 * 59) + ($contentLength == null ? 43 : $contentLength.hashCode());
|
Object $fileType = getFileType();
|
int result5 = (result4 * 59) + ($fileType == null ? 43 : $fileType.hashCode());
|
Object $owner = getOwner();
|
int result6 = (result5 * 59) + ($owner == null ? 43 : $owner.hashCode());
|
Object $isCurrent = getIsCurrent();
|
int result7 = (result6 * 59) + ($isCurrent == null ? 43 : $isCurrent.hashCode());
|
Object $version = getVersion();
|
int result8 = (result7 * 59) + ($version == null ? 43 : $version.hashCode());
|
Object $mark = getMark();
|
int result9 = (result8 * 59) + ($mark == null ? 43 : $mark.hashCode());
|
Object $displayName = getDisplayName();
|
int result10 = (result9 * 59) + ($displayName == null ? 43 : $displayName.hashCode());
|
Object $allPath = getAllPath();
|
int result11 = (result10 * 59) + ($allPath == null ? 43 : $allPath.hashCode());
|
Object $contentType = getContentType();
|
int result12 = (result11 * 59) + ($contentType == null ? 43 : $contentType.hashCode());
|
Object $suffix = getSuffix();
|
int result13 = (result12 * 59) + ($suffix == null ? 43 : $suffix.hashCode());
|
Object $objectKey = getObjectKey();
|
int result14 = (result13 * 59) + ($objectKey == null ? 43 : $objectKey.hashCode());
|
Object $contentMd5 = getContentMd5();
|
int result15 = (result14 * 59) + ($contentMd5 == null ? 43 : $contentMd5.hashCode());
|
Object $tenantId = getTenantId();
|
int result16 = (result15 * 59) + ($tenantId == null ? 43 : $tenantId.hashCode());
|
Object $coverTime = getCoverTime();
|
int result17 = (result16 * 59) + ($coverTime == null ? 43 : $coverTime.hashCode());
|
Object $link = getLink();
|
return (result17 * 59) + ($link == null ? 43 : $link.hashCode());
|
}
|
|
static /* synthetic */ Long access$000() {
|
return $default$contentLength();
|
}
|
|
public String getDisplayName() {
|
return this.displayName;
|
}
|
|
public Long getParentId() {
|
return this.parentId;
|
}
|
|
public String getAllPath() {
|
return this.allPath;
|
}
|
|
public Long getContentLength() {
|
return this.contentLength;
|
}
|
|
public String getContentType() {
|
return this.contentType;
|
}
|
|
public String getSuffix() {
|
return this.suffix;
|
}
|
|
public Integer getFileType() {
|
return this.fileType;
|
}
|
|
public String getObjectKey() {
|
return this.objectKey;
|
}
|
|
public String getContentMd5() {
|
return this.contentMd5;
|
}
|
|
public boolean isLocked() {
|
return this.isLocked;
|
}
|
|
public Long getOwner() {
|
return this.owner;
|
}
|
|
public String getTenantId() {
|
return this.tenantId;
|
}
|
|
public Boolean getIsCurrent() {
|
return this.isCurrent;
|
}
|
|
public Date getCoverTime() {
|
return this.coverTime;
|
}
|
|
public String getLink() {
|
return this.link;
|
}
|
|
public Integer getVersion() {
|
return this.version;
|
}
|
|
public Long getMark() {
|
return this.mark;
|
}
|
|
public static File newFolder(Long owner, Long parentId, final String displayName) {
|
return builder().displayName((String) Optional.ofNullable(displayName).orElse("新建文件夹")).parentId(parentId).owner(owner).fileType(Integer.valueOf(FileType.FOLDER.getValue())).isCurrent(true).build();
|
}
|
|
public static File newFile(Long owner, Long parentId, final String displayName) {
|
return builder().displayName((String) Optional.ofNullable(displayName).orElse("新建文本文件")).fileType(Integer.valueOf(FileType.FILE.getValue())).parentId(parentId).owner(owner).contentType("text/plain").suffix(".txt").build();
|
}
|
|
public void changeParent(Long parentId) {
|
this.parentId = parentId;
|
}
|
|
public void rename(@NonNull String newName) {
|
if (newName == null) {
|
throw new NullPointerException("newName is marked non-null but is null");
|
}
|
this.displayName = newName;
|
}
|
|
public void joinPath(String parentPath) {
|
String idStr = (String) Optional.ofNullable(getId()).map((v0) -> {
|
return v0.toString();
|
}).orElse("");
|
this.allPath = (String) Optional.ofNullable(this.allPath).orElse(idStr);
|
this.allPath = (String) Optional.ofNullable(parentPath).map(c -> {
|
return c + "/" + this.allPath;
|
}).orElse(this.allPath);
|
}
|
|
public void path(File targetFile, @NonNull File startFile) {
|
if (startFile == null) {
|
throw new NullPointerException("startFile is marked non-null but is null");
|
}
|
setAllPath(combPath(targetFile, startFile));
|
}
|
|
private String combPath(File targetFile, @NonNull File startFile) {
|
if (startFile == null) {
|
throw new NullPointerException("startFile is marked non-null but is null");
|
}
|
List<String> targetFilePath = (List) Optional.ofNullable(targetFile).map((v0) -> {
|
return v0.pathList();
|
}).orElse(new ArrayList());
|
String startPath = startFile.getId().toString();
|
List<String> thisPath = pathList();
|
int startIndex = thisPath.indexOf(startPath);
|
Collection<? extends String> otherPath = (List) thisPath.stream().skip(startIndex == -1 ? 0L : startIndex).collect(Collectors.toList());
|
List<String> newList = new ArrayList<>();
|
newList.addAll(targetFilePath);
|
newList.addAll(targetFilePath.size(), otherPath);
|
return String.join("/", newList);
|
}
|
|
public String lastPathId() {
|
return (String) Optional.of(pathList()).filter(c -> {
|
return !c.isEmpty();
|
}).map(c2 -> {
|
return (String) c2.get(c2.size() - 1);
|
}).orElse(null);
|
}
|
|
public List<String> pathList() {
|
Optional<String> path = Optional.ofNullable(this.allPath);
|
return (List) path.map(c -> {
|
return Arrays.asList(c.split("\\/"));
|
}).orElse(new ArrayList());
|
}
|
|
public void joinPath(List<String> pathList, String startPath) {
|
List<String> originPath = pathList();
|
int startIndex = originPath.indexOf(startPath);
|
Collection<? extends String> list = (List) originPath.stream().skip(startIndex).collect(Collectors.toList());
|
List<String> newList = new ArrayList<>();
|
newList.addAll(pathList);
|
newList.addAll(pathList.size(), list);
|
this.allPath = String.join("/", newList);
|
}
|
|
/* JADX WARN: Multi-variable type inference failed */
|
public void changeParent(Map<String, String> keyMap, Long defaultValue) {
|
boolean isFromRoot = this.parentId == null && defaultValue != null;
|
if (isFromRoot) {
|
changeParent(defaultValue);
|
return;
|
}
|
String key = (String) Optional.ofNullable(this.parentId).map((v0) -> {
|
return v0.toString();
|
}).orElse("");
|
String pid = (String) keyMap.getOrDefault(key, Optional.ofNullable(defaultValue).map((v0) -> {
|
return v0.toString();
|
}).orElse(null));
|
changeParent(pid, defaultValue);
|
}
|
|
public void changeChildPath(Map<String, String> keyMap) {
|
List<String> originPath = pathList();
|
List<String> newList1 = (List) originPath.stream().map(c -> {
|
return (String) keyMap.getOrDefault(c, c);
|
}).collect(Collectors.toList());
|
this.allPath = String.join("/", newList1);
|
}
|
|
public File copy() {
|
return builder().contentType(getContentType()).displayName(getDisplayName()).parentId(getParentId()).allPath(getAllPath()).objectKey(getObjectKey()).owner(getOwner()).contentLength(getContentLength()).suffix(getSuffix()).fileType(getFileType()).isCurrent(this.isCurrent).mark(this.mark).version(this.version).link(this.link).contentMd5(this.contentMd5).build();
|
}
|
|
public void setNewName(List<String> fileNames) {
|
setDisplayName(getNewName(fileNames, getDisplayName(), getDisplayName(), 0));
|
}
|
|
private String getNewName(List<String> fileNames, String originalName, String newName, Integer index) {
|
if (fileNames.contains(newName)) {
|
Integer index2 = Integer.valueOf(index.intValue() + 1);
|
return getNewName(fileNames, originalName, this.fileType.intValue() == FileType.FILE.getValue() ? originalName.split("\\.")[0] + "(" + index2 + ")." + originalName.split("\\.")[1] : originalName + "(" + index2 + ")", index2);
|
}
|
return newName;
|
}
|
|
private void changeParent(String pid, Long defaultValue) {
|
if (pid == null) {
|
changeParent(defaultValue);
|
} else {
|
changeParent(Long.valueOf(pid));
|
}
|
}
|
}
|