@Component public class registerUpdate extends Object
| Constructor and Description |
|---|
registerUpdate() |
| Modifier and Type | Method and Description |
|---|---|
org.bson.Document |
addDocument(com.mongodb.client.MongoCollection collection,
String UUIDName,
org.bson.Document newdoc,
String uuid)
Checks if all fields in the Json object are null.
|
boolean |
addToRegister(com.mongodb.client.MongoCollection collection,
org.bson.Document doc)
Creates a new entry document into the collection.
|
void |
environment(String database,
String user,
String password,
Integer port)
Sets up the connection information and connects to the Mongo database.
|
boolean |
isObjectEmpty(org.json.simple.JSONObject obj)
Checks if all fields in the Json object are null.
|
void |
setConfiguration(MongoConfiguration configuration)
Used to override the default implantation of the Mongo configuration object.
|
org.bson.Document |
updateRegister(String jsonString,
String id,
String collectionName)
Creates a new child document with a reference to the parent object.
|
org.bson.Document |
updateRegisterDocument(com.mongodb.client.MongoCollection collection,
String UUIDName,
org.bson.Document update,
org.bson.Document parentdoc)
Creates a new child document with a reference to the parent object.
|
public void environment(String database, String user, String password, Integer port) throws Exception
database - Database name.user - User login.password - User password.port - Database port.Exceptionpublic void setConfiguration(MongoConfiguration configuration)
configuration - Mongo configuration object.public org.bson.Document updateRegister(String jsonString, String id, String collectionName) throws Exception
jsonString - The json string that represents the data to be saved.id - Each docment will have a UUIDName and this will be used to search and add documents.collectionName - The collection name aka table.com.mongodb.MongoException - if the write failed due some other failureExceptionpublic org.bson.Document addDocument(com.mongodb.client.MongoCollection collection,
String UUIDName,
org.bson.Document newdoc,
String uuid)
collection - The collection name aka table.UUIDName - Each docment will have a UUIDName and this will be used to search and add documents.newdoc - The document to be added.uuid - The parent ID.public boolean isObjectEmpty(org.json.simple.JSONObject obj)
obj - the json object to check.public org.bson.Document updateRegisterDocument(com.mongodb.client.MongoCollection collection,
String UUIDName,
org.bson.Document update,
org.bson.Document parentdoc)
collection - the collection reference (aka table)UUIDName - the document with changes to be appliedupdate - the document that contains the new data.parentdoc - the parent document the new document will be compared against to create a new document.com.mongodb.MongoException - if the write failed due some other failurepublic boolean addToRegister(com.mongodb.client.MongoCollection collection,
org.bson.Document doc)
collection - The collection reference (aka table)doc - The document to be added.Copyright © 2018 Pivotal Software, Inc.. All rights reserved.