本文整理了Java中javax.jcr.Property.getParent()
方法的一些代码示例,展示了Property.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.getParent()
方法的具体详情如下:
包路径:javax.jcr.Property
类名称:Property
方法名:getParent
暂无
代码示例来源:origin: ModeShape/modeshape
private String getNameOfDdlContent( Property inputProperty ) throws RepositoryException {
Node parentNode = inputProperty.getParent();
if (JcrConstants.JCR_CONTENT.equalsIgnoreCase(parentNode.getName())) {
parentNode = parentNode.getParent();
}
return parentNode.getName();
}
}
代码示例来源:origin: info.magnolia/magnolia-core
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;
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if getParent() returns parent node
*/
public void testGetParent() throws RepositoryException {
assertTrue("getParent() of a property must return the parent node.",
testRootNode.isSame(property.getParent()));
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-console-frontend
@Override
public Time lastModifiedTime() {
try {
final Node node = model.getProperty().getParent();
return Time.valueOf(JcrUtils.getDateProperty(node, "jcr:lastModified", Calendar.getInstance()).getTime());
} catch (RepositoryException e) {
log.error("Unexpected exception while determining last modified date", e);
}
return Time.valueOf(new Date());
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine
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;
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape
public static Node getParent(Property prop) {
try {
return prop.getParent();
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to get the parent node of the property: " + prop, e);
}
}
代码示例来源:origin: net.adamcin.commons/net.adamcin.commons.jcr
public Property getProperty(String s) throws RepositoryException {
Property property = this.item.getProperty(s);
Node parent = property.getParent();
return new PropertyProxy(property, item == parent ? this : new NodeProxy(parent));
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
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);
}
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public boolean evaluateProperty(Property property) {
try {
return evaluateNode(property.getParent()) && propertyPredicate.evaluate(property);
} catch (RepositoryException e) {
throw new RuntimeRepositoryException(e);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public final boolean isSame( Item otherItem ) throws RepositoryException {
checkSession();
if (otherItem instanceof Property) {
Property otherProperty = (Property)otherItem;
// The nodes that own the properties must be the same ...
if (!getParent().isSame(otherProperty.getParent())) return false;
// The properties must have the same name ...
return getName().equals(otherProperty.getName());
}
return false;
}
代码示例来源:origin: ModeShape/modeshape
@Override
public final boolean isSame( Item otherItem ) throws RepositoryException {
checkSession();
if (otherItem instanceof Property) {
Property otherProperty = (Property)otherItem;
// The nodes that own the properties must be the same ...
if (!getParent().isSame(otherProperty.getParent())) return false;
// The properties must have the same name ...
return getName().equals(otherProperty.getName());
}
return false;
}
代码示例来源:origin: info.magnolia.templating/magnolia-templating-essentials-imaging
@Override
public boolean shouldRegenerate(Property cachedBinary, ParameterProvider<ThemeAwareParameter> parameterProvider) throws RepositoryException {
final Calendar cacheLastMod = NodeTypes.LastModified.getLastModified(cachedBinary.getParent().getParent());
final Calendar srcLastMod = NodeTypes.LastModified.getLastModified(parameterProvider.getParameter().getNode());
return cacheLastMod.before(srcLastMod);
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testWorkspaceReturnsLogicalName4() throws RepositoryException {
// GIVEN
Node root = MgnlContext.getJCRSession("magnolia-mgnlSystem").getRootNode();
root.addNode("test", NodeTypes.ContentNode.NAME).setProperty("testProp", "testVal");
root.getSession().save();
// WHEN
String name = root.getNode("test").getProperty("testProp").getParent().getSession().getWorkspace().getName();
// THEN
assertTrue(name.equals("magnolia-mgnlSystem"));
}
代码示例来源:origin: ModeShape/modeshape
private Property updateProperty( Property property,
JSONObject jsonItem ) throws RepositoryException, JSONException {
String propertyName = property.getName();
String jsonPropertyName = jsonItem.has(propertyName) ? propertyName : propertyName + BASE64_ENCODING_SUFFIX;
Node node = property.getParent();
setPropertyOnNode(node, jsonPropertyName, jsonItem.get(jsonPropertyName));
return property;
}
代码示例来源:origin: info.magnolia/magnolia-core
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);
}
}
代码示例来源:origin: org.fcrepo/fcrepo-kernel-modeshape
@SuppressWarnings("unchecked")
private static Stream<Property> getMembershipContext(final FedoraResource resource) throws RepositoryException {
return iteratorToStream(getJcrNode(resource).getReferences(LDP_MEMBER_RESOURCE))
.filter(UncheckedPredicate.uncheck((final Property p) -> {
final Node container = p.getParent();
return container.isNodeType(LDP_DIRECT_CONTAINER)
|| container.isNodeType(LDP_INDIRECT_CONTAINER);
}));
}
代码示例来源:origin: info.magnolia/magnolia-module-standard-templating-kit
@Override
public boolean shouldRegenerate(Property cachedBinary, ParameterProvider<STKParameter> parameterProvider) throws RepositoryException {
final Calendar cacheLastMod = NodeTypes.LastModified.getLastModified(cachedBinary.getParent().getParent());
final Calendar srcLastMod = NodeTypes.LastModified.getLastModified(parameterProvider.getParameter().getNodeData().getParent().getJCRNode());
return cacheLastMod.before(srcLastMod);
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void setPropertyAgain() throws RepositoryException {
Session session = getAdminSession();
Property p1 = session.getProperty("/foo/stringProp");
Property p2 = p1.getParent().setProperty("stringProp", "newValue");
Property p3 = session.getProperty("/foo/stringProp");
assertEquals("newValue", p1.getString());
assertEquals("newValue", p2.getString());
assertEquals("newValue", p3.getString());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testPropertyFromNodeReturnedFromPropertyIsWrapped() throws Exception {
MockSession session = new MockSession("sessionName");
Node rootNode = session.getRootNode();
Node foo = rootNode.addNode("foo");
foo.setProperty("text", "<html/>");
HTMLEscapingNodeWrapper wrapper = new HTMLEscapingNodeWrapper(foo, false);
Property property = wrapper.getProperty("text").getParent().getProperty("text");
assertTrue(property instanceof HTMLEscapingPropertyWrapper);
assertEquals("<html/>", property.getString());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testExecute() throws RepositoryException, TaskExecutionException {
// GIVEN
Property property1 = NodeUtil.createPath(session.getRootNode(), "/demo-project/about/subsection-articles/article", NodeTypes.ContentNode.NAME).setProperty("someProperty", "someValue");
Task task = new RemovePropertyTask("name", property1.getParent().getPath(), "someProperty");
// WHEN
task.execute(ctx);
// THEN
assertFalse("Property should have been removed", session.propertyExists("/demo-project/about/subsection-articles/article/someProperty"));
assertEquals("Remove property 'config:/demo-project/about/subsection-articles/article/someProperty'.", task.getDescription());
}
}
内容来源于网络,如有侵权,请联系作者删除!