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-44142 Provide FDS bulk action list serializers for system data se…
…ts, with unit tests. Custom data sets don't yet support definition of bulk actions so we provide a placeholder implementation to facilitate reference handling in the renderer
- Loading branch information
Showing
4 changed files
with
406 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...t-api/src/main/java/com/liferay/frontend/data/set/action/FDSBulkActionListSerializer.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,18 @@ | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2025 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.frontend.data.set.action; | ||
|
||
import com.liferay.frontend.data.set.model.FDSActionDropdownItem; | ||
import com.liferay.frontend.data.set.serializer.FDSSerializer; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Daniel Sanz | ||
*/ | ||
public interface FDSBulkActionListSerializer | ||
extends FDSSerializer<List<FDSActionDropdownItem>> { | ||
} |
38 changes: 38 additions & 0 deletions
38
.../com/liferay/frontend/data/set/internal/action/CustomFDSBulkActionListSerializerImpl.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,38 @@ | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2025 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.frontend.data.set.internal.action; | ||
|
||
import com.liferay.frontend.data.set.action.FDSBulkActionListSerializer; | ||
import com.liferay.frontend.data.set.constants.FDSTypes; | ||
import com.liferay.frontend.data.set.model.FDSActionDropdownItem; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import org.osgi.service.component.annotations.Component; | ||
|
||
/** | ||
* @author Daniel Sanz | ||
*/ | ||
@Component( | ||
property = "dataset.type=" + FDSTypes.CUSTOM, | ||
service = FDSBulkActionListSerializer.class | ||
) | ||
public class CustomFDSBulkActionListSerializerImpl | ||
implements FDSBulkActionListSerializer { | ||
|
||
@Override | ||
public List<FDSActionDropdownItem> serialize( | ||
String fdsName, HttpServletRequest httpServletRequest) { | ||
|
||
// TODO: add support for bulk actions in the DSM | ||
|
||
return Collections.emptyList(); | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
.../com/liferay/frontend/data/set/internal/action/SystemFDSBulkActionListSerializerImpl.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,49 @@ | ||
/** | ||
* 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.frontend.data.set.internal.action; | ||
|
||
import com.liferay.frontend.data.set.action.FDSBulkActionList; | ||
import com.liferay.frontend.data.set.action.FDSBulkActionListRegistry; | ||
import com.liferay.frontend.data.set.action.FDSBulkActionListSerializer; | ||
import com.liferay.frontend.data.set.constants.FDSTypes; | ||
import com.liferay.frontend.data.set.model.FDSActionDropdownItem; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* @author Daniel Sanz | ||
*/ | ||
@Component( | ||
property = "dataset.type=" + FDSTypes.SYSTEM, | ||
service = FDSBulkActionListSerializer.class | ||
) | ||
public class SystemFDSBulkActionListSerializerImpl | ||
implements FDSBulkActionListSerializer { | ||
|
||
@Override | ||
public List<FDSActionDropdownItem> serialize( | ||
String fdsName, HttpServletRequest httpServletRequest) { | ||
|
||
FDSBulkActionList fdsBulkActionList = | ||
_fdsBulkActionListRegistry.getFDSBulkActionList(fdsName); | ||
|
||
if (fdsBulkActionList == null) { | ||
return Collections.emptyList(); | ||
} | ||
|
||
return fdsBulkActionList.getFDSActionDropdownItems(httpServletRequest); | ||
} | ||
|
||
@Reference | ||
private FDSBulkActionListRegistry _fdsBulkActionListRegistry; | ||
|
||
} |
Oops, something went wrong.