1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.http;
16  
17  import com.liferay.portal.kernel.json.JSONArray;
18  import com.liferay.portal.kernel.json.JSONFactoryUtil;
19  import com.liferay.portal.kernel.json.JSONObject;
20  import com.liferay.portal.model.Group;
21  
22  import java.util.List;
23  
24  /**
25   * <a href="GroupJSONSerializer.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class is used by {@link GroupServiceJSON} to translate objects.
34   * </p>
35   *
36   * @author    Brian Wing Shun Chan
37   * @see       com.liferay.portal.service.http.GroupServiceJSON
38   * @generated
39   */
40  public class GroupJSONSerializer {
41      public static JSONObject toJSONObject(Group model) {
42          JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
43  
44          jsonObj.put("groupId", model.getGroupId());
45          jsonObj.put("companyId", model.getCompanyId());
46          jsonObj.put("creatorUserId", model.getCreatorUserId());
47          jsonObj.put("classNameId", model.getClassNameId());
48          jsonObj.put("classPK", model.getClassPK());
49          jsonObj.put("parentGroupId", model.getParentGroupId());
50          jsonObj.put("liveGroupId", model.getLiveGroupId());
51          jsonObj.put("name", model.getName());
52          jsonObj.put("description", model.getDescription());
53          jsonObj.put("type", model.getType());
54          jsonObj.put("typeSettings", model.getTypeSettings());
55          jsonObj.put("friendlyURL", model.getFriendlyURL());
56          jsonObj.put("active", model.getActive());
57  
58          return jsonObj;
59      }
60  
61      public static JSONArray toJSONArray(com.liferay.portal.model.Group[] models) {
62          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
63  
64          for (Group model : models) {
65              jsonArray.put(toJSONObject(model));
66          }
67  
68          return jsonArray;
69      }
70  
71      public static JSONArray toJSONArray(
72          com.liferay.portal.model.Group[][] models) {
73          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
74  
75          for (Group[] model : models) {
76              jsonArray.put(toJSONArray(model));
77          }
78  
79          return jsonArray;
80      }
81  
82      public static JSONArray toJSONArray(
83          List<com.liferay.portal.model.Group> models) {
84          JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
85  
86          for (Group model : models) {
87              jsonArray.put(toJSONObject(model));
88          }
89  
90          return jsonArray;
91      }
92  }