Search in sources :

Example 21 with PropertySet

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

the class MediaUploaderTypeTest method testCreateProperty.

@Test
public void testCreateProperty() {
    final InputTypeConfig config = InputTypeConfig.create().build();
    final Value value = this.type.createValue(ValueFactory.newPropertySet(new PropertySet()), config);
    assertNotNull(value);
    assertSame(ValueTypes.PROPERTY_SET, value.getType());
}
Also used : Value(com.enonic.xp.data.Value) PropertySet(com.enonic.xp.data.PropertySet) Test(org.junit.jupiter.api.Test)

Example 22 with PropertySet

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

the class DslOrderExprTest method equalsContract.

@Test
public void equalsContract() {
    final PropertySet expression1 = new PropertySet();
    expression1.addString("field", "myField");
    final PropertySet expression2 = new PropertySet();
    expression2.addString("field", "anotherField");
    EqualsVerifier.forClass(DslOrderExpr.class).withPrefabValues(PropertySet.class, expression1, expression2).usingGetClass().verify();
}
Also used : PropertySet(com.enonic.xp.data.PropertySet) Test(org.junit.jupiter.api.Test)

Example 23 with PropertySet

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

the class AuditLogSerializer method toCreateNodeParams.

public static CreateNodeParams.Builder toCreateNodeParams(final LogAuditLogParams auditLogParams) {
    List<String> objectUris = auditLogParams.getObjectUris().stream().map(AuditLogUri::toString).collect(Collectors.toList());
    final PropertyTree tree = new PropertyTree();
    final PropertySet data = tree.getRoot();
    data.addString(AuditLogPropertyNames.TYPE, auditLogParams.getType());
    data.addInstant(AuditLogPropertyNames.TIME, auditLogParams.getTime());
    data.addString(AuditLogPropertyNames.SOURCE, auditLogParams.getSource());
    data.addString(AuditLogPropertyNames.USER, auditLogParams.getUser().toString());
    data.addStrings(AuditLogPropertyNames.OBJECTURIS, objectUris);
    data.addSet(AuditLogPropertyNames.DATA, auditLogParams.getData().getRoot().copy(data.getTree()));
    return CreateNodeParams.create().nodeType(AuditLogConstants.NODE_TYPE).inheritPermissions(true).data(tree);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 24 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 25 with PropertySet

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

the class ContentAuditLogSupportImpl method doUpdate.

private void doUpdate(final UpdateContentParams params, final Content content, final Context rootContext) {
    final PropertyTree data = new PropertyTree();
    final PropertySet paramsSet = data.addSet("params");
    final PropertySet resultSet = data.addSet("result");
    final PrincipalKey modifier = rootContext.getAuthInfo().getUser() != null ? rootContext.getAuthInfo().getUser().getKey() : PrincipalKey.ofAnonymous();
    paramsSet.addString("contentId", nullToNull(params.getContentId()));
    paramsSet.addString("modifier", nullToNull(modifier));
    paramsSet.addBoolean("clearAttachments", params.isClearAttachments());
    paramsSet.addBoolean("requireValid", params.isRequireValid());
    addContent(resultSet, content);
    log("system.content.update", data, content.getId(), rootContext);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet) PrincipalKey(com.enonic.xp.security.PrincipalKey)

Aggregations

PropertySet (com.enonic.xp.data.PropertySet)208 PropertyTree (com.enonic.xp.data.PropertyTree)134 Test (org.junit.jupiter.api.Test)68 Content (com.enonic.xp.content.Content)29 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 DescriptorKey (com.enonic.xp.page.DescriptorKey)7 ContentQuery (com.enonic.xp.content.ContentQuery)6 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