Operaciones con items NoSQL
Los items de Catalyst NoSQL representan una colección de atributos que contienen los datos de un único punto de datos, como registros. A continuación se presentan los métodos que puedes usar con un item y realizar varias operaciones sobre él.
Eliminar atributos de un item construido
//public ZCNoSQLItem removeAttribute(String attrName) throws Exception;
item.removeAttribute("attribute name");
Obtener todas las claves del item que se está construyendo
//public Iterable<Map.Entry>String, Object>> attributes();
item.attributes();
Verificar si el item construido contiene un atributo específico
//public boolean hasAttribute(String attrName);
item.hasAttribute("attribute name");
Obtener el item como un map
//public Map asMap();
item.asMap();
//public Map<String, Object> getAllAttributesAsMap();
item.getAllAttributesAsMap();
Obtener el item como JSON
//public String toJSON() throws Exception;
item.toJSON();
Obtener la cantidad de atributos en el item construido
//public int numberOfAttributes();
item.numberOfAttributes();
ZCNoSQLAttribute
Puedes usar la clase ZCNoSQLAttribute para indicar los atributos sobre los cuales realizas las operaciones. Para acceder a los elementos anidados de un Map, puedes separar los atributos usando ‘,’ al usar ZCNoSQLAttribute. Para acceder a un índice específico de una lista, puedes denotarlo como “[<index>]”. Esto se demuestra en el ejemplo a continuación.
//public static ZCNoSQLAttribute getInstance(String ...pathElements) throws Exception;
//public ZCNoSQLAttribute(List<String> pathElements) throws Exception;
ZCNoSQLAttribute.getInstance("", ...);
new ZCNoSQLAttribute("", ...)
Los tipos de datos soportados por NoSQL se pueden denotar con ZCNoSQLAttribute de la siguiente manera:
| Tipo de dato soportado | Notación con 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
Los objetos de esta clase se usan para indicar el valor de los atributos junto con su tipo de dato, como se muestra a continuación.
// 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
Esta clase contiene la respuesta de las llamadas del SDK realizadas al servidor. Incluye los siguientes métodos.
- getSize - Se usa para retornar el tamaño de los datos leídos/escritos desde o hacia el servidor.
//public int getSize();
responseBean.getSize();
- getStartKey - Se usa para retornar la clave de inicio del siguiente conjunto de datos para paginación, si existen más datos.
//public ZCNoSQLItem getStartKey();
responseBean.getStartKey();
- getResponseDataList - Retorna los datos reales. Según el NOSQL_RETURN_VALUE, se retornan los datos antiguos o nuevos en el método getNew_item() o getOld_Item().
//public List<Data> getResponseDataList();
responseBean.getResponseDataList().get(<index>).getNew_item();
responseBean.getResponseDataList().get(<index>).getOld_item();
responseBean.getResponseDataList().get(<index>).setStatus();
Última actualización 2026-03-20 21:51:56 +0530 IST
Yes
No
Send your feedback to us