use of com.enonic.xp.context.Context in project xp by enonic.
the class ScheduleAuditLogSupportImpl method delete.
@Override
public void delete(final ScheduledJobName name, final boolean result) {
final Context context = scheduleContext();
executor.execute(() -> doDelete(name, result, context));
}
use of com.enonic.xp.context.Context in project xp by enonic.
the class ScheduleAuditLogSupportImpl method modify.
@Override
public void modify(ModifyScheduledJobParams params, ScheduledJob job) {
final Context context = scheduleContext();
executor.execute(() -> doUpdate(params, job, context));
}
use of com.enonic.xp.context.Context in project xp by enonic.
the class ContentServiceImplTest_duplicate method some_metadata_reset_on_duplicate.
@Test
public void some_metadata_reset_on_duplicate() throws Exception {
final User otherUser = User.create().key(PrincipalKey.ofUser(IdProviderKey.system(), "fisk")).login("fisk").build();
final CreateContentParams createContentParams = CreateContentParams.create().contentData(new PropertyTree()).displayName("rootContent").parent(ContentPath.ROOT).type(ContentTypeName.folder()).permissions(AccessControlList.create().add(AccessControlEntry.create().principal(otherUser.getKey()).allowAll().build()).build()).build();
final Content rootContent = this.contentService.create(createContentParams);
final Context duplicateContext = ContextBuilder.from(ContextAccessor.current()).authInfo(AuthenticationInfo.create().user(otherUser).principals(RoleKeys.CONTENT_MANAGER_ADMIN).build()).build();
final Content duplicateContent = duplicateContext.callWith(() -> doDuplicateContent(rootContent));
assertTrue(rootContent.getModifiedTime().isBefore(duplicateContent.getModifiedTime()));
assertTrue(rootContent.getCreatedTime().isBefore(duplicateContent.getCreatedTime()));
assertEquals(otherUser.getKey(), duplicateContent.getModifier());
assertEquals(otherUser.getKey(), duplicateContent.getOwner());
assertEquals(otherUser.getKey(), duplicateContent.getCreator());
}
use of com.enonic.xp.context.Context in project xp by enonic.
the class DeleteContentCommand method getCompareStatus.
private CompareStatus getCompareStatus(final NodeId nodeToDelete) {
final Context context = ContextAccessor.current();
final Branch currentBranch = context.getBranch();
final NodeComparison compare;
if (currentBranch.equals(ContentConstants.BRANCH_DRAFT)) {
compare = this.nodeService.compare(nodeToDelete, ContentConstants.BRANCH_MASTER);
} else {
compare = this.nodeService.compare(nodeToDelete, ContentConstants.BRANCH_DRAFT);
}
return compare.getCompareStatus();
}
use of com.enonic.xp.context.Context in project xp by enonic.
the class ContentAuditLogSupportImpl method applyPermissions.
@Override
public void applyPermissions(final ApplyContentPermissionsParams params, final ApplyContentPermissionsResult result) {
final Context context = ContextBuilder.copyOf(ContextAccessor.current()).build();
executor.execute(() -> doApplyPermissions(params, result, context));
}
Aggregations