javax.jcr.Property.getName()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中javax.jcr.Property.getName()方法的一些代码示例,展示了Property.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.getName()方法的具体详情如下:
包路径:javax.jcr.Property
类名称:Property
方法名:getName

Property.getName介绍

暂无

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

@Override
  public boolean evaluateTyped(Property property) {
    try {
      return !(property.getName().startsWith(NodeTypes.JCR_PREFIX)
          || property.getName().startsWith(NodeTypes.MGNL_PREFIX));
    } catch (RepositoryException e) {
      // either invalid or not accessible to the current user
      return false;
    }
  }
}

代码示例来源:origin: apache/jackrabbit

public boolean evaluate(Object object) {
    try {
      Property p = (Property) object;
      return !ignoredProperties.contains(p.getName());
    }
    catch (RepositoryException ignore) {
      return true;
    }
  }
});

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

public boolean include(Property property) {
    try {
      return !ignoredProperties.contains(property.getName());
    }
    catch (RepositoryException e) {
      return false;
    }
  }
};

代码示例来源:origin: org.apache.sling/org.apache.sling.scripting.javascript

public String jsGet_name() {
  try {
    return property.getName();
  } catch (RepositoryException e) {
    return property.toString();
  }
}

代码示例来源:origin: org.fcrepo/fcrepo-kernel-modeshape

@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);
    }
  }
}

代码示例来源: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: info.magnolia/magnolia-core

@Override
public boolean evaluateTyped(Property property) {
  try {
    return !excludedNames.contains(property.getName()) && !excludedTypes.contains(PropertyType.nameFromValue(property.getType()));
  } catch (RepositoryException e) {
    return false;
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
  public int compare(Property o1, Property o2) {
    try {
      return o1.getName().compareTo(o2.getName());
    } catch (RepositoryException e) {
      throw new RuntimeException(e);
    }
  }
});

代码示例来源:origin: apache/jackrabbit

/**
 * 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();
}

代码示例来源: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

/**
 * 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());
}

代码示例来源: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
protected boolean matchesSafely(Property item) {
  try {
    return propertyNameMatcher.matches(item.getName());
  } catch (RepositoryException e) {
    throw new RuntimeRepositoryException(e);
  }
}

代码示例来源:origin: apache/jackrabbit

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);
}

代码示例来源: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: apache/jackrabbit

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)));
}

代码示例来源:origin: ModeShape/modeshape

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);
}

代码示例来源:origin: info.magnolia/magnolia-core

@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());
}

代码示例来源:origin: info.magnolia/magnolia-core

@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));
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testPropertyNameIsWrappedAndEncoded() throws Exception {
  MockNode node = new MockNode();
  node.setProperty("<html>", "bla");
  HTMLEscapingNodeWrapper wrapper = new HTMLEscapingNodeWrapper(node, false);
  assertEquals("&lt;html&gt;", wrapper.getProperty("<html>").getName());
}

相关文章