001    /**
002     * Copyright (c) 2000-present 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.portlet.dynamicdatamapping.service.http;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.dynamicdatamapping.service.DDMStructureVersionServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link com.liferay.portlet.dynamicdatamapping.service.DDMStructureVersionServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
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 DDMStructureVersionServiceSoap
052     * @see com.liferay.portal.security.auth.HttpPrincipal
053     * @see com.liferay.portlet.dynamicdatamapping.service.DDMStructureVersionServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class DDMStructureVersionServiceHttp {
058            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion getLatestStructureVersion(
059                    HttpPrincipal httpPrincipal, long structureId)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(DDMStructureVersionServiceUtil.class,
063                                            "getLatestStructureVersion",
064                                            _getLatestStructureVersionParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey,
067                                            structureId);
068    
069                            Object returnObj = null;
070    
071                            try {
072                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
073                            }
074                            catch (Exception e) {
075                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
076                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
077                                    }
078    
079                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
080                            }
081    
082                            return (com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion)returnObj;
083                    }
084                    catch (com.liferay.portal.kernel.exception.SystemException se) {
085                            _log.error(se, se);
086    
087                            throw se;
088                    }
089            }
090    
091            public static com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion getStructureVersion(
092                    HttpPrincipal httpPrincipal, long structureVersionId)
093                    throws com.liferay.portal.kernel.exception.PortalException {
094                    try {
095                            MethodKey methodKey = new MethodKey(DDMStructureVersionServiceUtil.class,
096                                            "getStructureVersion", _getStructureVersionParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey,
099                                            structureVersionId);
100    
101                            Object returnObj = null;
102    
103                            try {
104                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
105                            }
106                            catch (Exception e) {
107                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
108                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
109                                    }
110    
111                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
112                            }
113    
114                            return (com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion)returnObj;
115                    }
116                    catch (com.liferay.portal.kernel.exception.SystemException se) {
117                            _log.error(se, se);
118    
119                            throw se;
120                    }
121            }
122    
123            public static java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion> getStructureVersions(
124                    HttpPrincipal httpPrincipal, long structureId, int start, int end,
125                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion> orderByComparator)
126                    throws com.liferay.portal.kernel.exception.PortalException {
127                    try {
128                            MethodKey methodKey = new MethodKey(DDMStructureVersionServiceUtil.class,
129                                            "getStructureVersions", _getStructureVersionsParameterTypes2);
130    
131                            MethodHandler methodHandler = new MethodHandler(methodKey,
132                                            structureId, start, end, orderByComparator);
133    
134                            Object returnObj = null;
135    
136                            try {
137                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
138                            }
139                            catch (Exception e) {
140                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
141                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
142                                    }
143    
144                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
145                            }
146    
147                            return (java.util.List<com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion>)returnObj;
148                    }
149                    catch (com.liferay.portal.kernel.exception.SystemException se) {
150                            _log.error(se, se);
151    
152                            throw se;
153                    }
154            }
155    
156            public static int getStructureVersionsCount(HttpPrincipal httpPrincipal,
157                    long structureId)
158                    throws com.liferay.portal.kernel.exception.PortalException {
159                    try {
160                            MethodKey methodKey = new MethodKey(DDMStructureVersionServiceUtil.class,
161                                            "getStructureVersionsCount",
162                                            _getStructureVersionsCountParameterTypes3);
163    
164                            MethodHandler methodHandler = new MethodHandler(methodKey,
165                                            structureId);
166    
167                            Object returnObj = null;
168    
169                            try {
170                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
171                            }
172                            catch (Exception e) {
173                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
174                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
175                                    }
176    
177                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
178                            }
179    
180                            return ((Integer)returnObj).intValue();
181                    }
182                    catch (com.liferay.portal.kernel.exception.SystemException se) {
183                            _log.error(se, se);
184    
185                            throw se;
186                    }
187            }
188    
189            private static Log _log = LogFactoryUtil.getLog(DDMStructureVersionServiceHttp.class);
190            private static final Class<?>[] _getLatestStructureVersionParameterTypes0 = new Class[] {
191                            long.class
192                    };
193            private static final Class<?>[] _getStructureVersionParameterTypes1 = new Class[] {
194                            long.class
195                    };
196            private static final Class<?>[] _getStructureVersionsParameterTypes2 = new Class[] {
197                            long.class, int.class, int.class,
198                            com.liferay.portal.kernel.util.OrderByComparator.class
199                    };
200            private static final Class<?>[] _getStructureVersionsCountParameterTypes3 = new Class[] {
201                            long.class
202                    };
203    }