forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LPD-44292 Extract logic into an util class
- Loading branch information
1 parent
c21c697
commit 6181859
Showing
2 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...eray/headless/admin/site/internal/resource/util/layout/structure/LayoutStructureUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2024 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
package com.liferay.headless.admin.site.internal.resource.util.layout.structure; | ||
|
||
import com.liferay.headless.admin.site.dto.v1_0.PageElement; | ||
import com.liferay.layout.util.structure.LayoutStructure; | ||
import com.liferay.portal.kernel.util.Validator; | ||
|
||
/** | ||
* @author Eudaldo Alonso | ||
*/ | ||
public class LayoutStructureUtil { | ||
|
||
public static String getParentExternalReferenceCode( | ||
PageElement pageElement, LayoutStructure layoutStructure) { | ||
|
||
String parentExternalReferenceCode = | ||
pageElement.getParentExternalReferenceCode(); | ||
|
||
if (Validator.isNotNull(parentExternalReferenceCode)) { | ||
return parentExternalReferenceCode; | ||
} | ||
|
||
return layoutStructure.getMainItemId(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters