Tabnine Logo
MultiStringPropertyState
Code IndexAdd Tabnine to your IDE (free)

How to use
MultiStringPropertyState
in
org.apache.jackrabbit.oak.plugins.memory

Best Java code snippets using org.apache.jackrabbit.oak.plugins.memory.MultiStringPropertyState (Showing top 20 results out of 315)

origin: apache/jackrabbit-oak

@NotNull
public static PropertyValue newString(@NotNull Iterable<String> value) {
  return new PropertyStateValue(MultiStringPropertyState.stringProperty("", value));
}
origin: apache/jackrabbit-oak

/**
 * Create a multi valued {@code PropertyState} from a list of strings.
 * @param name  The name of the property state
 * @param values  The values of the property state
 * @return  The new property state of type {@link Type#STRINGS}
 */
public static PropertyState stringProperty(String name, Iterable<String> values) {
  return new MultiStringPropertyState(name, values);
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Nonnull
public static PropertyValue newString(@Nonnull Iterable<String> value) {
  return new PropertyStateValue(MultiStringPropertyState.stringProperty("", value));
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Create a multi valued {@code PropertyState} from a list of strings.
 * @param name  The name of the property state
 * @param values  The values of the property state
 * @return  The new property state of type {@link Type#STRINGS}
 */
public static PropertyState stringProperty(String name, Iterable<String> values) {
  return new MultiStringPropertyState(name, values);
}
origin: apache/jackrabbit-oak

private void insert(NodeBuilder index, String key, String value) {
  ApproximateCounter.adjustCountSync(index, 1);
  NodeBuilder k = index.child(key);
  ArrayList<String> list = new ArrayList<String>();
  list.add(value);
  if (k.hasProperty("entry")) {
    // duplicate key (to detect duplicate entries)
    // this is just set temporarily,
    // while trying to add a duplicate entry
    PropertyState s = k.getProperty("entry");
    for (int i = 0; i < s.count(); i++) {
      String r = s.getValue(Type.STRING, i);
      if (!list.contains(r)) {
        list.add(r);
      }
    }
  }
  PropertyState s2 = MultiStringPropertyState.stringProperty("entry", list);
  k.setProperty(s2);
  insertCallback.accept(k);
}
origin: apache/jackrabbit-oak

parent.child("child-moved").setProperty("foo", "value");
parent.child("child-moved").setProperty(
    new MultiStringPropertyState("bar", Arrays.asList("value")));
store.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY);
parent = root.child("parent");
parent.setProperty("foo", "value");
parent.setProperty(new MultiStringPropertyState(
    "bar", Arrays.asList("value")));
store.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY);
origin: org.apache.jackrabbit/oak-core

private void insert(NodeBuilder index, String key, String value) {
  ApproximateCounter.adjustCountSync(index, 1);
  NodeBuilder k = index.child(key);
  ArrayList<String> list = new ArrayList<String>();
  list.add(value);
  if (k.hasProperty("entry")) {
    // duplicate key (to detect duplicate entries)
    // this is just set temporarily,
    // while trying to add a duplicate entry
    PropertyState s = k.getProperty("entry");
    for (int i = 0; i < s.count(); i++) {
      String r = s.getValue(Type.STRING, i);
      if (!list.contains(r)) {
        list.add(r);
      }
    }
  }
  PropertyState s2 = MultiStringPropertyState.stringProperty("entry", list);
  k.setProperty(s2);
  insertCallback.accept(k);
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

private void insert(NodeBuilder index, String key, String value) {
  ApproximateCounter.adjustCountSync(index, 1);
  NodeBuilder k = index.child(key);
  ArrayList<String> list = new ArrayList<String>();
  list.add(value);
  if (k.hasProperty("entry")) {
    // duplicate key (to detect duplicate entries)
    // this is just set temporarily,
    // while trying to add a duplicate entry
    PropertyState s = k.getProperty("entry");
    for (int i = 0; i < s.count(); i++) {
      String r = s.getValue(Type.STRING, i);
      if (!list.contains(r)) {
        list.add(r);
      }
    }
  }
  PropertyState s2 = MultiStringPropertyState.stringProperty("entry", list);
  k.setProperty(s2);
  insertCallback.accept(k);
}
origin: apache/jackrabbit-oak

    strings.add(getString(value, type));
  return MultiStringPropertyState.stringProperty(name, strings);
case PropertyType.BINARY:
  List<Blob> blobs = Lists.newArrayList();
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

    strings.add(getString(value, type));
  return MultiStringPropertyState.stringProperty(name, strings);
case PropertyType.BINARY:
  List<Blob> blobs = Lists.newArrayList();
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

private static void remove(NodeBuilder index, String key, String value) {
  ApproximateCounter.adjustCountSync(index, -1);
  NodeBuilder builder = index.getChildNode(key);
  if (builder.exists()) {
    // there could be (temporarily) multiple entries
    // we need to remove the right one
    PropertyState s = builder.getProperty("entry");
    if (s.count() == 1) {
      builder.remove();
    } else {
      ArrayList<String> list = new ArrayList<String>();
      for (int i = 0; i < s.count(); i++) {
        String r = s.getValue(Type.STRING, i);
        if (!r.equals(value)) {
          list.add(r);
        }
      }
      PropertyState s2 = MultiStringPropertyState.stringProperty("entry", list);
      builder.setProperty(s2);
    }
  }
}

origin: apache/jackrabbit-oak

private static void remove(NodeBuilder index, String key, String value) {
  ApproximateCounter.adjustCountSync(index, -1);
  NodeBuilder builder = index.getChildNode(key);
  if (builder.exists()) {
    // there could be (temporarily) multiple entries
    // we need to remove the right one
    PropertyState s = builder.getProperty("entry");
    if (s.count() == 1) {
      builder.remove();
    } else {
      ArrayList<String> list = new ArrayList<String>();
      for (int i = 0; i < s.count(); i++) {
        String r = s.getValue(Type.STRING, i);
        if (!r.equals(value)) {
          list.add(r);
        }
      }
      PropertyState s2 = MultiStringPropertyState.stringProperty("entry", list);
      builder.setProperty(s2);
    }
  }
}

origin: org.apache.jackrabbit/oak-core

private static void remove(NodeBuilder index, String key, String value) {
  ApproximateCounter.adjustCountSync(index, -1);
  NodeBuilder builder = index.getChildNode(key);
  if (builder.exists()) {
    // there could be (temporarily) multiple entries
    // we need to remove the right one
    PropertyState s = builder.getProperty("entry");
    if (s.count() == 1) {
      builder.remove();
    } else {
      ArrayList<String> list = new ArrayList<String>();
      for (int i = 0; i < s.count(); i++) {
        String r = s.getValue(Type.STRING, i);
        if (!r.equals(value)) {
          list.add(r);
        }
      }
      PropertyState s2 = MultiStringPropertyState.stringProperty("entry", list);
      builder.setProperty(s2);
    }
  }
}

origin: apache/jackrabbit-oak

@Test
public void testAssignFromStrings() {
  PropertyState source = MultiStringPropertyState.stringProperty("foo", Arrays.asList("1", "2", "3"));
  PropertyBuilder builder = PropertyBuilder.scalar(Type.LONG);
  builder.assignFrom(source);
  assertEquals(MultiLongPropertyState.createLongProperty("foo", Arrays.asList(1L, 2L, 3L)),
      builder.getPropertyState());
}
origin: apache/jackrabbit-oak

@Test
public void testAssignFromLongs() {
  PropertyState source = MultiLongPropertyState.createLongProperty("foo", Arrays.asList(1L, 2L, 3L));
  PropertyBuilder builder = PropertyBuilder.scalar(Type.STRING);
  builder.assignFrom(source);
  assertEquals(MultiStringPropertyState.stringProperty("foo", Arrays.asList("1", "2", "3")),
      builder.getPropertyState());
}
origin: apache/jackrabbit-oak

@Test
public void testAssignInvariant() {
  PropertyState source = MultiStringPropertyState.stringProperty("source", Arrays.asList("1", "2", "3"));
  PropertyBuilder builder = PropertyBuilder.scalar(Type.STRING);
  builder.assignFrom(source);
  assertEquals(source, builder.getPropertyState());
}
origin: apache/jackrabbit-oak

switch (type.tag()) {
  case PropertyType.STRING:
    return MultiStringPropertyState.stringProperty(name, (Iterable<String>) values);
  case PropertyType.BINARY:
    return MultiBinaryPropertyState.binaryPropertyFromBlob(name, (Iterable<Blob>) values);
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

switch (type.tag()) {
  case PropertyType.STRING:
    return MultiStringPropertyState.stringProperty(name, (Iterable<String>) values);
  case PropertyType.BINARY:
    return MultiBinaryPropertyState.binaryPropertyFromBlob(name, (Iterable<Blob>) values);
origin: apache/jackrabbit-oak

@Test
public void testStringProperty() {
  PropertyBuilder builder = PropertyBuilder.scalar(Type.STRING);
  builder.setName("foo").setValue("bar");
  Assert.assertEquals(StringPropertyState.stringProperty("foo", "bar"),
      builder.getPropertyState());
  builder.setArray();
  Assert.assertEquals(MultiStringPropertyState.stringProperty("foo", Arrays.asList("bar")),
      builder.getPropertyState());
}
origin: apache/jackrabbit-oak

@Test
public void testStringsProperty() {
  PropertyBuilder builder = PropertyBuilder.array(Type.STRING);
  builder.setName("foo")
      .addValue("one")
      .addValue("two");
  assertEquals(MultiStringPropertyState.stringProperty("foo", Arrays.asList("one", "two")),
      builder.getPropertyState());
  builder.setScalar();
  try {
    builder.getPropertyState();
  } catch (IllegalStateException expected) {
    // success
  }
  builder.removeValue("one");
  assertEquals(StringPropertyState.stringProperty("foo", "two"),
      builder.getPropertyState());
}
org.apache.jackrabbit.oak.plugins.memoryMultiStringPropertyState

Most used methods

  • stringProperty
    Create a multi valued PropertyState from a list of strings.
  • <init>

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • compareTo (BigDecimal)
  • getExternalFilesDir (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JLabel (javax.swing)
  • CodeWhisperer alternatives
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