public boolean evaluate(Object object) { try { Property p = (Property) object; return !ignoredProperties.contains(p.getName()); } catch (RepositoryException ignore) { return true; } } });
public boolean include(Property property) { try { return !ignoredProperties.contains(property.getName()); } catch (RepositoryException e) { return false; } } };
public String jsGet_name() { try { return property.getName(); } catch (RepositoryException e) { return property.toString(); } }
@Override public boolean test(final Property prop) { try { return (prop.getName().equals(JCR_LASTMODIFIED) && !subject.hasProperty(FEDORA_LASTMODIFIED)) || (prop.getName().equals(JCR_LASTMODIFIEDBY) && !subject.hasProperty(FEDORA_LASTMODIFIEDBY)) || (prop.getName().equals(JCR_CREATED) && !subject.hasProperty(FEDORA_CREATED)) || (prop.getName().equals(JCR_CREATEDBY) && !subject.hasProperty(FEDORA_CREATEDBY)); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } }
protected boolean skip(final Property prop) throws RepositoryException { final String primaryNodeTypeName = prop.getParent().getPrimaryNodeType().getName(); if (primaryNodeTypeName.equals(NT_FACETSEARCH) && HIPPO_COUNT.equals(prop.getName())) { return true; } if (prop.getName().equals(HIPPO_PATHS)) { return true; } return false; } }
@Override public boolean evaluateTyped(Property property) { try { return !excludedNames.contains(property.getName()) && !excludedTypes.contains(PropertyType.nameFromValue(property.getType())); } catch (RepositoryException e) { return false; } }
/** * Move <code>property</code> to the new <code>parent</code>. */ protected void move(Property property, Node parent) throws RepositoryException { parent.setProperty(property.getName(), property.getValue()); property.remove(); }
public static Property renameProperty(Property property, String newName) throws RepositoryException { // Do nothing if the property already has this name, otherwise we would remove the property if (property.getName().equals(newName)) { return property; } Node node = property.getParent(); Property newProperty = node.setProperty(newName, property.getValue()); property.remove(); return newProperty; }
/** * Test if the name of property created with an expanded name is properly * return as standard JCR name. * * @throws RepositoryException */ public void testExpandedNameItem() throws RepositoryException { String propName = getExpandedName(propertyName1); Property p = testRootNode.setProperty(propName, getJcrValue(superuser, RepositoryStub.PROP_PROP_VALUE1, RepositoryStub.PROP_PROP_TYPE1, "test")); assertEquals(propertyName1, p.getName()); }
public CurrentEvolutionEntryImpl(Property property, EvolutionConfig config) { try { this.config = config; this.type = EvolutionEntryType.PROPERTY; this.name = property.getName(); this.depth = EvolutionPathUtil.getLastDepthForPath(property.getPath()); this.path = property.getParent().getName(); this.value = config.printProperty(property); } catch (Exception e) { log.error("Could not inititalize VersionEntry", e); } }
@Override protected boolean matchesSafely(Property item) { try { return propertyNameMatcher.matches(item.getName()); } catch (RepositoryException e) { throw new RuntimeRepositoryException(e); } }
public void testShallowHoldForOtherSession() throws RepositoryException, NotExecutableException { retentionMgr.addHold(testNodePath, getHoldName(), false); superuser.save(); // check for other session assertNoEffect((Node) otherS.getItem(childN.getPath()), nodeName3, propertyName2); assertEffect((Node) otherS.getItem(testNodePath), childN.getName(), childP.getName(), nodeName3, propertyName2); }
public Link(Property property) { try { setJCRNode(property.getParent()); setWorkspace(property.getSession().getWorkspace().toString()); setProperty(property); setPropertyName(property.getName()); } catch (RepositoryException e) { throw new RuntimeRepositoryException(e); } }
public void testPropertyAccessibleAfterSave() throws NotExecutableException, RepositoryException { Property p; try { p = testRootNode.setProperty(propname, "anyValue"); } catch (RepositoryException e) { throw new NotExecutableException(); } // check if p is valid and can be accessed from the parent node. String name = p.getName(); assertEquals("Added property must have the original name", name, propname); assertTrue("Accessing the created property again must return the 'same' item.", p.isSame(testRootNode.getProperty(propname))); }
private RestProperty createRestProperty( Session session, Property property, String baseUrl ) throws RepositoryException { List<String> values = restPropertyValues(property, baseUrl, session); String url = RestHelper.urlFrom(baseUrl, ITEMS_METHOD_NAME, encodedPath(property.getPath())); String parentUrl = RestHelper.urlFrom(baseUrl, ITEMS_METHOD_NAME, encodedPath(property.getParent().getPath())); boolean multiValued = property.isMultiple(); return new RestProperty(property.getName(), url, parentUrl, values, multiValued); }
@Test public void getPropertyOrNull() throws Exception { // GIVEN final String propertyValue = "value"; final String propertyName = "myProperty"; root.setProperty(propertyName, propertyValue); // WHEN final Property res = PropertyUtil.getPropertyOrNull(root, "myProperty"); // THEN assertEquals("Props Name should be " + propertyName, propertyName, res.getName()); assertEquals("Props Value should be " + propertyValue, propertyValue, res.getString()); }
@Test public void multivalueProperty() throws Exception { // GIVEN MockNode nuts = new MockNode("nuts"); String[] multivaluePropertyValue = new String[]{"fakeNutProperty1", "fakeNutProperty2"}; Property property = nuts.setProperty("fakeNut", multivaluePropertyValue); // THEN assertThat(nuts, hasProperty(property.getName(), multivaluePropertyValue)); } }
@Test public void testPropertyNameIsWrappedAndEncoded() throws Exception { MockNode node = new MockNode(); node.setProperty("<html>", "bla"); HTMLEscapingNodeWrapper wrapper = new HTMLEscapingNodeWrapper(node, false); assertEquals("<html>", wrapper.getProperty("<html>").getName()); }