public DataSetLookup fromJson(String jsonString) throws JsonException { if (jsonString == null || jsonString.trim().isEmpty()) { return null; } JsonObject dataSetLookupJson = Json.parse(jsonString); return fromJson(dataSetLookupJson); }
public DataSetLookup fromJson(String jsonString) throws JsonException { if (jsonString == null || jsonString.trim().isEmpty()) { return null; } JsonObject dataSetLookupJson = Json.parse(jsonString); return fromJson(dataSetLookupJson); }
DataSetLookup dataSetLookup = dataSetLookupJsonMarshaller.fromJson(data); ds.setDataSetLookup(dataSetLookup);
DataSetLookup dataSetLookup = dataSetLookupJsonMarshaller.fromJson(data); ds.setDataSetLookup(dataSetLookup);
@Test public void testDataSetLookupMarshalling() { DataSetLookup original = DataSetLookupFactory.newDataSetLookupBuilder() .dataset("mydataset") .filter(OR(notEqualsTo("department", "IT"), greaterOrEqualsTo("amount", 100d))) .filter("department", notEqualsTo("IT")) .filter("amount", between(100d, 200d)) .filter("date", greaterThan(jsonMarshaller.parseDate("2018-01-01 00:00:00"))) .filter("country", isNull()) .group("department").select("Services") .group("date", "year").dynamic(DateIntervalType.YEAR, true) .column("date") .column("amount", AggregateFunctionType.SUM, "total") .sort("date", SortOrder.ASCENDING) .buildLookup(); JsonObject _jsonObj = jsonMarshaller.toJson(original); assertNotNull(_jsonObj.toString()); DataSetLookup unmarshalled = jsonMarshaller.fromJson(_jsonObj); assertEquals(unmarshalled, original); }
@Test public void testDataSetLookupMarshalling() { DataSetLookup original = DataSetFactory.newDataSetLookupBuilder() .dataset("mydataset") .filter(OR(notEqualsTo("department", "IT"), greaterOrEqualsTo("amount", 100d))) .filter("department", notEqualsTo("IT")) .filter("amount", between(100d, 200d)) .filter("date", greaterThan(jsonMarshaller.parseDate("2018-01-01 00:00:00"))) .filter("country", isNull()) .group("department").select("Services") .group("date", "year").dynamic(DateIntervalType.YEAR, true) .column("date") .column("amount", AggregateFunctionType.SUM, "total") .sort("date", SortOrder.ASCENDING) .buildLookup(); JsonObject _jsonObj = jsonMarshaller.toJson(original); assertNotNull(_jsonObj.toString()); DataSetLookup unmarshalled = jsonMarshaller.fromJson(_jsonObj); assertEquals(unmarshalled, original); }