From 2bb2aaefbdc48c31bbe85ec0d6c389a555aa6333 Mon Sep 17 00:00:00 2001 From: Sean Lin Date: Tue, 23 Feb 2021 16:01:17 -0800 Subject: [PATCH] Replace empty string with a more readable constant (#71) * Replace empty string with a more readable constant * chore: bump version Co-authored-by: melanahammel --- gradle.properties | 2 +- .../com/nike/cerberus/client/CerberusClient.java | 12 +++++++----- .../client/model/CerberusUserGroupPermission.java | 3 --- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 06a54ad..6e59d7e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -version=7.4.0 +version=7.4.3 groupId=com.nike artifactId=cerberus-client diff --git a/src/main/java/com/nike/cerberus/client/CerberusClient.java b/src/main/java/com/nike/cerberus/client/CerberusClient.java index b0ae15b..3fe73db 100644 --- a/src/main/java/com/nike/cerberus/client/CerberusClient.java +++ b/src/main/java/com/nike/cerberus/client/CerberusClient.java @@ -78,6 +78,8 @@ public class CerberusClient { public static final String SECURE_FILE_PATH_PREFIX = "v1/secure-file/"; + public static final String EMPTY_PATH = ""; + public static final MediaType DEFAULT_MEDIA_TYPE = MediaType.parse("application/json; charset=utf-8"); protected static final int DEFAULT_NUM_RETRIES = 3; @@ -356,7 +358,7 @@ public void delete(final String path) { * @return List of all roles */ public List listRoles() { - return buildAndExecuteRequest(ROLE_PATH, "", HttpMethod.GET, null, new TypeToken>(){}.getType()); + return buildAndExecuteRequest(ROLE_PATH, EMPTY_PATH, HttpMethod.GET, null, new TypeToken>(){}.getType()); } /** @@ -380,7 +382,7 @@ public Map getRolePermissionMap() { * @return List of all categories */ public List listCategories() { - return buildAndExecuteRequest(CATEGORY_PATH, "", HttpMethod.GET, null, new TypeToken>(){}.getType()); + return buildAndExecuteRequest(CATEGORY_PATH, EMPTY_PATH, HttpMethod.GET, null, new TypeToken>(){}.getType()); } /** @@ -405,7 +407,7 @@ public Map getCategoryMap() { * @return Map of category path to ID */ public String getCategoryIdByPath(String path) { - return listCategories().stream().collect(Collectors.toMap(CerberusCategoryResponse::getPath, CerberusCategoryResponse::getId)).get(path); + return getCategoryMap().get(path); } /** @@ -420,7 +422,7 @@ public String getCategoryIdByPath(String path) { * @return List of safe deposit box summaries */ public List listSafeDepositBoxes() { - return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, "", HttpMethod.GET, null, new TypeToken>(){}.getType()); + return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, EMPTY_PATH, HttpMethod.GET, null, new TypeToken>(){}.getType()); } @@ -466,7 +468,7 @@ public CerberusSafeDepositBoxResponse getSafeDepositBoxById(String id) { * @return The metadata of the created safe deposit box */ public CerberusSafeDepositBoxResponse createSafeDepositBox(CerberusSafeDepositBoxRequest cerberusSafeDepositBoxRequest) { - return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, "", HttpMethod.POST, cerberusSafeDepositBoxRequest, CerberusSafeDepositBoxResponse.class); + return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, EMPTY_PATH, HttpMethod.POST, cerberusSafeDepositBoxRequest, CerberusSafeDepositBoxResponse.class); } diff --git a/src/main/java/com/nike/cerberus/client/model/CerberusUserGroupPermission.java b/src/main/java/com/nike/cerberus/client/model/CerberusUserGroupPermission.java index 34703f8..d0ce014 100644 --- a/src/main/java/com/nike/cerberus/client/model/CerberusUserGroupPermission.java +++ b/src/main/java/com/nike/cerberus/client/model/CerberusUserGroupPermission.java @@ -36,7 +36,4 @@ public String getRoleId() { public void setRoleId(String roleId) { this.roleId = roleId; } - - - }