Need to create transient property which ends with user session.

1,092 views
Skip to first unread message

ag...@restorationhardware.com

unread,
May 2, 2008, 3:47:42 PM5/2/08
to ATG_Tech
Hi All,

I want to create transient property in userprofile repository. This
property value should remain only as long as user session is active
(just like securtiy status property).
I tried below options but no success.

1. <property name="currentpreaddress" data-type="string" /> - is
getting cached in userprofile repositor.
2. <property name="currentpreaddress" data-type="string" property-
type="atg.repository.SessionEnumPropertyDescriptor" /> - gives me
below error

Fri May 02 12:26:26 /atg/dynamo/server/HttpServer ---
javax.servlet.ServletException: Attempt to set property named
currentpreaddress (contactInfo:
rhbc7440001) with value = true (class=class java.lang.String). The
type should be class java.lang.Integer.

any ideas/suggestion where i am going wrong.

~abhi.

Jeremy Sears

unread,
May 2, 2008, 3:51:52 PM5/2/08
to atg_...@googlegroups.com
Perhaps you could post the code for your property descriptor, the repository definition and the code that is setting the property.  Without that, we can only guess.
--
Jeremy Sears

ag...@restorationhardware.com

unread,
May 2, 2008, 4:11:19 PM5/2/08
to ATG_Tech
Thanks Jeremy. Here is code.

Item Descriptor:-
under userProfile.xml
<item-descriptor name="contactInfo" display-property="address1"
display-name-resource="itemDescriptorContactInfo">
<property name="currentpreaddress" data-type="string" />
<property name="currentpostaddress" data-type="string" />
</item-descriptor>

Code to set up value :-

MutableRepositoryItem address = repository.createItem(contactInfo);
address.setPropertyValue("currentpreaddress","true");

I want "currentpreaddress" should loose its value with end of user
session.

~abhi

On May 2, 12:51 pm, "Jeremy Sears" <jsears....@gmail.com> wrote:
> Perhaps you could post the code for your property descriptor, the repository
> definition and the code that is setting the property. Without that, we can
> only guess.
> --
> Jeremy Sears
>
> On Fri, May 2, 2008 at 3:47 PM, abhigoel_...@yahoo.com <

Jeremy Sears

unread,
May 2, 2008, 4:29:36 PM5/2/08
to atg_...@googlegroups.com
In your first example, you try to use the SessionEnumPropertyDescriptor directly.  That property descriptor implementation only works with enumerated properties.  Try using the SessionPropertyDescriptor instead.  Note that you need to specify the session attribute name where you are storing the property value.


  <item-descriptor name="contactInfo" display-property="address1"
display-name-resource="itemDescriptorContactInfo">
    <property name="currentpreaddress" data-type="string" property-type="atg.repository.Session
PropertyDescriptor">
      <attribute name="sessionAttributeName" value="currentpreaddress"/>
    </property>
    <property name="currentpostaddress" data-type="string" property-type="atg.repository.Session
PropertyDescriptor">
      <attribute name="sessionAttributeName" value="currentpostaddress"/>
    </property>
  </item-descriptor>

Belmont, Adam

unread,
May 2, 2008, 5:35:23 PM5/2/08
to atg_...@googlegroups.com

One thing about SessionEnumPropertyDescriptor.

It adds properties to the HttpSession, not a session scoped Nucleus component.

That means you’ll not only see different values for different users (good), but you’ll see different values as users change web applications.

That may or may not be want you want. If all your jsps are in a single war file then you don’t have to worry about the problem above.

 

 -- Adam




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ATG_Tech" group.
To post to this group, send email to atg_...@googlegroups.com
To unsubscribe from this group, send email to atg_tech-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/atg_tech?hl=en
-~----------~----~----~----~------~----~------~--~---

ag...@restorationhardware.com

unread,
May 5, 2008, 3:17:31 PM5/5/08
to ATG_Tech
Thanks Jeremy, it worked for me :)
Also, thanks to you Belmont for your input. Fortunately we have single
war file, so i would escape from this limitation.

On May 2, 2:35 pm, "Belmont, Adam" <ad...@atg.com> wrote:
> One thing about SessionEnumPropertyDescriptor.
>
> It adds properties to the HttpSession, not a session scoped Nucleus
> component.
>
> That means you'll not only see different values for different users (good),
> but you'll see different values as users change web applications.
>
> That may or may not be want you want. If all your jsps are in a single war
> file then you don't have to worry about the problem above.
>
> -- Adam
>
> _____
>
> From: atg_...@googlegroups.com [mailto:atg_...@googlegroups.com] On Behalf
> Of Jeremy Sears
> Sent: Friday, May 02, 2008 4:30 PM
> To: atg_...@googlegroups.com
> Subject: [atg_tech:952] Re: Need to create transient property which ends
> with user session.
>
> In your first example, you try to use the SessionEnumPropertyDescriptor
> directly. That property descriptor implementation only works with
> enumerated properties. Try using the SessionPropertyDescriptor instead.
> Note that you need to specify the session attribute name where you are
> storing the property value.
>
> <item-descriptor name="contactInfo" display-property="address1"
> display-name-resource="itemDescriptorContactInfo">
> <property name="currentpreaddress" data-type="string"
> property-type="atg.repository.Session
>
> PropertyDescriptor">
> <attribute name="sessionAttributeName" value="currentpreaddress"/>
> </property>
>
> <property name="currentpostaddress" data-type="string"
> property-type="atg.repository.Session
>
> PropertyDescriptor">
> <attribute name="sessionAttributeName" value="currentpostaddress"/>
> </property>
>
> </item-descriptor>
>
> On Fri, May 2, 2008 at 4:11 PM, abhigoel_...@yahoo.com
> smime.p7s
> 4KDownload
Reply all
Reply to author
Forward
0 new messages