Examples of WriteOptions


Examples of org.lilyproject.tools.import_.json.WriteOptions

        if (filter.getField() != null && filter.getFieldValue() != null) {
            node.put("field", QNameConverter.toJson(filter.getField(), namespaces));

            ValueType valueType = repository.getTypeManager().getFieldTypeByName(filter.getField()).getValueType();
            JsonNode valueAsJson = RecordWriter.INSTANCE.valueToJson(filter.getFieldValue(), valueType,
                    new WriteOptions(), namespaces, repository);

            node.put("fieldValue", valueAsJson);
            node.putObject("value");
        }
View Full Code Here

Examples of org.lilyproject.tools.import_.json.WriteOptions

        }
        return integers;
    }

    public static WriteOptions getWriteOptions(UriInfo uriInfo) {
        WriteOptions options = new WriteOptions();

        String includeSchema = uriInfo.getQueryParameters().getFirst("schema");
        if (includeSchema != null) {
            options.setIncludeSchema(includeSchema.equalsIgnoreCase("true"));
        }

        String useNamespacePrefixes = uriInfo.getQueryParameters().getFirst("nsprefixes");
        if (useNamespacePrefixes != null) {
            options.setUseNamespacePrefixes(useNamespacePrefixes.equalsIgnoreCase("true"));
        }

        return options;
    }
View Full Code Here

Examples of org.lilyproject.tools.import_.json.WriteOptions

            job.getConfiguration().set(REPOSITORY_TABLES, Joiner.on(',').join(repositoryTables));
        }

        if (scan != null) {
            try {
                JsonNode node = RecordScanWriter.INSTANCE.toJson(scan, new WriteOptions(), repository);
                String scanData = JsonFormat.serializeAsString(node);
                job.getConfiguration().set(AbstractLilyScanInputFormat.SCAN, scanData);
            } catch (Exception e) {
                ExceptionUtil.handleInterrupt(e);
                throw new RuntimeException(e);
View Full Code Here

Examples of org.lilyproject.tools.import_.json.WriteOptions

        assertEquals(new Integer(55), record1.getField(new QName("import2", "f2")));
    }

    private byte[] scanToBytes(RecordScan scan) throws RepositoryException, InterruptedException, IOException {
        return JsonFormat.serializeAsBytes(
                writer.toJson(scan, new WriteOptions(), new NamespacesImpl(false), repository));
    }
View Full Code Here

Examples of org.lilyproject.tools.import_.json.WriteOptions

        assertNull(node.get("namespaces"));
        assertEquals("{ns}stringField", node.get("recordFilter").get("field").getTextValue());

        // Test serialization with namespace prefixes
        byte[] dataWithPrefixes = JsonFormat.serializeAsBytes(
                writer.toJson(scan, new WriteOptions(), repository));

        JsonNode nodeWithPrefixes = new ObjectMapper().readTree(dataWithPrefixes);
        assertNotNull(nodeWithPrefixes.get("namespaces"));
        assertTrue(nodeWithPrefixes.get("recordFilter").get("field").getTextValue().endsWith("$stringField"));
    }
View Full Code Here

Examples of org.lilyproject.tools.import_.json.WriteOptions

        record.setMetadata(new QName("ns", "field2"),
                new MetadataBuilder()
                        .delete("mfield4")
                        .build());

        WriteOptions options = new WriteOptions();
        options.setUseNamespacePrefixes(false);
        ObjectNode recordNode = RecordWriter.INSTANCE.toJson(record, options, repository);

        // Go through ser/deser
        String recordJson = JsonFormat.serializeAsString(recordNode);
        recordNode = (ObjectNode)JsonFormat.deserializeNonStd(recordJson);
View Full Code Here

Examples of org.rocksdb.WriteOptions

  public static final RocksMemoryResource rocksMemoryResource =
      new RocksMemoryResource();

  @Test
  public void writeOptions(){
    WriteOptions writeOptions = new WriteOptions();
    writeOptions.setDisableWAL(true);
    assertThat(writeOptions.disableWAL()).isTrue();
    writeOptions.setDisableWAL(false);
    assertThat(writeOptions.disableWAL()).isFalse();
    writeOptions.setSync(true);
    assertThat(writeOptions.sync()).isTrue();
    writeOptions.setSync(false);
    assertThat(writeOptions.sync()).isFalse();
  }
View Full Code Here

Examples of org.springframework.cassandra.core.WriteOptions

    b3.setIsbn("123456-3");
    b3.setTitle("Spring Data Cassandra Guide");
    b3.setAuthor("Cassandra Guru");
    b3.setPages(265);

    WriteOptions options = new WriteOptions();
    options.setTtl(60);
    options.setConsistencyLevel(ConsistencyLevel.ONE);
    options.setRetryPolicy(RetryPolicy.DOWNGRADING_CONSISTENCY);

    template.insert(b3, options);

    Book b5 = new Book();
    b5.setIsbn("123456-5");
View Full Code Here

Examples of org.springframework.cassandra.core.WriteOptions

    b3.setIsbn("123456-3");
    b3.setTitle("Spring Data Cassandra Guide");
    b3.setAuthor("Cassandra Guru");
    b3.setPages(265);

    WriteOptions options = new WriteOptions();
    options.setTtl(60);
    options.setConsistencyLevel(ConsistencyLevel.ONE);
    options.setRetryPolicy(RetryPolicy.DOWNGRADING_CONSISTENCY);

    template.insertAsynchronously(b3, options);

    /*
     * Test Single Insert with entity
View Full Code Here

Examples of org.springframework.cassandra.core.WriteOptions

  }

  @Test
  public void insertBatchTest() {

    WriteOptions options = new WriteOptions();
    options.setTtl(60);
    options.setConsistencyLevel(ConsistencyLevel.ONE);
    options.setRetryPolicy(RetryPolicy.DOWNGRADING_CONSISTENCY);

    List<Book> books = null;

    books = getBookList(20);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.