Class NetricsRecOp
- java.lang.Object
-
- com.netrics.likeit.NetricsRecOp
-
- All Implemented Interfaces:
java.io.Serializable
public class NetricsRecOp extends java.lang.Object implements java.io.Serializable
Objects of this class associate a record operation with a record. This class is used to associate a record operation (adding, updating, deleting records in a ibi™ Patterns - Search table) with the record to be operated on. It is used to send a stream of mixed record operations to the ibi™ Patterns - Search server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NetricsRecOp.Op
This defines the known record operations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NetricsRecOp
Add(NetricsRecord rec)
Create an Add Record Operation.static NetricsRecOp
Del(NetricsRecord rec)
Create a Delete Record Operation.static NetricsRecOp
Del(java.lang.String key)
Create a Delete Record Operation given a record key.static NetricsRecOp
Del(java.lang.String key, java.lang.String parent_key)
Create a Delete Record Operation given a record key and parent key.java.lang.String
getKey()
Get the record key of the record being operated on.NetricsRecOp.Op
getOperation()
Get the operation code for this Record Operation.java.lang.String
getParentKey()
Get the parent key of the record being operated on.NetricsRecord
getRecord()
Get the record being operated on by this operation.static NetricsRecOp
Rpl(NetricsRecord rec)
Create a Replace Record Operation.java.lang.String
toString()
Return a human readable form of this operation.static NetricsRecOp
Upd(NetricsRecord rec)
Create an Update Record Operation.
-
-
-
Method Detail
-
Add
public static NetricsRecOp Add(NetricsRecord rec) throws java.lang.IllegalArgumentException
Create an Add Record Operation. A record add operation adds a new record to the ibi™ Patterns - Search table. If a record with the same key already exists the operation fails. If the do max work flag is set these failures are quietly ignored.- Parameters:
rec
- the record to be added.- Returns:
- a new NetricsRecOp object.
- Throws:
java.lang.IllegalArgumentException
- if rec is null.
-
Upd
public static NetricsRecOp Upd(NetricsRecord rec) throws java.lang.IllegalArgumentException
Create an Update Record Operation. A record update operation adds a record to the ibi™ Patterns - Search table if no record with the same key exists. If a record with the same key already exists the record is replaced with the given record.- Parameters:
rec
- the record to be updated.- Returns:
- a new NetricsRecOp object.
- Throws:
java.lang.IllegalArgumentException
- if rec is null.
-
Rpl
public static NetricsRecOp Rpl(NetricsRecord rec) throws java.lang.IllegalArgumentException
Create a Replace Record Operation. A record replace operation replaces an existing record in the ibi Patterns table with a new version. It is an error if a record with the same key doesn't exist. If the do max work flag is set the error is quietly ignored.- Parameters:
rec
- the record to be replaced.- Returns:
- a new NetricsRecOp object.
- Throws:
java.lang.IllegalArgumentException
- if rec is null.
-
Del
public static NetricsRecOp Del(NetricsRecord rec) throws java.lang.IllegalArgumentException
Create a Delete Record Operation. A record delete operation deletes an existing record in the ibi Patterns table. It is an error if a record with the same key doesn't exist. If the do max work flag is set the error is quietly ignored.- Parameters:
rec
- the record to be deleted.- Returns:
- a new NetricsRecOp object.
- Throws:
java.lang.IllegalArgumentException
- if rec is null.
-
Del
public static NetricsRecOp Del(java.lang.String key) throws java.lang.IllegalArgumentException
Create a Delete Record Operation given a record key.A record delete operation deletes an existing record in the ibi Patterns table. It is an error if a record with the same key doesn't exist. If the do max work flag is set the error is quietly ignored.
A delete operation only needs a record key value. This method creates a delete operation given only the key, instead of a full record.
- Parameters:
key
- the key of the record to be deleted.- Returns:
- a new NetricsRecOp object.
- Throws:
java.lang.IllegalArgumentException
- if key is null or zero length.
-
Del
public static NetricsRecOp Del(java.lang.String key, java.lang.String parent_key) throws java.lang.IllegalArgumentException
Create a Delete Record Operation given a record key and parent key.A record delete operation deletes an existing record in the ibi Patterns table. It is an error if a record with the same key doesn't exist. If the do max work flag is set the error is quietly ignored.
A delete operation only needs a record key value. This method creates a delete operation for a child record given the key, and parent key. If parent_key is null or empty this creates a delete on a standard record.
- Parameters:
key
- the key of the child record to be deleted.parent_key
- the parent key of the child record.- Returns:
- a new NetricsRecOp object.
- Throws:
java.lang.IllegalArgumentException
- if key is null or zero length.
-
getOperation
public NetricsRecOp.Op getOperation()
Get the operation code for this Record Operation.- Returns:
- the operation code for this record operation.
-
getRecord
public NetricsRecord getRecord()
Get the record being operated on by this operation.- Returns:
- the record being operated on by this operation.
-
getKey
public java.lang.String getKey()
Get the record key of the record being operated on.- Returns:
- the key value of the record being operated on.
-
getParentKey
public java.lang.String getParentKey()
Get the parent key of the record being operated on.- Returns:
- the parent key value of the record, null or empty if this is not a child record.
-
toString
public java.lang.String toString()
Return a human readable form of this operation. The format is: <op-code>:<record-info> where op-code is the string value of the operation code fot this operation, and record-info is the string form of the record.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the human readable string form of this record operation.
-
-