logger.info("siteNodeId:" + siteNodeId);
logger.info("languageId:" + languageVO.getLanguageId());
if (url != null)
{
RedirectVO redirectVO = new RedirectVO();
redirectVO.setIsUserManaged(false);
redirectVO.setModifier(principal.getName());
redirectVO.setUrl(url);
redirectVO.setRedirectUrl(redirectUrl);
redirectVO.setSiteNodeId(siteNodeId);
redirectVO.setLanguageId(languageVO.getLanguageId());
Calendar calendar = Calendar.getInstance();
int months = CmsPropertyHandler.getDefaultNumberOfMonthsBeforeSystemRedirectExpire();
calendar.add(Calendar.MONTH, months);
redirectVO.setExpireDateTime(calendar.getTime());
List<RedirectVO> redirectVOList = RedirectController.getController().getSystemManagedRedirectVOList(url, db);
if(redirectVOList.isEmpty())
{
RedirectController.getController().create(redirectVO);
}
else
{
logger.info("A redirect rule already exists for the URL. URL: " + url);
}
}
if (urlWithLangInUrl != null)
{
RedirectVO redirectVOWithLangInUrl = new RedirectVO();
redirectVOWithLangInUrl.setIsUserManaged(false);
redirectVOWithLangInUrl.setModifier(principal.getName());
redirectVOWithLangInUrl.setUrl(urlWithLangInUrl);
redirectVOWithLangInUrl.setRedirectUrl(redirectUrl);
redirectVOWithLangInUrl.setSiteNodeId(siteNodeId);
redirectVOWithLangInUrl.setLanguageId(languageVO.getLanguageId());
List<RedirectVO> redirectVOListWithLangInUrl = RedirectController.getController().getSystemManagedRedirectVOList(urlWithLangInUrl, db);
if(redirectVOListWithLangInUrl.isEmpty())
{
RedirectController.getController().create(redirectVOWithLangInUrl);