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 BoxLock extends BoxTypedObject {
011
012    public static final String FIELD_CREATED_BY = "created_by";
013
014    public static final String FIELD_FILE = "file";
015
016    public static final String FIELD_EXPIRES_AT = "expires_at";
017
018    public static final String FIELD_LOCK_TYPE = "lock_type";
019
020    public static final String FIELD_IS_DOWNLOAD_PREVENTED = "is_download_prevented";
021
022    public static final String FIELD_SERVICE_ACTION = "service_action";
023
024    /**
025     * Constructor.
026     */
027    public BoxLock() {
028        setType(BoxResourceType.LOCK.toString());
029    }
030
031    /**
032     * Copy constructor, this does deep copy for all the fields.
033     *
034     * @param obj
035     */
036    public BoxLock(BoxLock obj) {
037        super(obj);
038    }
039
040    /**
041     * Instantiate the object from a map. Each entry in the map reflects to a field.
042     *
043     * @param map
044     */
045    public BoxLock(Map<String, Object> map) {
046        super(map);
047    }
048
049    @JsonProperty(FIELD_CREATED_BY)
050    public BoxUser getCreatedBy() {
051        return (BoxUser) getValue(FIELD_CREATED_BY);
052    }
053
054    @JsonProperty(FIELD_CREATED_BY)
055    public void setCreatedBy(BoxUser createdBy) {
056        put(FIELD_CREATED_BY, createdBy);
057    }
058
059    @JsonProperty(FIELD_FILE)
060    public BoxItem getFile() {
061        return (BoxItem) getValue(FIELD_FILE);
062    }
063
064    @JsonProperty(FIELD_FILE)
065    public void setFile(BoxItem file) {
066        put(FIELD_FILE, file);
067    }
068
069    @JsonProperty(FIELD_EXPIRES_AT)
070    public String getExpiresAt() {
071        return (String) getValue(FIELD_EXPIRES_AT);
072    }
073
074    @JsonProperty(FIELD_EXPIRES_AT)
075    public void setExpiresAt(String expiresAt) {
076        put(FIELD_EXPIRES_AT, expiresAt);
077    }
078
079    @JsonProperty(FIELD_LOCK_TYPE)
080    public String getLockType() {
081        return (String) getValue(FIELD_LOCK_TYPE);
082    }
083
084    @JsonProperty(FIELD_LOCK_TYPE)
085    public void setLockType(String lockType) {
086        put(FIELD_LOCK_TYPE, lockType);
087    }
088
089    @JsonProperty(FIELD_IS_DOWNLOAD_PREVENTED)
090    public Boolean isDownloadPrevented() {
091        return (Boolean) getValue(FIELD_IS_DOWNLOAD_PREVENTED);
092    }
093
094    @JsonProperty(FIELD_IS_DOWNLOAD_PREVENTED)
095    public void setDownloadPrevented(Boolean lockType) {
096        put(FIELD_IS_DOWNLOAD_PREVENTED, lockType);
097    }
098
099    @JsonProperty(FIELD_SERVICE_ACTION)
100    public BoxServiceAction getServiceAction() {
101        return (BoxServiceAction) getValue(FIELD_SERVICE_ACTION);
102    }
103
104    @JsonProperty(FIELD_SERVICE_ACTION)
105    public void setServiceAction(BoxServiceAction serviceAction) {
106        put(FIELD_SERVICE_ACTION, serviceAction);
107    }
108
109}