|
|
|
@ -19,35 +19,59 @@ import com.liferay.portal.kernel.exception.SystemException;
|
|
|
|
|
import com.liferay.portal.kernel.log.Log; |
|
|
|
|
import com.liferay.portal.kernel.log.LogFactoryUtil; |
|
|
|
|
import com.liferay.portal.kernel.util.StringPool; |
|
|
|
|
import com.liferay.portal.kernel.util.Validator; |
|
|
|
|
import com.liferay.portal.kernel.util.WebKeys; |
|
|
|
|
import com.liferay.portal.theme.ThemeDisplay; |
|
|
|
|
|
|
|
|
|
public class MappeUtil { |
|
|
|
|
private final static Log _log = LogFactoryUtil.getLog(MappeUtil.class); |
|
|
|
|
|
|
|
|
|
public static String getUrlFe(HttpServletRequest request, DettPratica dettPratica, Comune comune) |
|
|
|
|
public static String getUrlFe(HttpServletRequest request, DettPratica dettPratica, Comune comune, boolean readOnly) |
|
|
|
|
throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
|
String baseUrl = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(comune.getCompanyId(), |
|
|
|
|
|
|
|
|
|
ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
|
long companyId = td.getCompanyId(); |
|
|
|
|
|
|
|
|
|
String baseUrl = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, |
|
|
|
|
ConfigurazioneConstants.MAPPE_URL_IFRAME_FE); |
|
|
|
|
return getUrlComune(request, baseUrl, dettPratica, comune); |
|
|
|
|
return getUrlComune(request, baseUrl, dettPratica, comune, readOnly); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String getUrlBo(HttpServletRequest request, DettPratica dettPratica, Comune comune) |
|
|
|
|
public static String getUrlBo(HttpServletRequest request, DettPratica dettPratica, Comune comune, boolean readOnly) |
|
|
|
|
throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
|
String baseUrl = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(comune.getCompanyId(), |
|
|
|
|
|
|
|
|
|
ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
|
long companyId = td.getCompanyId(); |
|
|
|
|
|
|
|
|
|
String baseUrl = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, |
|
|
|
|
ConfigurazioneConstants.MAPPE_URL_IFRAME_BO); |
|
|
|
|
return getUrlComune(request, baseUrl, dettPratica, comune); |
|
|
|
|
return getUrlComune(request, baseUrl, dettPratica, comune, readOnly); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String getUrlComune(HttpServletRequest request, String baseUrl, DettPratica dettPratica, |
|
|
|
|
Comune comune) throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
|
long companyId = comune.getCompanyId(); |
|
|
|
|
Comune comune, boolean readOnly) throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
|
long companyId = td.getCompanyId(); |
|
|
|
|
|
|
|
|
|
String sharedSecret = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, |
|
|
|
|
ConfigurazioneConstants.MAPPE_SHARED_SECRET); |
|
|
|
|
long date = new Date().getTime() / 1000; |
|
|
|
|
String auth = DigestUtils.sha256Hex(date + sharedSecret + request.getServerName()); |
|
|
|
|
|
|
|
|
|
String url = baseUrl.replace("{{COD_BELFIORE}}", urlEncode(comune.getCodiceBelfiore())).replace( |
|
|
|
|
"{{ESTREMI_CAT}}", urlEncode(dettPratica.getEstremiCatastali())); |
|
|
|
|
String url = baseUrl; |
|
|
|
|
|
|
|
|
|
if(Validator.isNotNull(comune)) |
|
|
|
|
url = url.replace("{{COD_BELFIORE}}", urlEncode(comune.getCodiceBelfiore())); |
|
|
|
|
else |
|
|
|
|
url = url.replace("{{COD_BELFIORE}}", ""); |
|
|
|
|
|
|
|
|
|
if(Validator.isNotNull(dettPratica)) |
|
|
|
|
url = url.replace("{{ESTREMI_CAT}}", urlEncode(dettPratica.getEstremiCatastali())); |
|
|
|
|
else |
|
|
|
|
url = url.replace("{{ESTREMI_CAT}}", ""); |
|
|
|
|
|
|
|
|
|
url = url.replace("{{READONLY}}", (readOnly ? "true" : "false")); |
|
|
|
|
|
|
|
|
|
String query = StringPool.BLANK; |
|
|
|
|
String[] parti = StringUtils.split(url, StringPool.QUESTION); |
|
|
|
|