001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import com.liferay.portal.kernel.json.JSONArray;
018    import com.liferay.portal.kernel.json.JSONFactoryUtil;
019    import com.liferay.portal.kernel.json.JSONObject;
020    import com.liferay.portal.model.Group;
021    
022    import java.util.List;
023    
024    /**
025     * @author    Brian Wing Shun Chan
026     * @generated
027     */
028    public class GroupJSONSerializer {
029            public static JSONObject toJSONObject(Group model) {
030                    JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
031    
032                    jsonObj.put("groupId", model.getGroupId());
033                    jsonObj.put("companyId", model.getCompanyId());
034                    jsonObj.put("creatorUserId", model.getCreatorUserId());
035                    jsonObj.put("classNameId", model.getClassNameId());
036                    jsonObj.put("classPK", model.getClassPK());
037                    jsonObj.put("parentGroupId", model.getParentGroupId());
038                    jsonObj.put("liveGroupId", model.getLiveGroupId());
039                    jsonObj.put("name", model.getName());
040                    jsonObj.put("description", model.getDescription());
041                    jsonObj.put("type", model.getType());
042                    jsonObj.put("typeSettings", model.getTypeSettings());
043                    jsonObj.put("friendlyURL", model.getFriendlyURL());
044                    jsonObj.put("active", model.getActive());
045    
046                    return jsonObj;
047            }
048    
049            public static JSONArray toJSONArray(com.liferay.portal.model.Group[] models) {
050                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
051    
052                    for (Group model : models) {
053                            jsonArray.put(toJSONObject(model));
054                    }
055    
056                    return jsonArray;
057            }
058    
059            public static JSONArray toJSONArray(
060                    com.liferay.portal.model.Group[][] models) {
061                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
062    
063                    for (Group[] model : models) {
064                            jsonArray.put(toJSONArray(model));
065                    }
066    
067                    return jsonArray;
068            }
069    
070            public static JSONArray toJSONArray(
071                    List<com.liferay.portal.model.Group> models) {
072                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
073    
074                    for (Group model : models) {
075                            jsonArray.put(toJSONObject(model));
076                    }
077    
078                    return jsonArray;
079            }
080    }