001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
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.DDMStructureLinkServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.dynamicdatamapping.service.DDMStructureLinkServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       DDMStructureLinkServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.dynamicdatamapping.service.DDMStructureLinkServiceUtil
054     * @generated
055     */
056    public class DDMStructureLinkServiceHttp {
057            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink addStructureLink(
058                    HttpPrincipal httpPrincipal, long classNameId, long classPK,
059                    long structureId,
060                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(DDMStructureLinkServiceUtil.class.getName(),
065                                            "addStructureLink", _addStructureLinkParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey,
068                                            classNameId, classPK, structureId, serviceContext);
069    
070                            Object returnObj = null;
071    
072                            try {
073                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
081                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086    
087                            return (com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink)returnObj;
088                    }
089                    catch (com.liferay.portal.kernel.exception.SystemException se) {
090                            _log.error(se, se);
091    
092                            throw se;
093                    }
094            }
095    
096            public static void deleteStructureLink(HttpPrincipal httpPrincipal,
097                    long structureLinkId)
098                    throws com.liferay.portal.kernel.exception.PortalException,
099                            com.liferay.portal.kernel.exception.SystemException {
100                    try {
101                            MethodKey methodKey = new MethodKey(DDMStructureLinkServiceUtil.class.getName(),
102                                            "deleteStructureLink", _deleteStructureLinkParameterTypes1);
103    
104                            MethodHandler methodHandler = new MethodHandler(methodKey,
105                                            structureLinkId);
106    
107                            try {
108                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
109                            }
110                            catch (Exception e) {
111                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
112                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
113                                    }
114    
115                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
116                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
117                                    }
118    
119                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
120                            }
121                    }
122                    catch (com.liferay.portal.kernel.exception.SystemException se) {
123                            _log.error(se, se);
124    
125                            throw se;
126                    }
127            }
128    
129            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink getStructureLink(
130                    HttpPrincipal httpPrincipal, long structureLinkId)
131                    throws com.liferay.portal.kernel.exception.PortalException,
132                            com.liferay.portal.kernel.exception.SystemException {
133                    try {
134                            MethodKey methodKey = new MethodKey(DDMStructureLinkServiceUtil.class.getName(),
135                                            "getStructureLink", _getStructureLinkParameterTypes2);
136    
137                            MethodHandler methodHandler = new MethodHandler(methodKey,
138                                            structureLinkId);
139    
140                            Object returnObj = null;
141    
142                            try {
143                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
144                            }
145                            catch (Exception e) {
146                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
147                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
148                                    }
149    
150                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
151                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
152                                    }
153    
154                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
155                            }
156    
157                            return (com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink)returnObj;
158                    }
159                    catch (com.liferay.portal.kernel.exception.SystemException se) {
160                            _log.error(se, se);
161    
162                            throw se;
163                    }
164            }
165    
166            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink updateStructureLink(
167                    HttpPrincipal httpPrincipal, long structureLinkId, long classNameId,
168                    long classPK, long structureId)
169                    throws com.liferay.portal.kernel.exception.PortalException,
170                            com.liferay.portal.kernel.exception.SystemException {
171                    try {
172                            MethodKey methodKey = new MethodKey(DDMStructureLinkServiceUtil.class.getName(),
173                                            "updateStructureLink", _updateStructureLinkParameterTypes3);
174    
175                            MethodHandler methodHandler = new MethodHandler(methodKey,
176                                            structureLinkId, classNameId, classPK, structureId);
177    
178                            Object returnObj = null;
179    
180                            try {
181                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
182                            }
183                            catch (Exception e) {
184                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
185                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
186                                    }
187    
188                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
189                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
190                                    }
191    
192                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
193                            }
194    
195                            return (com.liferay.portlet.dynamicdatamapping.model.DDMStructureLink)returnObj;
196                    }
197                    catch (com.liferay.portal.kernel.exception.SystemException se) {
198                            _log.error(se, se);
199    
200                            throw se;
201                    }
202            }
203    
204            private static Log _log = LogFactoryUtil.getLog(DDMStructureLinkServiceHttp.class);
205            private static final Class<?>[] _addStructureLinkParameterTypes0 = new Class[] {
206                            long.class, long.class, long.class,
207                            com.liferay.portal.service.ServiceContext.class
208                    };
209            private static final Class<?>[] _deleteStructureLinkParameterTypes1 = new Class[] {
210                            long.class
211                    };
212            private static final Class<?>[] _getStructureLinkParameterTypes2 = new Class[] {
213                            long.class
214                    };
215            private static final Class<?>[] _updateStructureLinkParameterTypes3 = new Class[] {
216                            long.class, long.class, long.class, long.class
217                    };
218    }