• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-java-sdk / #6241

10 Feb 2026 05:27PM UTC coverage: 24.324% (+11.5%) from 12.84%
#6241

push

github

web-flow
fix(boxsdkgen): Move assigning default values from builder constructor to `build()` method (box/box-codegen#922) (#1712)

0 of 1677 new or added lines in 569 files covered. (0.0%)

2130 existing lines in 537 files now uncovered.

7388 of 30373 relevant lines covered (24.32%)

0.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/box/sdkgen/managers/folderclassifications/FolderClassificationsManager.java
1
package com.box.sdkgen.managers.folderclassifications;
2

3
import static com.box.sdkgen.internal.utils.UtilsManager.convertToString;
4
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
5
import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps;
6
import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams;
7

8
import com.box.sdkgen.networking.auth.Authentication;
9
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
10
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
11
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
12
import com.box.sdkgen.networking.network.NetworkSession;
13
import com.box.sdkgen.schemas.classification.Classification;
14
import com.box.sdkgen.serialization.json.JsonManager;
15
import java.util.List;
16
import java.util.Map;
17

18
public class FolderClassificationsManager {
19

20
  public Authentication auth;
21

22
  public NetworkSession networkSession;
23

24
  public FolderClassificationsManager() {
×
25
    this.networkSession = new NetworkSession();
×
26
  }
×
27

28
  protected FolderClassificationsManager(Builder builder) {
×
29
    this.auth = builder.auth;
×
30
    this.networkSession = builder.networkSession;
×
31
  }
×
32

33
  /**
34
   * Retrieves the classification metadata instance that has been applied to a folder.
35
   *
36
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
37
   * example `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
38
   *
39
   * @param folderId The unique identifier that represent a folder.
40
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
41
   *     and copying the ID from the URL. For example, for the URL
42
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
43
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
44
   */
45
  public Classification getClassificationOnFolder(String folderId) {
46
    return getClassificationOnFolder(folderId, new GetClassificationOnFolderHeaders());
×
47
  }
48

49
  /**
50
   * Retrieves the classification metadata instance that has been applied to a folder.
51
   *
52
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
53
   * example `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
54
   *
55
   * @param folderId The unique identifier that represent a folder.
56
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
57
   *     and copying the ID from the URL. For example, for the URL
58
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
59
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
60
   * @param headers Headers of getClassificationOnFolder method
61
   */
62
  public Classification getClassificationOnFolder(
63
      String folderId, GetClassificationOnFolderHeaders headers) {
64
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
65
    FetchResponse response =
×
66
        this.networkSession
67
            .getNetworkClient()
×
68
            .fetch(
×
69
                new FetchOptions.Builder(
70
                        String.join(
×
71
                            "",
72
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
73
                            "/2.0/folders/",
74
                            convertToString(folderId),
×
75
                            "/metadata/enterprise/securityClassification-6VMVochwUWo"),
76
                        "GET")
77
                    .headers(headersMap)
×
78
                    .responseFormat(ResponseFormat.JSON)
×
79
                    .auth(this.auth)
×
80
                    .networkSession(this.networkSession)
×
81
                    .build());
×
82
    return JsonManager.deserialize(response.getData(), Classification.class);
×
83
  }
84

85
  /**
86
   * Adds a classification to a folder by specifying the label of the classification to add.
87
   *
88
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
89
   * example `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
90
   *
91
   * @param folderId The unique identifier that represent a folder.
92
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
93
   *     and copying the ID from the URL. For example, for the URL
94
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
95
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
96
   */
97
  public Classification addClassificationToFolder(String folderId) {
98
    return addClassificationToFolder(
×
99
        folderId,
100
        new AddClassificationToFolderRequestBody(),
101
        new AddClassificationToFolderHeaders());
102
  }
103

104
  /**
105
   * Adds a classification to a folder by specifying the label of the classification to add.
106
   *
107
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
108
   * example `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
109
   *
110
   * @param folderId The unique identifier that represent a folder.
111
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
112
   *     and copying the ID from the URL. For example, for the URL
113
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
114
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
115
   * @param requestBody Request body of addClassificationToFolder method
116
   */
117
  public Classification addClassificationToFolder(
118
      String folderId, AddClassificationToFolderRequestBody requestBody) {
119
    return addClassificationToFolder(folderId, requestBody, new AddClassificationToFolderHeaders());
×
120
  }
121

122
  /**
123
   * Adds a classification to a folder by specifying the label of the classification to add.
124
   *
125
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
126
   * example `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
127
   *
128
   * @param folderId The unique identifier that represent a folder.
129
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
130
   *     and copying the ID from the URL. For example, for the URL
131
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
132
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
133
   * @param headers Headers of addClassificationToFolder method
134
   */
135
  public Classification addClassificationToFolder(
136
      String folderId, AddClassificationToFolderHeaders headers) {
137
    return addClassificationToFolder(folderId, new AddClassificationToFolderRequestBody(), headers);
×
138
  }
139

140
  /**
141
   * Adds a classification to a folder by specifying the label of the classification to add.
142
   *
143
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
144
   * example `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
145
   *
146
   * @param folderId The unique identifier that represent a folder.
147
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
148
   *     and copying the ID from the URL. For example, for the URL
149
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
150
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
151
   * @param requestBody Request body of addClassificationToFolder method
152
   * @param headers Headers of addClassificationToFolder method
153
   */
154
  public Classification addClassificationToFolder(
155
      String folderId,
156
      AddClassificationToFolderRequestBody requestBody,
157
      AddClassificationToFolderHeaders headers) {
158
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
159
    FetchResponse response =
×
160
        this.networkSession
161
            .getNetworkClient()
×
162
            .fetch(
×
163
                new FetchOptions.Builder(
164
                        String.join(
×
165
                            "",
166
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
167
                            "/2.0/folders/",
168
                            convertToString(folderId),
×
169
                            "/metadata/enterprise/securityClassification-6VMVochwUWo"),
170
                        "POST")
171
                    .headers(headersMap)
×
172
                    .data(JsonManager.serialize(requestBody))
×
173
                    .contentType("application/json")
×
174
                    .responseFormat(ResponseFormat.JSON)
×
175
                    .auth(this.auth)
×
176
                    .networkSession(this.networkSession)
×
177
                    .build());
×
178
    return JsonManager.deserialize(response.getData(), Classification.class);
×
179
  }
180

181
  /**
182
   * Updates a classification on a folder.
183
   *
184
   * <p>The classification can only be updated if a classification has already been applied to the
185
   * folder before. When editing classifications, only values are defined for the enterprise will be
186
   * accepted.
187
   *
188
   * @param folderId The unique identifier that represent a folder.
189
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
190
   *     and copying the ID from the URL. For example, for the URL
191
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
192
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
193
   * @param requestBody Request body of updateClassificationOnFolder method
194
   */
195
  public Classification updateClassificationOnFolder(
196
      String folderId, List<UpdateClassificationOnFolderRequestBody> requestBody) {
197
    return updateClassificationOnFolder(
×
198
        folderId, requestBody, new UpdateClassificationOnFolderHeaders());
199
  }
200

201
  /**
202
   * Updates a classification on a folder.
203
   *
204
   * <p>The classification can only be updated if a classification has already been applied to the
205
   * folder before. When editing classifications, only values are defined for the enterprise will be
206
   * accepted.
207
   *
208
   * @param folderId The unique identifier that represent a folder.
209
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
210
   *     and copying the ID from the URL. For example, for the URL
211
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
212
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
213
   * @param requestBody Request body of updateClassificationOnFolder method
214
   * @param headers Headers of updateClassificationOnFolder method
215
   */
216
  public Classification updateClassificationOnFolder(
217
      String folderId,
218
      List<UpdateClassificationOnFolderRequestBody> requestBody,
219
      UpdateClassificationOnFolderHeaders headers) {
220
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
221
    FetchResponse response =
×
222
        this.networkSession
223
            .getNetworkClient()
×
224
            .fetch(
×
225
                new FetchOptions.Builder(
226
                        String.join(
×
227
                            "",
228
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
229
                            "/2.0/folders/",
230
                            convertToString(folderId),
×
231
                            "/metadata/enterprise/securityClassification-6VMVochwUWo"),
232
                        "PUT")
233
                    .headers(headersMap)
×
234
                    .data(JsonManager.serialize(requestBody))
×
235
                    .contentType("application/json-patch+json")
×
236
                    .responseFormat(ResponseFormat.JSON)
×
237
                    .auth(this.auth)
×
238
                    .networkSession(this.networkSession)
×
239
                    .build());
×
240
    return JsonManager.deserialize(response.getData(), Classification.class);
×
241
  }
242

243
  /**
244
   * Removes any classifications from a folder.
245
   *
246
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
247
   * example `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
248
   *
249
   * @param folderId The unique identifier that represent a folder.
250
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
251
   *     and copying the ID from the URL. For example, for the URL
252
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
253
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
254
   */
255
  public void deleteClassificationFromFolder(String folderId) {
256
    deleteClassificationFromFolder(folderId, new DeleteClassificationFromFolderHeaders());
×
257
  }
×
258

259
  /**
260
   * Removes any classifications from a folder.
261
   *
262
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
263
   * example `/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo`.
264
   *
265
   * @param folderId The unique identifier that represent a folder.
266
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
267
   *     and copying the ID from the URL. For example, for the URL
268
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
269
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
270
   * @param headers Headers of deleteClassificationFromFolder method
271
   */
272
  public void deleteClassificationFromFolder(
273
      String folderId, DeleteClassificationFromFolderHeaders headers) {
274
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
275
    FetchResponse response =
×
276
        this.networkSession
277
            .getNetworkClient()
×
278
            .fetch(
×
279
                new FetchOptions.Builder(
280
                        String.join(
×
281
                            "",
282
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
283
                            "/2.0/folders/",
284
                            convertToString(folderId),
×
285
                            "/metadata/enterprise/securityClassification-6VMVochwUWo"),
286
                        "DELETE")
287
                    .headers(headersMap)
×
288
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
289
                    .auth(this.auth)
×
290
                    .networkSession(this.networkSession)
×
291
                    .build());
×
292
  }
×
293

294
  public Authentication getAuth() {
295
    return auth;
×
296
  }
297

298
  public NetworkSession getNetworkSession() {
299
    return networkSession;
×
300
  }
301

302
  public static class Builder {
303

304
    protected Authentication auth;
305

306
    protected NetworkSession networkSession;
307

NEW
308
    public Builder() {}
×
309

310
    public Builder auth(Authentication auth) {
UNCOV
311
      this.auth = auth;
×
UNCOV
312
      return this;
×
313
    }
314

315
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
316
      this.networkSession = networkSession;
×
UNCOV
317
      return this;
×
318
    }
319

320
    public FolderClassificationsManager build() {
NEW
321
      if (this.networkSession == null) {
×
NEW
322
        this.networkSession = new NetworkSession();
×
323
      }
324
      return new FolderClassificationsManager(this);
×
325
    }
326
  }
327
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc