Package com.cognite.client.util
Class RawRows
- java.lang.Object
-
- com.cognite.client.util.RawRows
-
public class RawRows extends Object
Helper class for working withRawRowobjects.
-
-
Constructor Summary
Constructors Constructor Description RawRows()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.cognite.client.dto.RawRowof(String columnsJsonObject)Create aRawRowobject based on aJson objectrepresenting the row columns.static com.cognite.client.dto.RawRowof(String rowKey, String columnsJsonObject)Create aRawRowobject based on aJson objectrepresenting the row columns.static com.cognite.client.dto.RawRowof(String dbName, String tableName, String rowKey, String columnsJsonObject)Create aRawRowobject based on aJson objectrepresenting the row columns.static com.cognite.client.dto.RawRowof(String dbName, String tableName, String rowKey, Map<String,Object> columns)Create aRawRowobject based on aMap<String, Object>representing the row columns.static com.cognite.client.dto.RawRowof(String rowKey, Map<String,Object> columns)Create aRawRowobject based on aMap<String, Object>representing the row columns.static com.cognite.client.dto.RawRowof(Map<String,Object> columns)Create aRawRowobject based on aMap<String, Object>representing the row columns.static List<com.cognite.client.dto.RawRow>setDbName(Collection<com.cognite.client.dto.RawRow> rows, String dbName)Specify the target CDF Raw database (name) for a collection ofRawRow.static List<com.cognite.client.dto.RawRow>setTableName(Collection<com.cognite.client.dto.RawRow> rows, String tableName)Specify the target CDF Raw table (name) for a collection ofRawRow.
-
-
-
Method Detail
-
of
public static com.cognite.client.dto.RawRow of(Map<String,Object> columns) throws Exception
Create aRawRowobject based on aMap<String, Object>representing the row columns. TheMap<String, Object>is parsed into aStructand set as thecolumnsin theRawRow. Each entry in theMapbecomes a separate column in the resultingRawRow. You need to add a valid database, table name and row key to the resultingRawRowafterwards. This method will just set them as empty strings.- Parameters:
columns- TheMaprepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Map cannot be parsed correctly.
-
of
public static com.cognite.client.dto.RawRow of(String rowKey, Map<String,Object> columns) throws Exception
Create aRawRowobject based on aMap<String, Object>representing the row columns. TheMap<String, Object>is parsed into aStructand set as thecolumnsin theRawRow. Each entry in theMapbecomes a separate column in the resultingRawRow. You need to add a valid database and table name to the resultingRawRowafterwards. This method will just set them as empty strings.- Parameters:
rowKey- The row key to add to theRawRow.columns- TheMaprepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Map cannot be parsed correctly.
-
of
public static com.cognite.client.dto.RawRow of(String dbName, String tableName, String rowKey, Map<String,Object> columns) throws Exception
Create aRawRowobject based on aMap<String, Object>representing the row columns. TheMap<String, Object>is parsed into aStructand set as thecolumnsin theRawRow. Each entry in theMapbecomes a separate column in the resultingRawRow.- Parameters:
dbName- The database name to add to theRawRow.tableName- The table name to add to theRawRow.rowKey- The row key to add to theRawRow.columns- TheMaprepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Map cannot be parsed correctly.
-
of
public static com.cognite.client.dto.RawRow of(String columnsJsonObject) throws Exception
Create aRawRowobject based on aJson objectrepresenting the row columns. TheJson objectis parsed into aStructand set as thecolumnsin theRawRow. Each top-level field in theJson objectbecomes a separate column in the resultingRawRow. You need to add a valid database, table name and row key to the resultingRawRowafterwards. This method will just set them as empty strings.- Parameters:
columnsJsonObject- TheJson objectrepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Json does not represent a valid Json object.
-
of
public static com.cognite.client.dto.RawRow of(String rowKey, String columnsJsonObject) throws Exception
Create aRawRowobject based on aJson objectrepresenting the row columns. TheJson objectis parsed into aStructand set as thecolumnsin theRawRow. Each top-level field in theJson objectbecomes a separate column in the resultingRawRow. You need to add a valid database and table name to the resultingRawRowafterwards. This method will just set them as empty strings.- Parameters:
rowKey- The row key to add to theRawRow.columnsJsonObject- TheJson objectrepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Json does not represent a valid Json object.
-
of
public static com.cognite.client.dto.RawRow of(String dbName, String tableName, String rowKey, String columnsJsonObject) throws Exception
Create aRawRowobject based on aJson objectrepresenting the row columns. TheJson objectis parsed into aStructand set as thecolumnsin theRawRow. Each top-level field in theJson objectbecomes a separate column in the resultingRawRow.- Parameters:
dbName- The database name to add to theRawRow.tableName- The table name to add to theRawRow.rowKey- The row key to add to theRawRow.columnsJsonObject- TheJson objectrepresenting the row columns.- Returns:
- The resulting
RawRowobject. - Throws:
Exception- if the input Json does not represent a valid Json object.
-
setTableName
public static List<com.cognite.client.dto.RawRow> setTableName(Collection<com.cognite.client.dto.RawRow> rows, String tableName)
Specify the target CDF Raw table (name) for a collection ofRawRow.- Parameters:
rows- The rows that will get their destination table set.tableName- The CDF Raw destination table name.- Returns:
- the rows with table name set.
-
setDbName
public static List<com.cognite.client.dto.RawRow> setDbName(Collection<com.cognite.client.dto.RawRow> rows, String dbName)
Specify the target CDF Raw database (name) for a collection ofRawRow.- Parameters:
rows- The rows that will get their destination table set.dbName- The CDF Raw destination database name.- Returns:
- the rows with database name set.
-
-