use of com.enonic.xp.data.Property in project xp by enonic.
the class JsonToPropertyTreeTranslatorTest method boolean_value.
@Test
public void boolean_value() throws Exception {
final JsonNode node = loadJson("allInputTypes");
final PropertyTree data = JsonToPropertyTreeTranslator.translate(node);
final Property property = data.getProperty("checkbox");
assertTrue(property.getValue().isBoolean());
assertEquals(true, property.getBoolean());
}
use of com.enonic.xp.data.Property in project xp by enonic.
the class JsonToPropertyTreeTranslatorTest method all_input_types.
@Test
public void all_input_types() throws Exception {
final JsonNode node = loadJson("allInputTypes");
final PropertyTree data = JsonToPropertyTreeTranslator.translate(node);
final Property media = data.getProperty("media");
assertNotNull(media);
assertEquals(ValueTypes.PROPERTY_SET.getName(), media.getType().getName());
}
use of com.enonic.xp.data.Property in project xp by enonic.
the class ScriptValueTranslatorTest method validateType.
private void validateType(final PropertyTree properties, final String propertyName, final ValueType valueType) {
final Property prop = properties.getProperty(propertyName);
assertEquals(valueType, prop.getType());
}
use of com.enonic.xp.data.Property in project xp by enonic.
the class PageHandlerWorker method renderShortcut.
private PortalResponse renderShortcut(final Content content) {
final Property shortcut = content.getData().getProperty(SHORTCUT_TARGET_PROPERTY);
final Reference target = shortcut == null ? null : shortcut.getReference();
if (target == null || target.getNodeId() == null) {
throw WebException.notFound("Missing shortcut target");
}
final PageUrlParams pageUrlParams = new PageUrlParams().id(target.toString()).portalRequest(this.request);
final Multimap<String, String> params = pageUrlParams.getParams();
params.putAll(this.request.getParams());
params.putAll(getShortcutParameters(content));
final String targetUrl = this.portalUrlService.pageUrl(pageUrlParams);
return PortalResponse.create().status(HttpStatus.TEMPORARY_REDIRECT).header("Location", targetUrl).build();
}
use of com.enonic.xp.data.Property in project xp by enonic.
the class HtmlAreaContentProcessor method processPageData.
private void processPageData(final Page page, final ContentIds.Builder processedIds) {
if (page == null) {
return;
}
if (page.hasDescriptor()) {
final PageDescriptor pageDescriptor = pageDescriptorService.getByKey(page.getDescriptor());
final Collection<Property> properties = getProperties(page.getConfig(), pageDescriptor.getConfig().getFormItems());
processDataTree(properties, processedIds);
}
if (page.hasRegions()) {
processRegionsData(page.getRegions(), processedIds);
}
}
Aggregations