001package co.codewizards.cloudstore.core.dto;
002
003import java.io.Serializable;
004import java.util.Date;
005
006import javax.xml.bind.annotation.XmlRootElement;
007
008import co.codewizards.cloudstore.core.oio.File;
009
010/**
011 * @author Marco หงุ่ยตระกูล-Schulze - marco at codewizards dot co
012 */
013@SuppressWarnings("serial")
014@XmlRootElement
015public class RepoFileDto implements Serializable {
016        private long id = Long.MIN_VALUE;
017
018        private Long parentId;
019
020        private String name;
021
022        private long localRevision;
023
024        private Date lastModified;
025
026        private boolean neededAsParent;
027
028        public RepoFileDto() { }
029
030        public long getId() {
031                return id;
032        }
033        public void setId(final long id) {
034                this.id = id;
035        }
036
037        public Long getParentId() {
038                return parentId;
039        }
040        public void setParentId(final Long parentId) {
041                this.parentId = parentId;
042        }
043
044        public String getName() {
045                return name;
046        }
047        public void setName(final String name) {
048                this.name = name;
049        }
050
051        public long getLocalRevision() {
052                return localRevision;
053        }
054        public void setLocalRevision(final long localRevision) {
055                this.localRevision = localRevision;
056        }
057        /**
058         * Gets the timestamp of the file's last modification.
059         * <p>
060         * It reflects the {@link File#lastModified() File.lastModified} property.
061         * @return the timestamp of the file's last modification.
062         */
063        public Date getLastModified() {
064                return lastModified;
065        }
066        public void setLastModified(final Date lastModified) {
067                this.lastModified = lastModified;
068        }
069
070        /**
071         * Indicates, whether this {@link RepoFileDto} was added to a {@link ChangeSetDto}, because it was needed
072         * as parent.
073         * <p>
074         * If this is <code>true</code>, the underlying file/directory is not dirty and does thus not need
075         * to be transferred. The presence of this {@code ChangeSetDto} serves only to complete the tree structure.
076         * <p>
077         * If this is <code>false</code>, the underlying file/directory was modified and must be transferred.
078         * @return whether this instance is only a filler to complete the tree, and the underlying file/directory was not modified.
079         */
080        public boolean isNeededAsParent() {
081                return neededAsParent;
082        }
083
084        public void setNeededAsParent(final boolean neededAsParent) {
085                this.neededAsParent = neededAsParent;
086        }
087
088        @Override
089        public String toString() {
090                return getClass().getSimpleName() + '[' + toString_getProperties() + ']';
091        }
092
093        protected String toString_getProperties() {
094                return "id=" + id
095                                + ", parentId=" + parentId
096                                + ", name=" + name
097                                + ", localRevision=" + localRevision
098                                + ", lastModified=" + lastModified
099                                + ", neededAsParent=" + neededAsParent;
100        }
101}