Search in sources :

Example 86 with PropertySet

use of com.enonic.xp.data.PropertySet in project xp by enonic.

the class ContentAuditLogSupportImpl method doPublish.

private void doPublish(final PushContentParams params, final PublishContentResult result, final Context rootContext) {
    if (params.getContentIds() == null) {
        return;
    }
    final PropertyTree data = new PropertyTree();
    final PropertySet paramsSet = data.addSet("params");
    final PropertySet resultSet = data.addSet("result");
    if (params.getContentIds() != null) {
        paramsSet.addStrings("contentIds", params.getContentIds().stream().map(ContentId::toString).collect(Collectors.toList()));
    }
    if (params.getExcludedContentIds() != null) {
        paramsSet.addStrings("excludedContentIds", params.getExcludedContentIds().stream().map(ContentId::toString).collect(Collectors.toList()));
    }
    if (params.getExcludeChildrenIds() != null) {
        paramsSet.addStrings("excludeChildrenIds", params.getExcludeChildrenIds().stream().map(ContentId::toString).collect(Collectors.toList()));
    }
    if (params.getContentPublishInfo() != null) {
        final ContentPublishInfo contentPublishInfo = params.getContentPublishInfo();
        final PropertySet contentPublishInfoSet = paramsSet.addSet("contentPublishInfo");
        contentPublishInfoSet.addInstant("from", contentPublishInfo.getFrom());
        contentPublishInfoSet.addInstant("to", contentPublishInfo.getTo());
        contentPublishInfoSet.addInstant("first", contentPublishInfo.getFirst());
    }
    paramsSet.addString("target", params.getTarget().toString());
    paramsSet.addString("message", params.getMessage());
    paramsSet.addBoolean("includeDependencies", params.isIncludeDependencies());
    addContents(resultSet, result.getPushedContents(), "pushedContents");
    addContents(resultSet, result.getDeletedContents(), "deletedContents");
    addContents(resultSet, result.getFailedContents(), "failedContents");
    addContents(resultSet, result.getUnpublishedContents(), "unpublishedContents");
    log("system.content.publish", data, ContentIds.create().addAll(result.getPushedContents()).addAll(result.getDeletedContents()).addAll(result.getUnpublishedContents()).build(), rootContext);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet) ContentPublishInfo(com.enonic.xp.content.ContentPublishInfo) ContentId(com.enonic.xp.content.ContentId)

Example 87 with PropertySet

use of com.enonic.xp.data.PropertySet in project xp by enonic.

the class ContentAuditLogSupportImpl method doMove.

private void doMove(final MoveContentParams params, final MoveContentsResult result, final Context rootContext) {
    final PropertyTree data = new PropertyTree();
    final PropertySet paramsSet = data.addSet("params");
    final PropertySet resultSet = data.addSet("result");
    paramsSet.addString("contentId", nullToNull(params.getContentId()));
    paramsSet.addString("parentContentPath", nullToNull(params.getParentContentPath()));
    if (params.getCreator() != null) {
        paramsSet.addString("creator", params.getCreator().getId());
    }
    addContents(resultSet, result.getMovedContents(), "movedContents");
    log("system.content.move", data, params.getContentId(), rootContext);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 88 with PropertySet

use of com.enonic.xp.data.PropertySet in project xp by enonic.

the class ContentAuditLogSupportImpl method doArchive.

private void doArchive(final ArchiveContentParams params, final ArchiveContentsResult result, final Context rootContext) {
    final PropertyTree data = new PropertyTree();
    final PropertySet paramsSet = data.addSet("params");
    final PropertySet resultSet = data.addSet("result");
    paramsSet.addString("contentId", nullToNull(params.getContentId()));
    addContents(resultSet, result.getArchivedContents(), "archivedContents");
    log("system.content.archive", data, params.getContentId(), rootContext);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 89 with PropertySet

use of com.enonic.xp.data.PropertySet in project xp by enonic.

the class ContentAuditLogSupportImpl method doRename.

private void doRename(final RenameContentParams params, final Content content, final Context rootContext) {
    final PropertyTree data = new PropertyTree();
    final PropertySet paramsSet = data.addSet("params");
    final PropertySet resultSet = data.addSet("result");
    paramsSet.addString("contentId", nullToNull(params.getContentId()));
    paramsSet.addString("newName", nullToNull(params.getNewName()));
    addContent(resultSet, content);
    log("system.content.rename", data, content.getId(), rootContext);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 90 with PropertySet

use of com.enonic.xp.data.PropertySet in project xp by enonic.

the class ContentAuditLogSupportImpl method doCreateContent.

private void doCreateContent(final CreateContentParams params, final Content content, final Context rootContext) {
    final PropertyTree data = new PropertyTree();
    final PropertySet paramsSet = data.addSet("params");
    final PropertySet resultSet = data.addSet("result");
    paramsSet.addString("displayName", params.getDisplayName());
    paramsSet.addString("type", nullToNull(params.getType()));
    paramsSet.addString("name", nullToNull(params.getName()));
    paramsSet.addBoolean("requireValid", params.isRequireValid());
    paramsSet.addBoolean("inheritPermissions", params.isInheritPermissions());
    if (params.getProcessedIds() != null) {
        paramsSet.addStrings("processedIds", params.getProcessedIds().stream().map(ContentId::toString).collect(Collectors.toList()));
    }
    if (params.getPermissions() != null) {
        paramsSet.addStrings("permissions", params.getPermissions().getEntries().stream().map(AccessControlEntry::toString).collect(Collectors.toList()));
    }
    addContent(resultSet, content);
    log("system.content.create", data, content.getPath(), rootContext);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet) AccessControlEntry(com.enonic.xp.security.acl.AccessControlEntry) ContentId(com.enonic.xp.content.ContentId)

Aggregations

PropertySet (com.enonic.xp.data.PropertySet)225 PropertyTree (com.enonic.xp.data.PropertyTree)150 Test (org.junit.jupiter.api.Test)69 Content (com.enonic.xp.content.Content)30 Node (com.enonic.xp.node.Node)20 CreateContentParams (com.enonic.xp.content.CreateContentParams)12 ContentId (com.enonic.xp.content.ContentId)11 Property (com.enonic.xp.data.Property)11 LogAuditLogParams (com.enonic.xp.audit.LogAuditLogParams)10 PrincipalKey (com.enonic.xp.security.PrincipalKey)9 ContentQuery (com.enonic.xp.content.ContentQuery)7 DescriptorKey (com.enonic.xp.page.DescriptorKey)7 ExtraDatas (com.enonic.xp.content.ExtraDatas)6 Form (com.enonic.xp.form.Form)6 PatternIndexConfigDocument (com.enonic.xp.index.PatternIndexConfigDocument)6 CreateAttachment (com.enonic.xp.attachment.CreateAttachment)5 ContentPropertyNames (com.enonic.xp.content.ContentPropertyNames)5 ExtraData (com.enonic.xp.content.ExtraData)5 PropertyPath (com.enonic.xp.data.PropertyPath)5 Page (com.enonic.xp.page.Page)5