/** * Defines the object that will be passed through to the create method * * @param params is a representation of the request params that are available * @return an object that holds the params we need for this Field. */ @Override protected Object getRelevantParams(Map<String, String[]> params) { Map<String, Object> commentParams = new HashMap<String, Object>(); String[] value = params.get(getId()); if (value != null && value.length > 0) { commentParams.put(getId(), value[0]); } CommentVisibility commentVisibility = new CommentVisibility(params, PARAM_COMMENT_LEVEL); commentParams.put(PARAM_GROUP_LEVEL, commentVisibility.getGroupLevel()); commentParams.put(PARAM_ROLE_LEVEL, commentVisibility.getRoleLevel()); if (params.containsKey(CREATE_COMMENT)) { commentParams.put(CREATE_COMMENT, params.get(CREATE_COMMENT)); } else if (params.containsKey(EDIT_COMMENT)) { commentParams.put(EDIT_COMMENT, params.get(EDIT_COMMENT)); } else if (params.containsKey(REMOVE_COMMENT)) { commentParams.put(REMOVE_COMMENT, params.get(REMOVE_COMMENT)); } if (params.containsKey(PARAM_COMMENT_ID)) { String[] commentId = params.get(PARAM_COMMENT_ID); if (commentId != null && commentId.length > 0) { commentParams.put(PARAM_COMMENT_ID, commentId[0]); } } if (params.containsKey(PARAM_COMMENT_OBJECT)) { commentParams.put(PARAM_COMMENT_OBJECT, params.get(PARAM_COMMENT_OBJECT)); } if (params.containsKey(PARAM_COMMENT_PROPERTY)) { commentParams.put(PARAM_COMMENT_PROPERTY, params.get(PARAM_COMMENT_PROPERTY)); } return commentParams; }