Refine search
private void setProperty(final Node newNode, final Node cloneNode, final String propertyName) throws RepositoryException { if (cloneNode.hasProperty(propertyName)) { final Property property = cloneNode.getProperty(propertyName); newNode.setProperty(propertyName, property.getValue()); } }
protected void verifyProperty( Node node, String propertyName, String expectedValue ) throws RepositoryException { Property property = node.getProperty(propertyName); Value value = property.isMultiple() ? property.getValues()[0] : property.getValue(); assertEquals(expectedValue, value.getString()); }
@Override public boolean hasNodeData(String name) throws RepositoryException { if (this.node.hasProperty(name)) { return true; } if (this.node.hasNode(name) && this.node.getNode(name).getProperty("jcr:frozenPrimaryType").getValue().getString().equals(ItemType.NT_RESOURCE)) { return true; } return false; }
protected void verifyProperty( Node node, String propertyName, long expectedValue ) throws RepositoryException { Property property = node.getProperty(propertyName); Value value = property.isMultiple() ? property.getValues()[0] : property.getValue(); assertEquals(expectedValue, value.getLong()); }
protected boolean hasBinaryNode(String name) throws RepositoryException { return this.node.hasNode(name) && (this.node.getNode(name).isNodeType(ItemType.NT_RESOURCE) || (this.node.hasProperty("jcr:frozenPrimaryType") && this.node.getNode(name).getProperty("jcr:frozenPrimaryType").getValue().getString().equals(ItemType.NT_RESOURCE))); } }
/** * Tests if adding a property with <code>Node.setProperty(String, * Value, int)</code> works with <code>Session.save()</code> */ public void testNewValuePropertySessionWithPropertyType() throws Exception { testNode.setProperty(propertyName1, v1, PropertyType.STRING); superuser.save(); assertEquals("Setting property with Node.setProperty(String, Value, int) and Session.save() not working", v1, testNode.getProperty(propertyName1).getValue()); }
/** * Tests if adding a property with <code>Node.setProperty(String, * Value, int)</code> works with <code>parentNode.save()</code> */ public void testNewValuePropertyParentWithPropertyType() throws Exception { testNode.setProperty(propertyName1, v1, PropertyType.STRING); testRootNode.getSession().save(); assertEquals("Setting property with Node.setProperty(String, Value, int) and parentNode.save() not working", v1, testNode.getProperty(propertyName1).getValue()); }
private void renameObsoleteProperty(Node controlNode, String oldName, String newName) throws RepositoryException { if (!controlNode.hasProperty(oldName)) { return; } Property property = controlNode.getProperty(oldName); controlNode.setProperty(newName, property.getValue()); property.remove(); }
/** * Tests if adding a property with <code>Node.setProperty(String, * Value)</code> works with <code>Session.save()</code> */ public void testNewValuePropertySession() throws Exception { testNode.setProperty(propertyName1, v1); superuser.save(); assertEquals("Setting property with Node.setProperty(String, Value) and Session.save() not working", v1, testNode.getProperty(propertyName1).getValue()); }
/** * Tests equals method of Reference value. */ public void testEquals() throws RepositoryException { Property prop2 = referencedNode.getProperty(jcrUUID); assertTrue("Incorrect equals method of Reference value.", PropertyUtil.equalValues(prop2.getValue(), prop.getValue())); } }
/** * Tests if adding a property with <code>Node.setProperty(String, * Value)</code> works with <code>parentNode.save()</code> */ public void testNewValuePropertyParent() throws Exception { testNode.setProperty(propertyName1, v1); testRootNode.getSession().save(); assertEquals("Setting property with Node.setProperty(String, Value) and parentNode.save() not working", v1, testNode.getProperty(propertyName1).getValue()); }
private boolean isBinary(Node requestedData) throws RepositoryException { return requestedData.isNodeType(NodeTypes.Resource.NAME) || (requestedData.hasProperty("jcr:frozenPrimaryType") && requestedData.getProperty("jcr:frozenPrimaryType").getValue().getString().equals(NodeTypes.Resource.NAME)); }
private void copyTemplateTranslations(final Session session, final String sourceKey, final String destinationKey) throws RepositoryException { final Node bundles = session.getNode("/hippo:configuration/hippo:translations/hippo:templates"); for (Node bundle : new NodeIterable(bundles.getNodes())) { if (bundle.hasProperty(sourceKey)) { bundle.setProperty(destinationKey, bundle.getProperty(sourceKey).getValue()); } else { log.debug("Cannot set translation for template {}, cannot find source {}", destinationKey, sourceKey); } } }
/** * Tests if adding a property with <code>Node.setProperty(String, * Calendar)</code> works with <code>parentNode.save()</code> */ public void testNewCalendarPropertyParent() throws Exception { testNode.setProperty(propertyName1, c1); testRootNode.getSession().save(); assertEquals("Setting property with Node.setProperty(String, Calendar) and parentNode.save() not working", vf.createValue(c1), testNode.getProperty(propertyName1).getValue()); }
public String getMethod() { try { Node node = getNode(); if (node.hasProperty("hippolog:eventMethod")) { return node.getProperty("hippolog:eventMethod").getValue().getString(); } } catch (RepositoryException e) { log.error(e.getMessage()); } return null; }
public String getDocument() { try { Node node = getNode(); if (node.hasProperty("hippolog:eventDocument")) { return node.getProperty("hippolog:eventDocument").getValue().getString(); } } catch (RepositoryException e) { log.error(e.getMessage()); } return null; }
/** * Tests if adding a property with <code>Node.setProperty(String, * Calendar)</code> works with <code>Session.save()</code> */ public void testNewCalendarPropertySession() throws Exception { testNode.setProperty(propertyName1, c1); superuser.save(); assertEquals("Setting property with Node.setProperty(String, Calendar) and Session.save() not working", vf.createValue(c1), testNode.getProperty(propertyName1).getValue()); }
public Value getValue(String s) throws ItemNotFoundException, RepositoryException { if (getNode().getProperty(s) != null) { return getNode().getProperty(s).getValue(); } else { return null; } }
/** * Checks that the given property does not exist and creates it with the given value, logs otherwise. */ protected void newProperty(InstallContext ctx, Node node, String propertyName, Object value) throws RepositoryException { if (!node.hasProperty(propertyName)) { PropertyUtil.setProperty(node, propertyName, value); } else { final String msg = format("Property \"{0}\" was expected not to exist at {1}, but exists with value \"{2}\" and was going to be created with value \"{3}\".", propertyName, node.getPath(), node.getProperty(propertyName).getValue().getString(), value); ctx.warn(msg); } }
@Override protected Object doLoadObject(Session session, Mapper mapper) throws Exception { if (logger.isLoggable(Level.FINE)) { logger.fine("Lazy loading single reference for " + nodePath + " " + propertyName); } Node node = PathUtils.getNode(nodePath, session); return mapper.getReferenceMapper().createReferencedObject(field, node.getProperty(propertyName).getValue(), parentObject, session, objClass, depth, nodeFilter, mapper); } }