/** * 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(); }
/** * 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()); }
/** * 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()); }
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; } }
public HstSiteContext(JcrNodeModel model) throws RepositoryException { super(model); Node node = this.model.getNode(); if (node.hasProperty("hst:portalconfigurationenabled")) { portalConfigEnabled = node.getProperty("hst:portalconfigurationenabled").getBoolean(); } }
@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; } }
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; }
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; }
/** * 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); } }
/** * 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); } }
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; }
@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; }
@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; }
@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()); } } };
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(); } }
@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()); }
@Test public void testSetActivated() throws RepositoryException { new MetaData(root).setActivated(); assertTrue(root.getProperty(NodeTypes.Activatable.ACTIVATION_STATUS).getBoolean()); }
@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)); } }
@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); }
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()); }