NoSQL Item Operations
Catalyst NoSQL items represent a collection of attributes that hold the data of a single data point, like records. Given below are the methods that you can use with an item and perform various operations on it.
Remove attributes from a constructed item
//public ZCNoSQLItem removeAttribute(String attrName) throws Exception;
item.removeAttribute("attribute name");
Get all the keys from the item being constructed
//public Iterable<Map.Entry>String, Object>> attributes();
item.attributes();
Check if the constructed item contains a specific attribute
//public boolean hasAttribute(String attrName);
item.hasAttribute("attribute name");
Getting the item as a map
//public Map asMap();
item.asMap();
//public Map<String, Object> getAllAttributesAsMap();
item.getAllAttributesAsMap();
Get the item as a JSON
//public String toJSON() throws Exception;
item.toJSON();
Get the count of the attributes in the constructed item
//public int numberOfAttributes();
item.numberOfAttributes();
ZCNoSQLAttribute
You can use the ZCNoSQLAttribute class to indicate the attributes upon which you perform the operations. To access the nested elements of a Map, you can separate the attributes using ‘,’ while using ZCNoSQLAttribute. To access a specific index of a list, you can denote it as “[<index>]”. This is demonstrated in the example below.
//public static ZCNoSQLAttribute getInstance(String ...pathElements) throws Exception;
//public ZCNoSQLAttribute(List<String> pathElements) throws Exception;
ZCNoSQLAttribute.getInstance("", …);
new ZCNoSQLAttribute("", …)
The datatypes supported by NoSQL can be denoted with the ZCNoSQLAttribute as follows:
Supported Data Type | Notation with ZCNoSQLAttribute |
---|---|
String | ZCNoSQLValue.DataType.S |
Numeric | ZCNoSQLValue.DataType.N |
Binary | ZCNoSQLValue.DataType.B |
Boolean | ZCNoSQLValue.DataType.BOOL |
Set of String | ZCNoSQLValue.DataType.SS |
Set of Numbers | ZCNoSQLValue.DataType.SN |
Set of Binary | ZCNoSQLValue.DataType.SB |
List | ZCNoSQLValue.DataType.L |
Map | ZCNoSQLValue.DataType.M |
Null | ZCNoSQLValue.DataType.NuLL |
ZCNoSQLValue
Objects of this class are used to indicate the value of attributes along with their data type, as shown below.
// public ZCNoSQLValue(DataType dataType, Object value) throws Exception;
//public static ZCNoSQLValue getInstance(DataType dataType, Object value) throws Exception;
new ZCNoSQLValue(<ZCNoSQLValue.DataType>, <Value>)
ZCNoSQLValue.getInstance(<ZCNoSQLValue.DataType>, <Value>)
ZCNoSQLResponseBean
This class contains the response of the SDK calls made to the server. This includes the following methods.
- getSize - Used to return the size of data read/write from or to the server.
//public int getSize();
responseBean.getSize();
- getStartKey - Used to return the start key for next set of data for pagination, if more data exists.
//public ZCNoSQLItem getStartKey();
responseBean.getStartKey();
- getResponseDataList - Returns the actual data. Based on the NOSQL_RETURN_VALUE, either the old or new data is returned in getNew_item() or getOld_Item() method.
//public List<Data> getResponseDataList();
responseBean.getResponseDataList().get(<index>).getNew_item();
responseBean.getResponseDataList().get(<index>).getOld_item();
responseBean.getResponseDataList().get(<index>).setStatus();
Last Updated 2025-06-20 16:21:48 +0530 IST
Yes
No
Send your feedback to us