001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.blogs.service.http;
022:
023: import com.liferay.portlet.blogs.service.BlogsEntryServiceUtil;
024:
025: import org.json.JSONArray;
026: import org.json.JSONObject;
027:
028: /**
029: * <a href="BlogsEntryServiceJSON.java.html"><b><i>View Source</i></b></a>
030: *
031: * <p>
032: * ServiceBuilder generated this class. Modifications in this class will be
033: * overwritten the next time is generated.
034: * </p>
035: *
036: * <p>
037: * This class provides a JSON utility for the
038: * <code>com.liferay.portlet.blogs.service.BlogsEntryServiceUtil</code>
039: * service utility. The static methods of this class calls the same methods of
040: * the service utility. However, the signatures are different because it is
041: * difficult for JSON to support certain types.
042: * </p>
043: *
044: * <p>
045: * ServiceBuilder follows certain rules in translating the methods. For example,
046: * if the method in the service utility returns a <code>java.util.List</code>,
047: * that is translated to a <code>org.json.JSONArray</code>. If the method in the
048: * service utility returns a <code>com.liferay.portlet.blogs.model.BlogsEntry</code>,
049: * that is translated to a <code>org.json.JSONObject</code>. Methods that JSON
050: * cannot safely use are skipped. The logic for the translation is encapsulated
051: * in <code>com.liferay.portlet.blogs.service.http.BlogsEntryJSONSerializer</code>.
052: * </p>
053: *
054: * <p>
055: * This allows you to call the the backend services directly from JavaScript.
056: * See <code>portal-web/docroot/html/portlet/tags_admin/unpacked.js</code> for a
057: * reference of how that portlet uses the generated JavaScript in
058: * <code>portal-web/docroot/html/js/service.js</code> to call the backend
059: * services directly from JavaScript.
060: * </p>
061: *
062: * <p>
063: * The JSON utility is only generated for remote services.
064: * </p>
065: *
066: * @author Brian Wing Shun Chan
067: *
068: * @see com.liferay.portlet.blogs.service.BlogsEntryServiceUtil
069: * @see com.liferay.portlet.blogs.service.http.BlogsEntryJSONSerializer
070: *
071: */
072: public class BlogsEntryServiceJSON {
073: public static void deleteEntry(long entryId)
074: throws java.rmi.RemoteException,
075: com.liferay.portal.SystemException,
076: com.liferay.portal.PortalException {
077: BlogsEntryServiceUtil.deleteEntry(entryId);
078: }
079:
080: public static JSONArray getCompanyEntries(long companyId, int max)
081: throws java.rmi.RemoteException,
082: com.liferay.portal.SystemException,
083: com.liferay.portal.PortalException {
084: java.util.List returnValue = BlogsEntryServiceUtil
085: .getCompanyEntries(companyId, max);
086:
087: return BlogsEntryJSONSerializer.toJSONArray(returnValue);
088: }
089:
090: public static java.lang.String getCompanyEntriesRSS(long companyId,
091: int max, java.lang.String type, double version,
092: java.lang.String displayStyle, java.lang.String feedURL,
093: java.lang.String entryURL) throws java.rmi.RemoteException,
094: com.liferay.portal.SystemException,
095: com.liferay.portal.PortalException {
096: java.lang.String returnValue = BlogsEntryServiceUtil
097: .getCompanyEntriesRSS(companyId, max, type, version,
098: displayStyle, feedURL, entryURL);
099:
100: return returnValue;
101: }
102:
103: public static JSONObject getEntry(long entryId)
104: throws java.rmi.RemoteException,
105: com.liferay.portal.SystemException,
106: com.liferay.portal.PortalException {
107: com.liferay.portlet.blogs.model.BlogsEntry returnValue = BlogsEntryServiceUtil
108: .getEntry(entryId);
109:
110: return BlogsEntryJSONSerializer.toJSONObject(returnValue);
111: }
112:
113: public static JSONObject getEntry(long groupId,
114: java.lang.String urlTitle) throws java.rmi.RemoteException,
115: com.liferay.portal.SystemException,
116: com.liferay.portal.PortalException {
117: com.liferay.portlet.blogs.model.BlogsEntry returnValue = BlogsEntryServiceUtil
118: .getEntry(groupId, urlTitle);
119:
120: return BlogsEntryJSONSerializer.toJSONObject(returnValue);
121: }
122:
123: public static JSONArray getGroupEntries(long groupId, int max)
124: throws java.rmi.RemoteException,
125: com.liferay.portal.SystemException,
126: com.liferay.portal.PortalException {
127: java.util.List returnValue = BlogsEntryServiceUtil
128: .getGroupEntries(groupId, max);
129:
130: return BlogsEntryJSONSerializer.toJSONArray(returnValue);
131: }
132:
133: public static java.lang.String getGroupEntriesRSS(long groupId,
134: int max, java.lang.String type, double version,
135: java.lang.String displayStyle, java.lang.String feedURL,
136: java.lang.String entryURL) throws java.rmi.RemoteException,
137: com.liferay.portal.SystemException,
138: com.liferay.portal.PortalException {
139: java.lang.String returnValue = BlogsEntryServiceUtil
140: .getGroupEntriesRSS(groupId, max, type, version,
141: displayStyle, feedURL, entryURL);
142:
143: return returnValue;
144: }
145:
146: public static JSONArray getOrganizationEntries(long organizationId,
147: int max) throws java.rmi.RemoteException,
148: com.liferay.portal.SystemException,
149: com.liferay.portal.PortalException {
150: java.util.List returnValue = BlogsEntryServiceUtil
151: .getOrganizationEntries(organizationId, max);
152:
153: return BlogsEntryJSONSerializer.toJSONArray(returnValue);
154: }
155:
156: public static java.lang.String getOrganizationEntriesRSS(
157: long organizationId, int max, java.lang.String type,
158: double version, java.lang.String displayStyle,
159: java.lang.String feedURL, java.lang.String entryURL)
160: throws java.rmi.RemoteException,
161: com.liferay.portal.SystemException,
162: com.liferay.portal.PortalException {
163: java.lang.String returnValue = BlogsEntryServiceUtil
164: .getOrganizationEntriesRSS(organizationId, max, type,
165: version, displayStyle, feedURL, entryURL);
166:
167: return returnValue;
168: }
169: }
|