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