@SuppressWarnings("unchecked") @NotNull public PropertyBuilder<T> assignFrom(PropertyState property) { if (property != null) { setName(property.getName()); if (property.isArray()) { isArray = true; setValues((Iterable<T>) property.getValue(type.getArrayType())); } else { isArray = false; setValue(property.getValue(type)); } } return this; }
@SuppressWarnings("unchecked") @Nonnull public PropertyBuilder<T> assignFrom(PropertyState property) { if (property != null) { setName(property.getName()); if (property.isArray()) { isArray = true; setValues((Iterable<T>) property.getValue(type.getArrayType())); } else { isArray = false; setValue(property.getValue(type)); } } return this; }
private PropertyState migrateMultiProperty(PropertyState propertyState) throws IOException { Iterable<Blob> oldBlobs = propertyState.getValue(Type.BINARIES); List<Blob> newBlobs = new ArrayList<Blob>(); PropertyBuilder<Blob> builder = new PropertyBuilder<Blob>(Type.BINARY); builder.assignFrom(propertyState); boolean blobUpdated = false; for (Blob oldBlob : oldBlobs) { String blobId = getIdentity(oldBlob); if (blobStore.isMigrated(blobId)) { newBlobs.add(new BlobStoreBlob(blobStore, blobId)); } else { String newBlobId = blobStore.writeBlob(oldBlob.getNewStream()); Blob newBlob = new BlobStoreBlob(blobStore, newBlobId); newBlobs.add(newBlob); blobUpdated = true; } } if (blobUpdated) { builder.setValues(newBlobs); return builder.getPropertyState(); } else { return null; } }
private PropertyState migrateMultiProperty(PropertyState propertyState) throws IOException { Iterable<Blob> oldBlobs = propertyState.getValue(Type.BINARIES); List<Blob> newBlobs = new ArrayList<Blob>(); PropertyBuilder<Blob> builder = new PropertyBuilder<Blob>(Type.BINARY); builder.assignFrom(propertyState); boolean blobUpdated = false; for (Blob oldBlob : oldBlobs) { String blobId = getIdentity(oldBlob); if (blobStore.isMigrated(blobId)) { newBlobs.add(new BlobStoreBlob(blobStore, blobId)); } else { String newBlobId = blobStore.writeBlob(oldBlob.getNewStream()); Blob newBlob = new BlobStoreBlob(blobStore, newBlobId); newBlobs.add(newBlob); blobUpdated = true; } } if (blobUpdated) { builder.setValues(newBlobs); return builder.getPropertyState(); } else { return null; } }
private PropertyState migrateMultiProperty(PropertyState propertyState) throws IOException { Iterable<Blob> oldBlobs = propertyState.getValue(Type.BINARIES); List<Blob> newBlobs = new ArrayList<Blob>(); PropertyBuilder<Blob> builder = new PropertyBuilder<Blob>(Type.BINARY); builder.assignFrom(propertyState); boolean blobUpdated = false; for (Blob oldBlob : oldBlobs) { String blobId = getIdentity(oldBlob); if (blobStore.isMigrated(blobId)) { newBlobs.add(new BlobStoreBlob(blobStore, blobId)); } else { String newBlobId = blobStore.writeBlob(oldBlob.getNewStream()); Blob newBlob = new BlobStoreBlob(blobStore, newBlobId); newBlobs.add(newBlob); blobUpdated = true; } } if (blobUpdated) { builder.setValues(newBlobs); return builder.getPropertyState(); } else { return null; } }
pb.setName(JCR_PREDECESSORS).setValues(successor.getProperty(JCR_PREDECESSORS).getValue(Type.REFERENCES)); NodeBuilder predecessor = getVersionById(vh, predId); PropertyBuilder<String> pb = PropertyBuilder.array(Type.REFERENCE); pb.setName(JCR_SUCCESSORS).setValues(predecessor.getProperty(JCR_SUCCESSORS).getValue(Type.REFERENCES));
pb.setName(JCR_PREDECESSORS).setValues(successor.getProperty(JCR_PREDECESSORS).getValue(Type.REFERENCES)); NodeBuilder predecessor = getVersionById(vh, predId); PropertyBuilder<String> pb = PropertyBuilder.array(Type.REFERENCE); pb.setName(JCR_SUCCESSORS).setValues(predecessor.getProperty(JCR_SUCCESSORS).getValue(Type.REFERENCES));
pb.setName(JCR_PREDECESSORS).setValues(successor.getProperty(JCR_PREDECESSORS).getValue(Type.REFERENCES)); NodeBuilder predecessor = getVersionById(vh, predId); PropertyBuilder<String> pb = PropertyBuilder.array(Type.REFERENCE); pb.setName(JCR_SUCCESSORS).setValues(predecessor.getProperty(JCR_SUCCESSORS).getValue(Type.REFERENCES));