Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

how to add property:value at specific path using ChangeSet API

I want to add new property at specific path using changeset API. But changeset API doesnt provides any such interface, where I can specify path, property and its value.

Example:

Class Alpha {

Integer xx; String yy; List <beta> listBeta;

//Setter and Getters }

class Beta { Integer betaXX; //Setter and Getters }

I added class Alpha in GigaSpace. xx|yy|{classBeta Instance}

Now, I want to add another instance of class Beta in collection listBeta and in list Beta only I would like to add Boolean variable boolVar. xx|yy| { {classBeta Instance (original)}, {classBeta Instance (new),boolVar} }

Idea is to manage document like JSON document. I can grow reduce document as per requirement. I can perform above operations in JSON document very easily like String leg1JSON = jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(classBeta Instance); Document leg1ReqDoc = Document.parse(leg1JSON).append(boolVar, value of boolVar) ; UpdateOptions uo = (new UpdateOptions()).upsert(true); collection.updateOne(original document, leg1Doc, uo);

Using ChangeSet, I can very well add new instance listBeta but how can I add boolVar as part of second instance of collection listBeta.

asked 2017-02-07 06:30:44 -0500

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

You can modify a field at any level of the object: https://docs.gigaspaces.com/xap121/ch...

If somehow you can implement this with the regular change API you can always implement a custom change. Its very simple: https://docs.gigaspaces.com/xap121/ch...

answered 2017-05-05 09:02:58 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-02-07 06:30:23 -0500

Seen: 26 times

Last updated: May 05