001package com.box.sdkgen.schemas.classificationtemplate; 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.List; 011import java.util.Objects; 012 013/** A metadata template that holds the security classifications defined by an enterprise. */ 014@JsonFilter("nullablePropertyFilter") 015public class ClassificationTemplate extends SerializableObject { 016 017 /** The ID of the classification template. */ 018 protected final String id; 019 020 /** The value will always be `metadata_template`. */ 021 @JsonDeserialize( 022 using = ClassificationTemplateTypeField.ClassificationTemplateTypeFieldDeserializer.class) 023 @JsonSerialize( 024 using = ClassificationTemplateTypeField.ClassificationTemplateTypeFieldSerializer.class) 025 protected EnumWrapper<ClassificationTemplateTypeField> type; 026 027 /** 028 * The scope of the classification template. This is in the format `enterprise_{id}` where the 029 * `id` is the enterprise ID. 030 */ 031 protected final String scope; 032 033 /** The value will always be `securityClassification-6VMVochwUWo`. */ 034 @JsonDeserialize( 035 using = 036 ClassificationTemplateTemplateKeyField.ClassificationTemplateTemplateKeyFieldDeserializer 037 .class) 038 @JsonSerialize( 039 using = 040 ClassificationTemplateTemplateKeyField.ClassificationTemplateTemplateKeyFieldSerializer 041 .class) 042 protected EnumWrapper<ClassificationTemplateTemplateKeyField> templateKey; 043 044 /** The name of this template as shown in web and mobile interfaces. */ 045 @JsonDeserialize( 046 using = 047 ClassificationTemplateDisplayNameField.ClassificationTemplateDisplayNameFieldDeserializer 048 .class) 049 @JsonSerialize( 050 using = 051 ClassificationTemplateDisplayNameField.ClassificationTemplateDisplayNameFieldSerializer 052 .class) 053 protected EnumWrapper<ClassificationTemplateDisplayNameField> displayName; 054 055 /** Determines if the template is always available in web and mobile interfaces. */ 056 protected Boolean hidden; 057 058 /** Determines if classifications are copied along when the file or folder is copied. */ 059 protected Boolean copyInstanceOnItemCopy; 060 061 /** 062 * A list of fields for this classification template. This includes only one field, the 063 * `Box__Security__Classification__Key`, which defines the different classifications available in 064 * this enterprise. 065 */ 066 protected final List<ClassificationTemplateFieldsField> fields; 067 068 public ClassificationTemplate( 069 @JsonProperty("id") String id, 070 @JsonProperty("scope") String scope, 071 @JsonProperty("fields") List<ClassificationTemplateFieldsField> fields) { 072 super(); 073 this.id = id; 074 this.scope = scope; 075 this.fields = fields; 076 this.type = 077 new EnumWrapper<ClassificationTemplateTypeField>( 078 ClassificationTemplateTypeField.METADATA_TEMPLATE); 079 this.templateKey = 080 new EnumWrapper<ClassificationTemplateTemplateKeyField>( 081 ClassificationTemplateTemplateKeyField.SECURITYCLASSIFICATION_6VMVOCHWUWO); 082 this.displayName = 083 new EnumWrapper<ClassificationTemplateDisplayNameField>( 084 ClassificationTemplateDisplayNameField.CLASSIFICATION); 085 } 086 087 protected ClassificationTemplate(Builder builder) { 088 super(); 089 this.id = builder.id; 090 this.type = builder.type; 091 this.scope = builder.scope; 092 this.templateKey = builder.templateKey; 093 this.displayName = builder.displayName; 094 this.hidden = builder.hidden; 095 this.copyInstanceOnItemCopy = builder.copyInstanceOnItemCopy; 096 this.fields = builder.fields; 097 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 098 } 099 100 public String getId() { 101 return id; 102 } 103 104 public EnumWrapper<ClassificationTemplateTypeField> getType() { 105 return type; 106 } 107 108 public String getScope() { 109 return scope; 110 } 111 112 public EnumWrapper<ClassificationTemplateTemplateKeyField> getTemplateKey() { 113 return templateKey; 114 } 115 116 public EnumWrapper<ClassificationTemplateDisplayNameField> getDisplayName() { 117 return displayName; 118 } 119 120 public Boolean getHidden() { 121 return hidden; 122 } 123 124 public Boolean getCopyInstanceOnItemCopy() { 125 return copyInstanceOnItemCopy; 126 } 127 128 public List<ClassificationTemplateFieldsField> getFields() { 129 return fields; 130 } 131 132 @Override 133 public boolean equals(Object o) { 134 if (this == o) { 135 return true; 136 } 137 if (o == null || getClass() != o.getClass()) { 138 return false; 139 } 140 ClassificationTemplate casted = (ClassificationTemplate) o; 141 return Objects.equals(id, casted.id) 142 && Objects.equals(type, casted.type) 143 && Objects.equals(scope, casted.scope) 144 && Objects.equals(templateKey, casted.templateKey) 145 && Objects.equals(displayName, casted.displayName) 146 && Objects.equals(hidden, casted.hidden) 147 && Objects.equals(copyInstanceOnItemCopy, casted.copyInstanceOnItemCopy) 148 && Objects.equals(fields, casted.fields); 149 } 150 151 @Override 152 public int hashCode() { 153 return Objects.hash( 154 id, type, scope, templateKey, displayName, hidden, copyInstanceOnItemCopy, fields); 155 } 156 157 @Override 158 public String toString() { 159 return "ClassificationTemplate{" 160 + "id='" 161 + id 162 + '\'' 163 + ", " 164 + "type='" 165 + type 166 + '\'' 167 + ", " 168 + "scope='" 169 + scope 170 + '\'' 171 + ", " 172 + "templateKey='" 173 + templateKey 174 + '\'' 175 + ", " 176 + "displayName='" 177 + displayName 178 + '\'' 179 + ", " 180 + "hidden='" 181 + hidden 182 + '\'' 183 + ", " 184 + "copyInstanceOnItemCopy='" 185 + copyInstanceOnItemCopy 186 + '\'' 187 + ", " 188 + "fields='" 189 + fields 190 + '\'' 191 + "}"; 192 } 193 194 public static class Builder extends NullableFieldTracker { 195 196 protected final String id; 197 198 protected EnumWrapper<ClassificationTemplateTypeField> type; 199 200 protected final String scope; 201 202 protected EnumWrapper<ClassificationTemplateTemplateKeyField> templateKey; 203 204 protected EnumWrapper<ClassificationTemplateDisplayNameField> displayName; 205 206 protected Boolean hidden; 207 208 protected Boolean copyInstanceOnItemCopy; 209 210 protected final List<ClassificationTemplateFieldsField> fields; 211 212 public Builder(String id, String scope, List<ClassificationTemplateFieldsField> fields) { 213 super(); 214 this.id = id; 215 this.scope = scope; 216 this.fields = fields; 217 } 218 219 public Builder type(ClassificationTemplateTypeField type) { 220 this.type = new EnumWrapper<ClassificationTemplateTypeField>(type); 221 return this; 222 } 223 224 public Builder type(EnumWrapper<ClassificationTemplateTypeField> type) { 225 this.type = type; 226 return this; 227 } 228 229 public Builder templateKey(ClassificationTemplateTemplateKeyField templateKey) { 230 this.templateKey = new EnumWrapper<ClassificationTemplateTemplateKeyField>(templateKey); 231 return this; 232 } 233 234 public Builder templateKey(EnumWrapper<ClassificationTemplateTemplateKeyField> templateKey) { 235 this.templateKey = templateKey; 236 return this; 237 } 238 239 public Builder displayName(ClassificationTemplateDisplayNameField displayName) { 240 this.displayName = new EnumWrapper<ClassificationTemplateDisplayNameField>(displayName); 241 return this; 242 } 243 244 public Builder displayName(EnumWrapper<ClassificationTemplateDisplayNameField> displayName) { 245 this.displayName = displayName; 246 return this; 247 } 248 249 public Builder hidden(Boolean hidden) { 250 this.hidden = hidden; 251 return this; 252 } 253 254 public Builder copyInstanceOnItemCopy(Boolean copyInstanceOnItemCopy) { 255 this.copyInstanceOnItemCopy = copyInstanceOnItemCopy; 256 return this; 257 } 258 259 public ClassificationTemplate build() { 260 if (this.type == null) { 261 this.type = 262 new EnumWrapper<ClassificationTemplateTypeField>( 263 ClassificationTemplateTypeField.METADATA_TEMPLATE); 264 } 265 if (this.templateKey == null) { 266 this.templateKey = 267 new EnumWrapper<ClassificationTemplateTemplateKeyField>( 268 ClassificationTemplateTemplateKeyField.SECURITYCLASSIFICATION_6VMVOCHWUWO); 269 } 270 if (this.displayName == null) { 271 this.displayName = 272 new EnumWrapper<ClassificationTemplateDisplayNameField>( 273 ClassificationTemplateDisplayNameField.CLASSIFICATION); 274 } 275 return new ClassificationTemplate(this); 276 } 277 } 278}