001package com.box.sdkgen.schemas.classification; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.serialization.json.EnumWrapper; 006import com.fasterxml.jackson.annotation.JsonFilter; 007import com.fasterxml.jackson.annotation.JsonProperty; 008import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 009import com.fasterxml.jackson.databind.annotation.JsonSerialize; 010import java.util.Objects; 011 012/** 013 * An instance of the classification metadata template, containing the classification applied to the 014 * file or folder. 015 * 016 * <p>To get more details about the classification applied to an item, request the classification 017 * metadata template. 018 */ 019@JsonFilter("nullablePropertyFilter") 020public class Classification extends SerializableObject { 021 022 /** The name of the classification applied to the item. */ 023 @JsonProperty("Box__Security__Classification__Key") 024 protected String boxSecurityClassificationKey; 025 026 /** 027 * The identifier of the item that this metadata instance has been attached to. This combines the 028 * `type` and the `id` of the parent in the form `{type}_{id}`. 029 */ 030 @JsonProperty("$parent") 031 protected String parent; 032 033 /** The value will always be `securityClassification-6VMVochwUWo`. */ 034 @JsonDeserialize( 035 using = ClassificationTemplateField.ClassificationTemplateFieldDeserializer.class) 036 @JsonSerialize(using = ClassificationTemplateField.ClassificationTemplateFieldSerializer.class) 037 @JsonProperty("$template") 038 protected EnumWrapper<ClassificationTemplateField> template; 039 040 /** 041 * The scope of the enterprise that this classification has been applied for. 042 * 043 * <p>This will be in the format `enterprise_{enterprise_id}`. 044 */ 045 @JsonProperty("$scope") 046 protected String scope; 047 048 /** 049 * The version of the metadata instance. This version starts at 0 and increases every time a 050 * classification is updated. 051 */ 052 @JsonProperty("$version") 053 protected Long version; 054 055 /** 056 * The unique ID of this classification instance. This will be include the name of the 057 * classification template and a unique ID. 058 */ 059 @JsonProperty("$type") 060 protected String type; 061 062 /** 063 * The version of the metadata template. This version starts at 0 and increases every time the 064 * template is updated. This is mostly for internal use. 065 */ 066 @JsonProperty("$typeVersion") 067 protected Double typeVersion; 068 069 /** Whether an end user can change the classification. */ 070 @JsonProperty("$canEdit") 071 protected Boolean canEdit; 072 073 public Classification() { 074 super(); 075 } 076 077 protected Classification(Builder builder) { 078 super(); 079 this.boxSecurityClassificationKey = builder.boxSecurityClassificationKey; 080 this.parent = builder.parent; 081 this.template = builder.template; 082 this.scope = builder.scope; 083 this.version = builder.version; 084 this.type = builder.type; 085 this.typeVersion = builder.typeVersion; 086 this.canEdit = builder.canEdit; 087 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 088 } 089 090 public String getBoxSecurityClassificationKey() { 091 return boxSecurityClassificationKey; 092 } 093 094 public String getParent() { 095 return parent; 096 } 097 098 public EnumWrapper<ClassificationTemplateField> getTemplate() { 099 return template; 100 } 101 102 public String getScope() { 103 return scope; 104 } 105 106 public Long getVersion() { 107 return version; 108 } 109 110 public String getType() { 111 return type; 112 } 113 114 public Double getTypeVersion() { 115 return typeVersion; 116 } 117 118 public Boolean getCanEdit() { 119 return canEdit; 120 } 121 122 @Override 123 public boolean equals(Object o) { 124 if (this == o) { 125 return true; 126 } 127 if (o == null || getClass() != o.getClass()) { 128 return false; 129 } 130 Classification casted = (Classification) o; 131 return Objects.equals(boxSecurityClassificationKey, casted.boxSecurityClassificationKey) 132 && Objects.equals(parent, casted.parent) 133 && Objects.equals(template, casted.template) 134 && Objects.equals(scope, casted.scope) 135 && Objects.equals(version, casted.version) 136 && Objects.equals(type, casted.type) 137 && Objects.equals(typeVersion, casted.typeVersion) 138 && Objects.equals(canEdit, casted.canEdit); 139 } 140 141 @Override 142 public int hashCode() { 143 return Objects.hash( 144 boxSecurityClassificationKey, parent, template, scope, version, type, typeVersion, canEdit); 145 } 146 147 @Override 148 public String toString() { 149 return "Classification{" 150 + "boxSecurityClassificationKey='" 151 + boxSecurityClassificationKey 152 + '\'' 153 + ", " 154 + "parent='" 155 + parent 156 + '\'' 157 + ", " 158 + "template='" 159 + template 160 + '\'' 161 + ", " 162 + "scope='" 163 + scope 164 + '\'' 165 + ", " 166 + "version='" 167 + version 168 + '\'' 169 + ", " 170 + "type='" 171 + type 172 + '\'' 173 + ", " 174 + "typeVersion='" 175 + typeVersion 176 + '\'' 177 + ", " 178 + "canEdit='" 179 + canEdit 180 + '\'' 181 + "}"; 182 } 183 184 public static class Builder extends NullableFieldTracker { 185 186 protected String boxSecurityClassificationKey; 187 188 protected String parent; 189 190 protected EnumWrapper<ClassificationTemplateField> template; 191 192 protected String scope; 193 194 protected Long version; 195 196 protected String type; 197 198 protected Double typeVersion; 199 200 protected Boolean canEdit; 201 202 public Builder boxSecurityClassificationKey(String boxSecurityClassificationKey) { 203 this.boxSecurityClassificationKey = boxSecurityClassificationKey; 204 return this; 205 } 206 207 public Builder parent(String parent) { 208 this.parent = parent; 209 return this; 210 } 211 212 public Builder template(ClassificationTemplateField template) { 213 this.template = new EnumWrapper<ClassificationTemplateField>(template); 214 return this; 215 } 216 217 public Builder template(EnumWrapper<ClassificationTemplateField> template) { 218 this.template = template; 219 return this; 220 } 221 222 public Builder scope(String scope) { 223 this.scope = scope; 224 return this; 225 } 226 227 public Builder version(Long version) { 228 this.version = version; 229 return this; 230 } 231 232 public Builder type(String type) { 233 this.type = type; 234 return this; 235 } 236 237 public Builder typeVersion(Double typeVersion) { 238 this.typeVersion = typeVersion; 239 return this; 240 } 241 242 public Builder canEdit(Boolean canEdit) { 243 this.canEdit = canEdit; 244 return this; 245 } 246 247 public Classification build() { 248 return new Classification(this); 249 } 250 } 251}