The following document contains the results of PMD's CPD 6.55.0.

Duplications

File Project Line
io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV1Impl.java WCM Core Components 61
io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV2Impl.java WCM Core Components 61
public LanguageNavigationItemV1Impl(@NotNull Page page, @NotNull Link link,
      int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
      @Nullable String title, @Nullable String parentId, @Nullable Component parentComponent) {
    super(page, link, level, active, current, children, parentId, parentComponent);
    this.page = page;
    this.title = title;
  }

  @Override
  public String getTitle() {
    return title;
  }

  @Override
  public Locale getLocale() {
    if (locale == null) {
      // looks up jcr:language properties to the root, then considers the page name, falls back to system default
      // we therefore assume the language structure is correctly configured for the site for this to be accurate
      locale = page.getLanguage(false);
    }
    return locale;
  }

  @Override
  public String getCountry() {
    if (country == null) {
      country = page.getLanguage(false).getCountry();
    }
    return country;
  }

  @Override
  public String getLanguage() {
    if (language == null) {
      // uses hyphens to ensure it's hreflang valid
      language = page.getLanguage(false).toString().replace('_', '-');
    }
    return language;
  }

  @Override
  @NotNull
  protected final PageData getComponentData() {
    return DataLayerBuilder.extending(super.getComponentData()).asPage()
        .withLanguage(this::getLanguage)
        .build();
  }

}
File Project Line
io/wcm/wcm/core/components/impl/models/v3/ImageV3Impl.java WCM Core Components 181
io/wcm/wcm/core/components/impl/models/wcmio/v1/ResponsiveImageV1Impl.java WCM Core Components 147
}

  /**
   * Checks if the resolved media is a DAM asset, and initializes properties from it.
   * @param properties Resource properties
   */
  private void initPropertiesFromDamAsset(ValueMap properties) {
    Asset asset = media.getAsset();
    if (asset != null) {
      if (!StringUtils.equals(media.getMediaSource().getId(), InlineMediaSource.ID)) {
        fileReference = asset.getPath();
      }
      alt = asset.getAltText();

      com.day.cq.dam.api.Asset damAsset = asset.adaptTo(com.day.cq.dam.api.Asset.class);
      if (damAsset != null) {
        boolean titleFromAsset = properties.get(PN_TITLE_VALUE_FROM_DAM, currentStyle.get(PN_TITLE_VALUE_FROM_DAM, true));
        boolean uuidDisabled = currentStyle.get(PN_UUID_DISABLED, false);

        if (!uuidDisabled) {
          uuid = damAsset.getID();
        }

        if (titleFromAsset) {
          String assetTitle = asset.getTitle();
          if (StringUtils.isNotEmpty(assetTitle)) {
            title = assetTitle;
          }
        }
      }
    }
  }
File Project Line
io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV1Impl.java WCM Core Components 57
io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV2Impl.java WCM Core Components 57
public NavigationItemV1Impl(@NotNull Page page, @NotNull Link link,
      int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
      @Nullable String parentId, @Nullable Component parentComponent) {
    super(page, link, parentId, parentComponent);
    this.page = page;
    this.active = active;
    this.current = current;
    this.level = level;
    this.children = children;
  }

  /**
   * @deprecated Deprecated in API
   */
  @Override
  @Deprecated(forRemoval = true)
  @JsonIgnore
  public Page getPage() {
    return page;
  }

  @Override
  public boolean isActive() {
    return active;
  }

  @Override
  public boolean isCurrent() {
    return current;
  }

  @Override
  public List<NavigationItem> getChildren() {
    return children;
  }

  @Override
  public int getLevel() {
    return level;
  }

}

Back to top

Version: 2.0.3-2.23.2-SNAPSHOT. Last Published: 2024-04-25.