001package org.nuxeo.box.api.marshalling.dao;
002
003import com.fasterxml.jackson.annotation.JsonProperty;
004
005import java.util.Map;
006
007/**
008 * Version of a file.
009 */
010public class BoxFileVersion extends BoxTypedObject {
011
012    public static final String FIELD_MODIFIED_BY = "modified_by";
013
014    public static final String FIELD_NAME = "name";
015
016    /**
017     * Constructor.
018     */
019    public BoxFileVersion() {
020        setType(BoxResourceType.FILE_VERSION.toString());
021    }
022
023    /**
024     * Copy constructor, this does deep copy for all the fields.
025     *
026     * @param obj
027     */
028    public BoxFileVersion(BoxFileVersion obj) {
029        super(obj);
030    }
031
032    /**
033     * Instantiate the object from a map. Each entry in the map reflects to a field.
034     *
035     * @param map
036     */
037    public BoxFileVersion(Map<String, Object> map) {
038        super(map);
039    }
040
041    /**
042     * Get the user last modified this version.
043     *
044     * @return the user last modified this version
045     */
046    @JsonProperty(FIELD_MODIFIED_BY)
047    public BoxUser getModifiedBy() {
048        return (BoxUser) getValue(FIELD_MODIFIED_BY);
049    }
050
051    /**
052     * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>}
053     *
054     * @param modifiedBy user last modified the version
055     */
056    @JsonProperty(FIELD_MODIFIED_BY)
057    private void setModifiedBy(BoxUser modifiedBy) {
058        put(FIELD_MODIFIED_BY, modifiedBy);
059    }
060
061    /**
062     * Get name of this version of file.
063     *
064     * @return name of this version of file
065     */
066    @JsonProperty(FIELD_NAME)
067    public String getName() {
068        return (String) getValue(FIELD_NAME);
069    }
070
071    /**
072     * Setter. This is only used by {@see <a href="http://jackson.codehaus .org">Jackson JSON processer</a>}
073     *
074     * @param name name
075     */
076    @JsonProperty(FIELD_NAME)
077    private void setName(String name) {
078        put(FIELD_NAME, name);
079    }
080
081}