Skip to content

Commit

Permalink
LPD-41552 We want to throw UnsupportedOperationException for now so i…
Browse files Browse the repository at this point in the history
…t is easier to identify the places where we will need to handle possibly missing references in a lazy way.

Revert "LPD-41552 Use get instead of fetch so NoSuchLayoutException is thrown instead of UnsupportedOperationException"

This reverts commit bca4e3c.
  • Loading branch information
ruben-pulido authored and brianchandotcom committed Nov 27, 2024
1 parent 1b62246 commit 8993840
Showing 1 changed file with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ public class WidgetPageWidgetInstanceResourceImpl
throw new UnsupportedOperationException();
}

Layout layout = _layoutLocalService.getLayoutByExternalReferenceCode(
Layout layout = _layoutLocalService.fetchLayoutByExternalReferenceCode(
sitePageExternalReferenceCode,
GroupUtil.getGroupId(
false, contextCompany.getCompanyId(),
siteExternalReferenceCode));

if (layout == null) {
throw new UnsupportedOperationException();
}

LayoutType layoutType = layout.getLayoutType();

if (!(layoutType instanceof LayoutTypePortlet)) {
Expand Down Expand Up @@ -94,12 +98,16 @@ public class WidgetPageWidgetInstanceResourceImpl
throw new UnsupportedOperationException();
}

Layout layout = _layoutLocalService.getLayoutByExternalReferenceCode(
Layout layout = _layoutLocalService.fetchLayoutByExternalReferenceCode(
sitePageExternalReferenceCode,
GroupUtil.getGroupId(
false, contextCompany.getCompanyId(),
siteExternalReferenceCode));

if (layout == null) {
throw new UnsupportedOperationException();
}

LayoutType layoutType = layout.getLayoutType();

if (!(layoutType instanceof LayoutTypePortlet)) {
Expand Down Expand Up @@ -127,12 +135,16 @@ public class WidgetPageWidgetInstanceResourceImpl
throw new UnsupportedOperationException();
}

Layout layout = _layoutLocalService.getLayoutByExternalReferenceCode(
Layout layout = _layoutLocalService.fetchLayoutByExternalReferenceCode(
sitePageExternalReferenceCode,
GroupUtil.getGroupId(
false, contextCompany.getCompanyId(),
siteExternalReferenceCode));

if (layout == null) {
throw new UnsupportedOperationException();
}

LayoutType layoutType = layout.getLayoutType();

if (!(layoutType instanceof LayoutTypePortlet)) {
Expand Down Expand Up @@ -164,12 +176,16 @@ public class WidgetPageWidgetInstanceResourceImpl
throw new UnsupportedOperationException();
}

Layout layout = _layoutLocalService.getLayoutByExternalReferenceCode(
Layout layout = _layoutLocalService.fetchLayoutByExternalReferenceCode(
sitePageExternalReferenceCode,
GroupUtil.getGroupId(
false, contextCompany.getCompanyId(),
siteExternalReferenceCode));

if (layout == null) {
throw new UnsupportedOperationException();
}

LayoutType layoutType = layout.getLayoutType();

if (!(layoutType instanceof LayoutTypePortlet)) {
Expand Down Expand Up @@ -198,12 +214,16 @@ public class WidgetPageWidgetInstanceResourceImpl
throw new UnsupportedOperationException();
}

Layout layout = _layoutLocalService.getLayoutByExternalReferenceCode(
Layout layout = _layoutLocalService.fetchLayoutByExternalReferenceCode(
sitePageExternalReferenceCode,
GroupUtil.getGroupId(
false, contextCompany.getCompanyId(),
siteExternalReferenceCode));

if (layout == null) {
throw new UnsupportedOperationException();
}

LayoutType layoutType = layout.getLayoutType();

if (!(layoutType instanceof LayoutTypePortlet)) {
Expand Down

0 comments on commit 8993840

Please sign in to comment.