From 0b44e3fd70a0572ea63517c77c24df85e351689d Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Wed, 25 Apr 2018 11:07:14 +0300 Subject: [PATCH] review changes --- .../rest/rm/community/util/PojoUtility.java | 8 +++++--- .../main/java/org/alfresco/rest/v0/RMAuditAPI.java | 14 +++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java index e3bb8c8860..ecc184a1ba 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java @@ -103,8 +103,8 @@ public class PojoUtility /** * Converting json to java object * - * @param json The json object to convert - * @param classz Class for the java object + * @param json The json object to convert + * @param classz Class for the java object * @return The converted java object * @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model */ @@ -112,7 +112,9 @@ public class PojoUtility { mandatoryObject("model", classz); mandatoryObject("jsonObject", json); + ObjectMapper mapper = new ObjectMapper(); + T obj = null; try { @@ -123,7 +125,7 @@ public class PojoUtility LOGGER.error("Unable to convert the json into a java object.", e.toString()); } - return (T) obj; + return obj; } /** diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java index 4bc5b4d21b..e7ba9dea78 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java @@ -59,12 +59,12 @@ public class RMAuditAPI extends BaseAPI private static final String RM_AUDIT_LOG_API = RM_AUDIT_API + "?{1}"; /** - * Returns a list of audit entries audit of Records Management events. . + * Returns a list of rm audit entries . * - * @param user The username of the user to use. + * @param user The username of the user to use. * @param password The password of the user. - * @param size Maximum number of log entries to return - * @param event The name of audit event to be retrieved + * @param size Maximum number of log entries to return + * @param event The name of audit event to be retrieved * @return return Only return log entries matching this event */ public List getRMAuditLog(String user, String password, final int size, final String event) @@ -72,7 +72,7 @@ public class RMAuditAPI extends BaseAPI String parameters = null; try { - parameters = "size=" + size + (event != null ? "&event=" + URLEncoder.encode(event, "UTF-8"): null ); + parameters = "size=" + size + (event != null ? "&event=" + URLEncoder.encode(event, "UTF-8"):""); } catch (UnsupportedEncodingException e) { @@ -85,7 +85,7 @@ public class RMAuditAPI extends BaseAPI } /** - * Clear the list of audit entries audit of Records Management events. . + * Clear the list of audit entries. * * @param username The username of the user to use. * @param password The password of the user. @@ -96,7 +96,7 @@ public class RMAuditAPI extends BaseAPI JSONObject deleteStatus = doDeleteRequest(username, password, RM_AUDIT_API); assertTrue(deleteStatus != null - //audit clear and audit login returned + //audit clear and login events are returned && getRMAuditLog(username, password, 100, null).size() == 2); }