@@ -78,6 +78,8 @@ public class CerberusClient {
78
78
79
79
public static final String SECURE_FILE_PATH_PREFIX = "v1/secure-file/" ;
80
80
81
+ public static final String EMPTY_PATH = "" ;
82
+
81
83
public static final MediaType DEFAULT_MEDIA_TYPE = MediaType .parse ("application/json; charset=utf-8" );
82
84
83
85
protected static final int DEFAULT_NUM_RETRIES = 3 ;
@@ -356,7 +358,7 @@ public void delete(final String path) {
356
358
* @return List of all roles
357
359
*/
358
360
public List <CerberusRoleResponse > listRoles () {
359
- return buildAndExecuteRequest (ROLE_PATH , "" , HttpMethod .GET , null , new TypeToken <List <CerberusRoleResponse >>(){}.getType ());
361
+ return buildAndExecuteRequest (ROLE_PATH , EMPTY_PATH , HttpMethod .GET , null , new TypeToken <List <CerberusRoleResponse >>(){}.getType ());
360
362
}
361
363
362
364
/**
@@ -380,7 +382,7 @@ public Map<CerberusRolePermission, String> getRolePermissionMap() {
380
382
* @return List of all categories
381
383
*/
382
384
public List <CerberusCategoryResponse > listCategories () {
383
- return buildAndExecuteRequest (CATEGORY_PATH , "" , HttpMethod .GET , null , new TypeToken <List <CerberusCategoryResponse >>(){}.getType ());
385
+ return buildAndExecuteRequest (CATEGORY_PATH , EMPTY_PATH , HttpMethod .GET , null , new TypeToken <List <CerberusCategoryResponse >>(){}.getType ());
384
386
}
385
387
386
388
/**
@@ -405,7 +407,7 @@ public Map<String, String> getCategoryMap() {
405
407
* @return Map of category path to ID
406
408
*/
407
409
public String getCategoryIdByPath (String path ) {
408
- return listCategories (). stream (). collect ( Collectors . toMap ( CerberusCategoryResponse :: getPath , CerberusCategoryResponse :: getId ) ).get (path );
410
+ return getCategoryMap ( ).get (path );
409
411
}
410
412
411
413
/**
@@ -420,7 +422,7 @@ public String getCategoryIdByPath(String path) {
420
422
* @return List of safe deposit box summaries
421
423
*/
422
424
public List <CerberusSafeDepositBoxSummaryResponse > listSafeDepositBoxes () {
423
- return buildAndExecuteRequest (SAFE_DEPOSIT_BOX_PREFIX , "" , HttpMethod .GET , null , new TypeToken <List <CerberusSafeDepositBoxSummaryResponse >>(){}.getType ());
425
+ return buildAndExecuteRequest (SAFE_DEPOSIT_BOX_PREFIX , EMPTY_PATH , HttpMethod .GET , null , new TypeToken <List <CerberusSafeDepositBoxSummaryResponse >>(){}.getType ());
424
426
}
425
427
426
428
@@ -466,7 +468,7 @@ public CerberusSafeDepositBoxResponse getSafeDepositBoxById(String id) {
466
468
* @return The metadata of the created safe deposit box
467
469
*/
468
470
public CerberusSafeDepositBoxResponse createSafeDepositBox (CerberusSafeDepositBoxRequest cerberusSafeDepositBoxRequest ) {
469
- return buildAndExecuteRequest (SAFE_DEPOSIT_BOX_PREFIX , "" , HttpMethod .POST , cerberusSafeDepositBoxRequest , CerberusSafeDepositBoxResponse .class );
471
+ return buildAndExecuteRequest (SAFE_DEPOSIT_BOX_PREFIX , EMPTY_PATH , HttpMethod .POST , cerberusSafeDepositBoxRequest , CerberusSafeDepositBoxResponse .class );
470
472
}
471
473
472
474
0 commit comments