--- /dev/null
+package com.pentila.entSavoie.cdt.util.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.liferay.portal.kernel.json.JSONArray;
+import com.liferay.portal.kernel.json.JSONObject;
+
+public class UserBean {
+
+ private Long userId;
+
+ private String firstName;
+
+ private String lastName;
+
+ public UserBean(JSONObject userAsJSON){
+ this.userId = userAsJSON.getLong("userId");
+ this.firstName = userAsJSON.getString("firstName");
+ this.lastName = userAsJSON.getString("lastName");
+ }
+
+ public static List<UserBean> getUserListFromJSON(JSONArray jsonUserArray) {
+ if(jsonUserArray == null || jsonUserArray.length() == 0){
+ return new ArrayList<UserBean>();
+ }
+ List<UserBean> userList = new ArrayList<UserBean>();
+ for(int i = 0; i < jsonUserArray.length(); i++ ){
+ userList.add(
+ new UserBean(jsonUserArray.getJSONObject(i)));
+ }
+ return userList;
+ }
+
+ public static List<Long> getListUserBeanAsListUserLong(List<UserBean> userBeanList){
+ List<Long> listUserLong = new ArrayList<Long>();
+ for(UserBean aUserBean : userBeanList){
+ listUserLong.add(aUserBean.getUserId());
+ }
+ return listUserLong;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+}