Tabnine Logo
Property.isMultiple
Code IndexAdd Tabnine to your IDE (free)

How to use
isMultiple
method
in
javax.jcr.Property

Best Java code snippets using javax.jcr.Property.isMultiple (Showing top 20 results out of 657)

origin: info.magnolia/magnolia-templating

@Override
@SneakyThrows(RepositoryException.class)
public boolean hasChildren() {
  return getValue().isMultiple();
}
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-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: info.magnolia/magnolia-templating

@Override
@SneakyThrows(RepositoryException.class)
public String getValueAsString() {
  if (getValue().isMultiple()) {
    return getName();
  } else {
    return getValue().getString();
  }
}
origin: org.onehippo.cms7/hippo-repository-connector

private Object getValue(final Property property) {
  try {
    if (property.isMultiple()) {
      return getMultipleValues(property);
    } else {
      return getSingleValue(property);
    }
  } catch (RepositoryException ignore) {}
  return null;
}
origin: info.magnolia/magnolia-templating

@Override
@SneakyThrows(RepositoryException.class)
public String getDescription() {
  return getValue().isMultiple() ? String.valueOf(getValue().getValues().length) : getName();
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

private Value[] getPropertyValues(PropertyValue operand, Node node)
    throws RepositoryException {
  Property property = getProperty(operand, node);
  if (property == null) {
    return new Value[0];
  } else if (property.isMultiple()) {
    return property.getValues();
  } else {
    return new Value[] { property.getValue() };
  }
}
origin: info.magnolia/magnolia-core

public static void moveProperty(Property source, Node targetNode) throws RepositoryException {
  // JCR props can't be moved, we gotta recreate w/ same value and delete
  if (source.isMultiple()) {
    targetNode.setProperty(source.getName(), source.getValues());
  } else {
    targetNode.setProperty(source.getName(), source.getValue());
  }
  source.remove();
}
origin: org.onehippo.cms7/hippo-repository-api

public Object getValue(Property property) throws RepositoryException {
  if (property.isMultiple()) {
    return multiValueGetter.getValue(property.getValues());
  } else {
    return singleValueGetter.getValue(property.getValue());
  }
}
origin: org.onehippo.cms7/hippo-repository-modules

private void forStringCodecProperties(final Node node, final PropertyVisitor visitor) throws RepositoryException {
  final PropertyIterator properties = node.getProperties();
  while (properties.hasNext()) {
    final Property property = properties.nextProperty();
    if (!property.isMultiple()
        && property.getType() == PropertyType.STRING
        && !property.getName().contains(":")) {
      visitor.visit(property);
    }
  }
}
origin: ModeShape/modeshape

protected void verifyProperty( Node node,
                String propertyName,
                String expectedValue ) throws RepositoryException {
  Property property = node.getProperty(propertyName);
  Value value = property.isMultiple() ? property.getValues()[0] : property.getValue();
  assertEquals(expectedValue, value.getString());
}
origin: info.magnolia/magnolia-core

@Override
protected boolean matchesSafely(Property item) {
  try {
    final V valueObject = (V) (item.isMultiple() ? Arrays.stream(item.getValues()).map(value -> PropertyUtil.getValueObject(value)).toArray() : PropertyUtil.getValueObject(item.getValue()));
    return propertyValueMatcher.matches(valueObject);
  } catch (RepositoryException e) {
    throw new RuntimeRepositoryException(e);
  }
}
origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Test
public void setMultiValueProperty() throws Exception {
  // GIVEN
  String[] values = { "Art", "Dan", "Jen" };
  JcrNodeAdapter adapter = new JcrNodeAdapter(node);
  Property<HashSet> property = new ObjectProperty<>(new HashSet<>(Arrays.asList(values)));
  adapter.addItemProperty("multiple", property);
  // WHEN
  Node res = adapter.applyChanges();
  // THEN
  assertTrue(res.getProperty("multiple").isMultiple());
}
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 testIsMultiple() throws RepositoryException {
  Property property = new MockProperty("test", "test", null);
  assertTrue(!property.isMultiple());
}
origin: apache/jackrabbit-oak

  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());
  }
}
origin: apache/jackrabbit-oak

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());
}
origin: info.magnolia/magnolia-core

@Test
public void testGetMultiValuedWithSingleValue() throws Exception {
  // GIVEN
  final String firstString = "one";
  final MockValue first = new MockValue(firstString);
  // WHEN
  final Property property = new MockProperty("test", new Value[]{first}, null);
  // THEN
  assertTrue(property.isMultiple());
  assertEquals(firstString, property.getValues()[0].getString());
}
origin: apache/jackrabbit-oak

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());
}
origin: apache/jackrabbit

private static void checkLength(Property p) throws RepositoryException {
  if (p.isMultiple()) {
    Value[] vals = p.getValues();
    long[] lengths = p.getLengths();
    for (int i = 0; i < lengths.length; i++) {
      assertTrue("Wrong property length", lengths[i] == getValueLength(vals[i]));
    }
  } else {
    assertTrue("Wrong property length", p.getLength() == getValueLength(p.getValue()));
  }
}
javax.jcrPropertyisMultiple

Javadoc

Returns true if this property is multi-valued and false if this property is single-valued.

Popular methods of Property

  • getString
    Returns a String representation of the value of this property. A shortcut for Property.getValue().g
  • getValues
    Returns an array of all the values of this property. Used to access multi-value properties. The arra
  • getValue
    Returns the value of this property as a Value object. The object returned is a copy of the stored va
  • getName
  • getType
    Returns the type of this Property. One of: * PropertyType.STRING * PropertyType.BINARY * Property
  • getBinary
    Returns a Binary representation of the value of this property. A shortcut for Property.getValue().g
  • getBoolean
    Returns a boolean representation of the value of this property. A shortcut for Property.getValue().
  • remove
  • getDate
    Returns a Calendar representation of the value of this property. A shortcut for Property.getValue()
  • getLong
    Returns a long representation of the value of this property. A shortcut for Property.getValue().get
  • getDefinition
    Returns the property definition that applies to this property. In some cases there may appear to be
  • setValue
    Sets the value of this property to the values array. If this property's property type is not constra
  • getDefinition,
  • setValue,
  • getParent,
  • getPath,
  • getNode,
  • getLength,
  • getDouble,
  • getStream,
  • getSession

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now