// start setting of list in right rail
  public void rightRailList(
      Node listNode, Element rightListEle, Map<String, String> urlMap, String locale) {
    try {
      Element title;
      Element description;
      Elements headElements = rightListEle.getElementsByTag("h2");
      if (headElements.size() > 1) {
        title = rightListEle.getElementsByTag("h2").last();
        description = rightListEle.getElementsByTag("p").last();
        sb.append("<li>Mismatch in count of list panel component in right rail.</li>");
      } else {
        title = rightListEle.getElementsByTag("h2").first();
        description = rightListEle.getElementsByTag("p").first();
      }
      listNode.setProperty("title", title.text());
      javax.jcr.Node introNode = listNode.getNode("intro");
      introNode.setProperty("paragraph_rte", description.text());
      javax.jcr.Node eleListNode = listNode.getNode("element_list_0");

      Elements ulList = rightListEle.getElementsByTag("ul");
      for (Element element : ulList) {
        java.util.List<String> list = new ArrayList<String>();
        Elements menuLiList = element.getElementsByTag("li");

        for (Element li : menuLiList) {
          JSONObject jsonObjrr = new JSONObject();
          Element listItemAnchor = li.getElementsByTag("a").first();
          String anchorText = listItemAnchor != null ? listItemAnchor.text() : "";
          String anchorHref = listItemAnchor.absUrl("href");
          if (StringUtil.isBlank(anchorHref)) {
            anchorHref = listItemAnchor.attr("href");
          }
          // Start extracting valid href
          log.debug("Before right list LinkUrl" + anchorHref + "\n");
          anchorHref = FrameworkUtils.getLocaleReference(anchorHref, urlMap, locale, sb);
          log.debug("after right list LinkUrl" + anchorHref + "\n");
          // End extracting valid href

          jsonObjrr.put("linktext", anchorText);
          jsonObjrr.put("linkurl", anchorHref);
          jsonObjrr.put("icon", "none");
          jsonObjrr.put("size", "");
          jsonObjrr.put("description", "");
          jsonObjrr.put("openInNewWindow", "false");
          list.add(jsonObjrr.toString());
        }
        eleListNode.setProperty("listitems", list.toArray(new String[list.size()]));
      }
      log.debug("Updated title, descriptoin and linktext at " + listNode.getPath());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 private void migratePrimaryCta(
     Element upperRightElement,
     Node midSizeUpperRightNode,
     String locale,
     Map<String, String> urlMap)
     throws PathNotFoundException, ValueFormatException, VersionException, LockException,
         ConstraintViolationException, RepositoryException {
   if (upperRightElement != null) {
     if (midSizeUpperRightNode.hasNode("primary_cta_v2")) {
       Element title = upperRightElement.getElementsByTag("h3").first();
       Element description = upperRightElement.getElementsByTag("p").first();
       Element link = upperRightElement.getElementsByTag("a").first();
       Node ctaNode = midSizeUpperRightNode.getNode("primary_cta_v2");
       if (title != null) {
         ctaNode.setProperty("title", title.text());
       } else {
         sb.append(Constants.PRIMARY_CTA_TITLE_ELEMENT_NOT_FOUND);
       }
       if (description != null) {
         ctaNode.setProperty("description", description.text());
       } else {
         sb.append(Constants.PRIMARY_CTA_DESCRIPTION_ELEMENT_NOT_FOUND);
       }
       if (link != null) {
         ctaNode.setProperty("linktext", link.text());
         if (ctaNode.hasNode("linkurl")) {
           String aUrl = link.absUrl("href");
           if (aUrl.equals("")) {
             aUrl = link.attr("href");
           }
           aUrl = FrameworkUtils.getLocaleReference(aUrl, urlMap, locale, sb);
           Node linkUrlNode = ctaNode.getNode("linkurl");
           linkUrlNode.setProperty("url", aUrl);
         } else {
           sb.append(Constants.PRIMARY_CTA_LINK_URL_NODE_NOT_FOUND);
         }
       } else {
         sb.append(Constants.PRIMARY_CTA_ANCHOR_ELEMENT_NOT_FOUND);
       }
     } else {
       sb.append(Constants.PRIMARY_CTA_COMPONENT_NOT_FOUND);
     }
   } else {
     sb.append(Constants.PRIMARY_CTA_COMPONENT_INWEB_NOT_FOUND);
   }
 }
 private void migrateFollowUsImage(
     Element followUsEle, Node midSizeLowerRightNode, String locale, Map<String, String> urlMap)
     throws PathNotFoundException, RepositoryException, JSONException {
   if (followUsEle != null) {
     if (midSizeLowerRightNode.hasNode("followus")) {
       Node followUsNode = midSizeLowerRightNode.getNode("followus");
       Element title = followUsEle.getElementsByTag("h2").first();
       if (title != null) {
         followUsNode.setProperty("title", title.text());
       } else {
         sb.append(Constants.FOLLOWUS_TITLE_NOT_FOUND);
       }
       Elements list = followUsEle.getElementsByTag("li");
       if (list != null) {
         List<String> listAdd = new ArrayList<String>();
         for (Element li : list) {
           Element a = li.getElementsByTag("a").first();
           if (a != null) {
             String aURL = a.absUrl("href");
             if (aURL.equals("")) {
               aURL = a.attr("href");
             }
             aURL = FrameworkUtils.getLocaleReference(aURL, urlMap, locale, sb);
             JSONObject obj = new JSONObject();
             obj.put("linktext", a.text());
             obj.put("linkurl", aURL);
             obj.put("icon", li.className());
             listAdd.add(obj.toString());
           } else {
             sb.append(Constants.FOLLOW_US_ANCHOR_ELEMENT_NOT_FOUND);
           }
         }
         followUsNode.setProperty("links", listAdd.toArray(new String[listAdd.size()]));
       } else {
         sb.append(Constants.FOLLOW_US_ANCHOR_ELEMENT_NOT_FOUND);
       }
     } else {
       sb.append(Constants.FOLLOWUS_NODE_NOT_FOUND);
     }
   } else {
     sb.append(Constants.FOLLOWUS_ELEMENT_NOT_FOUND);
   }
 }
  // start setting of spotlight
  public void spotLightTranslate(
      Node slNode, Element spElement, String locale, Map<String, String> urlMap) {
    try {
      Element spotLightTitle = spElement.getElementsByTag("h2").first();
      Element spotLightDescription = spElement.getElementsByTag("p").first();
      Elements spotLightAnchorElements = spElement.getElementsByTag("a");
      Element spotLightAnchor = spotLightAnchorElements.first();

      // start image
      String spotLightImage = FrameworkUtils.extractImagePath(spElement, sb);
      log.debug("spotLightImage " + spotLightImage + "\n");
      if (slNode != null) {
        if (slNode.hasNode("image")) {
          Node spotLightImageNode = slNode.getNode("image");
          String fileReference =
              spotLightImageNode.hasProperty("fileReference")
                  ? spotLightImageNode.getProperty("fileReference").getString()
                  : "";
          spotLightImage =
              FrameworkUtils.migrateDAMContent(spotLightImage, fileReference, locale, sb);
          log.debug("spotLightImage " + spotLightImage + "\n");
          if (StringUtils.isNotBlank(spotLightImage)) {
            spotLightImageNode.setProperty("fileReference", spotLightImage);
          } else {
            sb.append("<li> Image not found for spot light component on locale page. </li>");
          }
        } else {
          sb.append("<li>spotlight image node doesn't exist</li>");
        }
      }
      // end image

      if (spotLightDescription.getElementsByTag("a") != null
          && !spotLightDescription.getElementsByTag("a").isEmpty()) {
        slNode.setProperty("description", spotLightDescription.html());
        // start
        if (spotLightAnchorElements.size() > 1) {
          spotLightAnchor = spotLightAnchorElements.get(1);
        } else {
          spotLightAnchor = null;
          sb.append(
              "<li>Link is not found on locale page for the spotlight component. This needs to be deleted manually.</li>");
        }
        // end
      } else {
        slNode.setProperty("description", spotLightDescription.text());
      }

      if (spotLightAnchor != null) {
        String linkText = spotLightAnchor.text();
        String linkUrl = spotLightAnchor.absUrl("href");
        if (StringUtil.isBlank(linkUrl)) {
          linkUrl = spotLightAnchor.attr("href");
        }
        // Start extracting valid href
        log.debug("Before spotlight LinkUrl" + linkUrl + "\n");
        linkUrl = FrameworkUtils.getLocaleReference(linkUrl, urlMap, locale, sb);
        log.debug("after spotlight LinkUrl" + linkUrl + "\n");
        // End extracting valid href
        slNode.setProperty("linktext", linkText);
        javax.jcr.Node ctaNode = slNode.getNode("cta");
        if (ctaNode != null) {
          if (linkUrl != null) {
            //						ctaNode.setProperty("linktype", "Url");
            ctaNode.setProperty("url", linkUrl);
          }
        }
      }

      if (spotLightTitle != null) {
        Elements spotLightLink = spotLightTitle.getElementsByTag("a");
        if (spotLightLink.isEmpty()) {
          slNode.setProperty("title", spotLightTitle.text());
        } else {
          Element spotLightLinkEle = spotLightLink.first();
          String slLinkText = spotLightLinkEle.text();
          String slLinkUrl = spotLightLinkEle.absUrl("href");
          if (StringUtil.isBlank(slLinkUrl)) {
            slLinkUrl = spotLightLinkEle.attr("href");
          }
          // Start extracting valid href
          log.debug("Before spotlight LinkUrl" + slLinkUrl + "\n");
          slLinkUrl = FrameworkUtils.getLocaleReference(slLinkUrl, urlMap, locale, sb);
          log.debug("after spotlight LinkUrl" + slLinkUrl + "\n");
          // End extracting valid href
          slNode.setProperty("title", slLinkText);
          javax.jcr.Node titleLinkNode = slNode.getNode("titlelink");
          if (titleLinkNode != null) {
            if (slLinkUrl != null) {
              titleLinkNode.setProperty("linktype", "Url");
              titleLinkNode.setProperty("url", slLinkUrl);
            }
          }
        }
      }
      log.debug("Updated title, descriptoin and linktext at " + slNode.getPath());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  // start setting of selectorbar
  public void selectorBarTranslate(
      Node selectorBarPanelNode, Element ele, Map<String, String> urlMap, String locale) {

    try {
      String title = (ele != null ? ele.getElementsByTag("a").first().text() : "");
      String titleUrl = ele.getElementsByTag("a").first().absUrl("href");
      if (StringUtil.isBlank(titleUrl)) {
        titleUrl = ele.getElementsByTag("a").first().attr("href");
      }
      // Start extracting valid href
      log.debug("Before selector bar title LinkUrl" + titleUrl + "\n");
      titleUrl = FrameworkUtils.getLocaleReference(titleUrl, urlMap, locale, sb);
      log.debug("after selector bar title LinkUrl" + titleUrl + "\n");
      // End extracting valid href
      log.debug("selector component titleUrl: " + titleUrl);
      selectorBarPanelNode.setProperty("title", title);
      selectorBarPanelNode.setProperty("titleurl", titleUrl);
      if (ele.childNodeSize() >= 2) {
        log.debug("Child node size is greater than 1.");
        if (ele.select("div.menu").isEmpty()) {
          log.debug("Menu is not available.");
          sb.append(
              "<li>Selector bar drop down menu elements does not exist on the locale page.</li>");
        } else {
          log.debug("Menu is available.");
          Element menuEle = ele.child(1);
          if (menuEle != null) {
            log.debug("selector component menuEle: " + menuEle.toString());
            Element anchor = menuEle.getElementsByTag("a").last();
            String allLinkText = anchor != null ? anchor.text() : "";
            String allLinkUrl = anchor != null ? anchor.absUrl("href") : "";
            if (StringUtil.isBlank(allLinkUrl)) {
              allLinkUrl = anchor.attr("href");
            }
            // Start extracting valid href
            log.debug("Before selector bar menu LinkUrl" + allLinkUrl + "\n");
            allLinkUrl = FrameworkUtils.getLocaleReference(allLinkUrl, urlMap, locale, sb);
            log.debug("after selector bar menu LinkUrl" + allLinkUrl + "\n");
            // End extracting valid href
            selectorBarPanelNode.setProperty("alllinktext", allLinkText);
            selectorBarPanelNode.setProperty("alllinkurl", allLinkUrl);

            Elements menuUlList = menuEle.getElementsByTag("ul");
            for (Element element : menuUlList) {
              java.util.List<String> list = new ArrayList<String>();
              Elements menuLiList = element.getElementsByTag("li");
              System.out.println(menuLiList.size());

              for (Element li : menuLiList) {
                JSONObject jsonObj = new JSONObject();
                Element listItemAnchor = li.getElementsByTag("a").first();
                String anchorText = listItemAnchor != null ? listItemAnchor.text() : "";
                String anchorHref = listItemAnchor.absUrl("href");
                if (StringUtil.isBlank(anchorHref)) {
                  anchorHref = listItemAnchor.attr("href");
                }
                // Start extracting valid href
                log.debug("Before selectorbarLinkUrl" + anchorHref + "\n");
                anchorHref = FrameworkUtils.getLocaleReference(anchorHref, urlMap, locale, sb);
                log.debug("after selectorbarLinkUrl" + anchorHref + "\n");
                // End extracting valid href

                jsonObj.put("linktext", anchorText);
                jsonObj.put("linkurl", anchorHref);
                jsonObj.put("size", "");
                list.add(jsonObj.toString());
              }

              selectorBarPanelNode.setProperty("panelitems", list.toArray(new String[list.size()]));
            }
          } else {
            sb.append(
                "<li>Selector bar drop down menu elements does not exist on the locale page.</li>");
          }
        }
      } else {
        sb.append(
            "<li>Selector bar drop down menu elements does not exist on the locale page.</li>");
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  // start setting of heropanel
  public void heroPanelTranslate(
      Node heroPanelNode,
      Element ele,
      String locale,
      Map<String, String> urlMap,
      int imageSrcEmptyCount) {

    try {
      String title = ele.getElementsByTag("h2") != null ? ele.getElementsByTag("h2").text() : "";
      String desc =
          ele.getElementsByTag("p") != null ? ele.getElementsByTag("p").first().text() : "";

      Element anchor = ele.getElementsByTag("a").first();
      String anchorText = anchor != null ? anchor.text() : "";
      String anchorHref = anchor.absUrl("href");
      if (StringUtil.isBlank(anchorHref)) {
        anchorHref = anchor.attr("href");
      }
      // Start extracting valid href
      log.debug("Before heroPanelLinkUrl" + anchorHref + "\n");
      anchorHref = FrameworkUtils.getLocaleReference(anchorHref, urlMap, locale, sb);
      log.debug("after heroPanelLinkUrl" + anchorHref + "\n");
      // End extracting valid href

      // start image
      String heroImage = FrameworkUtils.extractImagePath(ele, sb);
      log.debug("heroImage before migration : " + heroImage + "\n");
      if (heroPanelNode != null) {
        Node heroPanelPopUpNode = null;
        Element lightBoxElement = null;
        Elements lightBoxElements = ele.select("div.c50-image").select("a.c26v4-lightbox");
        heroPanelPopUpNode = FrameworkUtils.getHeroPopUpNode(heroPanelNode);
        lightBoxElements =
            !lightBoxElements.isEmpty()
                ? lightBoxElements
                : ele.select("div.c50-text").select("a.c26v4-lightbox");

        if (lightBoxElements != null && !lightBoxElements.isEmpty()) {
          lightBoxElement = lightBoxElements.first();
        }

        if (heroPanelPopUpNode == null && lightBoxElement != null) {
          sb.append(
              "<li>video pop up is present in WEB page but it is not present in WEM page.</li>");
        }
        if (heroPanelPopUpNode != null && lightBoxElement == null) {
          sb.append(
              "<li>video pop up is present in WEM page but it is not present in WEB page.</li>");
        }
        if (heroPanelPopUpNode != null
            && lightBoxElement != null
            && StringUtils.isNotBlank(title)) {
          heroPanelPopUpNode.setProperty("popupHeader", title);
        }

        if (heroPanelNode.hasNode("image")) {
          Node imageNode = heroPanelNode.getNode("image");
          String fileReference =
              imageNode.hasProperty("fileReference")
                  ? imageNode.getProperty("fileReference").getString()
                  : "";
          heroImage = FrameworkUtils.migrateDAMContent(heroImage, fileReference, locale, sb);
          log.debug("heroImage after migration : " + heroImage + "\n");
          if (StringUtils.isNotBlank(heroImage)) {
            imageNode.setProperty("fileReference", heroImage);
          } else {
            imageSrcEmptyCount++;
          }
        } else {
          sb.append("<li>hero image node doesn't exist</li>");
        }

        heroPanelNode.setProperty("title", title);
        heroPanelNode.setProperty("description", desc);
        heroPanelNode.setProperty("linktext", anchorText);
        heroPanelNode.setProperty("linkurl", anchorHref);
      }
      // end image
      if (imageSrcEmptyCount > 0) {
        sb.append(
            "<li> "
                + imageSrcEmptyCount
                + " image(s) are not found on hero elements on locale page.</li>");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public String translate(
      String host,
      String loc,
      String prod,
      String type,
      String catType,
      String locale,
      Session session,
      Map<String, String> urlMap)
      throws IOException, ValueFormatException, VersionException, LockException,
          ConstraintViolationException, RepositoryException {

    log.debug("In the translate method");
    log.debug("In the translate method, catType is :" + catType);
    String pagePropertiesPath = "/content/<locale>/" + catType + "/<prod>/index/jcr:content";
    String indexLeft =
        "/content/<locale>/"
            + catType
            + "/<prod>/index/jcr:content/content_parsys/overview/layout-overview/gd12v2/gd12v2-left";
    String indexRight =
        "/content/<locale>/"
            + catType
            + "/<prod>/index/jcr:content/content_parsys/overview/layout-overview/gd12v2/gd12v2-right";

    String pageUrl = host + "/content/<locale>/" + catType + "/<prod>/index.html";
    pageUrl = pageUrl.replace("<locale>", locale).replace("<prod>", prod);
    pagePropertiesPath = pagePropertiesPath.replace("<locale>", locale).replace("<prod>", prod);
    sb.append("<td>" + "<a href=" + pageUrl + ">" + pageUrl + "</a>" + "</td>");
    sb.append("<td>" + "<a href=" + loc + ">" + loc + "</a>" + "</td>");
    sb.append("<td><ul>");

    indexLeft = indexLeft.replace("<locale>", locale).replace("<prod>", prod);
    indexRight = indexRight.replace("<locale>", locale).replace("<prod>", prod);

    javax.jcr.Node indexLeftNode = null;
    javax.jcr.Node indexRightNode = null;
    javax.jcr.Node pageJcrNode = null;
    try {
      indexLeftNode = session.getNode(indexLeft);
      indexRightNode = session.getNode(indexRight);
      pageJcrNode = session.getNode(pagePropertiesPath);
      try {
        //				doc = Jsoup.connect(loc).get();
        doc = getConnection(loc);

        if (doc != null) {
          log.debug("Connected to the provided URL");
          // ------------------------------------------------------------------------------------------------------------------------------------------
          // start set page properties.

          FrameworkUtils.setPageProperties(pageJcrNode, doc, session, sb);

          // end set page properties.
          // ------------------------------------------------------------------------------------------------------------------------------------------

          // start set hero large component properties.
          try {
            log.debug("Start of Hero component");
            Elements heroElements = doc.select("div.frame");
            Node heroNode =
                indexLeftNode.hasNode("hero_large") ? indexLeftNode.getNode("hero_large") : null;

            if (heroNode != null) {
              log.debug("hero node found: " + heroNode.getPath());
              if (heroElements.isEmpty()) {
                log.debug("No hero element found with div class name frame.");
                sb.append(
                    "<li>Hero component with class name 'frame' does not exist on locale page.</li>");
              } else {
                int eleSize = heroElements.size();
                log.debug("hero node element size: " + eleSize);
                NodeIterator heroPanelNodeIterator = heroNode.getNodes("heropanel*");
                int nodeSize = (int) heroPanelNodeIterator.getSize();
                log.debug("hero node nodeSize : " + nodeSize);
                if (eleSize == nodeSize) {
                  setForHero(heroElements, heroNode, locale, urlMap);
                } else if (nodeSize < eleSize) {
                  setForHero(heroElements, heroNode, locale, urlMap);
                  sb.append(
                      "<li>Mismatch in the count of hero panels. Additional panel(s) found on locale page. Locale page has "
                          + eleSize
                          + " panels and there are "
                          + nodeSize
                          + " nodes.</li>");
                } else if (nodeSize > eleSize) {
                  setForHero(heroElements, heroNode, locale, urlMap);
                  sb.append(
                      "<li>Mismatch in the count of hero panels. Additional node(s) found. Locale page has "
                          + eleSize
                          + " panels and there are "
                          + nodeSize
                          + " nodes.</li>");
                }
              }
            } else {
              log.debug("No hero node found at " + indexLeftNode);
              sb.append("<li>Node for hero large component does not exist.</li>");
            }
            log.debug("End of Hero component");

          } catch (Exception e) {
            sb.append("<li>Unable to update hero large component.</li>");
          }

          // end set Hero Large component properties.

          // start set selectorbar large component properties.
          try {
            Elements selectorBarLargeElements = doc.select("div.selectorbarpanel");
            if (selectorBarLargeElements.size() == 0) {
              selectorBarLargeElements =
                  doc.select("div.c58-pilot")
                      .select("div.left,div.mid,div.right"); // ("div.selectorbarpanel");
            }

            Node selectorBarNode =
                indexLeftNode.hasNode("selectorbarlarge_0")
                    ? indexLeftNode.getNode("selectorbarlarge_0")
                    : null;

            if (selectorBarNode != null) {
              if (selectorBarLargeElements.isEmpty()) {
                log.debug("No selector bar element found with div class name selectorbarpanel.");
                sb.append(
                    "<li>Selector bar component with class name 'selectorbarpanel' does not exist on locale page.</li>");
              } else {
                log.debug("selector bar node component found at : " + indexLeftNode.getPath());
                int eleSize = selectorBarLargeElements.size();
                log.debug("selector component element size: " + eleSize);
                NodeIterator selectorBarPanel = selectorBarNode.getNodes("selectorbarpanel*");
                int nodeSize = (int) selectorBarPanel.getSize();
                log.debug("selector component nodeSize : " + nodeSize);
                if (eleSize == nodeSize) {
                  for (Element ele : selectorBarLargeElements) {
                    Node selectorBarPanelNode;
                    if (selectorBarPanel.hasNext()) {
                      selectorBarPanelNode = (Node) selectorBarPanel.next();
                      selectorBarTranslate(selectorBarPanelNode, ele, urlMap, locale);
                    } else {
                      log.debug("Next node not found");
                    }
                  }
                } else if (eleSize > nodeSize) {
                  for (Element ele : selectorBarLargeElements) {
                    Node selectorBarPanelNode;
                    if (selectorBarPanel.hasNext()) {
                      selectorBarPanelNode = (Node) selectorBarPanel.next();
                      selectorBarTranslate(selectorBarPanelNode, ele, urlMap, locale);
                    } else {
                      log.debug("Next node not found");
                      sb.append(
                          "<li>Mismatch in the count of selector bar panel. Additional panel(s) found on locale page. Locale page has "
                              + eleSize
                              + " panels and there are "
                              + nodeSize
                              + " nodes.</li>");
                      break;
                    }
                  }

                } else if (eleSize < nodeSize) {
                  for (Element ele : selectorBarLargeElements) {
                    Node selectorBarPanelNode;
                    if (selectorBarPanel.hasNext()) {
                      selectorBarPanelNode = (Node) selectorBarPanel.next();
                      selectorBarTranslate(selectorBarPanelNode, ele, urlMap, locale);
                    }
                  }
                  sb.append(
                      "<li>Mismatch in the count of selector bar panels. Additional node(s) found. Locale page has "
                          + eleSize
                          + " panels and there are "
                          + nodeSize
                          + " nodes.</li>");
                }
              }
            } else {
              log.debug("No selector bar node found at " + indexLeftNode);
              sb.append("<li>Node for selector bar component does not exist.</li>");
            }
          } catch (Exception e) {
            sb.append("<li>Unable to update Selecotr bar large component." + e + "</li>");
          }

          // end set Selector bar.
          // Start of button
          Node textNode2 = null;
          try {
            textNode2 =
                indexLeftNode.hasNode("gd22v2")
                    ? indexLeftNode.getNode("gd22v2").getNode("gd22v2-right")
                    : null;
            Element a00v1CqElement =
                !doc.select("div.cl-grids").isEmpty()
                    ? !doc.select("div.cl-grids").select("div.a00v1-cq").isEmpty()
                        ? doc.select("div.cl-grids").select("div.a00v1-cq").first()
                        : null
                    : null;
            if (a00v1CqElement == null) {
              a00v1CqElement =
                  !doc.select("div.cl-grids").isEmpty()
                      ? !doc.select("div.cl-grids").select("a.a00v1").isEmpty()
                          ? doc.select("div.cl-grids").select("a.a00v1").first()
                          : null
                      : null;
            }
            if (textNode2 != null) {
              Node buttonNode = textNode2.getNode("a00v1_cq");
              if (buttonNode != null) {
                if (a00v1CqElement != null) {
                  Element cqAnchor = a00v1CqElement.getElementsByTag("a").first();
                  String anchorText = cqAnchor != null ? cqAnchor.text() : "";
                  String anchorHref = cqAnchor.absUrl("href");
                  if (StringUtil.isBlank(anchorHref)) {
                    anchorHref = cqAnchor.attr("href");
                  }
                  // Start extracting valid href
                  log.debug("Before ButtonLinkUrl" + anchorHref + "\n");
                  anchorHref = FrameworkUtils.getLocaleReference(anchorHref, urlMap, locale, sb);
                  log.debug("after ButtonLinkUrl" + anchorHref + "\n");
                  // End extracting valid href
                  buttonNode.setProperty("linkText", anchorText);
                  buttonNode.setProperty("linkUrl", anchorHref);
                  a00v1CqElement.remove();
                  //
                  //	doc.select("div.gd22v2-right").first().getElementsByTag("ul").first().remove();
                } else {
                  sb.append("<li>Button is not available on the locale page.</li>");
                  log.debug("This button does not exist.");
                }
              } else {
                if (a00v1CqElement != null) {
                  sb.append("<li>Additional button is available on the locale page.</li>");
                }
              }
            } else {
              if (a00v1CqElement != null) {
                sb.append("<li>Additional button is available on the locale page.</li>");
              }
            }
          } catch (Exception e) {
            sb.append("<li>Unable to update button component." + e + "</li>");
          }
          // End of button
          // start of text component
          try {
            Elements textElements = doc.select("div.gd-left").select("div.c00-pilot");
            Node textNode1 =
                indexLeftNode.hasNode("gd22v2")
                    ? indexLeftNode.getNode("gd22v2").getNode("gd22v2-left").getNode("text")
                    : indexLeftNode.getNode("text");
            if (textNode1 != null) {
              if (textElements.isEmpty()) {
                sb.append("<li>The first text element is not available on the locale page.</li>");
              } else {
                if (textElements.first().html() != null) {
                  textNode1.setProperty("text", textElements.first().html());
                } else {
                  sb.append("<li>The first text element is not available on the locale page.</li>");
                }
              }

            } else {
              if (textElements.first().html() != null) {
                sb.append("<li>The first text node is not available on the locale page.</li>");
              }
            }

            if (textNode2 != null) {
              Node textChildNode = textNode2.hasNode("text") ? textNode2.getNode("text") : null;
              if (textElements.size() >= 2) {
                if (textElements.get(1).html() != null) {
                  textChildNode.setProperty("text", textElements.get(1).html());
                } else {
                  sb.append(
                      "<li>The second text element is not available on the locale page.</li>");
                }
              } else {
                sb.append("<li>The second text element is not available on the locale page.</li>");
              }

            } else {
              if (textElements.size() >= 2) {
                if (textElements.get(1).html() != null) {
                  sb.append("<li>The second text node is not available on the locale page.</li>");
                }
              }
            }

          } catch (Exception e) {
            log.error("Exception " + e);
            sb.append("<li>Unable to update text components.</li>");
          }
          // end of text component

          // start set spotlight component.
          try {
            Elements spotLightElements = doc.select("div.c11-pilot");

            if (indexLeftNode != null) {
              log.debug("Spotlight node found: " + indexLeftNode.getPath());
              if (spotLightElements.isEmpty()) {
                log.debug("No spot light element found with div class name c11-pilot.");
                sb.append(
                    "<li>Spot light component with class name 'c11-pilot' does not exist on locale page.</li>");
              } else {
                int eleSize = spotLightElements.size();
                log.debug("Spotlight node element size: " + eleSize);
                NodeIterator slNodeIterator = indexLeftNode.getNodes("spotlight_large_v2*");
                int nodeSize = (int) slNodeIterator.getSize();
                log.debug("Spotlight node nodeSize : " + nodeSize);
                if (eleSize == nodeSize) {
                  for (Element spElement : spotLightElements) {
                    Node slNode;
                    if (slNodeIterator.hasNext()) {
                      slNode = (Node) slNodeIterator.next();
                      spotLightTranslate(slNode, spElement, locale, urlMap);
                    } else {
                      log.debug("Next node not found");
                    }
                  }
                } else if (nodeSize < eleSize) {
                  for (Element spElement : spotLightElements) {
                    Node slNode;
                    if (slNodeIterator.hasNext()) {
                      slNode = (Node) slNodeIterator.next();
                      spotLightTranslate(slNode, spElement, locale, urlMap);
                    } else {
                      log.debug("Next node not found");
                      sb.append(
                          "<li>Mismatch in the count of spot light panels. Additional panel(s) found on locale page. Locale page has "
                              + eleSize
                              + " panels and there are "
                              + nodeSize
                              + " nodes.</li>");
                      break;
                    }
                  }

                } else if (nodeSize > eleSize) {
                  for (Element spElement : spotLightElements) {
                    Node slNode;
                    if (slNodeIterator.hasNext()) {
                      slNode = (Node) slNodeIterator.next();
                      spotLightTranslate(slNode, spElement, locale, urlMap);
                    } else {
                      log.debug("Next node not found");
                    }
                  }
                  sb.append(
                      "<li>Mismatch in the count of spot light panels. Additional node(s) found. Locale page has "
                          + eleSize
                          + " panels and there are "
                          + nodeSize
                          + " nodes.</li>");
                }
              }

            } else {
              log.debug("No spot light node found at " + indexLeftNode);
              sb.append("<li>Node for spot light component does not exist.</li>");
            }
          } catch (Exception e) {
            sb.append("<li>Unable to update Spot light component.</li>");
            log.error("Exception : " + e);
          }
          // end set spotlight properties.

          // start right rail properties
          try {
            boolean migrate = true;
            Elements rightRailList =
                doc.select("div.gd-right").select("div.mlb-pilot").select("div.c00-pilot");

            if (rightRailList.isEmpty()) {
              rightRailList = doc.select("div.gd-right").select("div.n13-pilot");
              if (rightRailList != null) {
                int eleSize = rightRailList.size();
                if (eleSize == 1) {
                  Element rightListElem = rightRailList.first();
                  if (rightListElem != null) {
                    Elements ulElements = rightListElem.getElementsByTag("ul");
                    if (ulElements.size() > 1) {
                      sb.append(
                          "<li>The HTML structure for list component in right rail on the locale page is different and hence migration needs to be done manually.</li>");
                      migrate = false;
                    }
                  }
                }
              }
            }

            if (migrate) {
              if (rightRailList.isEmpty()) {
                log.debug(
                    "No right rail elements found with div class name c00-pilot or n13-pilot.");
                sb.append(
                    "<li>Right rail component with class name 'c00-pilot' or 'n13-pilot' does not exist on locale page.</li>");
              } else {
                int eleSize = rightRailList.size();
                NodeIterator listIterator = indexRightNode.getNodes("list*");
                int nodeSize = (int) listIterator.getSize();

                if (eleSize == nodeSize) {
                  for (Element rightListEle : rightRailList) {
                    Node listNode;
                    if (listIterator.hasNext()) {
                      listNode = (Node) listIterator.next();
                      rightRailList(listNode, rightListEle, urlMap, locale);
                    }
                  }
                } else if (eleSize > nodeSize) {
                  for (Element rightListEle : rightRailList) {
                    Node listNode;
                    if (listIterator.hasNext()) {
                      listNode = (Node) listIterator.next();
                      rightRailList(listNode, rightListEle, urlMap, locale);
                    }
                  }
                  sb.append(
                      "<li>Mismatch in the count of list panels. Additional panel(s) found on locale page. Locale page has "
                          + eleSize
                          + " panels and there are "
                          + nodeSize
                          + " nodes.</li>");
                } else if (eleSize < nodeSize) {
                  for (Element rightListEle : rightRailList) {
                    Node listNode;
                    if (listIterator.hasNext()) {
                      listNode = (Node) listIterator.next();
                      rightRailList(listNode, rightListEle, urlMap, locale);
                    }
                  }
                  sb.append(
                      "<li>Mismatch in the count of list panels. Additional node(s) found. Locale page has "
                          + eleSize
                          + " panels and there are "
                          + nodeSize
                          + " nodes.</li>");
                }
              }
            }

          } catch (Exception e) {
            sb.append("<li>Unable to update benefits tile_bordered component.</li>");
            log.error("Exception : ", e);
          }
          // end set index list.

          // start of follow us component
          try {
            String h2Content = "";
            boolean followUsEle = true;
            boolean followUsNode = true;
            List<String> list = new ArrayList<String>();
            Elements rightRailPilotElements = doc.select("div.gd-right").select("div.s14-pilot");
            if (rightRailPilotElements != null) {
              Element rightRailPilotElement = rightRailPilotElements.first();
              if (rightRailPilotElement != null) {
                Elements h2Elements = rightRailPilotElement.getElementsByTag("h2");
                if (h2Elements != null) {
                  Element h2Element = h2Elements.first();
                  h2Content = h2Element.text();
                } else {
                  sb.append("<li>h2 of right rail with class 'div.s14-pilot' is blank.</li>");
                }
                Elements liElements = rightRailPilotElement.getElementsByTag("li");
                for (Element ele : liElements) {
                  JSONObject obj = new JSONObject();
                  String icon = ele.attr("class");
                  obj.put("icon", icon);
                  Elements aElements = ele.getElementsByTag("a");
                  if (aElements != null) {
                    Element aElement = aElements.first();
                    String title = aElement.attr("title");
                    String href = aElement.absUrl("href");
                    if (StringUtil.isBlank(href)) {
                      href = aElement.attr("href");
                    }
                    // Start extracting valid href
                    log.debug("Before pilotLinkUrl" + href + "\n");
                    href = FrameworkUtils.getLocaleReference(href, urlMap, locale, sb);
                    log.debug("after pilotLinkUrl" + href + "\n");
                    // End extracting valid href
                    obj.put("linktext", title);
                    obj.put("linkurl", href);
                  } else {
                    sb.append("<li>No anchor tag found in the right rail social links</li>");
                  }
                  list.add(obj.toString());
                }
              } else {
                followUsEle = false;
              }
            } else {
              followUsEle = false;
            }

            if (indexRightNode.hasNode("followus")) {
              Node followus = indexRightNode.getNode("followus");
              if (StringUtils.isNotBlank(h2Content)) {
                followus.setProperty("title", h2Content);
              }

              if (list.size() > 1) {
                followus.setProperty("links", list.toArray(new String[list.size()]));
              }

            } else {
              followUsNode = false;
            }

            if (followUsEle) {
              if (followUsNode) {
                log.debug("Follow us element and node are available.");
              } else {
                sb.append(
                    "<li>Additional follow us element found in right rail on the locale page.</li>");
              }
            } else {
              if (followUsNode) {
                sb.append("<li>No follow us element found in right rail on the locale page.</li>");

              } else {
                log.debug("Follow us element and node are not available.");
              }
            }

          } catch (Exception e) {
            sb.append("<li>Unable to update follow us component.</li>");
            log.error("Exception : ", e);
          }

          // end of follow us component
          // start of image
          Elements aEle =
              !doc.select("div.gd12-pilot").select("div.gd-right").isEmpty()
                  ? doc.select("div.gd12-pilot").select("div.gd-right").select("a")
                  : null;
          log.debug("Image check:" + aEle);
          if (!aEle.isEmpty() && aEle != null) {
            for (Element aEl : aEle) {
              Element imgEle = aEl.getElementsByTag("img").first();
              if (imgEle != null) {
                sb.append("<li>Extra Image found in web page.</li>");
              }
            }
          }
          /*if(aEle != null && !aEle.isEmpty() && aEle.size() > 1){
          	sb.append("<li>Extra Image found in web page.</li>");
          }*/
          // end of image
          // start of c42-pilot component
          Elements c42Ele = doc.select("div.c42-pilot");
          if (!c42Ele.isEmpty()) {
            sb.append("<li>Extra component mbwtile found on web page</li>");
          }
          // end of c42-pilot component
        } else {
          sb.append(Constants.URL_CONNECTION_EXCEPTION);
        }
      } catch (Exception e) {
        //				doc = getConnection(loc);
        log.error("Exception : ", e);
      }

    } catch (Exception e) {
      sb.append("<li>Exception " + e + "</li>");
    }

    sb.append("</ul></td>");
    session.save();
    return sb.toString();
  }
 private void migrateHero(
     Element heroElement,
     Node sBHeroNode,
     String locale,
     Map<String, String> urlMap,
     String catType,
     String type)
     throws PathNotFoundException, RepositoryException, JSONException {
   if (heroElement != null) {
     Elements heroEles = heroElement.getElementsByClass("frame");
     if (heroEles != null) {
       int eleSize = heroEles.size();
       NodeIterator heroNodes =
           sBHeroNode.hasNode("hero_panel") ? sBHeroNode.getNodes("hero_panel*") : null;
       if (heroNodes != null) {
         int size = (int) heroNodes.getSize();
         for (Element heroEle : heroEles) {
           if (heroNodes.hasNext()) {
             Node heroPanelNode = heroNodes.nextNode();
             Element title = heroEle.getElementsByTag("h2").first();
             Element description = heroEle.getElementsByTag("p").first();
             Element anchor = heroEle.getElementsByTag("a").first();
             if (title != null) {
               heroPanelNode.setProperty("title", title.text());
             } else {
               sb.append(Constants.HERO_CONTENT_HEADING_ELEMENT_DOESNOT_EXISTS);
             }
             if (description != null) {
               heroPanelNode.setProperty("description", description.text());
             } else {
               sb.append(Constants.HERO_CONTENT_DESCRIPTION_ELEMENT_DOESNOT_EXISTS);
             }
             if (anchor != null) {
               heroPanelNode.setProperty("linktext", anchor.text());
               if (heroPanelNode.hasNode("cta")) {
                 Node ctaNode = heroPanelNode.getNode("cta");
                 String aUrl = anchor.absUrl("href");
                 if (StringUtils.isBlank(aUrl)) {
                   aUrl = anchor.attr("href");
                 }
                 aUrl = FrameworkUtils.getLocaleReference(aUrl, urlMap, locale, sb);
                 if (!aUrl.equals("") && !aUrl.isEmpty()) {
                   ctaNode.setProperty("url", aUrl);
                 } else {
                   sb.append(Constants.HERO_CONTENT_ANCHOR_LINK_IS_BLANK);
                 }
               } else {
                 sb.append(Constants.HERO_COMPONENT_CTA_NODE_NOT_FOUND);
               }
             } else {
               sb.append(Constants.HERO_CONTENT_ANCHOR_ELEMENT_DOESNOT_EXISTS);
             }
             if (heroPanelNode.hasNode("image")) {
               Node imageNode = heroPanelNode.getNode("image");
               String fileReference = FrameworkUtils.extractImagePath(heroEle, sb);
               fileReference = FrameworkUtils.migrateDAMContent(fileReference, "", locale, sb);
               if (!fileReference.equals("")) {
                 imageNode.setProperty("fileReference", fileReference);
               } else {
                 sb.append(Constants.HERO_CONTENT_IMAGE_LINK_IS_BLANK);
               }
             } else {
               sb.append(Constants.HERO_CONTENT_IMAGE_NODE_NOT_FOUND);
             }
           } else {
             sb.append(
                 Constants.MISMATCH_IN_HERO_SLIDES
                     + "Element size is "
                     + eleSize
                     + " and panel nodes are "
                     + size);
           }
         }
         if (heroNodes.hasNext()) {
           sb.append(
               Constants.MISMATCH_IN_HERO_SLIDES
                   + "Element size is "
                   + eleSize
                   + " and panel nodes are "
                   + size);
         }
       } else {
         sb.append(Constants.HERO_CONTENT_NODE_NOT_FOUND);
       }
     } else {
       sb.append(Constants.HERO_CONTENT_PANEL_ELEMENT_NOT_FOUND);
     }
   } else {
     sb.append(Constants.HERO_CONTENT_PANEL_ELEMENT_NOT_FOUND);
   }
 }
 private void migrateTopList(
     Element listEle,
     Node sBTopRightNode,
     String locale,
     Map<String, String> urlMap,
     String catType,
     String type)
     throws ValueFormatException, VersionException, LockException, ConstraintViolationException,
         RepositoryException {
   if (listEle != null) {
     Element title = listEle.getElementsByTag("a").first();
     if (title != null) {
       sBTopRightNode.setProperty("title", title.text());
     } else {
       sb.append(Constants.LIST_HEADING_COMPONENT_NOT_FOUND);
     }
     Element ul = listEle.getElementsByTag("ul").first();
     if (ul != null) {
       if (sBTopRightNode.hasNode("list_item_parsys")) {
         Node list_item_parsysNode = sBTopRightNode.getNode("list_item_parsys");
         if (list_item_parsysNode.hasNode("list_content")) {
           Node list_contentNode = list_item_parsysNode.getNode("list_content");
           if (list_contentNode.hasNode("listitems")) {
             Node listitemsNode = list_contentNode.getNode("listitems");
             NodeIterator itemsNode =
                 listitemsNode.hasNode("item_1") ? listitemsNode.getNodes("item_*") : null;
             if (itemsNode != null) {
               int size = (int) itemsNode.getSize();
               Elements liEles = ul.getElementsByTag("li");
               if (liEles != null) {
                 int eleSize = liEles.size();
                 for (Element li : liEles) {
                   if (itemsNode.hasNext()) {
                     Node itemNode = itemsNode.nextNode();
                     if (itemNode.hasNode("linkdata")) {
                       Node linkdataNode = itemNode.getNode("linkdata");
                       Element anchor = li.getElementsByTag("a").first();
                       if (anchor != null) {
                         linkdataNode.setProperty("linktext", anchor.text());
                         String aUrl = anchor.absUrl("href");
                         if (StringUtils.isBlank(aUrl)) {
                           aUrl = anchor.attr("href");
                         }
                         aUrl = FrameworkUtils.getLocaleReference(aUrl, urlMap, locale, sb);
                         if (!aUrl.isEmpty() && !aUrl.equals("")) {
                           linkdataNode.setProperty("url", aUrl);
                         } else {
                           sb.append(Constants.LINK_URL_NOT_FOUND_IN_LIST);
                         }
                       } else {
                         sb.append(Constants.LIST_ANCHOR_ELEMENTS_NOT_FOUND);
                       }
                     } else {
                       sb.append(Constants.LINK_DATA_NODE_FOR_LIST_NOT_FOUND);
                     }
                   } else {
                     sb.append(
                         Constants.MISMATCH_IN_LIST_ELEMENT
                             + eleSize
                             + Constants.LIST_NODES_COUNT
                             + size
                             + ".</li>");
                   }
                 }
                 if (itemsNode.hasNext()) {
                   sb.append(
                       Constants.MISMATCH_IN_LIST_NODES
                           + eleSize
                           + Constants.LIST_NODES_COUNT
                           + size
                           + ".</li>");
                 }
               } else {
                 sb.append(Constants.LIST_ELEMENT_NOT_FOUND);
               }
             } else {
               sb.append(Constants.LIST_ITEM_NODE_NOT_FOUND);
             }
           } else {
             sb.append(Constants.LIST_NODE_NOT_FOUND);
           }
         } else {
           sb.append(Constants.LIST_NODE_NOT_FOUND);
         }
       } else {
         sb.append(Constants.LIST_NODE_NOT_FOUND);
       }
     } else {
       sb.append(Constants.LIST_ELEMENT_NOT_FOUND);
     }
   } else {
     sb.append(Constants.LIST_COMPONENT_NOT_FOUND);
   }
 }
 private void migrateThird2(
     Elements listEles,
     Node sBThirdNode2,
     String locale,
     Map<String, String> urlMap,
     String catType,
     String type)
     throws RepositoryException {
   if (listEles != null) {
     int eleSize = listEles.size();
     NodeIterator thirdNodes =
         sBThirdNode2.hasNode("Th-Third-1") ? sBThirdNode2.getNodes("Th-Third*") : null;
     if (thirdNodes != null) {
       int size = (int) thirdNodes.getSize();
       for (Element list : listEles) {
         if (thirdNodes.hasNext()) {
           Node thirdNode = thirdNodes.nextNode();
           if (thirdNode.hasNode("tile")) {
             Node tileNode = thirdNode.getNode("tile");
             Element title = list.getElementsByTag("h3").first();
             Element description = list.getElementsByTag("p").first();
             Element anchor = list.getElementsByTag("a").first();
             if (title != null) {
               tileNode.setProperty("title", title.text());
             } else {
               sb.append(Constants.LIST_HEADING_COMPONENT_NOT_FOUND);
             }
             if (description != null) {
               tileNode.setProperty("description", description.text());
             } else {
               sb.append(Constants.LIST_INTRO_PARAGRAPH_ELEMENT_NOT_FOUND);
             }
             if (anchor != null) {
               if (tileNode.hasNode("cta")) {
                 Node ctaNode = tileNode.getNode("cta");
                 ctaNode.setProperty("linktext", anchor.text());
                 String aUrl = anchor.absUrl("href");
                 if (StringUtils.isBlank(aUrl)) {
                   aUrl = anchor.attr("href");
                 }
                 aUrl = FrameworkUtils.getLocaleReference(aUrl, urlMap, locale, sb);
                 if (!aUrl.equals("") && !aUrl.isEmpty()) {
                   ctaNode.setProperty("url", aUrl);
                 } else {
                   sb.append(Constants.LINK_URL_NOT_FOUND_IN_LIST);
                 }
               } else {
                 sb.append(Constants.LINK_DATA_NODE_FOR_LIST_NOT_FOUND);
               }
               tileNode.setProperty("title", title.text());
             } else {
               sb.append(Constants.LIST_ANCHOR_ELEMENTS_NOT_FOUND);
             }
           } else {
             sb.append(Constants.LIST_ITEM_NODE_NOT_FOUND);
           }
         } else {
           sb.append(
               Constants.MISMATCH_IN_LIST_ELEMENT
                   + eleSize
                   + Constants.LIST_NODES_COUNT
                   + size
                   + ".</li>");
         }
       }
       if (thirdNodes.hasNext()) {
         Element letUsHelp = doc.select("div.rc-persel").first();
         if (letUsHelp != null) {
           Node thirdNode = thirdNodes.nextNode();
           if (thirdNode.hasNode("tile")) {
             boolean check = true;
             Node tileNode = thirdNode.getNode("tile");
             Element title = letUsHelp.getElementsByTag("h3").first();
             Element description = letUsHelp.getElementsByTag("p").first();
             Element dAnchor = letUsHelp.getElementsByTag("a").first();
             letUsHelp.getElementsByTag("a").first().remove();
             Element anchor = letUsHelp.getElementsByTag("a").last();
             if (title != null) {
               tileNode.setProperty("title", title.text());
             } else {
               sb.append(Constants.LIST_HEADING_COMPONENT_NOT_FOUND);
             }
             if (description != null) {
               String anchorTag = "";
               if (dAnchor != null) {
                 anchorTag = dAnchor.outerHtml();
               } else {
                 check = false;
                 sb.append(Constants.LIST_ANCHOR_ELEMENTS_NOT_FOUND);
               }
               if (description.text().equals("")) {
                 description = letUsHelp.getElementsByTag("p").last();
               }
               tileNode.setProperty("description", description.text() + "</br></br>" + anchorTag);
             } else {
               sb.append(Constants.LIST_INTRO_PARAGRAPH_ELEMENT_NOT_FOUND);
             }
             if (anchor != null) {
               if (tileNode.hasNode("cta")) {
                 Node ctaNode = tileNode.getNode("cta");
                 ctaNode.setProperty("linktext", anchor.text());
                 String aUrl = anchor.absUrl("href");
                 if (StringUtils.isBlank(aUrl)) {
                   aUrl = anchor.attr("href");
                 }
                 aUrl = FrameworkUtils.getLocaleReference(aUrl, urlMap, locale, sb);
                 if (!aUrl.equals("") && !aUrl.isEmpty()) {
                   ctaNode.setProperty("url", aUrl);
                 } else {
                   sb.append(Constants.LINK_URL_NOT_FOUND_IN_LIST);
                 }
               } else {
                 sb.append(Constants.LINK_DATA_NODE_FOR_LIST_NOT_FOUND);
               }
             } else {
               if (check) sb.append(Constants.LIST_ANCHOR_ELEMENTS_NOT_FOUND);
             }
           } else {
             sb.append(Constants.LIST_ITEM_NODE_NOT_FOUND);
           }
         } else {
           sb.append(
               Constants.MISMATCH_IN_LIST_NODES
                   + eleSize
                   + Constants.LIST_NODES_COUNT
                   + size
                   + ".</li>");
         }
       }
     } else {
       sb.append(Constants.NO_LIST_NODES_FOUND);
     }
   } else {
     sb.append(Constants.LIST_COMPONENT_NOT_FOUND);
   }
 }
  private void setListElements(
      Element ele, Node rightListNode, Session session, String locale, Map<String, String> urlMap) {
    try {
      String ownPdfText = "";
      String pdfIcon = "";
      String pdfSize = "";
      Elements h2Ele = ele.getElementsByTag("h2");
      Elements h3Ele = ele.getElementsByTag("h3");
      Elements ulEle = ele.getElementsByTag("ul");
      String h2Text = null;
      String h3Text = null;

      // start of handling title of list component
      if (!h2Ele.isEmpty()) {
        h2Text = h2Ele.first().text();
        rightListNode.setProperty("title", h2Text);
        if (h2Ele.size() > 1) {
          sb.append(Constants.MISMATCH_IN_RIGHT_LIST_COUNT);
        }
      } else {
        sb.append(Constants.LIST_HEADING_COMPONENT_NOT_FOUND);
      }
      // end of handling title of list component

      // start of handling title of list component
      NodeIterator h3Iterator =
          rightListNode.hasNode("element_subtitle_0")
              ? rightListNode.getNodes("element_subtitle*")
              : null;
      if (h3Iterator != null) {
        if (!h3Ele.isEmpty()) {
          int eleSize = h3Ele.size();
          int nodeSize = (int) h3Iterator.getSize();
          Node h3nodeList;
          if (eleSize == nodeSize) {
            for (Element h3Itr : h3Ele) {
              h3nodeList = (Node) h3Iterator.next();
              h3Text = h3Itr.text();
              h3nodeList.setProperty("subtitle", h3Text);
            }
          }

          if (nodeSize < eleSize) {
            for (Element h3Itr : h3Ele) {
              if (h3Iterator.hasNext()) {
                h3nodeList = (Node) h3Iterator.next();
                h3Text = h3Itr.text();
                h3nodeList.setProperty("subtitle", h3Text);
              }
            }
            sb.append(
                Constants.MISMATCH_IN_LIST_ELEMENT
                    + nodeSize
                    + Constants.SPOTLIGHT_ELEMENT_COUNT
                    + eleSize);
          }
          if (nodeSize > eleSize) {
            for (Element h3Itr : h3Ele) {
              h3nodeList = (Node) h3Iterator.next();
              h3Text = h3Itr.text();
              h3nodeList.setProperty("subtitle", h3Text);
            }
            sb.append(
                Constants.LIST_ELEMENTS_COUNT_MISMATCH
                    + nodeSize
                    + Constants.SPOTLIGHT_ELEMENT_COUNT
                    + eleSize);
          }

        } else {
          sb.append(Constants.LIST_HEADING_COMPONENT_NOT_FOUND);
          log.debug("h3 text is not avalable");
        }
      } else {
        if (!h3Ele.isEmpty()) {
          log.debug("subtitle node doesnot exist but ele exist");
          sb.append(Constants.LIST_COMPONENT_NOT_FOUND);
        }
      }
      // end of handling title of list component

      // Element List
      NodeIterator ulNodeIterator =
          rightListNode.hasNode("element_list_0") ? rightListNode.getNodes("element_list*") : null;
      if (ulNodeIterator != null) {
        Node ulnodeList;
        for (Element ulItr : ulEle) {
          if (ulNodeIterator.hasNext()) {
            ulnodeList = (Node) ulNodeIterator.next();
            Elements list = ulItr.getElementsByTag("li");
            List<String> listAdd = new ArrayList<String>();
            for (Element li : list) {
              pdfIcon = "";
              pdfSize = "";
              boolean openNewWindow = false;
              // pdf content
              try {
                ownPdfText = li.ownText();
                if (StringUtils.isNotEmpty(ownPdfText)) {
                  log.debug("OWn text is:" + ownPdfText);
                  if (ownPdfText.toLowerCase().contains("pdf")
                      || ownPdfText.toLowerCase().contains("video")) {
                    pdfIcon = "pdf";
                    if (ownPdfText.toLowerCase().contains("video")) {
                      pdfIcon = "video";
                    }
                    int i = 0;
                    for (; i < ownPdfText.length(); i++) {
                      char character = ownPdfText.charAt(i);
                      boolean isDigit = Character.isDigit(character);
                      if (isDigit) {
                        break;
                      }
                    }
                    pdfSize = ownPdfText.substring(i, ownPdfText.length() - 1);
                    pdfSize = pdfSize.replace(")", "");
                    pdfSize = pdfSize.trim();
                  }
                }
              } catch (Exception e) {
                sb.append(Constants.Exception_BY_SPECIAL_CHARACTER);
                log.error("Exception : ", e);
              }

              // fix for new win icon
              Elements newwinCheck = li.select("span.newwin");
              if (!newwinCheck.isEmpty()) {
                log.debug("extra new win icon found");
                sb.append(Constants.EXTRA_ICON_FOUND_IN_LIST);
              }

              // check for the lock icon
              Elements imgInList = li.getElementsByTag("img");
              if (!imgInList.isEmpty()) {
                String altImg = imgInList.attr("alt");
                if (altImg.equals("lock_icon")) {
                  log.debug("lock icon found in the list");
                  sb.append(Constants.EXTRA_LOCK_IMG_FOUND_IN_LIST);
                }
              }

              if (!li.getElementsByTag("a").isEmpty()) {
                Element a = li.getElementsByTag("a").first();
                String aHref = a.absUrl("href");
                if (StringUtil.isBlank(aHref)) {
                  aHref = a.attr("href");
                }
                // Start extracting valid href
                log.debug("Before anchorHref" + a.absUrl("href") + "\n");
                String anchorHref = FrameworkUtils.getLocaleReference(aHref, urlMap, locale, sb);
                log.debug("after anchorHref" + anchorHref + "\n");
                // End extracting valid href
                JSONObject obj = new JSONObject();
                obj.put("linktext", a.text());
                obj.put("linkurl", anchorHref);
                obj.put("icon", pdfIcon);
                obj.put("size", pdfSize);
                obj.put("description", "");
                obj.put("openInNewWindow", openNewWindow);
                listAdd.add(obj.toString());
              }
            }
            ulnodeList.setProperty("listitems", listAdd.toArray(new String[listAdd.size()]));
          }
        }
        if (ulNodeIterator.hasNext()) {
          sb.append(Constants.MISMATCH_IN_RIGHT_LIST_COUNT);
        }
      } else {
        sb.append(Constants.NO_LIST_NODES_FOUND);
      }
      // End of Element List
    } catch (Exception e) {
      sb.append(Constants.UNABLE_TO_MIGRATE_LIST_COMPONENT);
      log.error("Exception : ", e);
    }
  }
  private void migrateHeroLarge(
      Document doc, Node trainingAndEventsLeftNode, String locale, Map<String, String> urlMap) {
    // TODO Auto-generated method stub
    try {
      String h2Text = "";
      String pText = "";
      String aText = "";
      String aHref = "";
      int pCount = 0;
      Node heroPanelNode = null;
      Elements heroElements = doc.select("div.c50-pilot");
      if (heroElements.size() > 0) {

        if (!heroElements.select("div.frame").isEmpty()) {
          heroElements = heroElements.select("div.frame");
        }
        Node heroNode =
            trainingAndEventsLeftNode.hasNode("hero_large")
                ? trainingAndEventsLeftNode.getNode("hero_large")
                : null;

        if (heroNode != null) {
          NodeIterator heroPanelNodeIterator =
              heroNode.hasNode("heropanel_0") ? heroNode.getNodes("heropanel*") : null;
          if (heroPanelNodeIterator != null) {
            if (heroElements != null) {
              int eleSize = heroElements.size();
              int nodeSize = (int) heroPanelNodeIterator.getSize();
              if (eleSize != nodeSize) {
                log.debug("Hero component node count mismatch!");
                sb.append(
                    "<li>Hero Component count mis match. Elements on page are: "
                        + eleSize
                        + " Node Count is: "
                        + nodeSize
                        + "</li>");
              }
              for (Element ele : heroElements) {
                if (heroPanelNodeIterator.hasNext()) {
                  heroPanelNode = (Node) heroPanelNodeIterator.next();
                  Elements h2TagText = ele.getElementsByTag("h2");
                  if (h2TagText != null) {
                    h2Text = h2TagText.text();
                    heroPanelNode.setProperty("title", h2Text);
                  } else {
                    sb.append(Constants.HERO_CONTENT_HEADING_ELEMENT_DOESNOT_EXISTS);
                  }

                  Elements descriptionText = ele.getElementsByTag("p");
                  if (descriptionText != null) {
                    if (descriptionText.size() > 2) {
                      for (Element desEle : descriptionText) {
                        pCount++;
                        pText = pText + desEle.text();
                        if (pCount == 2) {
                          break;
                        }
                      }
                    } else {
                      pText = descriptionText.first().text();
                    }
                    heroPanelNode.setProperty("description", pText);
                  } else {
                    sb.append(Constants.HERO_CONTENT_DESCRIPTION_ELEMENT_DOESNOT_EXISTS);
                  }

                  Element anchorText = ele.getElementsByTag("a").first();
                  if (anchorText != null) {
                    aText = anchorText.text();
                    aHref = anchorText.absUrl("href");
                    if (StringUtil.isBlank(aHref)) {
                      aHref = anchorText.attr("href");
                    }
                    // Start extracting valid href
                    log.debug("Before heroPanelLinkUrl" + aHref + "\n");
                    aHref = FrameworkUtils.getLocaleReference(aHref, urlMap, locale, sb);
                    log.debug("after heroPanelLinkUrl" + aHref + "\n");
                    // End extracting valid href
                    heroPanelNode.setProperty("linktext", aText);
                    heroPanelNode.setProperty("linkurl", aHref);
                  } else {
                    sb.append(Constants.HERO_CONTENT_ANCHOR_TEXT_IS_BLANK);
                  }

                  // start image
                  String heroImage = FrameworkUtils.extractImagePath(ele, sb);
                  log.debug("heroImage before migration : " + heroImage + "\n");
                  if (heroPanelNode.hasNode("image")) {
                    Node imageNode = heroPanelNode.getNode("image");
                    String fileReference =
                        imageNode.hasProperty("fileReference")
                            ? imageNode.getProperty("fileReference").getString()
                            : "";
                    heroImage =
                        FrameworkUtils.migrateDAMContent(heroImage, fileReference, locale, sb);
                    log.debug("heroImage after migration : " + heroImage + "\n");
                    if (StringUtils.isNotBlank(heroImage)) {
                      imageNode.setProperty("fileReference", heroImage);
                    }
                  } else {
                    sb.append("<li>hero image node doesn't exist</li>");
                  }
                  // end image
                }
              }
            } else {
              sb.append(Constants.HERO_CONTENT_PANEL_ELEMENT_NOT_FOUND);
            }
          } else {
            log.debug("hero panel node is not found");
          }
        } else {
          if (heroElements.isEmpty()) {
            log.debug("Hero Large node and elements are not found");
          } else {
            sb.append(Constants.HERO_NODE_NOT_AVAILABLE);
          }
        }
      } else {
        sb.append("<li>Hero component not found in web url</li>");
      }
    } catch (Exception e) {
      sb.append(Constants.EXCEPTOIN_IN_UPDATING_HERO_CONTENT);
      log.error("hero Error" + e);
    }
  }
Ejemplo n.º 13
0
 private void migrateTileBoreder(
     Elements tileEles, Node midSizeLowerRightNode, String locale, Map<String, String> urlMap)
     throws RepositoryException {
   if (tileEles != null) {
     int eleSize = tileEles.size();
     NodeIterator tileNodes =
         midSizeLowerRightNode.hasNode("tile_bordered")
             ? midSizeLowerRightNode.getNodes("tile_bordered*")
             : null;
     if (tileNodes != null) {
       int size = (int) tileNodes.getSize();
       for (Element tileEle : tileEles) {
         if (tileNodes.hasNext()) {
           Node tileNode = tileNodes.nextNode();
           Element title = tileEle.getElementsByTag("h2").first();
           if (title != null) {
             tileNode.setProperty("title", title.text());
           } else {
             sb.append(Constants.TILE_BORDERED_TITLE_ELEMENT_NOT_FOUND);
           }
           Element description = tileEle.getElementsByTag("p").first();
           if (description != null) {
             tileNode.setProperty("description", description.text());
           } else {
             sb.append(Constants.TILE_BORDERED_DESCRIPTION_NOT_FOUND);
           }
           Element anchor = tileEle.getElementsByTag("a").first();
           if (anchor != null) {
             tileNode.setProperty("linktext", anchor.text());
             String linkurl = anchor.absUrl("href");
             if (linkurl.equals("")) {
               linkurl = anchor.attr("href");
             }
             linkurl = FrameworkUtils.getLocaleReference(linkurl, urlMap, locale, sb);
             tileNode.setProperty("linkurl", linkurl);
           } else {
             sb.append(Constants.TILE_BORDERED_ANCHOR_ELEMENTS_NOT_FOUND);
           }
         } else {
           sb.append(
               Constants.MISMATCH_IN_TILEBORDER_COUNT
                   + eleSize
                   + Constants.TILEBORDER_NODE
                   + size
                   + ".</li>");
         }
       }
       if (tileNodes.hasNext()) {
         sb.append(
             Constants.MISMATCH_IN_TILEBORDER_COUNT
                 + eleSize
                 + Constants.TILEBORDER_NODE
                 + size
                 + ".</li>");
       }
     } else {
       sb.append(Constants.TILE_BORDERED_NODES_NOT_FOUND);
     }
   } else {
     sb.append(Constants.TILE_BORDERED_COMPONENT_NOT_FOUND);
   }
 }
Ejemplo n.º 14
0
 private void migrateSpotLight(
     Elements spEles, Node midSizeLowerLeftNode, String locale, Map<String, String> urlMap)
     throws PathNotFoundException, ValueFormatException, VersionException, LockException,
         ConstraintViolationException, RepositoryException {
   if (spEles != null) {
     int elesize = spEles.size();
     NodeIterator spNodes =
         midSizeLowerLeftNode.hasNode("spotlight_large_v2")
             ? midSizeLowerLeftNode.getNodes("spotlight_large_v2*")
             : null;
     if (spNodes != null) {
       int size = (int) spNodes.getSize();
       for (Element spEle : spEles) {
         if (spNodes.hasNext()) {
           Node spNode = spNodes.nextNode();
           Element title = spEle.getElementsByTag("h2").first();
           if (title != null) {
             spNode.setProperty("title", title.text());
           } else {
             sb.append(Constants.SPOTLIGHT_HEADING_ELEMENT_NOT_FOUND);
           }
           Element description = spEle.getElementsByTag("p").first();
           if (description != null) {
             spNode.setProperty("description", description.text());
           } else {
             sb.append(Constants.SPOTLIGHT_DESCRIPTION_ELEMENT_NOT_FOUND);
           }
           spEle.getElementsByTag("p").first().remove();
           Elements bullets = spEle.getElementsByTag("li");
           if (bullets.size() == 0) {
             Element bullet = spEle.getElementsByTag("p").first();
             if (bullet != null && !bullet.ownText().isEmpty()) {
               String link = FrameworkUtils.extractHtmlBlobContent(bullet, "", locale, sb, urlMap);
               String bulletValue[] = {link};
               spNode.setProperty("bullets", bulletValue);
               spEle.getElementsByTag("p").first().remove();
             } else {
               sb.append(Constants.SPOTLIGHT_ANCHOR_ELEMENT_NOT_FOUND);
             }
           } else {
             List<String> list = new ArrayList<String>();
             for (Element li : bullets) {
               String link = FrameworkUtils.extractHtmlBlobContent(li, "", locale, sb, urlMap);
               link = link.replace("<li>", "").replace("</li>", "");
               list.add(link);
             }
             spNode.setProperty("bullets", list.toArray(new String[list.size()]));
           }
           Element splink = spEle.getElementsByTag("p").first();
           if (splink != null) {
             Element spLink = splink.getElementsByTag("a").first();
             if (spNode.hasProperty("linktext")) {
               if (spLink != null) {
                 spNode.setProperty("linktext", spLink.text());
                 if (spNode.hasNode("cta")) {
                   Node ctaNode = spNode.getNode("cta");
                   String aUrl = spLink.absUrl("href");
                   if (aUrl.equals("")) {
                     aUrl = spLink.attr("href");
                   }
                   aUrl = FrameworkUtils.getLocaleReference(aUrl, urlMap, locale, sb);
                   ctaNode.setProperty("url", aUrl);
                 }
               } else {
                 sb.append(Constants.SPOTLIGHT_ANCHOR_ELEMENT_NOT_FOUND);
               }
             }
           } else {
             if (spNode.hasProperty("linktext")) {
               sb.append(Constants.SPOTLIGHT_ANCHOR_ELEMENT_NOT_FOUND);
             }
           }
           if (spNode.hasNode("image")) {
             Node imageNode = spNode.getNode("image");
             String fileReference = FrameworkUtils.extractImagePath(spEle, sb);
             fileReference = FrameworkUtils.migrateDAMContent(fileReference, "", locale, sb);
             if (fileReference != "") {
               imageNode.setProperty("fileReference", fileReference);
             } else {
               sb.append(Constants.SPOTLIGHT_IMAGE_NOT_AVAILABLE);
             }
           } else {
             sb.append(Constants.SPOTLIGHT_IMAGE_NODE_NOT_AVAILABLE);
           }
         } else {
           //
           //	sb.append(Constants.SPOTLIGHT_ELEMENT_MISMATCH+size+Constants.SPOTLIGHT_ELEMENT_COUNT+elesize+".</li>");
         }
       }
       if (size != elesize) {
         sb.append(
             Constants.SPOTLIGHT_ELEMENT_MISMATCH
                 + size
                 + Constants.SPOTLIGHT_ELEMENT_COUNT
                 + elesize
                 + ".</li>");
       }
       /*if(spNodes.hasNext()){
       	sb.append(Constants.SPOTLIGHT_ELEMENT_MISMATCH+size+Constants.SPOTLIGHT_ELEMENT_COUNT+elesize+".</li>");
       }*/
     } /*else{
       	sb.append(Constants.SPOTLIGHT_NODE_NOT_FOUND);
       }*/
   } /*else{
     	sb.append(Constants.SPOTLIGHT_ELEMENT_NOT_FOUND);
     }*/
 }
Ejemplo n.º 15
0
  private void migrateHero(
      Elements heroLargeElements,
      Node midSizeUpperLeftNode,
      String locale,
      Map<String, String> urlMap)
      throws PathNotFoundException, ValueFormatException, VersionException, LockException,
          ConstraintViolationException, RepositoryException, JSONException {
    Node heroLargeNode = null;
    Value[] panelPropertiest = null;
    if (midSizeUpperLeftNode.hasNode("hero_large")) {
      heroLargeNode = midSizeUpperLeftNode.getNode("hero_large");
      Property panelNodesProperty =
          heroLargeNode.hasProperty("panelNodes") ? heroLargeNode.getProperty("panelNodes") : null;
      if (panelNodesProperty.isMultiple()) {
        panelPropertiest = panelNodesProperty.getValues();
      }
    } else {
      log.debug(
          "<li>Node with name 'hero_large' doesn't exist under "
              + midSizeUpperLeftNode.getPath()
              + "</li>");
      log.debug(
          "Node with name 'hero_large' doesn't exist under " + midSizeUpperLeftNode.getPath());
    }

    if (heroLargeElements != null) {
      Element heroLargeElement = heroLargeElements.first();
      if (heroLargeElement != null) {
        int eleSize = heroLargeElement.select("div.frame").size();
        Elements heroLargeFrameElements = heroLargeElement.select("div.frame");
        Node heroPanelNode = null;
        if (heroLargeFrameElements != null) {
          if (eleSize != heroLargeNode.getNodes("heropanel*").getSize()) {
            sb.append(Constants.MISMATCH_IN_HERO_SLIDES);
            heroLargeElement.select("div.frame").first().remove();
            heroLargeFrameElements = heroLargeElement.select("div.frame");
          }
          int i = 0;
          for (Element ele : heroLargeFrameElements) {
            String heroPanelTitle = "";
            String heroPanelDescription = "";
            String heroPanelLinkText = "";
            String heroPanellinkUrl = "";
            Elements heroTitleElements = ele.getElementsByTag("h2");
            if (heroTitleElements != null) {
              Element heroTitleElement = heroTitleElements.first();
              if (heroTitleElement != null) {
                heroPanelTitle = heroTitleElement.text();
              } else {
                sb.append(Constants.HERO_CONTENT_HEADING_ELEMENT_DOESNOT_EXISTS);
                log.debug("No h2 first element found with in the class 'frame' of div.");
              }
            } else {
              sb.append(Constants.HERO_CONTENT_HEADING_ELEMENT_DOESNOT_EXISTS);
              log.debug("No h2 found with in the class 'frame' of div.");
            }
            Elements heroDescriptionElements = ele.getElementsByTag("p");
            if (heroDescriptionElements != null) {
              Element heroDescriptionElement = heroDescriptionElements.first();
              if (heroDescriptionElement != null) {
                heroPanelDescription = heroDescriptionElement.text();
              } else {
                sb.append(Constants.HERO_CONTENT_DESCRIPTION_ELEMENT_DOESNOT_EXISTS);
                log.debug("No p frist element found with in the class 'frame' of div.");
              }
            } else {
              sb.append(Constants.HERO_CONTENT_DESCRIPTION_ELEMENT_DOESNOT_EXISTS);
              log.debug("No p elemtn found with in the class 'frame' of div.");
            }
            Elements heroPanelLinkTextElements = ele.getElementsByTag("b");
            if (heroPanelLinkTextElements != null) {
              Element heroPanelLinkTextElement = heroPanelLinkTextElements.first();
              if (heroPanelLinkTextElement != null) {
                heroPanelLinkText = heroPanelLinkTextElement.text();
              } else {
                sb.append(Constants.HERO_CONTENT_ANCHOR_TEXT_IS_BLANK);
                log.debug("No b tags first elemtn found with in the class 'frame' of div.");
              }
            } else {
              sb.append(Constants.HERO_CONTENT_ANCHOR_TEXT_IS_BLANK);
              log.debug("No b tag found with the class 'frame' of div.");
            }
            Elements heroPanelLinkUrlElements = ele.getElementsByTag("a");
            if (heroPanelLinkUrlElements != null) {
              Element heroPanelLinkUrlElement = heroPanelLinkUrlElements.first();
              if (heroPanelLinkUrlElement != null) {
                heroPanellinkUrl = heroPanelLinkUrlElement.absUrl("href");
                if (heroPanellinkUrl.equals("")) {
                  heroPanellinkUrl = heroPanelLinkUrlElement.attr("href");
                }
                // Start extracting valid href
                log.debug("heroPanellinkUrl before migration : " + heroPanellinkUrl);
                heroPanellinkUrl =
                    FrameworkUtils.getLocaleReference(heroPanellinkUrl, urlMap, locale, sb);
                log.debug("heroPanellinkUrl after migration : " + heroPanellinkUrl);
                // End extracting valid href
              } else {
                sb.append(Constants.HERO_CONTENT_ANCHOR_LINK_IS_BLANK);
                log.debug("No anchor first element found with in the class 'frame' of div.");
              }
            } else {
              sb.append(Constants.HERO_CONTENT_ANCHOR_LINK_IS_BLANK);
              log.debug("No anchor element found with in the class 'frame' of div.");
            }
            // start image
            String heroImage = FrameworkUtils.extractImagePath(ele, sb);
            log.debug("heroImage path : " + heroImage);
            // end image
            log.debug("heroPanelTitle : " + heroPanelTitle);
            log.debug("heroPanelDescription : " + heroPanelDescription);
            log.debug("heroPanelLinkText : " + heroPanelLinkText);
            log.debug("heroPanellinkUrl : " + heroPanellinkUrl);

            if (panelPropertiest != null && i <= panelPropertiest.length) {
              String propertyVal = panelPropertiest[i].getString();
              if (StringUtils.isNotBlank(propertyVal)) {
                JSONObject jsonObj = new JSONObject(propertyVal);
                if (jsonObj.has("panelnode")) {
                  String panelNodeProperty = jsonObj.get("panelnode").toString();
                  heroPanelNode =
                      heroLargeNode.hasNode(panelNodeProperty)
                          ? heroLargeNode.getNode(panelNodeProperty)
                          : null;
                  log.debug("hero_node_Name : " + heroPanelNode.getName());
                }
              }
              i++;
            } else {
              sb.append(Constants.HERO_CONTENT_NODE_NOT_FOUND);
              log.debug("No list panelProperties found for the hero compoent order.");
            }

            if (heroPanelNode != null) {
              Node heroPanelPopUpNode = null;
              Elements lightBoxElements = ele.select("div.c50-image").select("a.c26v4-lightbox");
              if (lightBoxElements != null && !lightBoxElements.isEmpty()) {
                heroPanelPopUpNode = FrameworkUtils.getHeroPopUpNode(heroPanelNode);
              }
              if (StringUtils.isNotBlank(heroPanelTitle)) {
                heroPanelNode.setProperty("title", heroPanelTitle);
                if (heroPanelPopUpNode != null) {
                  heroPanelPopUpNode.setProperty("popupHeader", heroPanelTitle);
                } else {
                  if (lightBoxElements != null && lightBoxElements.size() != 0) {
                    sb.append("<li>Hero content video pop up node not found.</li>");
                    log.debug(
                        "No pop-up node found for the hero panel node " + heroPanelNode.getPath());
                  }
                }
              } else {
                sb.append(Constants.HERO_SLIDE_TITLE_NOT_FOUND);
                log.debug("Title is blank with in the 'frame' class of div.");
              }
              if (StringUtils.isNotBlank(heroPanelDescription)) {
                heroPanelNode.setProperty("description", heroPanelDescription);
              } else {
                sb.append(Constants.HERO_SLIDE_DESCRIPTION_NOT_FOUND);
                log.debug("Description is blank with in the 'frame' class of the div.");
              }
              if (StringUtils.isNotBlank(heroPanelLinkText)) {
                heroPanelNode.setProperty("linktext", heroPanelLinkText);
              } else {
                sb.append(Constants.HERO_SLIDE_DESCRIPTION_NOT_FOUND);
                log.debug("Link Text doesn't exists with in the class 'frame' of the div.");
              }
              if (StringUtils.isNotBlank(heroPanellinkUrl)) {
                heroPanelNode.setProperty("linkurl", heroPanellinkUrl);
              } else {
                sb.append(Constants.HERO_SLIDE_LINKURL_NOT_FOUND);
                log.debug("Link url doesn't exists with in the class 'frame' of the div.");
              }
              if (heroPanelNode.hasNode("image")) {
                Node imageNode = heroPanelNode.getNode("image");
                String fileReference =
                    imageNode.hasProperty("fileReference")
                        ? imageNode.getProperty("fileReference").getString()
                        : "";
                heroImage = FrameworkUtils.migrateDAMContent(heroImage, fileReference, locale, sb);
                log.debug("heroImage : " + heroImage);
                if (StringUtils.isNotBlank(heroImage)) {
                  imageNode.setProperty("fileReference", heroImage);
                }
              } else {
                sb.append(Constants.HERO_SLIDE_IMAGE_NODE_NOT_FOUND);
                log.debug("'image' node doesn't exists in " + heroPanelNode.getPath());
              }
            }
          }
        } else {
          log.debug("<li>Hero Large Frames/Panel Elements is not found</li>");
          log.debug("No div found with class 'frame'");
        }
      } else {
        sb.append(Constants.HERO_LARGE_COMPONENT_NOT_FOUND);
        log.debug("No first element found with class 'c50-pilot'");
      }
    } else {
      sb.append("<li>Hero Large component is not found on web publisher page</li>");
      log.debug("No element found with class 'c50-pilot'");
    }
  }