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.Organization;
021    
022    import java.util.List;
023    
024    /**
025     * @author    Brian Wing Shun Chan
026     * @generated
027     */
028    public class OrganizationJSONSerializer {
029            public static JSONObject toJSONObject(Organization model) {
030                    JSONObject jsonObj = JSONFactoryUtil.createJSONObject();
031    
032                    jsonObj.put("organizationId", model.getOrganizationId());
033                    jsonObj.put("companyId", model.getCompanyId());
034                    jsonObj.put("parentOrganizationId", model.getParentOrganizationId());
035                    jsonObj.put("leftOrganizationId", model.getLeftOrganizationId());
036                    jsonObj.put("rightOrganizationId", model.getRightOrganizationId());
037                    jsonObj.put("name", model.getName());
038                    jsonObj.put("type", model.getType());
039                    jsonObj.put("recursable", model.getRecursable());
040                    jsonObj.put("regionId", model.getRegionId());
041                    jsonObj.put("countryId", model.getCountryId());
042                    jsonObj.put("statusId", model.getStatusId());
043                    jsonObj.put("comments", model.getComments());
044    
045                    return jsonObj;
046            }
047    
048            public static JSONArray toJSONArray(
049                    com.liferay.portal.model.Organization[] models) {
050                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
051    
052                    for (Organization model : models) {
053                            jsonArray.put(toJSONObject(model));
054                    }
055    
056                    return jsonArray;
057            }
058    
059            public static JSONArray toJSONArray(
060                    com.liferay.portal.model.Organization[][] models) {
061                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
062    
063                    for (Organization[] 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.Organization> models) {
072                    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
073    
074                    for (Organization model : models) {
075                            jsonArray.put(toJSONObject(model));
076                    }
077    
078                    return jsonArray;
079            }
080    }