Search in sources :

Example 6 with PropertyTree

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

the class TestDataFixtures method getProfile.

private static PropertyTree getProfile() {
    final PropertySet appPropertySet = new PropertySet();
    appPropertySet.setString("subString", "subStringValue");
    appPropertySet.setLong("subLong", 123L);
    final PropertyTree profile = new PropertyTree();
    profile.setSet("myApp", appPropertySet);
    profile.setString("string", "stringValue");
    return profile;
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 7 with PropertyTree

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

the class TestDataFixtures method newExampleContentBuilder.

public static Content.Builder newExampleContentBuilder() {
    final Content.Builder builder = Content.create();
    builder.id(ContentId.from("123456"));
    builder.name("mycontent");
    builder.displayName("My Content");
    builder.parentPath(ContentPath.from("/path/to"));
    builder.modifier(PrincipalKey.from("user:system:admin"));
    builder.modifiedTime(Instant.ofEpochSecond(0));
    builder.creator(PrincipalKey.from("user:system:admin"));
    builder.createdTime(Instant.ofEpochSecond(0));
    builder.language(Locale.ENGLISH);
    final PropertyTree tree = new PropertyTree();
    tree.setString("myfield", "Hello World");
    builder.data(tree);
    builder.attachments(newAttachments());
    builder.valid(true);
    builder.childOrder(ChildOrder.from("_ts DESC, _name ASC"));
    return builder;
}
Also used : Content(com.enonic.xp.content.Content) PropertyTree(com.enonic.xp.data.PropertyTree)

Example 8 with PropertyTree

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

the class TestDataFixtures method newPropertyTree.

public static PropertyTree newPropertyTree() {
    final PropertyTree tree = new PropertyTree();
    tree.setBoolean("boolean", true);
    tree.addBooleans("boolean", true, false);
    tree.setLong("long", 1L);
    tree.addLongs("longs", 1L, 2L, 3L);
    tree.setDouble("double", 2.2);
    tree.addDoubles("doubles", 1.1, 2.2, 3.3);
    tree.setString("string", "a");
    tree.addStrings("strings", "a", "b", "c");
    tree.setString("stringEmpty", "");
    tree.setString("stringNull", null);
    tree.setString("set.property", "value");
    tree.addXml("xml", "<xml><my-xml hello='world'/></xml>");
    tree.addBinaryReference("binaryReference", BinaryReference.from("abc"));
    tree.addLink("link", Link.from(ContentPath.from("/my/content").toString()));
    tree.addGeoPoint("geoPoint", new GeoPoint(1.1, -1.1));
    tree.addGeoPoints("geoPoints", new GeoPoint(1.1, -1.1), new GeoPoint(2.2, -2.2));
    tree.addInstant("instant", Instant.MAX);
    tree.addLocalDate("localDate", LocalDate.of(2014, 1, 31));
    tree.addLocalDateTime("localDateTime", LocalDateTime.of(2014, 1, 31, 10, 30, 5));
    final PropertySet set1 = tree.addSet("c");
    set1.setBoolean("d", true);
    set1.addStrings("e", "3", "4", "5");
    set1.setLong("f", 2L);
    return tree;
}
Also used : GeoPoint(com.enonic.xp.util.GeoPoint) PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 9 with PropertyTree

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

the class ModifyNodeExecutor method setUserData.

private void setUserData() {
    final PropertyTree newPropertyTree = new PropertyTree();
    this.propertyTree.getProperties().forEach((property) -> {
        if (!property.getName().startsWith("_")) {
            property.copyTo(newPropertyTree.getRoot());
        }
    });
    this.editableNode.data = newPropertyTree;
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree)

Example 10 with PropertyTree

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

the class CreateNodeParamsFactoryTest method manual_order_value.

@Test
public void manual_order_value() throws Exception {
    final PropertyTree properties = new PropertyTree();
    properties.setLong(MANUAL_ORDER_VALUE, 3L);
    final CreateNodeParams createNodeParams = new CreateNodeParamsFactory().create(properties, BinaryAttachments.empty());
    assertEquals(3L, createNodeParams.getManualOrderValue().longValue());
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) CreateNodeParams(com.enonic.xp.node.CreateNodeParams) Test(org.junit.jupiter.api.Test)

Aggregations

PropertyTree (com.enonic.xp.data.PropertyTree)639 Test (org.junit.jupiter.api.Test)404 PropertySet (com.enonic.xp.data.PropertySet)134 Content (com.enonic.xp.content.Content)125 Node (com.enonic.xp.node.Node)112 CreateContentParams (com.enonic.xp.content.CreateContentParams)64 Form (com.enonic.xp.form.Form)37 Page (com.enonic.xp.page.Page)32 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)31 DescriptorKey (com.enonic.xp.page.DescriptorKey)30 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)30 CreateNodeParams (com.enonic.xp.node.CreateNodeParams)28 PrincipalKey (com.enonic.xp.security.PrincipalKey)28 BinaryReference (com.enonic.xp.util.BinaryReference)28 Property (com.enonic.xp.data.Property)26 UpdateContentParams (com.enonic.xp.content.UpdateContentParams)24 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)23 ByteSource (com.google.common.io.ByteSource)22 ExtraData (com.enonic.xp.content.ExtraData)21 Instant (java.time.Instant)21