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.tags.service.http;
022:
023: import com.liferay.portlet.tags.service.TagsAssetServiceUtil;
024:
025: import org.json.JSONArray;
026: import org.json.JSONObject;
027:
028: /**
029: * <a href="TagsAssetServiceJSON.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.tags.service.TagsAssetServiceUtil</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.tags.model.TagsAsset</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.tags.service.http.TagsAssetJSONSerializer</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.tags.service.TagsAssetServiceUtil
069: * @see com.liferay.portlet.tags.service.http.TagsAssetJSONSerializer
070: *
071: */
072: public class TagsAssetServiceJSON {
073: public static void deleteAsset(long assetId)
074: throws java.rmi.RemoteException,
075: com.liferay.portal.SystemException,
076: com.liferay.portal.PortalException {
077: TagsAssetServiceUtil.deleteAsset(assetId);
078: }
079:
080: public static JSONObject getAsset(long assetId)
081: throws java.rmi.RemoteException,
082: com.liferay.portal.SystemException,
083: com.liferay.portal.PortalException {
084: com.liferay.portlet.tags.model.TagsAsset returnValue = TagsAssetServiceUtil
085: .getAsset(assetId);
086:
087: return TagsAssetJSONSerializer.toJSONObject(returnValue);
088: }
089:
090: public static java.lang.String getAssetsRSS(long groupId,
091: long[] classNameIds, long[] entryIds, long[] notEntryIds,
092: boolean andOperator, java.lang.String orderByCol1,
093: java.lang.String orderByCol2,
094: java.lang.String orderByType1,
095: java.lang.String orderByType2,
096: boolean excludeZeroViewCount, java.util.Date publishDate,
097: java.util.Date expirationDate, int max,
098: java.lang.String type, double version,
099: java.lang.String displayStyle, java.lang.String feedURL,
100: java.lang.String entryURL) throws java.rmi.RemoteException,
101: com.liferay.portal.SystemException,
102: com.liferay.portal.PortalException {
103: java.lang.String returnValue = TagsAssetServiceUtil
104: .getAssetsRSS(groupId, classNameIds, entryIds,
105: notEntryIds, andOperator, orderByCol1,
106: orderByCol2, orderByType1, orderByType2,
107: excludeZeroViewCount, publishDate,
108: expirationDate, max, type, version,
109: displayStyle, feedURL, entryURL);
110:
111: return returnValue;
112: }
113:
114: public static com.liferay.portlet.tags.model.TagsAssetType[] getAssetTypes(
115: java.lang.String languageId)
116: throws java.rmi.RemoteException {
117: com.liferay.portlet.tags.model.TagsAssetType[] returnValue = TagsAssetServiceUtil
118: .getAssetTypes(languageId);
119:
120: return returnValue;
121: }
122:
123: public static com.liferay.portlet.tags.model.TagsAssetDisplay[] getCompanyAssetDisplays(
124: long companyId, int begin, int end,
125: java.lang.String languageId)
126: throws java.rmi.RemoteException,
127: com.liferay.portal.SystemException,
128: com.liferay.portal.PortalException {
129: com.liferay.portlet.tags.model.TagsAssetDisplay[] returnValue = TagsAssetServiceUtil
130: .getCompanyAssetDisplays(companyId, begin, end,
131: languageId);
132:
133: return returnValue;
134: }
135:
136: public static JSONArray getCompanyAssets(long companyId, int begin,
137: int end) throws java.rmi.RemoteException,
138: com.liferay.portal.SystemException {
139: java.util.List returnValue = TagsAssetServiceUtil
140: .getCompanyAssets(companyId, begin, end);
141:
142: return TagsAssetJSONSerializer.toJSONArray(returnValue);
143: }
144:
145: public static int getCompanyAssetsCount(long companyId)
146: throws java.rmi.RemoteException,
147: com.liferay.portal.SystemException {
148: int returnValue = TagsAssetServiceUtil
149: .getCompanyAssetsCount(companyId);
150:
151: return returnValue;
152: }
153:
154: public static java.lang.String getCompanyAssetsRSS(long companyId,
155: int max, java.lang.String type, double version,
156: java.lang.String displayStyle, java.lang.String feedURL,
157: java.lang.String entryURL) throws java.rmi.RemoteException,
158: com.liferay.portal.SystemException,
159: com.liferay.portal.PortalException {
160: java.lang.String returnValue = TagsAssetServiceUtil
161: .getCompanyAssetsRSS(companyId, max, type, version,
162: displayStyle, feedURL, entryURL);
163:
164: return returnValue;
165: }
166:
167: public static JSONObject incrementViewCounter(
168: java.lang.String className, long classPK)
169: throws java.rmi.RemoteException,
170: com.liferay.portal.SystemException,
171: com.liferay.portal.PortalException {
172: com.liferay.portlet.tags.model.TagsAsset returnValue = TagsAssetServiceUtil
173: .incrementViewCounter(className, classPK);
174:
175: return TagsAssetJSONSerializer.toJSONObject(returnValue);
176: }
177:
178: public static com.liferay.portlet.tags.model.TagsAssetDisplay[] searchAssetDisplays(
179: long companyId, java.lang.String portletId,
180: java.lang.String keywords, java.lang.String languageId,
181: int begin, int end) throws java.rmi.RemoteException,
182: com.liferay.portal.SystemException,
183: com.liferay.portal.PortalException {
184: com.liferay.portlet.tags.model.TagsAssetDisplay[] returnValue = TagsAssetServiceUtil
185: .searchAssetDisplays(companyId, portletId, keywords,
186: languageId, begin, end);
187:
188: return returnValue;
189: }
190:
191: public static int searchAssetDisplaysCount(long companyId,
192: java.lang.String portletId, java.lang.String keywords,
193: java.lang.String languageId)
194: throws java.rmi.RemoteException,
195: com.liferay.portal.SystemException {
196: int returnValue = TagsAssetServiceUtil
197: .searchAssetDisplaysCount(companyId, portletId,
198: keywords, languageId);
199:
200: return returnValue;
201: }
202:
203: public static JSONObject updateAsset(long groupId,
204: java.lang.String className, long classPK,
205: java.lang.String[] entryNames, java.util.Date startDate,
206: java.util.Date endDate, java.util.Date publishDate,
207: java.util.Date expirationDate, java.lang.String mimeType,
208: java.lang.String title, java.lang.String description,
209: java.lang.String summary, java.lang.String url, int height,
210: int width, java.lang.Integer priority)
211: throws java.rmi.RemoteException,
212: com.liferay.portal.SystemException,
213: com.liferay.portal.PortalException {
214: com.liferay.portlet.tags.model.TagsAsset returnValue = TagsAssetServiceUtil
215: .updateAsset(groupId, className, classPK, entryNames,
216: startDate, endDate, publishDate,
217: expirationDate, mimeType, title, description,
218: summary, url, height, width, priority);
219:
220: return TagsAssetJSONSerializer.toJSONObject(returnValue);
221: }
222: }
|