001
014
015 package com.liferay.portal.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.IntegerWrapper;
020 import com.liferay.portal.kernel.util.LongWrapper;
021 import com.liferay.portal.kernel.util.MethodWrapper;
022 import com.liferay.portal.kernel.util.NullWrapper;
023 import com.liferay.portal.security.auth.HttpPrincipal;
024 import com.liferay.portal.service.ResourceServiceUtil;
025
026
056 public class ResourceServiceHttp {
057 public static com.liferay.portal.model.Resource getResource(
058 HttpPrincipal httpPrincipal, long companyId, java.lang.String name,
059 int scope, java.lang.String primKey)
060 throws com.liferay.portal.kernel.exception.PortalException,
061 com.liferay.portal.kernel.exception.SystemException {
062 try {
063 Object paramObj0 = new LongWrapper(companyId);
064
065 Object paramObj1 = name;
066
067 if (name == null) {
068 paramObj1 = new NullWrapper("java.lang.String");
069 }
070
071 Object paramObj2 = new IntegerWrapper(scope);
072
073 Object paramObj3 = primKey;
074
075 if (primKey == null) {
076 paramObj3 = new NullWrapper("java.lang.String");
077 }
078
079 MethodWrapper methodWrapper = new MethodWrapper(ResourceServiceUtil.class.getName(),
080 "getResource",
081 new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
082
083 Object returnObj = null;
084
085 try {
086 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
087 }
088 catch (Exception e) {
089 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
090 throw (com.liferay.portal.kernel.exception.PortalException)e;
091 }
092
093 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
094 throw (com.liferay.portal.kernel.exception.SystemException)e;
095 }
096
097 throw new com.liferay.portal.kernel.exception.SystemException(e);
098 }
099
100 return (com.liferay.portal.model.Resource)returnObj;
101 }
102 catch (com.liferay.portal.kernel.exception.SystemException se) {
103 _log.error(se, se);
104
105 throw se;
106 }
107 }
108
109 private static Log _log = LogFactoryUtil.getLog(ResourceServiceHttp.class);
110 }