本文整理了Java中javax.jcr.Property.getBoolean()
方法的一些代码示例,展示了Property.getBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.getBoolean()
方法的具体详情如下:
包路径:javax.jcr.Property
类名称:Property
方法名:getBoolean
[英]Returns a boolean
representation of the value of this property. A shortcut for Property.getValue().getBoolean()
.
[中]返回此属性值的boolean
表示形式。Property.getValue().getBoolean()
的快捷方式。
代码示例来源:origin: info.magnolia/magnolia-core
/**
* Returns true if the node has been activated.
*/
public static boolean isActivated(Node node) throws RepositoryException {
return node.hasProperty(ACTIVATION_STATUS) && node.getProperty(ACTIVATION_STATUS).getBoolean();
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if adding a property with <code>Node.setProperty(String,
* boolean)</code> works with <code>Session.save()</code>
*/
public void testNewBooleanPropertySession() throws Exception {
testNode.setProperty(propertyName1, true);
superuser.save();
assertEquals("Setting property with Node.setProperty(String, boolean) and Session.save() not working",
true,
testNode.getProperty(propertyName1).getBoolean());
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if adding a property with <code>Node.setProperty(String,
* boolean)</code> works with <code>parentNode.save()</code>
*/
public void testNewBooleanPropertyParent() throws Exception {
testNode.setProperty(propertyName1, true);
testRootNode.getSession().save();
assertEquals("Setting property with Node.setProperty(String, boolean) and parentNode.save() not working",
true,
testNode.getProperty(propertyName1).getBoolean());
}
代码示例来源:origin: info.magnolia.cache/magnolia-cache-core
private boolean getBooleanAndRemove(Node node, String propertyName, boolean defaultValue) throws RepositoryException {
if (node.hasProperty(propertyName)) {
final Property property = node.getProperty(propertyName);
final boolean val = property.getBoolean();
property.remove();
return val;
}
return defaultValue;
}
}
代码示例来源:origin: org.onehippo.ecm/hst-addon-configuration-editor-frontend
public HstSiteContext(JcrNodeModel model) throws RepositoryException {
super(model);
Node node = this.model.getNode();
if (node.hasProperty("hst:portalconfigurationenabled")) {
portalConfigEnabled = node.getProperty("hst:portalconfigurationenabled").getBoolean();
}
}
代码示例来源:origin: info.magnolia.templating/magnolia-templating-essentials-models
@Override
public boolean evaluateTyped(Node node) {
try {
return node.isNodeType(nodeType) && !(node.hasProperty(NavigationTemplatingFunctions.HIDE_IN_NAVIGATION_PROPERTY_NAME) && node.getProperty(NavigationTemplatingFunctions.HIDE_IN_NAVIGATION_PROPERTY_NAME).getBoolean());
} catch (RepositoryException e) {
log.error("Failed to resolve if node {} should be visible in navigation.", node, e);
}
return false;
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-addon-automatic-export-frontend
private boolean isExportEnabled() {
boolean enabled = true;
try {
Node node = getJcrSession().getNode(CONFIG_NODE_PATH);
enabled = node.getProperty(CONFIG_ENABLED_PROPERTY_NAME).getBoolean();
} catch (PathNotFoundException e) {
log.warn("No such item: " + CONFIG_NODE_PATH + "/" + CONFIG_ENABLED_PROPERTY_NAME);
} catch (RepositoryException e) {
log.error("An error occurred reading export enabled flag", e);
}
return enabled;
}
代码示例来源:origin: info.magnolia/magnolia-module-rssaggregator
private boolean retrieveAutomatedImport() {
try {
return MgnlContext.getJCRSession(RepositoryConstants.CONFIG).getNode(RSS_CONFIG_PATH).getProperty("automatedImport").getBoolean();
} catch (RepositoryException e) {
log.debug("Property automatedImport could not be retrieved from rss module configuration, it will be disabled by default.");
}
// If not able to get the property return default one - disabled global scheduled import
return false;
}
代码示例来源:origin: org.drools/guvnor-repository
/**
* Check if module is archived.
*/
public boolean isModuleArchived(String name) {
Node folderNode = this.getAreaNode(MODULE_AREA);
try {
Node node = folderNode.getNode(name);
return node.getProperty(AssetItem.CONTENT_PROPERTY_ARCHIVE_FLAG).getBoolean();
} catch (RepositoryException e) {
throw new RulesRepositoryException(e);
}
}
代码示例来源:origin: org.chtijbug.drools/guvnor-repository
/**
* Check if module is archived.
*/
public boolean isModuleArchived(String name) {
Node folderNode = this.getAreaNode(MODULE_AREA);
try {
Node node = folderNode.getNode(name);
return node.getProperty(AssetItem.CONTENT_PROPERTY_ARCHIVE_FLAG).getBoolean();
} catch (RepositoryException e) {
throw new RulesRepositoryException(e);
}
}
代码示例来源:origin: info.magnolia/magnolia-core
public boolean getBooleanProperty(String name) {
try {
final Property property = getJCRProperty(name);
if (property != null) {
return property.getBoolean();
}
} catch (RepositoryException re) {
log.error(re.getMessage(), re);
}
return false;
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
@Override
public boolean getBoolean(String key) throws StringValueConversionException {
try {
Property property = getProperty(key);
if (property != null) {
return property.getBoolean();
}
} catch (RepositoryException ex) {
log.error(ex.getMessage());
}
return false;
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public boolean getBoolean() {
if (isExist()) {
try {
return getJCRProperty().getBoolean();
} catch (RepositoryException e) {
throw new RuntimeException("Can't read value of nodedata " + toString(), e);
}
}
return false;
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
protected void entering(Node node, int level) throws RepositoryException {
if (node.isNodeType("rep:Permissions")
&& node.hasProperty("rep:accessControlledPath")
&& path.equals(node.getProperty("rep:accessControlledPath").getString())) {
assertEquals(index, node.getProperty("rep:index").getLong());
assertEquals(isAllow, node.getProperty("rep:isAllow").getBoolean());
}
}
};
代码示例来源:origin: apache/jackrabbit-oak
private boolean isReindexFinished() throws RepositoryException {
Session s = repos.get(0).login(ADMIN);
try {
boolean reindex = s.getNode("/oak:index/" + INDEX_DEF_NODE)
.getProperty(REINDEX_PROPERTY_NAME).getBoolean();
return !reindex;
} finally {
s.logout();
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testSetUnActivated() throws RepositoryException {
root.setProperty(NodeTypes.Activatable.ACTIVATION_STATUS, true);
new MetaData(root).setUnActivated();
assertFalse(root.getProperty(NodeTypes.Activatable.ACTIVATION_STATUS).getBoolean());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testSetActivated() throws RepositoryException {
new MetaData(root).setActivated();
assertTrue(root.getProperty(NodeTypes.Activatable.ACTIVATION_STATUS).getBoolean());
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility
@Test
public void testUpdateTo532AddsIncludeSystemNodesPropertyToJCRBrowser() throws Exception {
// GIVEN
Node websiteJCRBrowserContentConnector = NodeUtil.createPath(session.getRootNode(), ContentAppModuleVersionHandler.UI_ADMINCENTRAL_CONTENTCONNECTOR, NodeTypes.ContentNode.NAME);
// WHEN
executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.3"));
// THEN
assertThat(websiteJCRBrowserContentConnector, hasProperty("includeSystemNodes"));
assertThat(websiteJCRBrowserContentConnector.getProperty("includeSystemNodes").getBoolean(), is(false));
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void setPropertyToBoolean() throws Exception {
// GIVEN
final Object value = Boolean.TRUE;
PropertyUtil.setProperty(root, PROPERTY_NAME, value);
// WHEN
boolean res = root.getProperty(PROPERTY_NAME).getBoolean();
// THEN
assertEquals(value, res);
}
代码示例来源:origin: apache/jackrabbit-oak
public void testStringRequiredTypeBoolean() throws Exception {
Value stringValue = superuser.getValueFactory().createValue("true", PropertyType.STRING);
Property p = node.setProperty(BOOLEAN_PROP_NAME, stringValue);
assertEquals(PropertyType.BOOLEAN, p.getType());
assertEquals(PropertyType.BOOLEAN, p.getValue().getType());
assertTrue(p.getBoolean());
PropertyDefinition def = p.getDefinition();
assertEquals(PropertyType.BOOLEAN, def.getRequiredType());
assertEquals(NT_NAME, def.getDeclaringNodeType().getName());
}
内容来源于网络,如有侵权,请联系作者删除!