cwmiller / broadworks-connector

Simple library for connecting to BroadWorks OCI-P API
MIT License
8 stars 5 forks source link

migrate function #53

Open TwinMist opened 4 years ago

TwinMist commented 4 years ago

Hi Hope your doing well. it there anyway you can build in a functions that the will let you do a get request and then use that data in a add request. Will need the option to modify first.

basically a easy way to migrate users from one group to another.

thanks

TwinMist commented 3 years ago

Hi do you know the best way to achieve this has a have a load of users to move. be great if you could do a UserGetRequest then a way to update the response like changing the groupid and userId etc then push this back into a addUserRequest

many thanks

cwmiller commented 3 years ago

I don't have a great solution to achieve this. You can't easily copy one data object to the other. The only way I can think of to automatically do this is to use reflection. Use reflection to retrieve all the public methods on the source and target objects. Iterate through all the getter methods on the source, call them to get their value, then call the equivalent setter method on the target object with the source field's value. I'm not sure how reliable this would be.

The only other solution is to manually map everything in code yourself.

TwinMist commented 3 years ago

Do you think you could have a go to automatically do this? Been trying to do it manually but is it turning into 1000's lines of code. will be very great full if possible.

thanks