on 08-31-2010 4:31 PM
Hello Experts,
My requirement is as follows-
I have an iView with multiple trays. Each tray has its own UI elements.
At runtime user is allowed to collapse/expand trays by default. However, once the user logs out of the portal and logs in back all the trays are expanded again.
Is there any way in which I can maintain the collapsed trays even after the user has logged out and logged in again?
There is a personalization property for hidden tray but none for collapse/expand.
Please help me out with this issue.
Regards,
Nisha.
Hi Angelo/Ilan,
Apologies for the delay.
Context -
Value Node - UserDet
cardinality - 1..1
collectionType - list
initializeLeadSelection - true
name - UserDet
selection - 0..1
singleton - true
typedAccessRequired - true
Value Atrribute - myUser
calculated - false
name - myUser
readOnly - false
type - com.sap.security.api.IUser
Value Attribute - UserMaint
calculated - false
name - UserMaint
readOnly - false
type - com.sap.security.api.IUserMaint
On button_1 click to load user -
public void onActionloadUser(
com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent) {
//@@begin onActionloadUser(ServerEvent)
try {
wdContext.currentUserDetElement().setMyUser(
WDClientUser.getCurrentUser().getSAPUser());
String user =
wdContext.currentUserDetElement().getMyUser().getUniqueID();
IUserMaint userMaint =
UMFactory.getUserFactory().getMutableUser(user);
wdContext.currentUserDetElement().setUserMaint(userMaint);
} catch (WDUMException ex) {
wdComponentAPI.getMessageManager().raiseException(
ex.getLocalizedMessage(),
true);
} catch (UMException ume) {
wdComponentAPI.getMessageManager().raiseException(
ume.getLocalizedMessage(),
true);
}
//@@end
}
On click of tray to save property -
String attribs[] = new String[1];
attribs[0] = "true";
String propertiesName = "Expandable";
wdContext.currentUserDetElement().getUserMaint().setAttribute("com.sap.security.core.usermanagement", propertiesName, attribs);
On button_2 click to load property -
public void onActionloadCode(
com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent) {
//@@begin onActionloadCode(ServerEvent)
String attribute[] =
wdContext.currentUserDetElement().getUserMaint().getAttribute(
"com.sap.security.core.usermanagement",
"Expandable");
if(attribute != null)
wdComponentAPI.getMessageManager().reportSuccess(
"Attribute in load code:" + attribute[0]);
//@@end
}
I am unable to retrieve the attribute for a user after the user moves to another role or logs off the portal and logs in again.
Please help.
Thank you for all the help so far.
Nisha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nisha, I just sent an example of code ... you must perform the methods save () and commit (). A good navigated in the methods of that class would be very helpful.
In any case:
public boolean UMSavePropertiesByNode( )
{
//@@begin UMSavePropertiesByNode()
String properties[] = this.getPropertiesByNode();
String propertiesName = this.getUMPropertyName() + ".TableColumns";
wdThis.wdGetMMComponentController().messManagerShowMessage("propertiesName = " + propertiesName, PBMessagesTypes.TP_Debug, null, myLogger);
wdThis.wdGetMMComponentController().messManagerShowMessage("properties[].length = " + properties.length, PBMessagesTypes.TP_Debug, null, myLogger);
try {
boolean retorno = wdContext.currentVnAppPropertiesElement().getVaIUserMaint().setAttribute("com.sap.security.core.usermanagement", propertiesName, properties);
if (retorno) {
wdContext.currentVnAppPropertiesElement().getVaIUserMaint().save();
wdContext.currentVnAppPropertiesElement().getVaIUserMaint().commit();
msg.reportMessage(IMessageMMComponent.UMPROPERTY__SAVE__FIELDS__SUCCESS, null, false);
}
} catch (UMException ex) {
wdContext.currentVnAppPropertiesElement().getVaIUserMaint().rollback();
msg.reportMessage(IMessageMMComponent.UMPROPERTY__SAVE__FIELDS__ERROR, null, false);
return false;
} catch (Exception e) {
//wdContext.currentVnAppPropertiesElement().getVaIUserMaint().rollback();
messages.addPBMessagesItem(e.getLocalizedMessage(), e, true, PBMessagesTypes.TP_DebugStackTrace.ordinal(), "CstCtrlTableUtils.UMSavePropertiesByNode");
return false;
}
return true;
//@@end
}
regards,
Angelo
Hi Angelo,
Saving and commit resolved my issue.
Hurray!!
Thanks a ton.
Nisha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Angelo,
Thank you very much for this piece of code.
I can succesfully set the attribute using your code.
However, I am not able to read the user property on a reload, because when i try to load the code after logging out and logging in again I cannot read any value from the property.
Any suggestion?
I have a context attribute of type IUserMaint to which I am trying to sett the attribute.
Please advise.
Regards,
Nisha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ilan,
I just wanted to ensure there is no personalization or iview property that maintains the history for portal users.
If there is no such way, I will have to use a database.
Thanks for your input
Regards,
Nisha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You will need to save user settings in the properties customizable user at UM.
LOAD USER
public void loadCurrentUser( )
{
//@@begin loadCurrentUser()
try {
wdContext.currentVnAppPropertiesElement().setVaIUser(WDClientUser.getCurrentUser().getSAPUser());
String user = wdContext.currentVnAppPropertiesElement().getVaIUser().getUniqueID();
IUserMaint userMaint = UMFactory.getUserFactory().getMutableUser(user);
wdContext.currentVnAppPropertiesElement().setVaIUserMaint(userMaint);
} catch (WDUMException ex) {
wdComponentAPI.getMessageManager().raiseException(ex.getLocalizedMessage(), true);
}
//@@end
}
SAVE CODE
public boolean UMSave(String val1 )
{
//@@begin UMSaveQtdPageItems()
String attribs[] = new String[1];
attribs[0] = val1;
String propertiesName = "PropertyName";
try {
boolean retorno = wdContext.currentVnAppPropertiesElement().getVaIUserMaint().setAttribute("com.sap.security.core.usermanagement", propertiesName, attribs);
} catch (UMException ex) {
wdContext.currentVnAppPropertiesElement().getVaIUserMaint().rollback();
return false;
}
return true;
//@@end
}
LOAD CODE
public String UMLoad( )
{
//@@begin UMLoadQtdPageItems()
try {
String attribute[] = wdContext.currentVnAppPropertiesElement().getVaIUserMaint().getAttribute("com.sap.security.core.usermanagement", "PropertyName");
}
} catch (Exception ex) {
}
//@@end
}
best regards,
Angelo
You need to use some kind of data store.
Why not use a database?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.