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.portal.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.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.ContactServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link ContactServiceUtil} 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 HttpPrincipal} parameter.
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see ContactServiceSoap
051     * @see HttpPrincipal
052     * @see ContactServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class ContactServiceHttp {
057            public static com.liferay.portal.kernel.model.Contact getContact(
058                    HttpPrincipal httpPrincipal, long contactId)
059                    throws com.liferay.portal.kernel.exception.PortalException {
060                    try {
061                            MethodKey methodKey = new MethodKey(ContactServiceUtil.class,
062                                            "getContact", _getContactParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey, contactId);
065    
066                            Object returnObj = null;
067    
068                            try {
069                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
070                            }
071                            catch (Exception e) {
072                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
073                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
074                                    }
075    
076                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
077                            }
078    
079                            return (com.liferay.portal.kernel.model.Contact)returnObj;
080                    }
081                    catch (com.liferay.portal.kernel.exception.SystemException se) {
082                            _log.error(se, se);
083    
084                            throw se;
085                    }
086            }
087    
088            public static java.util.List<com.liferay.portal.kernel.model.Contact> getContacts(
089                    HttpPrincipal httpPrincipal, long classNameId, long classPK, int start,
090                    int end,
091                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.kernel.model.Contact> orderByComparator)
092                    throws com.liferay.portal.kernel.exception.PortalException {
093                    try {
094                            MethodKey methodKey = new MethodKey(ContactServiceUtil.class,
095                                            "getContacts", _getContactsParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey,
098                                            classNameId, classPK, start, end, orderByComparator);
099    
100                            Object returnObj = null;
101    
102                            try {
103                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
104                            }
105                            catch (Exception e) {
106                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
107                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
108                                    }
109    
110                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
111                            }
112    
113                            return (java.util.List<com.liferay.portal.kernel.model.Contact>)returnObj;
114                    }
115                    catch (com.liferay.portal.kernel.exception.SystemException se) {
116                            _log.error(se, se);
117    
118                            throw se;
119                    }
120            }
121    
122            public static int getContactsCount(HttpPrincipal httpPrincipal,
123                    long classNameId, long classPK)
124                    throws com.liferay.portal.kernel.exception.PortalException {
125                    try {
126                            MethodKey methodKey = new MethodKey(ContactServiceUtil.class,
127                                            "getContactsCount", _getContactsCountParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey,
130                                            classNameId, classPK);
131    
132                            Object returnObj = null;
133    
134                            try {
135                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
136                            }
137                            catch (Exception e) {
138                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
139                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
140                                    }
141    
142                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
143                            }
144    
145                            return ((Integer)returnObj).intValue();
146                    }
147                    catch (com.liferay.portal.kernel.exception.SystemException se) {
148                            _log.error(se, se);
149    
150                            throw se;
151                    }
152            }
153    
154            private static Log _log = LogFactoryUtil.getLog(ContactServiceHttp.class);
155            private static final Class<?>[] _getContactParameterTypes0 = new Class[] {
156                            long.class
157                    };
158            private static final Class<?>[] _getContactsParameterTypes1 = new Class[] {
159                            long.class, long.class, int.class, int.class,
160                            com.liferay.portal.kernel.util.OrderByComparator.class
161                    };
162            private static final Class<?>[] _getContactsCountParameterTypes2 = new Class[] {
163                            long.class, long.class
164                    };
165    }