Search in sources :

Example 1 with ContentName

use of com.enonic.xp.content.ContentName in project xp by enonic.

the class RenamedEventSyncCommand method doSync.

private void doSync(final ContentToSync content) {
    content.getTargetContext().runWith(() -> {
        if (isToSyncName(content.getTargetContent())) {
            if (needToRename(content.getSourceContent(), content.getTargetContent())) {
                final ContentName newName = ContentName.from(buildNewPath(content.getTargetContent().getParentPath(), content.getSourceContent().getName()).getName());
                contentService.rename(RenameContentParams.create().contentId(content.getTargetContent().getId()).newName(newName).stopInherit(!newName.equals(content.getSourceContent().getName())).build());
            }
        }
    });
}
Also used : ContentName(com.enonic.xp.content.ContentName)

Example 2 with ContentName

use of com.enonic.xp.content.ContentName in project xp by enonic.

the class MoveContentHandler method rename.

private Content rename(final ContentId sourceId, final String newName) {
    final ContentName newContentName = ContentName.from(newName);
    final RenameContentParams renameParams = RenameContentParams.create().contentId(sourceId).newName(newContentName).build();
    return contentService.rename(renameParams);
}
Also used : ContentName(com.enonic.xp.content.ContentName) RenameContentParams(com.enonic.xp.content.RenameContentParams)

Aggregations

ContentName (com.enonic.xp.content.ContentName)2 RenameContentParams (com.enonic.xp.content.RenameContentParams)1