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;
}
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;
}
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;
}
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;
}
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());
}
Aggregations