本文整理了Java中javax.jcr.Property.getValues()
方法的一些代码示例,展示了Property.getValues()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.getValues()
方法的具体详情如下:
包路径:javax.jcr.Property
类名称:Property
方法名:getValues
[英]Returns an array of all the values of this property. Used to access multi-value properties. The array returned is a copy of the stored values, so changes to it are not reflected in internal storage.
[中]返回此属性的所有值的数组。用于访问多值属性。返回的数组是存储值的副本,因此对它的更改不会反映在内部存储中。
代码示例来源:origin: org.onehippo.cms7/hippo-addon-channel-manager-content-service
private static void copyFolderTypes(final Node parentNode, final Node newFolder) throws RepositoryException {
final Property parentFolderType = parentNode.getProperty(HIPPOSTD_FOLDERTYPE);
newFolder.setProperty(HIPPOSTD_FOLDERTYPE, parentFolderType.getValues());
}
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
private boolean needsUpdate(Node indexNode, IndexDefinition def) throws RepositoryException {
Value[] currentPropertyNames = indexNode.getProperty(PN_PROPERTY_NAMES).getValues();
return !currentPropertyNames[0].getString().equals(def.propertyName);
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-workflow-frontend
private boolean isLive(Node document) throws RepositoryException {
final Property property = JcrUtils.getPropertyIfExists(document, HippoNodeType.HIPPO_AVAILABILITY);
if (property != null) {
for (Value value : property.getValues()) {
if ("live".equals(value.getString())) {
return true;
}
}
}
return false;
}
代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault
private void writeSupertypes(Writer out, Node node) throws IOException, RepositoryException {
Value[] types = node.getProperty(JcrConstants.JCR_SUPERTYPES).getValues();
String delim = " > ";
for (Value s: types) {
out.write(delim);
out.write(s.getString());
delim = ", ";
}
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if adding properties with <code>Node.setProperty(String,
* String[])</code> works with <code>Session.save()</code>
*/
public void testNewStringArrayPropertySession() throws Exception {
testNode.setProperty(propertyName2, sArray1);
superuser.save();
assertEquals("Setting properties with Node.setProperty(String, String[]) and Session.save() not working",
Arrays.asList(vArray1),
Arrays.asList(testNode.getProperty(propertyName2).getValues()));
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine
public final Set<String> getMembers(Node group) throws RepositoryException {
final Property membersProperty = JcrUtils.getPropertyIfExists(group, HippoNodeType.HIPPO_MEMBERS);
if (membersProperty != null) {
Value[] values = membersProperty.getValues();
final Set<String> members = new HashSet<>(values.length);
for (final Value value : values) {
members.add(value.getString());
}
return members;
}
return new HashSet<>();
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
private boolean isLive(Node variant) throws RepositoryException {
if (variant.hasProperty(HippoNodeType.HIPPO_AVAILABILITY)) {
Property property = variant.getProperty(HippoNodeType.HIPPO_AVAILABILITY);
for (Value value : property.getValues()) {
if ("live".equals(value.getString())) {
return true;
}
}
}
return false;
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if adding properties with <code>Node.setProperty(String,
* Value[])</code> works with <code>Session.save()</code>
*/
public void testNewValueArrayPropertySession() throws Exception {
testNode.setProperty(propertyName2, vArray1);
superuser.save();
assertEquals("Setting properties with Node.setProperty(String, Value[]) and Session.save() not working",
Arrays.asList(vArray1),
Arrays.asList(testNode.getProperty(propertyName2).getValues()));
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-translation-repository
private List<String> getValues() throws RepositoryException {
if (property.isMultiple()) {
final List<String> values = new ArrayList<>();
for (Value value : property.getValues()) {
values.add(value.getString());
}
return values;
}
else {
return Arrays.asList(property.getString());
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-workflow
public List<String> getGalleryTypes() throws RemoteException, RepositoryException {
List<String> list = new LinkedList<>();
Value[] values = subject.getProperty(HIPPOSTD_GALLERYTYPE).getValues();
for (final Value value : values) {
list.add(value.getString());
}
return list;
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if adding properties with <code>Node.setProperty(String,
* Value[])</code> works with <code>parentNode.save()</code>
*/
public void testNewValueArrayPropertyParent() throws Exception {
testNode.setProperty(propertyName2, vArray1);
testRootNode.getSession().save();
assertEquals("Setting properties with Node.setProperty(String, Value[]) and parentNode.save() not working",
Arrays.asList(vArray1),
Arrays.asList(testNode.getProperty(propertyName2).getValues()));
}
代码示例来源:origin: apache/jackrabbit
/**
* Test the persistence of a property modified with an multi-value String
* parameter and saved from the Session Requires a multi-value String (mv)
*/
public void testMultiStringSession() throws RepositoryException {
String[] mv = new String[]{PROP_VALUE_1, PROP_VALUE_2};
property2.setValue(mv);
superuser.save();
Value[] values = property2.getValues();
List<String> strValues = new ArrayList<String>();
for (int i = 0; i < values.length; i++) {
strValues.add(values[i].getString());
}
assertEquals("Node property not saved", Arrays.asList(mv), strValues);
}
代码示例来源:origin: org.onehippo.cms7.essentials.sdk/implementation
public static String getDefaultPosition(final Node editorTemplate) throws RepositoryException {
final Node root = editorTemplate.getNode("root");
if (root.hasProperty("wicket.extensions")) {
final Value[] extensions = root.getProperty("wicket.extensions").getValues();
return root.getProperty(extensions[0].getString()).getString() + ".item";
}
return "${cluster.id}.field";
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if adding properties with <code>Node.setProperty(String, Value[],
* int)</code> works with <code>Session.save()</code>
*/
public void testNewValueArrayPropertySessionWithPropertyType() throws Exception {
testNode.setProperty(propertyName2, vArray1, PropertyType.STRING);
superuser.save();
assertEquals("Setting properties with Node.setProperty(String, Value[], int) and Session.save() not working",
Arrays.asList(vArray1),
Arrays.asList(testNode.getProperty(propertyName2).getValues()));
}
代码示例来源:origin: org.onehippo.cms7/hippo-addon-channel-manager-content-service
private void storeProperty(final Collection<FieldValue> values, final Property property) throws RepositoryException {
if (property.isMultiple()) {
for (final Value v : property.getValues()) {
values.add(getFieldValue(v.getString()));
}
} else {
values.add(getFieldValue(property.getString()));
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-admin
public List<String> getMembers() throws RepositoryException {
List<String> members = new ArrayList<String>();
if (node.hasProperty(HippoNodeType.HIPPO_MEMBERS)) {
Value[] vals = node.getProperty(HippoNodeType.HIPPO_MEMBERS).getValues();
for (Value val : vals) {
members.add(val.getString());
}
}
Collections.sort(members);
return members;
}
代码示例来源:origin: org.onehippo.cms7/hippo-addon-channel-manager-content-service
protected static boolean hasProperty(final Node node, final String propertyName) throws RepositoryException {
if (!node.hasProperty(propertyName)) {
return false;
}
final Property property = node.getProperty(propertyName);
if (!property.isMultiple()) {
return true;
}
// empty multiple property is equivalent to no property.
return property.getValues().length > 0;
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testMultiStringProperty() throws Exception {
// GIVEN
final String propertyName = "multi";
final String first = "one";
final String second = "two";
// WHEN
root.setProperty(propertyName, new String[]{first, second});
// THEN
assertTrue(root.hasProperty(propertyName));
Property property = root.getProperty(propertyName);
assertEquals(first, property.getValues()[0].getString());
assertEquals(second, property.getValues()[1].getString());
}
代码示例来源:origin: org.onehippo.cms7.essentials/hippo-essentials-plugin-api-implementation
public static String getDefaultPosition(final Node editorTemplate) throws RepositoryException {
final Node root = editorTemplate.getNode("root");
if (root.hasProperty("wicket.extensions")) {
final Value[] extensions = root.getProperty("wicket.extensions").getValues();
return root.getProperty(extensions[0].getString()).getString() + ".item";
}
return "${cluster.id}.field";
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if adding properties with <code>Node.setProperty(String, String[],
* int)</code> works with <code>parentNode.save()</code>
*/
public void testNewStringArrayPropertyParentWithPropertyType() throws Exception {
testNode.setProperty(propertyName2, sArray1, PropertyType.STRING);
testRootNode.getSession().save();
assertEquals("Setting properties with Node.setProperty(String, String[], int) and parentNode.save() not working",
Arrays.asList(vArray1),
Arrays.asList(testNode.getProperty(propertyName2).getValues()));
}
内容来源于网络,如有侵权,请联系作者删除!