on 06-16-2009 11:35 AM
Hello,
I have a WebDynpro Application and I want to store some user specific personalization data in a client cookie...
Two question:
Is there a better way to store user specific personalization data?
How can I set and get cookies from the client?
Thanks!
Johannes
I think this is persistent
please if anybody have used it tell me about it
try{
IWDClientUser LoggedUser = WDClientUser.getCurrentUser();
IUserMaint User = UMFactory.getUserFactory().getMutableUser(LoggedUser.getSAPUser().getUniqueID());
//To get the values of the custom attribute ..
String Value[] = User.getAttribute("com.sap.security.core.usermanagement", "Flag");
if (Value == null || Value.length == 0) {
User.setAttribute("com.sap.security.core.usermanagement", "Flag",new String[]{"BorderColor=pink"} );
User.commit();
} else {
//Sample code for getting the value of theattribute
for (int i = 0; i < Value.length; i++) {
wdComponentAPI.getMessageManager().reportSuccess("Value of the custom Att" + Value<i>);
}
}
wdComponentAPI.getMessageManager().reportSuccess("Stored attribute::"+((String[])User.getAttribute("com.sap.security.core.usermanagement", "Flag"))[0]);
}catch...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Honestly,
I kinda liked this last implementation code. This thread is old, does anyone has any knowledge how would UME save this "Attributes" for an user?
Not sure what is funny about it. Of course it's not a "Cookie" but I still didn't understand where the funny thing is. Can you please explain?
Regards,
Daniel
Hi Daniel
I mean that the solution is funny when we are talking about Cookies. Of course the code itself is not funny, but rather good
My point is the following. UME User Attributes, as I know, shall describe additional characteristics of the user himself. For example, in some organization an user can have such attributes as Position, Age, Sex, etc. These attributes do not depend on any application.
From other side Cookies is different thing. Let me give the following definition - Cookies are set of user preferences for a particular web-application. Same user may have many different preferences for many applications running on same server.
From the point of view I think that storing application specific user properties as UME User Attributes is incorrect.
In addition, UME in NW Java can be configured in several ways. For example, Java UME can reference LDAP directory or ABAP UME (dual ABAP+Java stack) as user storage. In the case I'm not sure if the code for setting user attributes will work.
@Daniel, please share your thoughts about this in the new thread that I created regarding the problem:
Thanks and Regards,
Siarhei
How can I store it in the portal database?
Regars,
Johannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Do you have any backend database in your application.
For example Oracle, R/3 etc..
Store in that database.
For example if you are using Oracle databse
Then using JDBC you can insert the data into database.
If your backend is SAP R/3
Then using Adaptive RFC model you can make RFC call to store the data in R/3 sytem.
Regards,
Charan
Hello,
what about setting a cookie?
Regards,
Johannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Johannes,
If you want persistance after expiring the session also then why dont you store that data in Database.
In client session you can store complex data objects also. Array of Java class objects.
As per my knowledge there is no better way other than client session / database.
Regards,
Charan
Hello,
thanks for the fast reply!!
The solution works als long as I don't close my Internet Explorer. I need a solution that stores the personalization data longer...
Thanks!
Johannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use the below code:
WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE,"KEY","Value");
WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE,"KEY").toString();
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can maintain the clinet side data in session.
Code to maintain the client side data in session
String test1 = wdContext.currentContextElement().getTest1();
String test2 = wdContext.currentContextElement().getTest2();
IMaintainScope maintainer = Utils.getScopeMaintainer(WDScopeType.CLIENTSESSION_SCOPE);
maintainer.getScope().put("Test1", test1);
maintainer.getScope().put("Test2", test2);
//Retrieving the data from session
if(maintainer.getScope().get("Test1") != null)
{
String test1= maintainer.getScope().get("Test1").toString();
}
if(maintainer.getScope().get("Test2") != null)
{
String test2= maintainer.getScope().get("Test2").toString();
}
Hoe this helps you...
Regards,
Saleem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.