feat(Data): add PCloudNode, PCloudFile, PCloudFolder and RootPCloudFolder
This commit is contained in:
parent
8ad6ec0df1
commit
f14c46fa2a
@ -0,0 +1,62 @@
|
||||
package org.cryptomator.data.cloud.pcloud;
|
||||
|
||||
import org.cryptomator.domain.Cloud;
|
||||
import org.cryptomator.domain.CloudFile;
|
||||
import org.cryptomator.util.Optional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
class PCloudFile implements CloudFile, PCloudNode {
|
||||
|
||||
private final PCloudFolder parent;
|
||||
private final Long fileid;
|
||||
private final String name;
|
||||
private final String path;
|
||||
private final Optional<Long> size;
|
||||
private final Optional<Date> modified;
|
||||
|
||||
public PCloudFile(PCloudFolder parent, Long fileid, String name, String path, Optional<Long> size, Optional<Date> modified) {
|
||||
this.parent = parent;
|
||||
this.fileid = fileid;
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
this.size = size;
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cloud getCloud() {
|
||||
return parent.getCloud();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return fileid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PCloudFolder getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Long> getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Date> getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package org.cryptomator.data.cloud.pcloud;
|
||||
|
||||
import org.cryptomator.domain.Cloud;
|
||||
import org.cryptomator.domain.CloudFolder;
|
||||
|
||||
class PCloudFolder implements CloudFolder, PCloudNode {
|
||||
|
||||
private final PCloudFolder parent;
|
||||
private final Long folderid;
|
||||
private final String name;
|
||||
private final String path;
|
||||
|
||||
public PCloudFolder(PCloudFolder parent, Long folderid, String name, String path) {
|
||||
this.parent = parent;
|
||||
this.folderid = folderid;
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cloud getCloud() {
|
||||
return parent.getCloud();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return folderid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PCloudFolder getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PCloudFolder withCloud(Cloud cloud) {
|
||||
return new PCloudFolder(parent.withCloud(cloud), folderid, name, path);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package org.cryptomator.data.cloud.pcloud;
|
||||
|
||||
import org.cryptomator.domain.CloudNode;
|
||||
|
||||
interface PCloudNode extends CloudNode {
|
||||
|
||||
Long getId();
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.cryptomator.data.cloud.pcloud;
|
||||
|
||||
import org.cryptomator.domain.Cloud;
|
||||
import org.cryptomator.domain.PCloudCloud;
|
||||
|
||||
class RootPCloudFolder extends PCloudFolder {
|
||||
|
||||
private final PCloudCloud cloud;
|
||||
private static final long rootFolderId = 0L;
|
||||
|
||||
public RootPCloudFolder(PCloudCloud cloud) {
|
||||
super(null, rootFolderId, "", "");
|
||||
this.cloud = cloud;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PCloudCloud getCloud() {
|
||||
return cloud;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PCloudFolder withCloud(Cloud cloud) {
|
||||
return new RootPCloudFolder((PCloudCloud) cloud);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user