001/*
002 * (C) Copyright 2018 Nuxeo (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Florent Guillaume
018 *     Mickaƫl Schoentgen
019 */
020package org.nuxeo.drive.adapter.impl;
021
022import org.nuxeo.drive.adapter.FileSystemItem;
023import org.nuxeo.drive.adapter.FolderItem;
024
025/**
026 * Simple FileSystemItem just holding data, used for JSON deserialization.
027 *
028 * @since 9.10-HF01, 10.1
029 */
030public class SimpleFileSystemItem extends AbstractFileSystemItem {
031
032    protected String downloadURL;
033
034    protected String digestAlgorithm;
035
036    protected String digest;
037
038    /** @since 11.1 */
039    protected long size;
040
041    protected boolean canUpdate;
042
043    protected boolean canCreateChild;
044
045    protected boolean canScrollDescendants;
046
047    public String getDownloadURL() {
048        return downloadURL;
049    }
050
051    public String getDigestAlgorithm() {
052        return digestAlgorithm;
053    }
054
055    public String getDigest() {
056        return digest;
057    }
058
059    /** @since 11.1 */
060    public long getSize() {
061        return size;
062    }
063
064    public boolean getCanUpdate() {
065        return canUpdate;
066    }
067
068    public boolean getCanCreateChild() {
069        return canCreateChild;
070    }
071
072    public boolean getCanScrollDescendants() {
073        return canScrollDescendants;
074    }
075
076    public void setDownloadURL(String downloadURL) {
077        this.downloadURL = downloadURL;
078    }
079
080    public void setDigestAlgorithm(String digestAlgorithm) {
081        this.digestAlgorithm = digestAlgorithm;
082    }
083
084    public void setDigest(String digest) {
085        this.digest = digest;
086    }
087
088    /** @since 11.1 */
089    public void setSize(long size) {
090        this.size = size;
091    }
092
093    public void setCanUpdate(boolean canUpdate) {
094        this.canUpdate = canUpdate;
095    }
096
097    public void setCanCreateChild(boolean canCreateChild) {
098        this.canCreateChild = canCreateChild;
099    }
100
101    public void setCanScrollDescendants(boolean canScrollDescendants) {
102        this.canScrollDescendants = canScrollDescendants;
103    }
104
105    @Override
106    public void rename(String name) {
107        throw new UnsupportedOperationException();
108    }
109
110    @Override
111    public void delete() {
112        throw new UnsupportedOperationException();
113    }
114
115    @Override
116    public boolean canMove(FolderItem dest) {
117        throw new UnsupportedOperationException();
118    }
119
120    @Override
121    public FileSystemItem move(FolderItem dest) {
122        throw new UnsupportedOperationException();
123    }
124
125    // Override equals and hashCode to explicitly show that their implementation rely on the parent class and doesn't
126    // depend on the fields added to this class.
127    @Override
128    public boolean equals(Object obj) {
129        return super.equals(obj);
130    }
131
132    @Override
133    public int hashCode() {
134        return super.hashCode();
135    }
136
137}