Save entity in user settings

Hi

I show program context after login to application and I’d like to save entity to userSetting.

AbstractEditor oe = openEditor("rental$ProgramContext.edit", new ProgramContext(),
				WindowManager.OpenType.DIALOG);
ProgramContext pc = (ProgramContext) oe.getItem();

userSettingService.saveSetting();

How can I convert entity to xlm and use userSettingService.saveSetting().

You can use any Java XML serialization library, e.g. XStream. It is already in the dependencies of the core module, so you can do the conversion in a middleware service.

But why do you want to save the serialized entity and not just its ID?

Hi

I resolved this problem myself. I need this because I have no persistent entity which I show in edit window before any proces. I need to save values form this editwindow. Now I convert entity to xml
and use userSettingService when I accept editwindow, When I need show this window again I read saving values from userSettingService,covert xml to entity and show in editwindow.

I attach exemplary class. Class ParamsWidow manages to show editwindow and load values from userSettingService. Entity class have to have xml annotations e.g.
@XmlAttribute(name = “currdate”)

EntityToXml.java (1.5 KB)
ParamsWindow.java (1.7 KB)