/** * Create a multi valued {@code PropertyState} from a list of {@link Blob}. * @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#BINARIES} */ public static PropertyState binaryPropertyFromBlob(String name, Iterable<Blob> values) { return new MultiBinaryPropertyState(name, values); }
blobs.add(AbstractPropertyState.getBlob(value)); return MultiBinaryPropertyState.binaryPropertyFromBlob(name, blobs); case PropertyType.LONG: List<Long> longs = Lists.newArrayList();
blobs.add(AbstractPropertyState.getBlob(value)); return MultiBinaryPropertyState.binaryPropertyFromBlob(name, blobs); case PropertyType.LONG: List<Long> longs = Lists.newArrayList();
@NotNull private PropertyState compact(@NotNull PropertyState property) { compactionMonitor.onProperty(); String name = property.getName(); Type<?> type = property.getType(); if (type == BINARY) { compactionMonitor.onBinary(); return binaryProperty(name, property.getValue(Type.BINARY)); } else if (type == BINARIES) { List<Blob> blobs = newArrayList(); for (Blob blob : property.getValue(BINARIES)) { compactionMonitor.onBinary(); blobs.add(blob); } return binaryPropertyFromBlob(name, blobs); } else { return createProperty(name, property.getValue(type), type); } }
/** * Create a multi valued {@code PropertyState} from a list of {@link Blob}. * @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#BINARIES} */ public static PropertyState binaryPropertyFromBlob(String name, Iterable<Blob> values) { return new MultiBinaryPropertyState(name, values); }
private static NodeStore initNodeStore(final Optional<Blob> blobProp1, final Optional<Blob> blobProp2, final Optional<String> stringProp, final Optional<Integer> intProp, final Optional<List<Blob>> blobPropList) throws CommitFailedException { final NodeStore nodeStore = new MemoryNodeStore(); NodeBuilder rootBuilder = nodeStore.getRoot().builder(); NodeBuilder builder = initNodeBuilder(rootBuilder); if (blobProp1.isPresent()) { builder.setProperty("blobProp1", blobProp1.get()); } if (blobProp2.isPresent()) { builder.setProperty("blobProp2", blobProp2.get()); } if (stringProp.isPresent()) { builder.setProperty("stringProp", stringProp.get()); } if (intProp.isPresent()) { builder.setProperty("intProp", intProp.get()); } if (blobPropList.isPresent()) { builder.setProperty(MultiBinaryPropertyState .binaryPropertyFromBlob("blobPropList", blobPropList.get())); } nodeStore.merge(rootBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY); return nodeStore; }
/** * Create a multi valued {@code PropertyState} from a list of byte arrays. * @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#BINARIES} */ public static PropertyState binaryPropertyFromArray(String name, Iterable<byte[]> values) { List<Blob> blobs = Lists.newArrayList(); for (byte[] data : values) { blobs.add(new ArrayBasedBlob(data)); } return new MultiBinaryPropertyState(name, blobs); }
return MultiStringPropertyState.stringProperty(name, (Iterable<String>) values); case PropertyType.BINARY: return MultiBinaryPropertyState.binaryPropertyFromBlob(name, (Iterable<Blob>) values); case PropertyType.LONG: return MultiLongPropertyState.createLongProperty(name, (Iterable<Long>) values);
/** * Create a multi valued {@code PropertyState} from a list of byte arrays. * @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#BINARIES} */ public static PropertyState binaryPropertyFromArray(String name, Iterable<byte[]> values) { List<Blob> blobs = Lists.newArrayList(); for (byte[] data : values) { blobs.add(new ArrayBasedBlob(data)); } return new MultiBinaryPropertyState(name, blobs); }
return MultiStringPropertyState.stringProperty(name, (Iterable<String>) values); case PropertyType.BINARY: return MultiBinaryPropertyState.binaryPropertyFromBlob(name, (Iterable<Blob>) values); case PropertyType.LONG: return MultiLongPropertyState.createLongProperty(name, (Iterable<Long>) values);
private static void addTestContent(@NotNull String parent, @NotNull NodeStore nodeStore) throws CommitFailedException, IOException { NodeBuilder rootBuilder = nodeStore.getRoot().builder(); NodeBuilder parentBuilder = rootBuilder.child(parent); parentBuilder.setChildNode("a").setChildNode("aa").setProperty("p", 42); parentBuilder.getChildNode("a").setChildNode("bb").setChildNode("bbb"); parentBuilder.setChildNode("b").setProperty("bin", createBlob(nodeStore, 42)); parentBuilder.setChildNode("c").setProperty(binaryPropertyFromBlob("bins", createBlobs(nodeStore, 42, 43, 44))); nodeStore.merge(rootBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY); }
private static void addTestContent(NodeStore nodeStore) throws CommitFailedException, IOException { NodeBuilder builder = nodeStore.getRoot().builder(); builder.setChildNode("a").setChildNode("aa").setProperty("p", 42); builder.getChildNode("a").setChildNode("error").setChildNode("IOException"); builder.setChildNode("b").setProperty("bin", createBlob(nodeStore, 42)); builder.setChildNode("c").setProperty(binaryPropertyFromBlob("bins", createBlobs(nodeStore, 42, 43, 44))); nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY); }
case PropertyType.BINARY: return type.isArray() ? MultiBinaryPropertyState.binaryPropertyFromBlob(name, (Iterable<Blob>) value) : BinaryPropertyState.binaryProperty(name, (Blob) value); case PropertyType.LONG:
case PropertyType.BINARY: return type.isArray() ? MultiBinaryPropertyState.binaryPropertyFromBlob(name, (Iterable<Blob>) value) : BinaryPropertyState.binaryProperty(name, (Blob) value); case PropertyType.LONG: