/** * @inheritDoc */ public PropertyDefinition getDefinition() throws RepositoryException { return property.getDefinition(); }
public Object jsGet_definition() { try { return property.getDefinition(); } catch (RepositoryException re) { return Undefined.instance; } }
@Override public PropertyDefinition getDefinition() throws RepositoryException { return getWrappedProperty().getDefinition(); }
/** * {@inheritDoc} */ @Override public void onProperty(Property prop, int level) throws RepositoryException { if (ignored.contains(prop.getName()) && prop.getDefinition().isProtected()) { return; } props.add(prop); }
public boolean isPropertyMandatory(final Object node, final String name) throws PersistenceException { try { final Property prop = ((Node)node).getProperty(name); return prop.getDefinition().isMandatory(); } catch ( final RepositoryException re) { throw new PersistenceException(re.getMessage(), re); } }
public boolean isPropertyMultiple(final Object node, final String name) throws PersistenceException { try { final Property prop = ((Node)node).getProperty(name); return prop.getDefinition().isMultiple(); } catch ( final RepositoryException re) { throw new PersistenceException(re.getMessage(), re); } }
private boolean isProtected(ItemImpl item) throws RepositoryException { ItemDefinition def; if (item.isNode()) { def = ((Node) item).getDefinition(); } else { def = ((Property) item).getDefinition(); } return def.isProtected(); }
protected void setUp() throws Exception { super.setUp(); childNodeTypeName = getProperty("nodetype"); // set the property p = versionableNode.setProperty(propertyName1, initialPropValue); // assert that property has the proper opv-behaviour PropertyDefinition pd = p.getDefinition(); if (pd.getOnParentVersion() != OPVAction) { fail("JCR Property at '"+p.getPath()+"' does not have the required OnParentVersion "+OnParentVersionAction.nameFromValue(OPVAction)+" definition."); } testRootNode.getSession().save(); }
/** {@inheritDoc} */ public RemotePropertyDefinition getDefinition() throws RepositoryException, RemoteException { try { return getFactory().getRemotePropertyDefinition(property.getDefinition()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
protected Value[] getValues(final Property prop) throws RepositoryException { if (prop.getDefinition().isMultiple()) { return prop.getValues(); } else { return new Value[] { prop.getValue() }; } }
private List<String> getDeletablePropertyNames(final Node node) throws RepositoryException { final List<String> names = new ArrayList<>(); for (Property property : new PropertyIterable(node.getProperties())) { final ItemDefinition definition = property.getDefinition(); final String name = property.getName(); if (!definition.isProtected() && !definition.isMandatory() && !isKnownDerivedPropertyName(name)) { names.add(name); } } return names; }
/** * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item) */ @Override protected boolean matches(Item item) throws RepositoryException { if (item.isNode()) { return ((Node) item).getDefinition().isMandatory() == isMandatory; } return ((Property) item).getDefinition().isMandatory() == isMandatory; } }
/** * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item) */ protected boolean matches(Item item) throws RepositoryException { if (item.isNode()) { return ((Node) item).getDefinition().isMandatory() == isMandatory; } return ((Property) item).getDefinition().isMandatory() == isMandatory; } }
protected void removeProperties(final Node node) throws RepositoryException { for (Property property : new PropertyIterable(node.getProperties())) { if (!property.getDefinition().isProtected()) { property.remove(); } } }
public boolean matches(Item item) throws RepositoryException { if (item.isNode()) { return ((Node) item).getDefinition().isMandatory() == isMandatory; } else { return ((Property) item).getDefinition().isMandatory() == isMandatory; } }
/** * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item) */ @Override protected boolean matches(Item item) throws RepositoryException { if (item.isNode()) { return ((Node) item).getDefinition().isMandatory() == isMandatory; } return ((Property) item).getDefinition().isMandatory() == isMandatory; } }
@Test public void testDefaultPropertyDefinition() throws Exception { // GIVEN // WHEN Property property = new MockProperty("test", new MockValue("value"), null); // THEN assertThat(property.getDefinition(), instanceOf(MockPropertyDefinition.class)); assertThat(property.getDefinition().isMultiple(), is(false)); assertThat(property.getDefinition().isMandatory(), is(false)); }
public void testEmptyValues() throws Exception { superuser.importXML(targetPath, getImportStream(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); superuser.save(); Node n = superuser.getNode(targetPath).getNode(nodeName4); Property p = n.getNode(nodeName3).getProperty("test:multiProperty"); assertTrue(p.isMultiple()); assertTrue(p.getDefinition().isMultiple()); Assert.assertArrayEquals(new String[0], p.getValues()); } }
public void testSingleValues() throws Exception { superuser.importXML(targetPath, getImportStream(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); superuser.save(); Node n = superuser.getNode(targetPath).getNode(nodeName4); Property p = n.getNode(nodeName1).getProperty("test:multiProperty"); assertTrue(p.isMultiple()); assertTrue(p.getDefinition().isMultiple()); Assert.assertArrayEquals(new Value[]{vf.createValue("v1")}, p.getValues()); }
public void testMultiValues() throws Exception { superuser.importXML(targetPath, getImportStream(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); superuser.save(); Node n = superuser.getNode(targetPath).getNode(nodeName4); Property p = n.getNode(nodeName2).getProperty("test:multiProperty"); assertTrue(p.isMultiple()); assertTrue(p.getDefinition().isMultiple()); Value[] expected = new Value[] {vf.createValue("v1"), vf.createValue("v2")}; Assert.assertArrayEquals(expected, p.getValues()); }