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

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

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

origin: apache/jackrabbit-oak

@NotNull
public static PropertyValue newString(@NotNull Iterable<String> value) {
  return new PropertyStateValue(MultiStringPropertyState.stringProperty("", value));
}
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: 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: 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: 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

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

case PropertyType.STRING:
  return type.isArray()
  ? MultiStringPropertyState.stringProperty(name, (Iterable<String>) value)
  : StringPropertyState.stringProperty(name, (String) value);
case PropertyType.BINARY:
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

case PropertyType.STRING:
  return type.isArray()
  ? MultiStringPropertyState.stringProperty(name, (Iterable<String>) value)
  : StringPropertyState.stringProperty(name, (String) value);
case PropertyType.BINARY:
org.apache.jackrabbit.oak.plugins.memoryMultiStringPropertyStatestringProperty

Javadoc

Create a multi valued PropertyState from a list of strings.

Popular methods of MultiStringPropertyState

  • <init>

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSupportFragmentManager (FragmentActivity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top plugins for Android Studio
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