Class CleanupEntityBuilder
java.lang.Object
org.exoplatform.addons.documents.cleanup.rest.util.CleanupEntityBuilder
Domain model to REST DTO mapping. No business logic.
-
Method Summary
Modifier and TypeMethodDescriptionstatic KeepItemsResultRestEntitybuild(CleanupBulkResult result) static CampaignRestEntitybuild(CleanupCampaign campaign) static CampaignItemRestEntitybuild(CleanupCampaignItem item, org.exoplatform.social.core.manager.IdentityManager identityManager) Item DTO WITHOUT its failure detail — the safe default, seebuild(CleanupCampaignItem, IdentityManager, boolean).static CampaignItemRestEntitybuild(CleanupCampaignItem item, org.exoplatform.social.core.manager.IdentityManager identityManager, boolean includeFailureDetail) Item DTO, its administrator-only failure DETAIL included only when asked for.static CampaignComparisonRestEntitybuild(CleanupComparison comparison) build(CleanupFailureGroup failureGroup) static CampaignScanUnitRestEntitybuild(CleanupScanUnit unit) build(CleanupScanUnitProgress progress) static MyItemsSummaryRestEntitybuild(CleanupUserSummary summary) static PagedResult<CampaignItemRestEntity> build(org.springframework.data.domain.Page<CleanupCampaignItem> page, org.exoplatform.social.core.manager.IdentityManager identityManager) Page of item DTOs WITHOUT their failure detail — the safe default, seebuild(Page, IdentityManager, boolean).static PagedResult<CampaignItemRestEntity> build(org.springframework.data.domain.Page<CleanupCampaignItem> page, org.exoplatform.social.core.manager.IdentityManager identityManager, boolean includeFailureDetail) Page of item DTOs, their administrator-only failure detail included only when asked for — same security boundary asbuild(CleanupCampaignItem, IdentityManager, boolean), read that javadoc before touching this flag.static CampaignRestEntitybuildDefaults(CleanupParams params, int maxScanThreads) The platform DEFAULTS as the creation form consumes them: the same field names a campaign carries, so the form fills from either shape, plus the ceiling the scan-thread input must not exceed.static CleanupParamstoParamOverrides(CampaignRestEntity entity)
-
Method Details
-
build
-
build
public static CampaignItemRestEntity build(CleanupCampaignItem item, org.exoplatform.social.core.manager.IdentityManager identityManager) Item DTO WITHOUT its failure detail — the safe default, seebuild(CleanupCampaignItem, IdentityManager, boolean).- Parameters:
item- item to mapidentityManager- identity manager resolving the owner- Returns:
- the item DTO, its failureDetail left null
-
build
public static CampaignItemRestEntity build(CleanupCampaignItem item, org.exoplatform.social.core.manager.IdentityManager identityManager, boolean includeFailureDetail) Item DTO, its administrator-only failure DETAIL included only when asked for.THE FLAG IS A SECURITY BOUNDARY, not a convenience: this very DTO is served both to administrators (
GET {id}/items) and to end users (GET published/my-items,@Secured("users")). The failure detail carries exception messages and stack frames that can name nodes and paths OUTSIDE the calling user's visibility — aReferentialIntegrityExceptionnames the REFERENCING node, e.g. a shortcut living in a space the user is not a member of. So the admin endpoint passes true and the user one passes false, explicitly, and the default overload above omits it.failureReasonstays on BOTH paths: it is now a bare, stable message code, so it leaks nothing.- Parameters:
item- item to mapidentityManager- identity manager resolving the ownerincludeFailureDetail- true ONLY on an administrator-restricted endpoint- Returns:
- the item DTO
-
build
public static PagedResult<CampaignItemRestEntity> build(org.springframework.data.domain.Page<CleanupCampaignItem> page, org.exoplatform.social.core.manager.IdentityManager identityManager) Page of item DTOs WITHOUT their failure detail — the safe default, seebuild(Page, IdentityManager, boolean).- Parameters:
page- page of items to mapidentityManager- identity manager resolving the owners- Returns:
- the paged DTOs, their failureDetail left null
-
build
public static PagedResult<CampaignItemRestEntity> build(org.springframework.data.domain.Page<CleanupCampaignItem> page, org.exoplatform.social.core.manager.IdentityManager identityManager, boolean includeFailureDetail) Page of item DTOs, their administrator-only failure detail included only when asked for — same security boundary asbuild(CleanupCampaignItem, IdentityManager, boolean), read that javadoc before touching this flag.- Parameters:
page- page of items to mapidentityManager- identity manager resolving the ownersincludeFailureDetail- true ONLY on an administrator-restricted endpoint- Returns:
- the paged DTOs
-
build
- Parameters:
progress- per-unit breakdown of a dry run- Returns:
- its REST representation, with the in-flight units mapped along
-
build
-
build
-
build
-
build
-
build
-
buildDefaults
The platform DEFAULTS as the creation form consumes them: the same field names a campaign carries, so the form fills from either shape, plus the ceiling the scan-thread input must not exceed.- Parameters:
params- platform default parametersmaxScanThreads- highest reader-thread count the server accepts- Returns:
- the defaults, as a campaign-shaped payload
-
toParamOverrides
- Parameters:
entity- creation request body- Returns:
- partial parameter overrides (null fields defaulted downstream)
-