use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class InputValidatorTest method validate_correct_input_types.
@Test
public void validate_correct_input_types() {
// Creates a property set
final PropertySet propertySet = new PropertySet();
propertySet.addString("setString", "ost");
propertySet.addDouble("setDouble", 123d);
// Creates the correct data to validate
final PropertyTree data = new PropertyTree();
data.addString("textLine", "textLine");
data.addString("color", "#12345");
data.addString("comboBox", "value2");
data.addBoolean("checkbox", true);
data.addString("phone", "+4797773223");
data.addString("tag", "myTag");
data.addReference("contentSelector", new Reference(new NodeId()));
data.addString("contentTypeFilter", "article");
data.addString("siteConfigurator", "my config here");
data.addDouble("double", 1.1d);
data.addLong("long", 12345678910L);
data.addStrings("stringArray", "a", "b", "c");
data.addLocalDateTime("localDateTime", LocalDateTime.parse("2015-01-14T10:00:00"));
data.addInstant("dateTime", DateTimeFormatter.ISO_DATE_TIME.parse("2015-01-15T10:15:00+02:00", Instant::from));
data.addLocalDate("date", LocalDate.parse("2015-01-15"));
data.addLocalTime("time", LocalTime.parse("10:00:32.123"));
data.addGeoPoint("geoPoint", GeoPoint.from("-45,34"));
data.addString("htmlArea", "<stuff>staff</stuff>");
// Validates the correct data
inputValidator.validate(data);
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class FlattenedPageDataUpgrader method addDescriptorBasedComponentData.
private void addDescriptorBasedComponentData(final PropertySet sourceComponentDataSet, final PropertySet targetComponentDataSet) {
targetComponentDataSet.setString(TGT_DESCRIPTOR_KEY, sourceComponentDataSet.getString(SRC_TEMPLATE_KEY));
final PropertySet sourceConfigSet = sourceComponentDataSet.getSet(SRC_CONFIG_KEY);
final String sourceTemplateKey = sourceComponentDataSet.getString(SRC_TEMPLATE_KEY);
if (sourceConfigSet != null && sourceTemplateKey != null) {
final PropertySet targetConfigSet = targetComponentDataSet.addSet(TGT_CONFIG_KEY);
final String applicationKey = getSanitizedApplicationKey(sourceTemplateKey);
final PropertySet applicationConfigSet = targetConfigSet.addSet(applicationKey);
final String componentName = getSanitizedComponentName(sourceTemplateKey);
applicationConfigSet.setSet(componentName, sourceConfigSet);
}
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class IndexConfigUpgrader method upgradePageIndexConfig.
private PatternIndexConfigDocument upgradePageIndexConfig(final PatternIndexConfigDocument sourceDocument, final NodeVersion nodeVersion) {
final List<PropertySet> components = Lists.newArrayList(nodeVersion.getData().getSets("components"));
final String descriptorKeyStr = nodeVersion.getData().getString(PropertyPath.from("components.page.descriptor"));
final DescriptorKey pageDescriptorKey = descriptorKeyStr != null ? DescriptorKey.from(descriptorKeyStr) : null;
final FlattenedPageIndexUpgrader pageIndexUpgrader = new FlattenedPageIndexUpgrader(pageDescriptorKey, components);
return pageIndexUpgrader.upgrade(sourceDocument);
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class FlattenedPageRegionsIndexUpgrader method upgradeComponents.
private void upgradeComponents() {
this.components.forEach(propertySet -> {
PropertySet componentSet;
componentSet = propertySet.getSet(LAYOUT);
if (componentSet != null) {
upgradeDescriptorBasedComponent(componentSet, LAYOUT);
}
componentSet = propertySet.getSet(PART);
if (componentSet != null) {
upgradeDescriptorBasedComponent(componentSet, PART);
}
});
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class TemplateControllerMappings method handle.
public void handle(final NodeId nodeId, final PropertyTree nodeData) {
final String contentType = nodeData.getString(CONTENT_TYPE_KEY);
final PropertySet sourcePageSet = nodeData.getSet(SRC_PAGE_KEY);
if (sourcePageSet == null || !TEMPLATE_CONTENT_TYPE_VALUE.equals(contentType)) {
return;
}
final String controllerKey = sourcePageSet.getString(SRC_CONTROLLER_KEY);
if (controllerKey != null) {
templateControllerMap.put(nodeId.toString(), controllerKey);
}
}
Aggregations