[SOLVED] How to update user with API Identity

1
0
-1

Hi ,
I can not update a user's data with the API Identity .
Here is my code :

import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.UserUpdater;

...
aUser instanciation...
...

UserUpdater updateDescriptor = new UserUpdater();
updateDescriptor.setJobTitle("test");

try {

IdentityAPI identityAPI = apiAccessor.getIdentityAPI();
//The id is correctly recovered
identityAPI.updateUser(Long.parseLong(aUser.get("id")), updateDescriptor);

}
catch (Exception e) {

logger.severe(e.printStackTrace());

}

There are no errors at runtime or in the logs but the update doesn't work (I see nothing in organisation menu).

What is the problem?

I Thank you in advance for your solutions. :)

Comments

Submitted by antoine.mottier on Mon, 11/16/2015 - 10:25

Can you please share the whole process (.bos file)? That would help to understand where the "aUser" come from.

Also e.printStackTrace() return void, so you will get nothing in the log file. Stack trace will be sent to System.err that might be configured differently based on your application server, Operating System...

If you want to see the log message you should use (assuming you are using Java Util Logging): log(Level.SEVERE, "Some custom message", e)

Submitted by mathieu.delacre on Tue, 11/17/2015 - 12:19

Thanks for your answer.
The process

The Zip contains the .bos file. It's not the same example, but the problem is the same : The update doesn't work. I use "log(Level.SEVERE, "xxx", e)" but I have no errors.

Submitted by antoine.mottier on Tue, 11/17/2015 - 14:24

Hi,

It seems that your process use a specific organization. Can you include in the .bos file your custom organization so testing becomes easier?

Thanks

Submitted by mathieu.delacre on Tue, 11/17/2015 - 15:20

Sorry, you can get it here

Submitted by antoine.mottier on Tue, 11/17/2015 - 15:31

I just did a test and everything seems to run fine. I can see that user custom metadata are updated with the "supervisor" user id (information available on the detailed view of a user under "other" section).

Note that in the process you shared you don't use any UserUpdaterand you don't change any job title. Maybe you didn't share the example that match your description?

Submitted by mathieu.delacre on Tue, 11/17/2015 - 16:42

It's strange, to me the field "supervisor" is not update in the organization.I look in the sub-menu "Custom" because I don't see the "other" menu, but it's probably the same, right ?

Indeed I indicated that it was not the same example but the problem was the same: no error but no change.

Submitted by antoine.mottier on Tue, 11/17/2015 - 16:53

Can you confirm that you look the organization information in the Portal and not in the Studio? "Custom" let me think you are in the Studio because it is named "Other" in the Portal.

An organization can be defined in the Studio and will be stored in the Studio workspace until it is published on Bonita Portal. When published organization will be store in Bonita Engine database. So you end up with two copies of the organization: the one stored in the Studio workspace and the one store in Bonita Engine. When you run your process and call the API you modify the organization stored in Bonita Engine. You can view information of this copy of the organization using Portal administrator view.

Submitted by mathieu.delacre on Tue, 11/17/2015 - 17:19

Ah ok you teach me that subtlety ... Indeed the organization is modified on the database Bonita Engine.
The question then is, how to publish the changes made on the Bonita Engine database to the Studio workspace ? So that the changes are taken into account in the execution of another process.

Submitted by antoine.mottier on Thu, 11/19/2015 - 14:31

From Studio "administrator" view you can go to "Organization" -> "Import / Export" and click on the button "Export".

You will get an XML file with organization content as stored by Bonita Engine.

In the Studio you can import the organization stored in the XML file using "Organization" -> "Import..." menu.

Submitted by mathieu.delacre on Thu, 11/19/2015 - 17:08

Ok thank you for your help, thanks to you I found out something important. :)

1 answer

1
0
-1

Nobody has solution?
Thanks

Comments

Submitted by antoine.mottier on Fri, 11/20/2015 - 10:06

Just to make sure: now everything is running as you expect?

Notifications