From be1f4a7171679d79a9049122b79feccea83d3d44 Mon Sep 17 00:00:00 2001 From: Ray Lee Date: Thu, 7 Dec 2017 21:52:06 -0800 Subject: [PATCH] DRYD-169: Fix typos. --- .../services/account/AccountResource.java | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java index 8ba98f756..911d2f4b9 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java @@ -138,7 +138,7 @@ public class AccountResource extends SecurityResourceBase { } return result; } - + protected UriInfo createUriInfo() throws URISyntaxException { return createUriInfo(""); } @@ -156,7 +156,7 @@ public class AccountResource extends SecurityResourceBase { */ private String getAccountCsid(String userId) { String result = null; - + try { UriInfo uriInfo = createUriInfo(String.format("uid=%s", userId)); AccountsCommonList accountsCommonList = getAccountList(uriInfo); @@ -172,19 +172,19 @@ public class AccountResource extends SecurityResourceBase { // TODO Auto-generated catch block e.printStackTrace(); } - + return result; } - + /** * Return the list of roles (display name) for a user id. - * + * * @param userId * @return */ public List getAccountRoles(String userId, String tenantId) { List result = null; - + String accountCsid = getAccountCsid(userId); if (accountCsid != null) { AccountRole accountRole = getAccountRole(accountCsid); @@ -202,7 +202,7 @@ public class AccountResource extends SecurityResourceBase { } } } - + return result; } @@ -211,29 +211,29 @@ public class AccountResource extends SecurityResourceBase { public AccountsCommon updateAccount(@Context UriInfo ui, @PathParam("csid") String csid,AccountsCommon theUpdate) { return (AccountsCommon)update(ui, csid, theUpdate, AccountsCommon.class); } - + /** * Resets an accounts password. - * + * * Requires three query params: * id = CSID of the account * token = the password reset token generated by the system * password = the new password - * + * * @param ui * @return */ @POST @Path(PROCESS_PASSWORD_RESET_PATH) public Response processPasswordReset(@Context UriInfo ui) { - Response response = null; + Response response = null; // // Create a read/write copy of the UriInfo info // ui = new UriInfoWrapper(ui); MultivaluedMap queryParams = ui.getQueryParameters(); - + // // Get the 'token' and 'password' params // @@ -243,14 +243,14 @@ public class AccountResource extends SecurityResourceBase { "The query parameter 'token' is missing or contains no value.").type("text/plain").build(); return response; } - + String password = queryParams.getFirst("password"); if (password == null || password.trim().isEmpty()) { response = Response.status(Response.Status.BAD_REQUEST).entity( "The query parameter 'password' is missing or contains no value.").type("text/plain").build(); return response; } - + // // Retrieve the token from the DB // @@ -263,7 +263,7 @@ public class AccountResource extends SecurityResourceBase { response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); return response; } - + // // Make sure the token is not null // @@ -273,7 +273,7 @@ public class AccountResource extends SecurityResourceBase { response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); return response; } - + // // From the token, get the account to update. // @@ -285,7 +285,7 @@ public class AccountResource extends SecurityResourceBase { response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); return response; } - + // // // @@ -301,7 +301,7 @@ public class AccountResource extends SecurityResourceBase { updateAccount(ui, targetAccount.getCsid(), accountUpdate); String msg = String.format("Successfully reset password using token ID='%s'.", token.getId()); - response = Response.status(Response.Status.OK).entity(msg).type("text/plain").build(); + response = Response.status(Response.Status.OK).entity(msg).type("text/plain").build(); } else { String errMsg = String.format("Could not reset password using token with ID='%s'. Password reset token has expired.", token.getId()); @@ -317,16 +317,16 @@ public class AccountResource extends SecurityResourceBase { tenantId); response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); } - + return response; } - + @POST @Path(PASSWORD_RESET_PATH) public Response requestPasswordReset(@Context UriInfo ui) { Response response = null; - - MultivaluedMap queryParams = ui.getQueryParameters(); + + MultivaluedMap queryParams = ui.getQueryParameters(); String email = queryParams.getFirst(AccountClient.EMAIL_QUERY_PARAM); if (email == null) { response = Response.status(Response.Status.BAD_REQUEST).entity("You must specify an 'email' query paramater.").type("text/plain").build(); @@ -338,10 +338,10 @@ public class AccountResource extends SecurityResourceBase { response = Response.status(Response.Status.BAD_REQUEST).entity("You must specify an 'tid' (tenant ID) query paramater.").type("text/plain").build(); return response; } - + AccountsCommonList accountList = getAccountList(ui); if (accountList == null || accountList.getTotalItems() == 0) { - response = Response.status(Response.Status.NOT_FOUND).entity("Could not locatate an account associated with the email: " + + response = Response.status(Response.Status.NOT_FOUND).entity("Could not locate an account associated with the email: " + email).type("text/plain").build(); } else if (accountList.getTotalItems() > 1) { response = Response.status(Response.Status.BAD_REQUEST).entity("Located more than one account associated with the email: " + @@ -360,14 +360,14 @@ public class AccountResource extends SecurityResourceBase { private boolean contains(String targetTenantID, List accountTenantList) { boolean result = false; - + for (AccountTenant accountTenant : accountTenantList) { if (accountTenant.getTenantId().equalsIgnoreCase(targetTenantID)) { result = true; break; } } - + return result; } @@ -376,9 +376,9 @@ public class AccountResource extends SecurityResourceBase { */ private Response requestPasswordReset(UriInfo ui, String targetTenantID, AccountListItem accountListItem) throws Exception { Response result = null; - + if (contains(targetTenantID, accountListItem.getTenants()) == false) { - String errMsg = String.format("Could not send a password request email to user ID='%s'. That account is not associtated with the targeted tenant ID = '%s'.", + String errMsg = String.format("Could not send a password request email to user ID='%s'. That account is not associated with the targeted tenant ID = '%s'.", accountListItem.email, targetTenantID); result = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).type("text/plain").build(); return result; @@ -394,11 +394,11 @@ public class AccountResource extends SecurityResourceBase { String baseUrl = baseUrlBuilder.replacePath(null).build(emptyValues).toString(); emailConfig.setBaseurl(baseUrl); // - // Configuring (via config files) the base URL is not supported as of CSpace v5.0. Log a warning if we find config for it. + // Configuring (via config files) the base URL is not supported as of CSpace v5.0. Log a warning if we find config for it. // if (deprecatedConfigBaseUrl != null) { if (deprecatedConfigBaseUrl.equalsIgnoreCase(baseUrl) == false) { - String warnMsg = String.format("Ignoring deprecated 'baseurl' email config value '%s'. Using '%s' instead.", + String warnMsg = String.format("Ignoring deprecated 'baseurl' email config value '%s'. Using '%s' instead.", deprecatedConfigBaseUrl, baseUrl); logger.warn(warnMsg); } @@ -411,9 +411,9 @@ public class AccountResource extends SecurityResourceBase { if (status != null) { String errMsg = String.format("Could not send a password request email to user ID='%s'. Error: '%s'", accountListItem.email, status); - result = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).type("text/plain").build(); + result = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).type("text/plain").build(); } else { - String okMsg = String.format("Password reset email send to '%s'.", accountListItem.getEmail()); + String okMsg = String.format("Password reset email sent to '%s'.", accountListItem.getEmail()); result = Response.status(Response.Status.OK).entity(okMsg).type("text/plain").build(); } } else { @@ -434,7 +434,7 @@ public class AccountResource extends SecurityResourceBase { AccountsCommon account = (AccountsCommon)get(csid, AccountsCommon.class); // If marked as metadata immutable, do not delete if(AccountClient.IMMUTABLE.equals(account.getMetadataProtection())) { - Response response = + Response response = Response.status(Response.Status.FORBIDDEN).entity("Account: "+csid+" is immutable.").type("text/plain").build(); return response; } @@ -468,7 +468,7 @@ public class AccountResource extends SecurityResourceBase { AccountsCommon account = (AccountsCommon)get(accCsid, AccountsCommon.class); // If marked as roles immutable, do not create if(AccountClient.IMMUTABLE.equals(account.getRolesProtection())) { - Response response = + Response response = Response.status(Response.Status.FORBIDDEN).entity("Roles for Account: "+accCsid+" are immutable.").type("text/plain").build(); return response; } @@ -503,7 +503,7 @@ public class AccountResource extends SecurityResourceBase { checkResult(result, accCsid, ServiceMessages.GET_FAILED); return result; } - + @GET @Path("{csid}/accountroles") public AccountRole getAccountRole( @@ -537,7 +537,7 @@ public class AccountResource extends SecurityResourceBase { checkResult(result, accCsid, ServiceMessages.GET_FAILED); return result; } - + public Response deleteAccountRole(String accCsid, AccountRole input) { logger.debug("deleteAccountRole with accCsid=" + accCsid); ensureCSID(accCsid, ServiceMessages.DELETE_FAILED+ "accountroles account "); @@ -545,7 +545,7 @@ public class AccountResource extends SecurityResourceBase { AccountsCommon account = (AccountsCommon)get(accCsid, AccountsCommon.class); // If marked as roles immutable, do not delete if(AccountClient.IMMUTABLE.equals(account.getRolesProtection())) { - Response response = + Response response = Response.status(Response.Status.FORBIDDEN).entity("Roles for Account: "+accCsid+" are immutable.").type("text/plain").build(); return response; } @@ -558,7 +558,7 @@ public class AccountResource extends SecurityResourceBase { throw bigReThrow(e, ServiceMessages.DELETE_FAILED, accCsid); } } - + @DELETE @Path("{csid}/accountroles") public Response deleteAccountRole(@PathParam("csid") String accCsid) { @@ -568,7 +568,7 @@ public class AccountResource extends SecurityResourceBase { // If marked as roles immutable, do not delete AccountsCommon account = (AccountsCommon)get(accCsid, AccountsCommon.class); if(AccountClient.IMMUTABLE.equals(account.getRolesProtection())) { - Response response = + Response response = Response.status(Response.Status.FORBIDDEN).entity("Roles for Account: "+accCsid+" are immutable.").type("text/plain").build(); return response; } -- 2.47.3