use of com.enonic.xp.content.ContentPropertyNames.ORIGINAL_PARENT_PATH in project xp by enonic.
the class RestoreContentCommand method updateProperties.
private void updateProperties(final Node node, final boolean isRootContent) {
final FindNodesByParentResult childrenToRestore = nodeService.findByParent(FindNodesByParentParams.create().size(-1).recursive(true).parentId(node.id()).build());
childrenToRestore.getNodeIds().forEach(id -> nodeService.update(UpdateNodeParams.create().id(id).editor(toBeEdited -> {
toBeEdited.data.removeProperties(ARCHIVED_TIME);
toBeEdited.data.removeProperties(ARCHIVED_BY);
}).build()));
if (isRootContent) {
nodeService.update(UpdateNodeParams.create().id(node.id()).editor(toBeEdited -> {
toBeEdited.data.removeProperties(ORIGINAL_PARENT_PATH);
toBeEdited.data.removeProperties(ORIGINAL_NAME);
toBeEdited.data.removeProperties(ARCHIVED_TIME);
toBeEdited.data.removeProperties(ARCHIVED_BY);
}).build());
}
}
use of com.enonic.xp.content.ContentPropertyNames.ORIGINAL_PARENT_PATH in project xp by enonic.
the class ArchiveContentCommand method updateProperties.
private Node updateProperties(final NodeId nodeId) {
final FindNodesByParentResult childrenToArchive = nodeService.findByParent(FindNodesByParentParams.create().size(-1).recursive(true).parentId(nodeId).build());
final Instant now = Instant.now();
final String archivedBy = getCurrentUser().getKey().toString();
childrenToArchive.getNodeIds().forEach(id -> nodeService.update(UpdateNodeParams.create().id(id).editor(toBeEdited -> {
toBeEdited.data.setInstant(ARCHIVED_TIME, now);
toBeEdited.data.setString(ARCHIVED_BY, archivedBy);
}).build()));
return nodeService.update(UpdateNodeParams.create().id(nodeId).editor(toBeEdited -> {
toBeEdited.data.setString(ORIGINAL_PARENT_PATH, ContentNodeHelper.translateNodePathToContentPath(toBeEdited.source.parentPath()).toString());
toBeEdited.data.setString(ORIGINAL_NAME, toBeEdited.source.name().toString());
toBeEdited.data.setInstant(ARCHIVED_TIME, now);
toBeEdited.data.setString(ARCHIVED_BY, archivedBy);
}).build());
}
Aggregations