That is indeed possible.

audit attributes are fetched from the ServiceContext that is in the thread
local in ServiceContextStore.get(). All you have to do is to set your own
instance of ServiceContext in ServiceContextStore, i.e.
ServiceContextStore.set(ctx)

Remember to remove it from the thread local, when request is done, i.e.
ServiceContextStore.set(null)

You can create the ServiceContext instance programatically
    String applicationId = "MyApp";
    String userId = "someone";
    String sessionId =
String.valueOf(sessionIdGenerator.nextInt(MAX_GENERATED_SESSION_ID));
    ServiceContext ctx = new ServiceContext(userId, sessionId,
applicationId);

or if you have a servlet in front of the requests you can use the
ServiceContextServletFilter, which is in sculptor-framework.


I can also mention that ServiceContext is invaluable for logging. Everything
you put into the Properties of the ServiceContext will be logged in case of
exception by ErrorHandlingAdvice.

/Patrik



Narich wrote:
> 
> Hello
> 
> I removed ServiceContext by setting generate.serviceContext=false in my
> properties file 
> 
> now, i note that autidable attributes(lastUpdated, lastUpdatedBy...)  are
> not updated. 
> 
> so, is there other ways to update them automatically without using
> servicecontext?  
> 
> thanks 
> 

-- 
View this message in context: 
http://old.nabble.com/ServiceContext-tp29182033s17564p29183211.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to