001
014
015 package com.liferay.portlet.dynamicdatamapping.service.http;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.MethodHandler;
020 import com.liferay.portal.kernel.util.MethodKey;
021 import com.liferay.portal.security.auth.HttpPrincipal;
022 import com.liferay.portal.service.http.TunnelUtil;
023
024 import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateServiceUtil;
025
026
056 public class DDMTemplateServiceHttp {
057 public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate addTemplate(
058 HttpPrincipal httpPrincipal, long groupId, long structureId,
059 java.util.Map<java.util.Locale, java.lang.String> nameMap,
060 java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
061 java.lang.String type, java.lang.String mode,
062 java.lang.String language, java.lang.String script,
063 com.liferay.portal.service.ServiceContext serviceContext)
064 throws com.liferay.portal.kernel.exception.PortalException,
065 com.liferay.portal.kernel.exception.SystemException {
066 try {
067 MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
068 "addTemplate", _addTemplateParameterTypes0);
069
070 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
071 structureId, nameMap, descriptionMap, type, mode, language,
072 script, serviceContext);
073
074 Object returnObj = null;
075
076 try {
077 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
078 }
079 catch (Exception e) {
080 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
081 throw (com.liferay.portal.kernel.exception.PortalException)e;
082 }
083
084 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
085 throw (com.liferay.portal.kernel.exception.SystemException)e;
086 }
087
088 throw new com.liferay.portal.kernel.exception.SystemException(e);
089 }
090
091 return (com.liferay.portlet.dynamicdatamapping.model.DDMTemplate)returnObj;
092 }
093 catch (com.liferay.portal.kernel.exception.SystemException se) {
094 _log.error(se, se);
095
096 throw se;
097 }
098 }
099
100 public static void deleteTemplate(HttpPrincipal httpPrincipal,
101 long templateId)
102 throws com.liferay.portal.kernel.exception.PortalException,
103 com.liferay.portal.kernel.exception.SystemException {
104 try {
105 MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
106 "deleteTemplate", _deleteTemplateParameterTypes1);
107
108 MethodHandler methodHandler = new MethodHandler(methodKey,
109 templateId);
110
111 try {
112 TunnelUtil.invoke(httpPrincipal, methodHandler);
113 }
114 catch (Exception e) {
115 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
116 throw (com.liferay.portal.kernel.exception.PortalException)e;
117 }
118
119 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
120 throw (com.liferay.portal.kernel.exception.SystemException)e;
121 }
122
123 throw new com.liferay.portal.kernel.exception.SystemException(e);
124 }
125 }
126 catch (com.liferay.portal.kernel.exception.SystemException se) {
127 _log.error(se, se);
128
129 throw se;
130 }
131 }
132
133 public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate getTemplate(
134 HttpPrincipal httpPrincipal, long templateId)
135 throws com.liferay.portal.kernel.exception.PortalException,
136 com.liferay.portal.kernel.exception.SystemException {
137 try {
138 MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
139 "getTemplate", _getTemplateParameterTypes2);
140
141 MethodHandler methodHandler = new MethodHandler(methodKey,
142 templateId);
143
144 Object returnObj = null;
145
146 try {
147 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
148 }
149 catch (Exception e) {
150 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
151 throw (com.liferay.portal.kernel.exception.PortalException)e;
152 }
153
154 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
155 throw (com.liferay.portal.kernel.exception.SystemException)e;
156 }
157
158 throw new com.liferay.portal.kernel.exception.SystemException(e);
159 }
160
161 return (com.liferay.portlet.dynamicdatamapping.model.DDMTemplate)returnObj;
162 }
163 catch (com.liferay.portal.kernel.exception.SystemException se) {
164 _log.error(se, se);
165
166 throw se;
167 }
168 }
169
170 public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate> getTemplates(
171 HttpPrincipal httpPrincipal, long structureId, java.lang.String type,
172 java.lang.String mode)
173 throws com.liferay.portal.kernel.exception.SystemException {
174 try {
175 MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
176 "getTemplates", _getTemplatesParameterTypes3);
177
178 MethodHandler methodHandler = new MethodHandler(methodKey,
179 structureId, type, mode);
180
181 Object returnObj = null;
182
183 try {
184 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
185 }
186 catch (Exception e) {
187 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
188 throw (com.liferay.portal.kernel.exception.SystemException)e;
189 }
190
191 throw new com.liferay.portal.kernel.exception.SystemException(e);
192 }
193
194 return (java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMTemplate>)returnObj;
195 }
196 catch (com.liferay.portal.kernel.exception.SystemException se) {
197 _log.error(se, se);
198
199 throw se;
200 }
201 }
202
203 public static com.liferay.portlet.dynamicdatamapping.model.DDMTemplate updateTemplate(
204 HttpPrincipal httpPrincipal, long templateId,
205 java.util.Map<java.util.Locale, java.lang.String> nameMap,
206 java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
207 java.lang.String type, java.lang.String mode,
208 java.lang.String language, java.lang.String script,
209 com.liferay.portal.service.ServiceContext serviceContext)
210 throws com.liferay.portal.kernel.exception.PortalException,
211 com.liferay.portal.kernel.exception.SystemException {
212 try {
213 MethodKey methodKey = new MethodKey(DDMTemplateServiceUtil.class.getName(),
214 "updateTemplate", _updateTemplateParameterTypes4);
215
216 MethodHandler methodHandler = new MethodHandler(methodKey,
217 templateId, nameMap, descriptionMap, type, mode, language,
218 script, serviceContext);
219
220 Object returnObj = null;
221
222 try {
223 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
224 }
225 catch (Exception e) {
226 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
227 throw (com.liferay.portal.kernel.exception.PortalException)e;
228 }
229
230 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
231 throw (com.liferay.portal.kernel.exception.SystemException)e;
232 }
233
234 throw new com.liferay.portal.kernel.exception.SystemException(e);
235 }
236
237 return (com.liferay.portlet.dynamicdatamapping.model.DDMTemplate)returnObj;
238 }
239 catch (com.liferay.portal.kernel.exception.SystemException se) {
240 _log.error(se, se);
241
242 throw se;
243 }
244 }
245
246 private static Log _log = LogFactoryUtil.getLog(DDMTemplateServiceHttp.class);
247 private static final Class<?>[] _addTemplateParameterTypes0 = new Class[] {
248 long.class, long.class, java.util.Map.class, java.util.Map.class,
249 java.lang.String.class, java.lang.String.class,
250 java.lang.String.class, java.lang.String.class,
251 com.liferay.portal.service.ServiceContext.class
252 };
253 private static final Class<?>[] _deleteTemplateParameterTypes1 = new Class[] {
254 long.class
255 };
256 private static final Class<?>[] _getTemplateParameterTypes2 = new Class[] {
257 long.class
258 };
259 private static final Class<?>[] _getTemplatesParameterTypes3 = new Class[] {
260 long.class, java.lang.String.class, java.lang.String.class
261 };
262 private static final Class<?>[] _updateTemplateParameterTypes4 = new Class[] {
263 long.class, java.util.Map.class, java.util.Map.class,
264 java.lang.String.class, java.lang.String.class,
265 java.lang.String.class, java.lang.String.class,
266 com.liferay.portal.service.ServiceContext.class
267 };
268 }