Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Working with parsys

Mikołaj Mański edited this page Jul 29, 2016 · 1 revision

Working with parsys

We can get any parsys by providing it's data-path HTML attribute to the AuthorPage#getParsys method which is implemented as shown below:

public Parsys getParsys(String dataPath) {
    String path = DataPathUtil.normalize(dataPath); // discard the numeric appendix if present
    return parsyses.stream() //
        .filter(parsys -> StringUtils.contains(parsys.getDataPath(), path)) //
        .findFirst() //
        .orElseThrow(() -> new IllegalStateException("Parsys not found"));
}

Using parsys we can insert a component into it or delete it from there. When it comes to components, the methods that are responsible for handling them are also using ther data-paths. This is the implementation of Parsys#getComponent method:

public Component getComponent(String dataPath) {
    String componentDataPath = DataPathUtil.normalize(dataPath); // discard the numeric appendix if present
    return componentList.stream() //
        .filter(containsDataPath(componentDataPath)) //
        .findFirst() //
        .orElseThrow(() -> new IllegalStateException("Component not present in the parsys"));}

If youw want to know more about Data paths please refer to the Component descriptions tutorial.

Getting started with Bobcat

  1. Getting started

AEM Related Features

  1. Authoring tutorial - Classic
  1. AEM Classic Authoring Advanced usage
  1. Authoring tutorial - Touch UI
Clone this wiki locally