public String parseCodePoint(String codePoint) { try { if (!isBlank(codePoint)) { return String.valueOf(Character.toChars(Integer.parseInt(codePoint))); } } catch (Exception e) { // If is not a code point then return the string "as is" } return codePoint; }
public String parseCodePoint(String codePoint) { try { if (!isBlank(codePoint)) { return String.valueOf(Character.toChars(Integer.parseInt(codePoint))); } } catch (Exception e) { // If is not a code point then return the string "as is" } return codePoint; }
public DataSetProviderType readProviderType(JsonObject json) throws Exception { String provider = json.getString(PROVIDER); if (isBlank(provider)) { throw new IllegalArgumentException("Missing 'provider' property"); } DataSetProviderType type = dataSetProviderRegistry.getProviderTypeByName(provider); if (type == null) { throw new IllegalArgumentException("Provider not supported: " + provider); } return type; }
public DataSetProviderType readProviderType(JsonObject json) throws Exception { String provider = json.getString(PROVIDER); if (isBlank(provider)) { throw new IllegalArgumentException("Missing 'provider' property"); } DataSetProviderType type = dataSetProviderRegistry.getProviderTypeByName(provider); if (type == null) { throw new IllegalArgumentException("Provider not supported: " + provider); } return type; }
@Override public void fromJson(SQLDataSetDef def, JsonObject json) { String dataSource = json.getString(DATA_SOURCE); String dbTable = json.getString(DB_TABLE); String dbSchema = json.getString(DB_SCHEMA); String dbSQL = json.getString(DB_SQL); if (!isBlank(dataSource)) { def.setDataSource(dataSource); } if (!isBlank(dbSchema)) { def.setDbSchema(dbSchema); } if (!isBlank(dbTable)) { def.setDbTable(dbTable); } if (!isBlank(dbSQL)) { def.setDbSQL(dbSQL); } }
@Override public void fromJson(SQLDataSetDef def, JsonObject json) { String dataSource = json.getString(DATA_SOURCE); String dbTable = json.getString(DB_TABLE); String dbSchema = json.getString(DB_SCHEMA); String dbSQL = json.getString(DB_SQL); if (!isBlank(dataSource)) { def.setDataSource(dataSource); } if (!isBlank(dbSchema)) { def.setDbSchema(dbSchema); } if (!isBlank(dbTable)) { def.setDbTable(dbTable); } if (!isBlank(dbSQL)) { def.setDbSQL(dbSQL); } }
@Override public void fromJson(RemoteDataSetDef def, JsonObject json) { String queryTarget = json.getString(QUERY_TARGET); String serverTemplateId = json.getString(SERVER_TEMPLATE_ID); String dataSource = json.getString(DATA_SOURCE); String dbSchema = json.getString(DB_SCHEMA); String dbSQL = json.getString(DB_SQL); if (!isBlank(queryTarget)) { def.setQueryTarget(queryTarget); } if (!isBlank(serverTemplateId)) { def.setServerTemplateId(serverTemplateId); } if (!isBlank(dataSource)) { def.setDataSource(dataSource); } if (!isBlank(dbSchema)) { def.setDbSchema(dbSchema); } if (!isBlank(dbSQL)) { def.setDbSQL(dbSQL); } }
@Override public void fromJson(RemoteDataSetDef def, JsonObject json) { String queryTarget = json.getString(QUERY_TARGET); String serverTemplateId = json.getString(SERVER_TEMPLATE_ID); String dataSource = json.getString(DATA_SOURCE); String dbSchema = json.getString(DB_SCHEMA); String dbSQL = json.getString(DB_SQL); if (!isBlank(queryTarget)) { def.setQueryTarget(queryTarget); } if (!isBlank(serverTemplateId)) { def.setServerTemplateId(serverTemplateId); } if (!isBlank(dataSource)) { def.setDataSource(dataSource); } if (!isBlank(dbSchema)) { def.setDbSchema(dbSchema); } if (!isBlank(dbSQL)) { def.setDbSQL(dbSQL); } }
String numberPattern = json.getString(NUMBERPATTERN); if (!isBlank(fileURL)) { def.setFileURL(fileURL); if (!isBlank(filePath)) { def.setFilePath(filePath); if (!isBlank(separatorChar)) { def.setSeparatorChar(separatorChar.charAt(0)); if (!isBlank(quoteChar)) { def.setQuoteChar(quoteChar.charAt(0)); if (!isBlank(escapeChar)) { def.setEscapeChar(escapeChar.charAt(0)); if (!isBlank(numberPattern)) { def.setNumberPattern(numberPattern); if (!isBlank(datePattern)) { def.setDatePattern(datePattern);
if (isBlank(serverURL)) { throw new IllegalArgumentException("The serverURL property is missing."); } else { if (isBlank(clusterName)) { throw new IllegalArgumentException("The clusterName property is missing."); } else { if (isBlank(index)) { throw new IllegalArgumentException("The index property is missing."); } else { if (!isBlank(type)) { dataSetDef.setType(type); if (!isBlank(query)) { dataSetDef.setQuery(query); if (!isBlank(relevance)) { dataSetDef.setRelevance(relevance); if (!isBlank(cacheEnabled)) { dataSetDef.setCacheEnabled(Boolean.parseBoolean(cacheEnabled)); if (!isBlank(cacheMaxRows)) { dataSetDef.setCacheMaxRows(Integer.parseInt(cacheMaxRows));
String numberPattern = json.getString(NUMBERPATTERN); if (!isBlank(fileURL)) { def.setFileURL(fileURL); if (!isBlank(filePath)) { def.setFilePath(filePath); if (!isBlank(separatorChar)) { def.setSeparatorChar(separatorChar.charAt(0)); if (!isBlank(quoteChar)) { def.setQuoteChar(quoteChar.charAt(0)); if (!isBlank(escapeChar)) { def.setEscapeChar(escapeChar.charAt(0)); if (!isBlank(numberPattern)) { def.setNumberPattern(numberPattern); if (!isBlank(datePattern)) { def.setDatePattern(datePattern);
if (isBlank(serverURL)) { throw new IllegalArgumentException("The serverURL property is missing."); } else { if (isBlank(clusterName)) { throw new IllegalArgumentException("The clusterName property is missing."); } else { if (isBlank(index)) { throw new IllegalArgumentException("The index property is missing."); } else { if (!isBlank(type)) { dataSetDef.setType(type); if (!isBlank(query)) { dataSetDef.setQuery(query); if (!isBlank(relevance)) { dataSetDef.setRelevance(relevance); if (!isBlank(cacheEnabled)) { dataSetDef.setCacheEnabled(Boolean.parseBoolean(cacheEnabled)); if (!isBlank(cacheMaxRows)) { dataSetDef.setCacheMaxRows(Integer.parseInt(cacheMaxRows));
if (!isBlank(uuid)) { def.setUUID(uuid); if (!isBlank(name)) { def.setName(name); if (!isBlank(isPublic)) { def.setPublic(Boolean.parseBoolean(isPublic)); if (!isBlank(pushEnabled)) { def.setPushEnabled(Boolean.parseBoolean(pushEnabled)); if (!isBlank(pushMaxSize)) { def.setPushMaxSize(Integer.parseInt(pushMaxSize)); if (!isBlank(cacheEnabled)) { def.setCacheEnabled(Boolean.parseBoolean(cacheEnabled)); if (!isBlank(cacheMaxRows)) { def.setCacheMaxRows(Integer.parseInt(cacheMaxRows)); if (!isBlank(refreshTime)) { def.setRefreshTime(refreshTime); if (!isBlank(refreshAlways)) { def.setRefreshAlways(Boolean.parseBoolean(refreshAlways)); if (!isBlank(allColumns)) { def.setAllColumnsEnabled(Boolean.parseBoolean(allColumns));
@Override public void fromJson(BeanDataSetDef def, JsonObject json) { String generator = json.getString(GENERATOR_CLASS); if (!isBlank(generator)) { def.setGeneratorClass(generator); } if (json.has(GENERATOR_PARAMS)) { JsonArray array = json.getArray(GENERATOR_PARAMS); for (int i=0; i<array.length(); i++) { JsonObject param = array.getObject(i); String paramId = param.getString(PARAM); String value = param.getString(VALUE); if (!isBlank(paramId)) { def.getParamaterMap().put(paramId, value); } } } }
if (!isBlank(uuid)) { def.setUUID(uuid); if (!isBlank(name)) { def.setName(name); if (!isBlank(isPublic)) { def.setPublic(Boolean.parseBoolean(isPublic)); if (!isBlank(pushEnabled)) { def.setPushEnabled(Boolean.parseBoolean(pushEnabled)); if (!isBlank(pushMaxSize)) { def.setPushMaxSize(Integer.parseInt(pushMaxSize)); if (!isBlank(cacheEnabled)) { def.setCacheEnabled(Boolean.parseBoolean(cacheEnabled)); if (!isBlank(cacheMaxRows)) { def.setCacheMaxRows(Integer.parseInt(cacheMaxRows)); if (!isBlank(refreshTime)) { def.setRefreshTime(refreshTime); if (!isBlank(refreshAlways)) { def.setRefreshAlways(Boolean.parseBoolean(refreshAlways)); if (!isBlank(allColumns)) { def.setAllColumnsEnabled(Boolean.parseBoolean(allColumns));
@Override public void fromJson(BeanDataSetDef def, JsonObject json) { String generator = json.getString(GENERATOR_CLASS); if (!isBlank(generator)) { def.setGeneratorClass(generator); } if (json.has(GENERATOR_PARAMS)) { JsonArray array = json.getArray(GENERATOR_PARAMS); for (int i=0; i<array.length(); i++) { JsonObject param = array.getObject(i); String paramId = param.getString(PARAM); String value = param.getString(VALUE); if (!isBlank(paramId)) { def.getParamaterMap().put(paramId, value); } } } }